You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/04/27 11:37:49 UTC

[camel] branch main updated (1d7d94a -> 6fe177c)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 1d7d94a  CAMEL-16477: camel-core - ProcessorDefinitionHelper: ruturn a collection instead of an iterator for filterTypeInOutputs methods
     new 9a18c05  CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
     new 5089b27  CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
     new 4ab5de2  Regen
     new ca5e3c4  CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
     new 1c24215  CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
     new 6fe177c  CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/catalog/components/aws2-ddb.json  |  2 +
 .../camel/catalog/docs/aws2-ddb-component.adoc     |  6 ++-
 .../aws2/ddb/Ddb2ComponentConfigurer.java          |  6 +++
 .../component/aws2/ddb/Ddb2EndpointConfigurer.java |  6 +++
 .../component/aws2/ddb/Ddb2EndpointUriFactory.java |  3 +-
 .../apache/camel/component/aws2/ddb/aws2-ddb.json  |  2 +
 .../src/main/docs/aws2-ddb-component.adoc          |  6 ++-
 .../camel/component/aws2/ddb/Ddb2Component.java    |  5 +-
 .../component/aws2/ddb/Ddb2Configuration.java      | 14 +++++
 .../camel/component/aws2/ddb/Ddb2Endpoint.java     | 61 ++--------------------
 .../aws2/ddb/client/Ddb2ClientFactory.java}        | 22 ++++----
 .../aws2/ddb/client/Ddb2InternalClient.java}       | 14 ++---
 .../client/impl/Ddb2ClientIAMOptimizedImpl.java}   | 32 ++++++------
 .../ddb/client/impl/Ddb2ClientStandardImpl.java}   | 32 ++++++------
 .../component/aws2/ddb/Ddb2ClientFactoryTest.java  | 51 ++++++++++++++++++
 .../dsl/Aws2DdbComponentBuilderFactory.java        | 19 +++++++
 .../endpoint/dsl/Ddb2EndpointBuilderFactory.java   | 37 +++++++++++++
 .../modules/ROOT/pages/aws2-ddb-component.adoc     |  6 ++-
 18 files changed, 207 insertions(+), 117 deletions(-)
 copy components/camel-aws/{camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/client/Cw2ClientFactory.java => camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2ClientFactory.java} (58%)
 copy components/camel-aws/{camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/client/AWS2CamelS3InternalClient.java => camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2InternalClient.java} (67%)
 copy components/camel-aws/{camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/client/impl/Cw2ClientIAMOptimizedImpl.java => camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java} (73%)
 copy components/camel-aws/{camel-aws2-cw/src/main/java/org/apache/camel/component/aws2/cw/client/impl/Cw2ClientStandardImpl.java => camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java} (78%)
 create mode 100644 components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/Ddb2ClientFactoryTest.java

[camel] 03/06: Regen

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4ab5de233566147b2490183d9ad0e8b1e15ac684
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:23:01 2021 +0200

    Regen
---
 .../resources/org/apache/camel/catalog/components/aws2-ddb.json         | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
index 269509c..0a558f3 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/aws2-ddb.json
@@ -38,6 +38,7 @@
     "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The region in which DDB client needs to work" },
     "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
     "uriEndpointOverride": { "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" },
+    "useDefaultCredentialsProvider": { "kind": "property", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set whether the S3 client should expect to load credentials through a de [...]
     "writeCapacity": { "kind": "property", "displayName": "Write Capacity", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The provisioned throughput to reserved for writing resources to your table" },
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
     "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
@@ -60,6 +61,7 @@
     "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The region in which DDB client needs to work" },
     "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
     "uriEndpointOverride": { "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" },
+    "useDefaultCredentialsProvider": { "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set whether the S3 client should expect to load credentials through a d [...]
     "writeCapacity": { "kind": "parameter", "displayName": "Write Capacity", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The provisioned throughput to reserved for writing resources to your table" },
     "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
     "secretKey": { "kind": "parameter", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }

[camel] 04/06: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit ca5e3c4ea3640f1232ef05d961bc64acc349fd5e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:27:11 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
---
 .../component/aws2/ddb/Ddb2ClientFactoryTest.java  | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/Ddb2ClientFactoryTest.java b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/Ddb2ClientFactoryTest.java
new file mode 100644
index 0000000..036c388
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ddb/src/test/java/org/apache/camel/component/aws2/ddb/Ddb2ClientFactoryTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.camel.component.aws2.ddb;
+
+import org.apache.camel.component.aws2.ddb.client.Ddb2ClientFactory;
+import org.apache.camel.component.aws2.ddb.client.Ddb2InternalClient;
+import org.apache.camel.component.aws2.ddb.client.impl.Ddb2ClientIAMOptimizedImpl;
+import org.apache.camel.component.aws2.ddb.client.impl.Ddb2ClientStandardImpl;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class Ddb2ClientFactoryTest {
+
+    @Test
+    public void getStandardDdb2ClientDefault() {
+        Ddb2Configuration ddb2Configuration = new Ddb2Configuration();
+        Ddb2InternalClient ddb2Client = Ddb2ClientFactory.getDynamoDBClient(ddb2Configuration);
+        assertTrue(ddb2Client instanceof Ddb2ClientStandardImpl);
+    }
+
+    @Test
+    public void getStandardDdb2Client() {
+        Ddb2Configuration ddb2Configuration = new Ddb2Configuration();
+        ddb2Configuration.setUseDefaultCredentialsProvider(false);
+        Ddb2InternalClient ddb2Client = Ddb2ClientFactory.getDynamoDBClient(ddb2Configuration);
+        assertTrue(ddb2Client instanceof Ddb2ClientStandardImpl);
+    }
+
+    @Test
+    public void getIAMOptimizedDdb2Client() {
+        Ddb2Configuration ddb2Configuration = new Ddb2Configuration();
+        ddb2Configuration.setUseDefaultCredentialsProvider(true);
+        Ddb2InternalClient ddb2Client = Ddb2ClientFactory.getDynamoDBClient(ddb2Configuration);
+        assertTrue(ddb2Client instanceof Ddb2ClientIAMOptimizedImpl);
+    }
+}

[camel] 01/06: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 9a18c0546279624ed51faae40f3b8a7f974b6e5d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:16:32 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
---
 .../component/aws2/ddb/Ddb2Configuration.java      |  14 +++
 .../aws2/ddb/client/Ddb2ClientFactory.java         |  41 ++++++++
 .../aws2/ddb/client/Ddb2InternalClient.java        |  32 +++++++
 .../client/impl/Ddb2ClientIAMOptimizedImpl.java    |  88 +++++++++++++++++
 .../ddb/client/impl/Ddb2ClientStandardImpl.java    | 104 +++++++++++++++++++++
 5 files changed, 279 insertions(+)

diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Configuration.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Configuration.java
index d75850a..de82380 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Configuration.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Configuration.java
@@ -65,6 +65,8 @@ public class Ddb2Configuration implements Cloneable {
     private boolean overrideEndpoint;
     @UriParam
     private String uriEndpointOverride;
+    @UriParam(defaultValue = "false")
+    private boolean useDefaultCredentialsProvider;
 
     public String getAccessKey() {
         return accessKey;
@@ -266,6 +268,18 @@ public class Ddb2Configuration implements Cloneable {
         this.keyScalarType = keyScalarType;
     }
 
+    /**
+     * Set whether the S3 client should expect to load credentials through a default credentials provider or to expect
+     * static credentials to be passed in.
+     */
+    public void setUseDefaultCredentialsProvider(Boolean useDefaultCredentialsProvider) {
+        this.useDefaultCredentialsProvider = useDefaultCredentialsProvider;
+    }
+
+    public Boolean isUseDefaultCredentialsProvider() {
+        return useDefaultCredentialsProvider;
+    }
+
     // *************************************************
     //
     // *************************************************
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2ClientFactory.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2ClientFactory.java
new file mode 100644
index 0000000..84d3666
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2ClientFactory.java
@@ -0,0 +1,41 @@
+/*
+ * 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.camel.component.aws2.ddb.client;
+
+import org.apache.camel.component.aws2.ddb.Ddb2Configuration;
+import org.apache.camel.component.aws2.ddb.client.impl.Ddb2ClientIAMOptimizedImpl;
+import org.apache.camel.component.aws2.ddb.client.impl.Ddb2ClientStandardImpl;
+
+/**
+ * Factory class to return the correct type of AWS DynamoDB client.
+ */
+public final class Ddb2ClientFactory {
+
+    private Ddb2ClientFactory() {
+    }
+
+    /**
+     * Return the correct AWS DynamoDB client (based on remote vs local).
+     * 
+     * @param  configuration configuration
+     * @return               DynamoDBClient
+     */
+    public static Ddb2InternalClient getDynamoDBClient(Ddb2Configuration configuration) {
+        return configuration.isUseDefaultCredentialsProvider()
+                ? new Ddb2ClientIAMOptimizedImpl(configuration) : new Ddb2ClientStandardImpl(configuration);
+    }
+}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2InternalClient.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2InternalClient.java
new file mode 100644
index 0000000..83e062d
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/Ddb2InternalClient.java
@@ -0,0 +1,32 @@
+/*
+ * 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.camel.component.aws2.ddb.client;
+
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+
+/**
+ * Manage the required actions of an DynamoDB client for either local or remote.
+ */
+public interface Ddb2InternalClient {
+
+    /**
+     * Returns an DynamoDb client after a factory method determines which one to return.
+     * 
+     * @return DynamoDbClient DynamoDbClient
+     */
+    DynamoDbClient getDynamoDBClient();
+}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java
new file mode 100644
index 0000000..d2929cb
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java
@@ -0,0 +1,88 @@
+/*
+ * 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.camel.component.aws2.ddb.client.impl;
+
+import org.apache.camel.component.aws2.ddb.Ddb2Configuration;
+import org.apache.camel.component.aws2.ddb.client.Ddb2InternalClient;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.http.SdkHttpClient;
+import software.amazon.awssdk.http.SdkHttpConfigurationOption;
+import software.amazon.awssdk.http.apache.ApacheHttpClient;
+import software.amazon.awssdk.http.apache.ProxyConfiguration;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder;
+import software.amazon.awssdk.utils.AttributeMap;
+
+import java.net.URI;
+
+/**
+ * Manage an AWS DynamoDB client for all users to use (enabling temporary creds). This implementation is for remote
+ * instances to manage the credentials on their own (eliminating credential rotations)
+ */
+public class Ddb2ClientIAMOptimizedImpl implements Ddb2InternalClient {
+    private static final Logger LOG = LoggerFactory.getLogger(Ddb2ClientIAMOptimizedImpl.class);
+    private Ddb2Configuration configuration;
+
+    /**
+     * Constructor that uses the config file.
+     */
+    public Ddb2ClientIAMOptimizedImpl(Ddb2Configuration configuration) {
+        LOG.trace("Creating an AWS DynamoDB client for an ec2 instance with IAM temporary credentials (normal for ec2s).");
+        this.configuration = configuration;
+    }
+
+    /**
+     * Getting the DynamoDB aws client that is used.
+     * 
+     * @return DynamoDB Client.
+     */
+    @Override
+    public DynamoDbClient getDynamoDBClient() {
+        DynamoDbClient client = null;
+        DynamoDbClientBuilder clientBuilder = DynamoDbClient.builder();
+        ProxyConfiguration.Builder proxyConfig = null;
+        ApacheHttpClient.Builder httpClientBuilder = null;
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
+            proxyConfig = ProxyConfiguration.builder();
+            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
+                                           + configuration.getProxyPort());
+            proxyConfig.endpoint(proxyEndpoint);
+            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
+            clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
+        }
+        if (configuration.isOverrideEndpoint()) {
+            clientBuilder.endpointOverride(URI.create(configuration.getUriEndpointOverride()));
+        }
+        if (configuration.isTrustAllCertificates()) {
+            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
+                    .builder()
+                    .put(
+                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
+                            Boolean.TRUE)
+                    .build());
+            clientBuilder.httpClient(ahc);
+        }
+        client = clientBuilder.build();
+        return client;
+    }
+}
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java
new file mode 100644
index 0000000..5a2b373
--- /dev/null
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java
@@ -0,0 +1,104 @@
+/*
+ * 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.camel.component.aws2.ddb.client.impl;
+
+import org.apache.camel.component.aws2.ddb.Ddb2Configuration;
+import org.apache.camel.component.aws2.ddb.client.Ddb2InternalClient;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
+import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
+import software.amazon.awssdk.http.SdkHttpClient;
+import software.amazon.awssdk.http.SdkHttpConfigurationOption;
+import software.amazon.awssdk.http.apache.ApacheHttpClient;
+import software.amazon.awssdk.http.apache.ProxyConfiguration;
+import software.amazon.awssdk.regions.Region;
+import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
+import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder;
+import software.amazon.awssdk.utils.AttributeMap;
+
+import java.net.URI;
+
+/**
+ * Manage an AWS DynamoDB client for all users to use. This implementation is for local instances to use a static and
+ * solid credential set.
+ */
+public class Ddb2ClientStandardImpl implements Ddb2InternalClient {
+    private static final Logger LOG = LoggerFactory.getLogger(Ddb2ClientStandardImpl.class);
+    private Ddb2Configuration configuration;
+
+    /**
+     * Constructor that uses the config file.
+     */
+    public Ddb2ClientStandardImpl(Ddb2Configuration configuration) {
+        LOG.trace("Creating an AWS DynamoDB manager using static credentials.");
+        this.configuration = configuration;
+    }
+
+    /**
+     * Getting the DynamoDB AWS client that is used.
+     * 
+     * @return Amazon DynamoDB Client.
+     */
+    @Override
+    public DynamoDbClient getDynamoDBClient() {
+        DynamoDbClient client = null;
+        DynamoDbClientBuilder clientBuilder = DynamoDbClient.builder();
+        ProxyConfiguration.Builder proxyConfig = null;
+        ApacheHttpClient.Builder httpClientBuilder = null;
+        boolean isClientConfigFound = false;
+        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
+            proxyConfig = ProxyConfiguration.builder();
+            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
+                    + configuration.getProxyPort());
+            proxyConfig.endpoint(proxyEndpoint);
+            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
+            isClientConfigFound = true;
+        }
+        if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
+            AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
+            if (isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
+                        .credentialsProvider(StaticCredentialsProvider.create(cred));
+            } else {
+                clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
+            }
+        } else {
+            if (!isClientConfigFound) {
+                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
+            }
+        }
+        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
+        }
+        if (configuration.isOverrideEndpoint()) {
+            clientBuilder.endpointOverride(URI.create(configuration.getUriEndpointOverride()));
+        }
+        if (configuration.isTrustAllCertificates()) {
+            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
+                    .builder()
+                    .put(
+                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
+                            Boolean.TRUE)
+                    .build());
+            clientBuilder.httpClient(ahc);
+        }
+        client = clientBuilder.build();
+        return client;
+    }
+}

[camel] 02/06: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5089b2797fc75467b02d0b9df257dce566ab0410
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:17:59 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
---
 .../camel/catalog/docs/aws2-ddb-component.adoc     |  6 ++--
 .../aws2/ddb/Ddb2ComponentConfigurer.java          |  6 ++++
 .../component/aws2/ddb/Ddb2EndpointConfigurer.java |  6 ++++
 .../component/aws2/ddb/Ddb2EndpointUriFactory.java |  3 +-
 .../apache/camel/component/aws2/ddb/aws2-ddb.json  |  2 ++
 .../src/main/docs/aws2-ddb-component.adoc          |  6 ++--
 .../client/impl/Ddb2ClientIAMOptimizedImpl.java    |  4 +--
 .../ddb/client/impl/Ddb2ClientStandardImpl.java    |  6 ++--
 .../dsl/Aws2DdbComponentBuilderFactory.java        | 19 +++++++++++
 .../endpoint/dsl/Ddb2EndpointBuilderFactory.java   | 37 ++++++++++++++++++++++
 .../modules/ROOT/pages/aws2-ddb-component.adoc     |  6 ++--
 11 files changed, 89 insertions(+), 12 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ddb-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ddb-component.adoc
index 0ca8e26..d40a9fe 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ddb-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/aws2-ddb-component.adoc
@@ -42,7 +42,7 @@ You can append query options to the URI in the following format,
 
 
 // component options: START
-The AWS 2 DynamoDB component supports 20 options, which are listed below.
+The AWS 2 DynamoDB component supports 21 options, which are listed below.
 
 
 
@@ -65,6 +65,7 @@ The AWS 2 DynamoDB component supports 20 options, which are listed below.
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
@@ -94,7 +95,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (18 parameters):
+=== Query Parameters (19 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -115,6 +116,7 @@ with the following path and query parameters:
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2ComponentConfigurer.java b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2ComponentConfigurer.java
index 6f1d2fb..b1215ce 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2ComponentConfigurer.java
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2ComponentConfigurer.java
@@ -63,6 +63,8 @@ public class Ddb2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "trustAllCertificates": getOrCreateConfiguration(target).setTrustAllCertificates(property(camelContext, boolean.class, value)); return true;
         case "uriendpointoverride":
         case "uriEndpointOverride": getOrCreateConfiguration(target).setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true;
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": getOrCreateConfiguration(target).setUseDefaultCredentialsProvider(property(camelContext, boolean.class, value)); return true;
         case "writecapacity":
         case "writeCapacity": getOrCreateConfiguration(target).setWriteCapacity(property(camelContext, java.lang.Long.class, value)); return true;
         default: return false;
@@ -112,6 +114,8 @@ public class Ddb2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "trustAllCertificates": return boolean.class;
         case "uriendpointoverride":
         case "uriEndpointOverride": return java.lang.String.class;
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": return boolean.class;
         case "writecapacity":
         case "writeCapacity": return java.lang.Long.class;
         default: return null;
@@ -157,6 +161,8 @@ public class Ddb2ComponentConfigurer extends PropertyConfigurerSupport implement
         case "trustAllCertificates": return getOrCreateConfiguration(target).isTrustAllCertificates();
         case "uriendpointoverride":
         case "uriEndpointOverride": return getOrCreateConfiguration(target).getUriEndpointOverride();
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": return getOrCreateConfiguration(target).isUseDefaultCredentialsProvider();
         case "writecapacity":
         case "writeCapacity": return getOrCreateConfiguration(target).getWriteCapacity();
         default: return null;
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointConfigurer.java b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointConfigurer.java
index ff8b052..ee60c1b 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointConfigurer.java
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointConfigurer.java
@@ -53,6 +53,8 @@ public class Ddb2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "trustAllCertificates": target.getConfiguration().setTrustAllCertificates(property(camelContext, boolean.class, value)); return true;
         case "uriendpointoverride":
         case "uriEndpointOverride": target.getConfiguration().setUriEndpointOverride(property(camelContext, java.lang.String.class, value)); return true;
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": target.getConfiguration().setUseDefaultCredentialsProvider(property(camelContext, boolean.class, value)); return true;
         case "writecapacity":
         case "writeCapacity": target.getConfiguration().setWriteCapacity(property(camelContext, java.lang.Long.class, value)); return true;
         default: return false;
@@ -99,6 +101,8 @@ public class Ddb2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "trustAllCertificates": return boolean.class;
         case "uriendpointoverride":
         case "uriEndpointOverride": return java.lang.String.class;
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": return boolean.class;
         case "writecapacity":
         case "writeCapacity": return java.lang.Long.class;
         default: return null;
@@ -141,6 +145,8 @@ public class Ddb2EndpointConfigurer extends PropertyConfigurerSupport implements
         case "trustAllCertificates": return target.getConfiguration().isTrustAllCertificates();
         case "uriendpointoverride":
         case "uriEndpointOverride": return target.getConfiguration().getUriEndpointOverride();
+        case "usedefaultcredentialsprovider":
+        case "useDefaultCredentialsProvider": return target.getConfiguration().isUseDefaultCredentialsProvider();
         case "writecapacity":
         case "writeCapacity": return target.getConfiguration().getWriteCapacity();
         default: return null;
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointUriFactory.java b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointUriFactory.java
index 9293a2e..63dc75a 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointUriFactory.java
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/java/org/apache/camel/component/aws2/ddb/Ddb2EndpointUriFactory.java
@@ -20,7 +20,7 @@ public class Ddb2EndpointUriFactory extends org.apache.camel.support.component.E
     private static final Set<String> PROPERTY_NAMES;
     private static final Set<String> SECRET_PROPERTY_NAMES;
     static {
-        Set<String> props = new HashSet<>(19);
+        Set<String> props = new HashSet<>(20);
         props.add("amazonDDBClient");
         props.add("proxyProtocol");
         props.add("readCapacity");
@@ -28,6 +28,7 @@ public class Ddb2EndpointUriFactory extends org.apache.camel.support.component.E
         props.add("keyScalarType");
         props.add("uriEndpointOverride");
         props.add("keyAttributeType");
+        props.add("useDefaultCredentialsProvider");
         props.add("proxyHost");
         props.add("tableName");
         props.add("trustAllCertificates");
diff --git a/components/camel-aws/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddb/aws2-ddb.json b/components/camel-aws/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddb/aws2-ddb.json
index 269509c..0a558f3 100644
--- a/components/camel-aws/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddb/aws2-ddb.json
+++ b/components/camel-aws/camel-aws2-ddb/src/generated/resources/org/apache/camel/component/aws2/ddb/aws2-ddb.json
@@ -38,6 +38,7 @@
     "region": { "kind": "property", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The region in which DDB client needs to work" },
     "trustAllCertificates": { "kind": "property", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
     "uriEndpointOverride": { "kind": "property", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" },
+    "useDefaultCredentialsProvider": { "kind": "property", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set whether the S3 client should expect to load credentials through a de [...]
     "writeCapacity": { "kind": "property", "displayName": "Write Capacity", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The provisioned throughput to reserved for writing resources to your table" },
     "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...]
     "accessKey": { "kind": "property", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
@@ -60,6 +61,7 @@
     "region": { "kind": "parameter", "displayName": "Region", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The region in which DDB client needs to work" },
     "trustAllCertificates": { "kind": "parameter", "displayName": "Trust All Certificates", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "If we want to trust all certificates in case of overriding the endpoint" },
     "uriEndpointOverride": { "kind": "parameter", "displayName": "Uri Endpoint Override", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option" },
+    "useDefaultCredentialsProvider": { "kind": "parameter", "displayName": "Use Default Credentials Provider", "group": "producer", "label": "", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Set whether the S3 client should expect to load credentials through a d [...]
     "writeCapacity": { "kind": "parameter", "displayName": "Write Capacity", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Long", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "The provisioned throughput to reserved for writing resources to your table" },
     "accessKey": { "kind": "parameter", "displayName": "Access Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Access Key" },
     "secretKey": { "kind": "parameter", "displayName": "Secret Key", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.aws2.ddb.Ddb2Configuration", "configurationField": "configuration", "description": "Amazon AWS Secret Key" }
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/docs/aws2-ddb-component.adoc b/components/camel-aws/camel-aws2-ddb/src/main/docs/aws2-ddb-component.adoc
index 0ca8e26..d40a9fe 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/docs/aws2-ddb-component.adoc
+++ b/components/camel-aws/camel-aws2-ddb/src/main/docs/aws2-ddb-component.adoc
@@ -42,7 +42,7 @@ You can append query options to the URI in the following format,
 
 
 // component options: START
-The AWS 2 DynamoDB component supports 20 options, which are listed below.
+The AWS 2 DynamoDB component supports 21 options, which are listed below.
 
 
 
@@ -65,6 +65,7 @@ The AWS 2 DynamoDB component supports 20 options, which are listed below.
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
@@ -94,7 +95,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (18 parameters):
+=== Query Parameters (19 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -115,6 +116,7 @@ with the following path and query parameters:
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java
index d2929cb..89b3500 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientIAMOptimizedImpl.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.aws2.ddb.client.impl;
 
+import java.net.URI;
+
 import org.apache.camel.component.aws2.ddb.Ddb2Configuration;
 import org.apache.camel.component.aws2.ddb.client.Ddb2InternalClient;
 import org.apache.camel.util.ObjectHelper;
@@ -30,8 +32,6 @@ import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder;
 import software.amazon.awssdk.utils.AttributeMap;
 
-import java.net.URI;
-
 /**
  * Manage an AWS DynamoDB client for all users to use (enabling temporary creds). This implementation is for remote
  * instances to manage the credentials on their own (eliminating credential rotations)
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java
index 5a2b373..eee5bb8 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/client/impl/Ddb2ClientStandardImpl.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.aws2.ddb.client.impl;
 
+import java.net.URI;
+
 import org.apache.camel.component.aws2.ddb.Ddb2Configuration;
 import org.apache.camel.component.aws2.ddb.client.Ddb2InternalClient;
 import org.apache.camel.util.ObjectHelper;
@@ -32,8 +34,6 @@ import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder;
 import software.amazon.awssdk.utils.AttributeMap;
 
-import java.net.URI;
-
 /**
  * Manage an AWS DynamoDB client for all users to use. This implementation is for local instances to use a static and
  * solid credential set.
@@ -65,7 +65,7 @@ public class Ddb2ClientStandardImpl implements Ddb2InternalClient {
         if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
             proxyConfig = ProxyConfiguration.builder();
             URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
-                    + configuration.getProxyPort());
+                                           + configuration.getProxyPort());
             proxyConfig.endpoint(proxyEndpoint);
             httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
             isClientConfigFound = true;
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbComponentBuilderFactory.java
index fd717da..fca644b 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/Aws2DdbComponentBuilderFactory.java
@@ -311,6 +311,24 @@ public interface Aws2DdbComponentBuilderFactory {
             return this;
         }
         /**
+         * Set whether the S3 client should expect to load credentials through a
+         * default credentials provider or to expect static credentials to be
+         * passed in.
+         * 
+         * The option is a: &lt;code&gt;boolean&lt;/code&gt; type.
+         * 
+         * Default: false
+         * Group: producer
+         * 
+         * @param useDefaultCredentialsProvider the value to set
+         * @return the dsl builder
+         */
+        default Aws2DdbComponentBuilder useDefaultCredentialsProvider(
+                boolean useDefaultCredentialsProvider) {
+            doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider);
+            return this;
+        }
+        /**
          * The provisioned throughput to reserved for writing resources to your
          * table.
          * 
@@ -415,6 +433,7 @@ public interface Aws2DdbComponentBuilderFactory {
             case "region": getOrCreateConfiguration((Ddb2Component) component).setRegion((java.lang.String) value); return true;
             case "trustAllCertificates": getOrCreateConfiguration((Ddb2Component) component).setTrustAllCertificates((boolean) value); return true;
             case "uriEndpointOverride": getOrCreateConfiguration((Ddb2Component) component).setUriEndpointOverride((java.lang.String) value); return true;
+            case "useDefaultCredentialsProvider": getOrCreateConfiguration((Ddb2Component) component).setUseDefaultCredentialsProvider((boolean) value); return true;
             case "writeCapacity": getOrCreateConfiguration((Ddb2Component) component).setWriteCapacity((java.lang.Long) value); return true;
             case "autowiredEnabled": ((Ddb2Component) component).setAutowiredEnabled((boolean) value); return true;
             case "accessKey": getOrCreateConfiguration((Ddb2Component) component).setAccessKey((java.lang.String) value); return true;
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
index f05bbc3..854b73a 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Ddb2EndpointBuilderFactory.java
@@ -429,6 +429,43 @@ public interface Ddb2EndpointBuilderFactory {
             return this;
         }
         /**
+         * Set whether the S3 client should expect to load credentials through a
+         * default credentials provider or to expect static credentials to be
+         * passed in.
+         * 
+         * The option is a: &lt;code&gt;boolean&lt;/code&gt; type.
+         * 
+         * Default: false
+         * Group: producer
+         * 
+         * @param useDefaultCredentialsProvider the value to set
+         * @return the dsl builder
+         */
+        default Ddb2EndpointBuilder useDefaultCredentialsProvider(
+                boolean useDefaultCredentialsProvider) {
+            doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider);
+            return this;
+        }
+        /**
+         * Set whether the S3 client should expect to load credentials through a
+         * default credentials provider or to expect static credentials to be
+         * passed in.
+         * 
+         * The option will be converted to a &lt;code&gt;boolean&lt;/code&gt;
+         * type.
+         * 
+         * Default: false
+         * Group: producer
+         * 
+         * @param useDefaultCredentialsProvider the value to set
+         * @return the dsl builder
+         */
+        default Ddb2EndpointBuilder useDefaultCredentialsProvider(
+                String useDefaultCredentialsProvider) {
+            doSetProperty("useDefaultCredentialsProvider", useDefaultCredentialsProvider);
+            return this;
+        }
+        /**
          * The provisioned throughput to reserved for writing resources to your
          * table.
          * 
diff --git a/docs/components/modules/ROOT/pages/aws2-ddb-component.adoc b/docs/components/modules/ROOT/pages/aws2-ddb-component.adoc
index 7e85fde..ed7222b 100644
--- a/docs/components/modules/ROOT/pages/aws2-ddb-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws2-ddb-component.adoc
@@ -44,7 +44,7 @@ You can append query options to the URI in the following format,
 
 
 // component options: START
-The AWS 2 DynamoDB component supports 20 options, which are listed below.
+The AWS 2 DynamoDB component supports 21 options, which are listed below.
 
 
 
@@ -67,6 +67,7 @@ The AWS 2 DynamoDB component supports 20 options, which are listed below.
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean
 | *accessKey* (security) | Amazon AWS Access Key |  | String
@@ -96,7 +97,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (18 parameters):
+=== Query Parameters (19 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -117,6 +118,7 @@ with the following path and query parameters:
 | *region* (producer) | The region in which DDB client needs to work |  | String
 | *trustAllCertificates* (producer) | If we want to trust all certificates in case of overriding the endpoint | false | boolean
 | *uriEndpointOverride* (producer) | Set the overriding uri endpoint. This option needs to be used in combination with overrideEndpoint option |  | String
+| *useDefaultCredentialsProvider* (producer) | Set whether the S3 client should expect to load credentials through a default credentials provider or to expect static credentials to be passed in. | false | boolean
 | *writeCapacity* (producer) | The provisioned throughput to reserved for writing resources to your table |  | Long
 | *accessKey* (security) | Amazon AWS Access Key |  | String
 | *secretKey* (security) | Amazon AWS Secret Key |  | String

[camel] 05/06: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1c2421575adec92885a1ed132f3419b9fd5fdd67
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:29:31 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
---
 .../camel/component/aws2/ddb/Ddb2Component.java    |  4 +-
 .../camel/component/aws2/ddb/Ddb2Endpoint.java     | 50 ++--------------------
 2 files changed, 5 insertions(+), 49 deletions(-)

diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
index d8418cf..c0deb31 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
@@ -54,9 +54,9 @@ public class Ddb2Component extends DefaultComponent {
         configuration.setTableName(remaining);
         Ddb2Endpoint endpoint = new Ddb2Endpoint(uri, this, configuration);
         setProperties(endpoint, parameters);
-        if (configuration.getAmazonDDBClient() == null
+        if (!configuration.isUseDefaultCredentialsProvider() && configuration.getAmazonDDBClient() == null
                 && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
-            throw new IllegalArgumentException("amazonDDBClient or accessKey and secretKey must be specified");
+            throw new IllegalArgumentException("useDefaultCredentialsProvider is set to false, amazonDDBClient or accessKey and secretKey must be specified");
         }
 
         return endpoint;
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
index 676a33e..3f19d6e 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
@@ -23,6 +23,7 @@ import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.component.aws2.ddb.client.Ddb2ClientFactory;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.ScheduledPollEndpoint;
@@ -82,7 +83,8 @@ public class Ddb2Endpoint extends ScheduledPollEndpoint {
     public void doStart() throws Exception {
         super.doStart();
 
-        ddbClient = configuration.getAmazonDDBClient() != null ? configuration.getAmazonDDBClient() : createDdbClient();
+        ddbClient = configuration.getAmazonDDBClient() != null
+                ? configuration.getAmazonDDBClient() : Ddb2ClientFactory.getDynamoDBClient(configuration).getDynamoDBClient();
 
         String tableName = getConfiguration().getTableName();
         LOG.trace("Querying whether table [{}] already exists...", tableName);
@@ -139,52 +141,6 @@ public class Ddb2Endpoint extends ScheduledPollEndpoint {
         return ddbClient;
     }
 
-    DynamoDbClient createDdbClient() {
-        DynamoDbClient client = null;
-        DynamoDbClientBuilder clientBuilder = DynamoDbClient.builder();
-        ProxyConfiguration.Builder proxyConfig = null;
-        ApacheHttpClient.Builder httpClientBuilder = null;
-        boolean isClientConfigFound = false;
-        if (ObjectHelper.isNotEmpty(configuration.getProxyHost()) && ObjectHelper.isNotEmpty(configuration.getProxyPort())) {
-            proxyConfig = ProxyConfiguration.builder();
-            URI proxyEndpoint = URI.create(configuration.getProxyProtocol() + "://" + configuration.getProxyHost() + ":"
-                                           + configuration.getProxyPort());
-            proxyConfig.endpoint(proxyEndpoint);
-            httpClientBuilder = ApacheHttpClient.builder().proxyConfiguration(proxyConfig.build());
-            isClientConfigFound = true;
-        }
-        if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) {
-            AwsBasicCredentials cred = AwsBasicCredentials.create(configuration.getAccessKey(), configuration.getSecretKey());
-            if (isClientConfigFound) {
-                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder)
-                        .credentialsProvider(StaticCredentialsProvider.create(cred));
-            } else {
-                clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
-            }
-        } else {
-            if (!isClientConfigFound) {
-                clientBuilder = clientBuilder.httpClientBuilder(httpClientBuilder);
-            }
-        }
-        if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
-            clientBuilder = clientBuilder.region(Region.of(configuration.getRegion()));
-        }
-        if (configuration.isOverrideEndpoint()) {
-            clientBuilder.endpointOverride(URI.create(configuration.getUriEndpointOverride()));
-        }
-        if (configuration.isTrustAllCertificates()) {
-            SdkHttpClient ahc = ApacheHttpClient.builder().buildWithDefaults(AttributeMap
-                    .builder()
-                    .put(
-                            SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
-                            Boolean.TRUE)
-                    .build());
-            clientBuilder.httpClient(ahc);
-        }
-        client = clientBuilder.build();
-        return client;
-    }
-
     private void waitForTableToBecomeAvailable(String tableName) {
         LOG.trace("Waiting for [{}] to become ACTIVE...", tableName);
 

[camel] 06/06: CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 6fe177ca9834dc23be667f8dce57b65cb36311c6
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Apr 27 13:32:18 2021 +0200

    CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - DynamoDB Component
---
 .../org/apache/camel/component/aws2/ddb/Ddb2Component.java    |  3 ++-
 .../org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java     | 11 -----------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
index c0deb31..157eaca 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Component.java
@@ -56,7 +56,8 @@ public class Ddb2Component extends DefaultComponent {
         setProperties(endpoint, parameters);
         if (!configuration.isUseDefaultCredentialsProvider() && configuration.getAmazonDDBClient() == null
                 && (configuration.getAccessKey() == null || configuration.getSecretKey() == null)) {
-            throw new IllegalArgumentException("useDefaultCredentialsProvider is set to false, amazonDDBClient or accessKey and secretKey must be specified");
+            throw new IllegalArgumentException(
+                    "useDefaultCredentialsProvider is set to false, amazonDDBClient or accessKey and secretKey must be specified");
         }
 
         return endpoint;
diff --git a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
index 3f19d6e..c52c5ca 100644
--- a/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ddb/src/main/java/org/apache/camel/component/aws2/ddb/Ddb2Endpoint.java
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.component.aws2.ddb;
 
-import java.net.URI;
-
 import org.apache.camel.Category;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
@@ -30,16 +28,8 @@ import org.apache.camel.support.ScheduledPollEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
-import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
 import software.amazon.awssdk.awscore.exception.AwsServiceException;
-import software.amazon.awssdk.http.SdkHttpClient;
-import software.amazon.awssdk.http.SdkHttpConfigurationOption;
-import software.amazon.awssdk.http.apache.ApacheHttpClient;
-import software.amazon.awssdk.http.apache.ProxyConfiguration;
-import software.amazon.awssdk.regions.Region;
 import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
-import software.amazon.awssdk.services.dynamodb.DynamoDbClientBuilder;
 import software.amazon.awssdk.services.dynamodb.model.AttributeDefinition;
 import software.amazon.awssdk.services.dynamodb.model.CreateTableRequest;
 import software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest;
@@ -48,7 +38,6 @@ import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
 import software.amazon.awssdk.services.dynamodb.model.ResourceNotFoundException;
 import software.amazon.awssdk.services.dynamodb.model.TableDescription;
 import software.amazon.awssdk.services.dynamodb.model.TableStatus;
-import software.amazon.awssdk.utils.AttributeMap;
 
 /**
  * Store and retrieve data from AWS DynamoDB service using AWS SDK version 2.x.