You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/15 02:37:54 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6661: NIFI-10791: Adding AWS SDK v2 support to AWSCredentialsProviderContro…

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


##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/factory/CredentialsStrategy.java:
##########
@@ -72,4 +72,16 @@ public interface CredentialsStrategy {
     AWSCredentialsProvider getDerivedCredentialsProvider(Map<PropertyDescriptor, String> properties,
                                                          AWSCredentialsProvider primaryCredentialsProvider);
 
+    /**
+     * Creates an AwsCredentialsProvider instance for this strategy, given the properties defined by the user.
+     */
+    AwsCredentialsProvider getV2CredentialsProvider(Map<PropertyDescriptor, String> properties);

Review Comment:
   ```suggestion
       AwsCredentialsProvider getAwsCredentialsProvider(Map<PropertyDescriptor, String> properties);
   ```



##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-service-api/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AwsV2CredentialsProviderService.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * 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.processors.aws.credentials.provider.service;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.processor.exception.ProcessException;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+
+/**
+ * AwsV2CredentialsProviderService interface to support getting AwsCredentialsProvider used for instantiating
+ * aws clients using the v2 SDK.
+ *
+ * @see <a href="https://sdk.amazonaws.com/java/api/2.0.0/software/amazon/awssdk/auth/credentials/AwsCredentialsProvider.html">AwsCredentialsProvider</a>
+ */
+@Tags({"aws", "v2", "security", "credentials", "provider", "session"})
+@CapabilityDescription("Provides AwsCredentialsProvider.")
+public interface AwsV2CredentialsProviderService extends ControllerService {

Review Comment:
   ```suggestion
   public interface AwsCredentialsProviderService extends ControllerService {
   ```



##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/factory/CredentialsStrategy.java:
##########
@@ -72,4 +72,16 @@ public interface CredentialsStrategy {
     AWSCredentialsProvider getDerivedCredentialsProvider(Map<PropertyDescriptor, String> properties,
                                                          AWSCredentialsProvider primaryCredentialsProvider);
 
+    /**
+     * Creates an AwsCredentialsProvider instance for this strategy, given the properties defined by the user.
+     */
+    AwsCredentialsProvider getV2CredentialsProvider(Map<PropertyDescriptor, String> properties);
+
+    /**
+     * Creates an AwsCredentialsProvider instance for this strategy, given the properties defined by the user and
+     * the AwsCredentialsProvider from the winning primary strategy.
+     */
+    AwsCredentialsProvider getDerivedV2CredentialsProvider(Map<PropertyDescriptor, String> properties,

Review Comment:
   ```suggestion
       AwsCredentialsProvider getDerivedAwsCredentialsProvider(Map<PropertyDescriptor, String> properties,
   ```



##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-service-api/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AwsV2CredentialsProviderService.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * 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.processors.aws.credentials.provider.service;
+
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.controller.ControllerService;
+import org.apache.nifi.processor.exception.ProcessException;
+import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
+
+/**
+ * AwsV2CredentialsProviderService interface to support getting AwsCredentialsProvider used for instantiating
+ * aws clients using the v2 SDK.
+ *
+ * @see <a href="https://sdk.amazonaws.com/java/api/2.0.0/software/amazon/awssdk/auth/credentials/AwsCredentialsProvider.html">AwsCredentialsProvider</a>
+ */
+@Tags({"aws", "v2", "security", "credentials", "provider", "session"})
+@CapabilityDescription("Provides AwsCredentialsProvider.")
+public interface AwsV2CredentialsProviderService extends ControllerService {
+
+    /**
+     * Get credentials provider for Java SDK v2
+     * @return credentials provider
+     * @throws ProcessException process exception in case there is problem in getting credentials provider
+     *
+     * @see <a href="https://sdk.amazonaws.com/java/api/2.0.0/software/amazon/awssdk/auth/credentials/AwsCredentialsProvider.html">AwsCredentialsProvider</a>
+     */
+    AwsCredentialsProvider getAwsV2CredentialsProvider() throws ProcessException;

Review Comment:
   The `ProcessException` does not need to be declared because it is a `RuntimeException`.
   ```suggestion
       AwsCredentialsProvider getAwsCredentialsProvider();
   ```



##########
nifi-nar-bundles/nifi-aws-bundle/pom.xml:
##########
@@ -26,10 +26,51 @@
     <packaging>pom</packaging>
 
     <properties>
+        <!-- keep AWS 1.x until NIFI-8287 -->
+        <aws-java-sdk-version>1.12.182</aws-java-sdk-version>
+        <aws-java-sdk-v2-version>2.17.158</aws-java-sdk-v2-version>

Review Comment:
   These properties are not necessary since they are declared in the root Maven configuration.



##########
nifi-nar-bundles/nifi-aws-bundle/pom.xml:
##########
@@ -26,10 +26,51 @@
     <packaging>pom</packaging>
 
     <properties>
+        <!-- keep AWS 1.x until NIFI-8287 -->
+        <aws-java-sdk-version>1.12.182</aws-java-sdk-version>
+        <aws-java-sdk-v2-version>2.17.158</aws-java-sdk-v2-version>
         <!-- keep KCL 1.x until NIFI-8531 (blocked by NIFI-8287) -->
         <aws-kinesis-client-library-version>1.14.8</aws-kinesis-client-library-version>
     </properties>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>software.amazon.awssdk</groupId>
+                <artifactId>bom</artifactId>
+                <version>${aws-java-sdk-v2-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.amazonaws</groupId>
+                <artifactId>aws-java-sdk-bom</artifactId>
+                <version>${aws-java-sdk-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.amazonaws</groupId>
+                <artifactId>aws-java-sdk-core</artifactId>
+                <version>${aws-java-sdk-version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>com.fasterxml.jackson.core</groupId>
+                        <artifactId>jackson-databind</artifactId>
+                    </exclusion>

Review Comment:
   Is there a particular reason for this exclusion?



##########
nifi-nar-bundles/nifi-aws-bundle/pom.xml:
##########
@@ -26,10 +26,51 @@
     <packaging>pom</packaging>
 
     <properties>
+        <!-- keep AWS 1.x until NIFI-8287 -->
+        <aws-java-sdk-version>1.12.182</aws-java-sdk-version>
+        <aws-java-sdk-v2-version>2.17.158</aws-java-sdk-v2-version>
         <!-- keep KCL 1.x until NIFI-8531 (blocked by NIFI-8287) -->
         <aws-kinesis-client-library-version>1.14.8</aws-kinesis-client-library-version>
     </properties>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>software.amazon.awssdk</groupId>
+                <artifactId>bom</artifactId>
+                <version>${aws-java-sdk-v2-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+            <dependency>
+                <groupId>com.amazonaws</groupId>
+                <artifactId>aws-java-sdk-bom</artifactId>
+                <version>${aws-java-sdk-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>

Review Comment:
   These BOM dependencies are declared in the root Maven configuration.



-- 
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-unsubscribe@nifi.apache.org

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