turcsanyip commented on a change in pull request #4369:
URL: https://github.com/apache/nifi/pull/4369#discussion_r452068857



##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/storage/ADLSCredentialsControllerService.java
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.services.azure.storage;
+
+import com.google.common.base.Function;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+import java.util.function.BiConsumer;
+
+/**
+ * Provides credentials details for ADLS
+ *
+ * @see AbstractControllerService
+ */
+@Tags({"azure", "microsoft", "cloud", "storage", "adls", "credentials"})
+@CapabilityDescription("Defines credentials for ADLS processors.")
+public class ADLSCredentialsControllerService extends 
AbstractControllerService implements ADLSCredentialsService {
+
+    public static final PropertyDescriptor ACCOUNT_NAME = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ACCOUNT_NAME)
+        .description(AzureStorageUtils.ACCOUNT_NAME_BASE_DESCRIPTION)
+        .required(true)
+        .build();
+
+    public static final PropertyDescriptor ENDPOINT_SUFFIX = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ENDPOINT_SUFFIX)
+        .description(
+            "Storage accounts in public Azure always use a common FQDN suffix. 
" +
+                "Override this endpoint suffix with a different suffix in 
certain circumsances (like Azure Stack or non-public Azure regions).")
+        .required(true)
+        .defaultValue("dfs.core.windows.net")
+        .build();
+
+    public static final PropertyDescriptor USE_MANAGED_IDENTITY = new 
PropertyDescriptor.Builder()
+        .name("storage-use-managed-identity")
+        .displayName("Use Azure Managed Identity")
+        .description("Choose whether or not to use the managed identity of 
Azure VM/VMSS ")
+        .required(false)
+        .defaultValue("false")
+        .allowableValues("true", "false")
+        .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
+        .build();
+
+    private static final List<PropertyDescriptor> PROPERTIES = 
Collections.unmodifiableList(Arrays.asList(
+        ACCOUNT_NAME,
+        AzureStorageUtils.ACCOUNT_KEY,
+        AzureStorageUtils.PROP_SAS_TOKEN,
+        ENDPOINT_SUFFIX,

Review comment:
       I would move it up after the Account Name. It is not really a credential 
attribute, but rather belongs to the storage "location" and Account Name is 
also related to the location / storage url.

##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/AbstractAzureDataLakeStorageProcessor.java
##########
@@ -136,11 +88,7 @@
             .build();
 
     private static final List<PropertyDescriptor> PROPERTIES = 
Collections.unmodifiableList(
-            Arrays.asList(AbstractAzureDataLakeStorageProcessor.ACCOUNT_NAME,
-                    AbstractAzureDataLakeStorageProcessor.ACCOUNT_KEY,
-                    AbstractAzureDataLakeStorageProcessor.SAS_TOKEN,
-                    AbstractAzureDataLakeStorageProcessor.USE_MANAGED_IDENTITY,
-                    AbstractAzureDataLakeStorageProcessor.ENDPOINT_SUFFIX,
+            Arrays.asList(AzureStorageUtils.STORAGE_CREDENTIALS_SERVICE,

Review comment:
       This is the Blob credential service.

##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/storage/ADLSCredentialsControllerService.java
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.services.azure.storage;
+
+import com.google.common.base.Function;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+import java.util.function.BiConsumer;
+
+/**
+ * Provides credentials details for ADLS
+ *
+ * @see AbstractControllerService
+ */
+@Tags({"azure", "microsoft", "cloud", "storage", "adls", "credentials"})
+@CapabilityDescription("Defines credentials for ADLS processors.")
+public class ADLSCredentialsControllerService extends 
AbstractControllerService implements ADLSCredentialsService {
+
+    public static final PropertyDescriptor ACCOUNT_NAME = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ACCOUNT_NAME)
+        .description(AzureStorageUtils.ACCOUNT_NAME_BASE_DESCRIPTION)
+        .required(true)
+        .build();
+
+    public static final PropertyDescriptor ENDPOINT_SUFFIX = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ENDPOINT_SUFFIX)
+        .description(
+            "Storage accounts in public Azure always use a common FQDN suffix. 
" +
+                "Override this endpoint suffix with a different suffix in 
certain circumsances (like Azure Stack or non-public Azure regions).")

Review comment:
       Typo: circumstances
   (old issue, pls. also fix it in AzureStorageUtils as well)

##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/storage/ADLSCredentialsControllerService.java
##########
@@ -0,0 +1,152 @@
+/*
+ * 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.services.azure.storage;
+
+import com.google.common.base.Function;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.PropertyValue;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.StringJoiner;
+import java.util.function.BiConsumer;
+
+/**
+ * Provides credentials details for ADLS
+ *
+ * @see AbstractControllerService
+ */
+@Tags({"azure", "microsoft", "cloud", "storage", "adls", "credentials"})
+@CapabilityDescription("Defines credentials for ADLS processors.")
+public class ADLSCredentialsControllerService extends 
AbstractControllerService implements ADLSCredentialsService {
+
+    public static final PropertyDescriptor ACCOUNT_NAME = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ACCOUNT_NAME)
+        .description(AzureStorageUtils.ACCOUNT_NAME_BASE_DESCRIPTION)
+        .required(true)
+        .build();
+
+    public static final PropertyDescriptor ENDPOINT_SUFFIX = new 
PropertyDescriptor.Builder()
+        .fromPropertyDescriptor(AzureStorageUtils.ENDPOINT_SUFFIX)
+        .description(

Review comment:
       I think we should customize the display name as well.
   Something like "Endpoint Suffix" (as it was in the processor level property) 
or "Storage Endpoint Suffix" would be fine.
   I don't really understand why it has the long "Common Storage Account 
Endpoint Suffix" name in the Blob processors.

##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-services-api/src/main/java/org/apache/nifi/services/azure/storage/ADLSCredentialsDetails.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.services.azure.storage;
+
+import com.azure.core.credential.AccessToken;
+
+public class ADLSCredentialsDetails {
+    private final String accountName;
+
+    private final String accountKey;
+    private final String sasToken;
+    private final String endpointSuffix;
+
+    private final AccessToken accessToken;
+
+    private final boolean useManagedIdentity;
+
+    public ADLSCredentialsDetails(
+        String accountName,
+        String accountKey,
+        String sasToken,
+        String endpointSuffix,
+        AccessToken accessToken,
+        boolean useManagedIdentity
+    ) {
+        this.accountName = accountName;
+        this.accountKey = accountKey;
+        this.sasToken = sasToken;
+        this.accessToken = accessToken;
+        this.endpointSuffix = endpointSuffix;
+        this.useManagedIdentity = useManagedIdentity;

Review comment:
       Could you please use the same order of the fields above (also adjust 
constructor parameters and assignments) as in the builder / getters (those 
looks fine)?

##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/AbstractAzureDataLakeStorageProcessor.java
##########
@@ -136,11 +88,7 @@
             .build();
 
     private static final List<PropertyDescriptor> PROPERTIES = 
Collections.unmodifiableList(
-            Arrays.asList(AbstractAzureDataLakeStorageProcessor.ACCOUNT_NAME,
-                    AbstractAzureDataLakeStorageProcessor.ACCOUNT_KEY,
-                    AbstractAzureDataLakeStorageProcessor.SAS_TOKEN,
-                    AbstractAzureDataLakeStorageProcessor.USE_MANAGED_IDENTITY,
-                    AbstractAzureDataLakeStorageProcessor.ENDPOINT_SUFFIX,
+            Arrays.asList(AzureStorageUtils.STORAGE_CREDENTIALS_SERVICE,
                     AbstractAzureDataLakeStorageProcessor.FILESYSTEM,
                     AbstractAzureDataLakeStorageProcessor.DIRECTORY,
                     AbstractAzureDataLakeStorageProcessor.FILE));

Review comment:
       Unnecessary class name in static reference. It is an old issue, but 
please fix it.
   
   Another old issue below: the local REL_SUCCESS / REL_FAILURE constants 
should be used.
   Pls. fix it too.




----------------------------------------------------------------
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.

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


Reply via email to