[GitHub] [nifi] exceptionfactory commented on a diff in pull request #7092: NIFI-11327 Add Export/Import All - NiFi CLI - NiFi Registry

2023-04-17 Thread via GitHub


exceptionfactory commented on code in PR #7092:
URL: https://github.com/apache/nifi/pull/7092#discussion_r1169146473


##
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java:
##
@@ -295,6 +295,48 @@ public Response createFlowVersion(
 return 
Response.status(Response.Status.OK).entity(createdSnapshot).build();
 }
 
+@POST
+@Path("{flowId}/versions/preserveSourceProperties")

Review Comment:
   Yes, that's what I had in mind, not a separate path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a diff in pull request #7092: NIFI-11327 Add Export/Import All - NiFi CLI - NiFi Registry

2023-04-04 Thread via GitHub


exceptionfactory commented on code in PR #7092:
URL: https://github.com/apache/nifi/pull/7092#discussion_r1157392825


##
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java:
##
@@ -295,6 +295,48 @@ public Response createFlowVersion(
 return 
Response.status(Response.Status.OK).entity(createdSnapshot).build();
 }
 
+@POST
+@Path("{flowId}/versions/migrate")

Review Comment:
   Thanks for the reply and background @bbende.
   
   Unfortunately JAX-RS does not appear to support method-based matching using 
Request query parameters, but it seems like introducing a 
`preserveSourceProperties` parameter in the existing method would provide a 
clear separation of behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [nifi] exceptionfactory commented on a diff in pull request #7092: NIFI-11327 Add Export/Import All - NiFi CLI - NiFi Registry

2023-04-03 Thread via GitHub


exceptionfactory commented on code in PR #7092:
URL: https://github.com/apache/nifi/pull/7092#discussion_r1155979058


##
nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/BucketFlowResource.java:
##
@@ -295,6 +295,48 @@ public Response createFlowVersion(
 return 
Response.status(Response.Status.OK).entity(createdSnapshot).build();
 }
 
+@POST
+@Path("{flowId}/versions/migrate")

Review Comment:
   Having a verb `migrate` in the path does not follow general REST API 
conventions, where the path should be a noun and the HTTP method is the verb. 
One option could be to make `migrate` and `Boolean` query parameter on the 
`/versions` resource method. However, the word `migrate` itself does not 
clearly convey what is happening, so perhaps another parameter name would be 
better. As the method name mentions keeping the author, it seems like a better 
approach would be to adding a query parameter named something like 
`preserveAuthor`. If there are other properties to be preserved, perhaps it 
could be named `preserveSourceProperties`.



##
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandOption.java:
##
@@ -164,7 +164,9 @@ public enum CommandOption {
 OUTPUT_TYPE("ot", "outputType", "The type of output to produce (json or 
simple)", true),
 VERBOSE("verbose", "verbose", "Indicates that verbose output should be 
provided", false),
 RECURSIVE("r", "recursive", "Indicates the command should perform the 
action recursively", false),
-HELP("h", "help", "Help", false)
+HELP("h", "help", "Help", false),
+SKIP("skip", "skip", "Indicates to skip an operation if target object 
exists", true),

Review Comment:
   The word `skip` does not clearly convey the intent of this parameter. 
Perhaps `skip-existing` could work, or some other combination of words that 
makes it clear what should be skipped.



##
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/CommandOption.java:
##
@@ -164,7 +164,9 @@ public enum CommandOption {
 OUTPUT_TYPE("ot", "outputType", "The type of output to produce (json or 
simple)", true),
 VERBOSE("verbose", "verbose", "Indicates that verbose output should be 
provided", false),
 RECURSIVE("r", "recursive", "Indicates the command should perform the 
action recursively", false),
-HELP("h", "help", "Help", false)
+HELP("h", "help", "Help", false),
+SKIP("skip", "skip", "Indicates to skip an operation if target object 
exists", true),
+KEEP("keep", "keep", "Indicates to keep the original format or type of an 
object", true)

Review Comment:
   Similar to `skip`, the word `keep` by itself does not indicate the meaning. 
Perhaps `preserve-format` or `preserve-type` could be better.



##
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/registry/flow/ExportAllFlows.java:
##
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.toolkit.cli.impl.command.registry.flow;
+
+import org.apache.commons.cli.ParseException;
+import org.apache.nifi.registry.bucket.Bucket;
+import org.apache.nifi.registry.client.NiFiRegistryClient;
+import org.apache.nifi.registry.client.NiFiRegistryException;
+import org.apache.nifi.registry.flow.VersionedFlow;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshot;
+import org.apache.nifi.registry.flow.VersionedFlowSnapshotMetadata;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import 
org.apache.nifi.toolkit.cli.impl.command.registry.AbstractNiFiRegistryCommand;
+import org.apache.nifi.toolkit.cli.impl.command.registry.bucket.ListBuckets;
+import 
org.apache.nifi.toolkit.cli.impl.result.registry.VersionedFlowSnapshotsResult;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class