turcsanyip commented on code in PR #8954:
URL: https://github.com/apache/nifi/pull/8954#discussion_r1636738794


##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/DisableFlowAnalysisRules.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import 
org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiActivateCommand;
+import org.apache.nifi.toolkit.cli.impl.result.VoidResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleRunStatusEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRulesEntity;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Command for enabling flow analysis rule.

Review Comment:
   ```suggestion
    * Command for disabling flow analysis rule.
   ```



##########
nifi-system-tests/nifi-system-test-suite/src/test/resources/conf/default/bootstrap.conf:
##########
@@ -27,7 +27,7 @@ java.arg.3=-Xmx512m
 
 java.arg.14=-Djava.awt.headless=true
 
-#java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8002
+java.arg.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8002

Review Comment:
   This may be added unintentionally.



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/DeleteFlowAnalysisRule.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.ControllerClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand;
+import org.apache.nifi.toolkit.cli.impl.result.nifi.FlowAnalysisRuleResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Command for creating a flow analysis rule.

Review Comment:
   ```suggestion
    * Command for deleting a flow analysis rule.
   ```



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ControllerClient.java:
##########
@@ -61,6 +66,26 @@ public interface ControllerClient {
     VersionedReportingTaskImportResponseEntity 
importReportingTasks(VersionedReportingTaskImportRequestEntity 
importRequestEntity)
             throws NiFiClientException, IOException;
 
+    FlowAnalysisRulesEntity getFlowAnalysisRules() throws NiFiClientException, 
IOException;
+
+    FlowAnalysisRuleEntity getFlowAnalysisRule(final String id) throws 
NiFiClientException, IOException;
+
+    PropertyDescriptorEntity getFlowAnalysisRulePropertyDescriptor(final 
String componentId, final String propertyName, final Boolean sensitive) throws 
NiFiClientException, IOException;
+
+    FlowAnalysisRuleEntity createFlowAnalysisRule(FlowAnalysisRuleEntity 
reportingTask) throws NiFiClientException, IOException;
+
+    FlowAnalysisRuleEntity updateFlowAnalysisRule(final FlowAnalysisRuleEntity 
flowAnalysisRuleEntity) throws NiFiClientException, IOException;
+
+    FlowAnalysisRuleEntity activateFlowAnalysisRule(final String id, final 
FlowAnalysisRuleRunStatusEntity runStatusEntity) throws NiFiClientException, 
IOException;
+
+    FlowAnalysisRuleEntity deleteFlowAnalysisRule(final FlowAnalysisRuleEntity 
flowAnalysisRule) throws NiFiClientException, IOException;
+
+    VerifyConfigRequestEntity 
submitFlowAnalysisRuleConfigVerificationRequest(final VerifyConfigRequestEntity 
configRequestEntity) throws NiFiClientException, IOException;
+
+    VerifyConfigRequestEntity 
getFlowAnalysisRuleConfigVerificationRequest(final String taskId, final String 
verificationRequestId) throws NiFiClientException, IOException;
+
+    VerifyConfigRequestEntity 
deleteFlowAnalysisRuleConfigVerificationRequest(final String taskId, final 
String verificationRequestId) throws NiFiClientException, IOException;

Review Comment:
   What is the purpose of these methods? They seemed to be unused.



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/client/nifi/ControllerClient.java:
##########
@@ -61,6 +66,26 @@ public interface ControllerClient {
     VersionedReportingTaskImportResponseEntity 
importReportingTasks(VersionedReportingTaskImportRequestEntity 
importRequestEntity)
             throws NiFiClientException, IOException;
 
+    FlowAnalysisRulesEntity getFlowAnalysisRules() throws NiFiClientException, 
IOException;
+
+    FlowAnalysisRuleEntity getFlowAnalysisRule(final String id) throws 
NiFiClientException, IOException;
+
+    PropertyDescriptorEntity getFlowAnalysisRulePropertyDescriptor(final 
String componentId, final String propertyName, final Boolean sensitive) throws 
NiFiClientException, IOException;

Review Comment:
   This method is called from a test only.



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/EnableFlowAnalysisRules.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import 
org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiActivateCommand;
+import org.apache.nifi.toolkit.cli.impl.result.VoidResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleRunStatusEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRulesEntity;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Command for enabling flow analysis rule.
+ */
+public class EnableFlowAnalysisRules extends 
AbstractNiFiActivateCommand<FlowAnalysisRuleEntity,
+        FlowAnalysisRuleRunStatusEntity> {
+
+    public EnableFlowAnalysisRules() {
+        super("enable-flow-analysis-rules");
+    }
+
+    @Override
+    public String getDescription() {
+        return "Attempts to enable all flow analysis rules. In stand-alone 
mode this command " +

Review Comment:
   The command can also be used for enabling a single rule by id (not only all 
rules).



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/GetFlowAnalysisRule.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.ControllerClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand;
+import org.apache.nifi.toolkit.cli.impl.result.nifi.FlowAnalysisRuleResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Command for retrieving the status of a flow analysis rule.
+ */
+public class GetFlowAnalysisRule extends 
AbstractNiFiCommand<FlowAnalysisRuleResult> {
+
+    public GetFlowAnalysisRule() {
+        super("get-flow-analysis-rule", FlowAnalysisRuleResult.class);
+    }
+
+    @Override
+    public String getDescription() {
+        return "Retrieves the status for a flow analysis rule.";

Review Comment:
   Not sure what _status_ means here. The command prints more info than 
`GetFlowAnalysisRules` and _status_ is not mentioned there.
   ```suggestion
           return "Retrieves a flow analysis rule.";
   ```



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/GetFlowAnalysisRule.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.ControllerClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand;
+import org.apache.nifi.toolkit.cli.impl.result.nifi.FlowAnalysisRuleResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Command for retrieving the status of a flow analysis rule.
+ */
+public class GetFlowAnalysisRule extends 
AbstractNiFiCommand<FlowAnalysisRuleResult> {

Review Comment:
   ```suggestion
   /**
    * Command for retrieving a flow analysis rule.
    */
   public class GetFlowAnalysisRule extends 
AbstractNiFiCommand<FlowAnalysisRuleResult> {
   ```



##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/flow/DisableFlowAnalysisRules.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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.nifi.flow;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import 
org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiActivateCommand;
+import org.apache.nifi.toolkit.cli.impl.result.VoidResult;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRuleRunStatusEntity;
+import org.apache.nifi.web.api.entity.FlowAnalysisRulesEntity;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Command for enabling flow analysis rule.
+ */
+public class DisableFlowAnalysisRules extends 
AbstractNiFiActivateCommand<FlowAnalysisRuleEntity,
+        FlowAnalysisRuleRunStatusEntity> {
+
+    public DisableFlowAnalysisRules() {
+        super("disable-flow-analysis-rules");
+    }
+
+    @Override
+    public String getDescription() {
+        return "Attempts to disable all flow analysis rules. In stand-alone 
mode this command " +

Review Comment:
   The command can also be used for disabling a single rule by id (not only all 
rules).



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to