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/30 13:42:08 UTC
[camel] 09/10: CAMEL-16465 - Camel-AWS: Add
useDefaultCredentialProvider option to all the components - EC2 Component
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 33a8531b2f232b26bf3a6590a06af4218307284b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 30 15:39:25 2021 +0200
CAMEL-16465 - Camel-AWS: Add useDefaultCredentialProvider option to all the components - EC2 Component
---
.../camel/component/aws2/ec2/AWS2EC2Endpoint.java | 46 ----------------------
1 file changed, 46 deletions(-)
diff --git a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
index 5599ffb..837ad03 100644
--- a/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ec2/src/main/java/org/apache/camel/component/aws2/ec2/AWS2EC2Endpoint.java
@@ -91,50 +91,4 @@ public class AWS2EC2Endpoint extends ScheduledPollEndpoint {
public Ec2Client getEc2Client() {
return ec2Client;
}
-
- Ec2Client createEc2Client() {
- Ec2Client client = null;
- Ec2ClientBuilder clientBuilder = Ec2Client.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;
- }
}