Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extends fix of CAMEL-21713: endpoint url override to aws-secret-manager #17060

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -202,46 +202,40 @@ protected void doStart() throws Exception {
}
}
if (!useSqsNotification) {
CloudTrailClientBuilder clientBuilder = CloudTrailClient.builder();
if (ObjectHelper.isNotEmpty(accessKey) && ObjectHelper.isNotEmpty(secretKey) && ObjectHelper.isNotEmpty(region)) {
CloudTrailClientBuilder clientBuilder = CloudTrailClient.builder();

AwsBasicCredentials cred = AwsBasicCredentials.create(accessKey, secretKey);
clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
clientBuilder.region(Region.of(region));
cloudTrailClient = clientBuilder.build();
} else if (useDefaultCredentialsProvider && ObjectHelper.isNotEmpty(region)) {
CloudTrailClientBuilder clientBuilder = CloudTrailClient.builder();
clientBuilder.region(Region.of(region));
cloudTrailClient = clientBuilder.build();
} else if (useProfileCredentialsProvider && ObjectHelper.isNotEmpty(profileName)) {
CloudTrailClientBuilder clientBuilder = CloudTrailClient.builder();
clientBuilder.credentialsProvider(ProfileCredentialsProvider.create(profileName));
clientBuilder.region(Region.of(region));
cloudTrailClient = clientBuilder.build();
} else {
throw new RuntimeCamelException(
"Using the AWS Secrets Refresh Task requires setting AWS credentials as application properties or environment variables");
}
cloudTrailClient = isOverrideEndpoint
? clientBuilder.endpointOverride(URI.create(uriEndpointOverride)).build() : clientBuilder.build();
} else {
SqsClientBuilder clientBuilder = SqsClient.builder();
if (ObjectHelper.isNotEmpty(accessKey) && ObjectHelper.isNotEmpty(secretKey) && ObjectHelper.isNotEmpty(region)) {
SqsClientBuilder clientBuilder = SqsClient.builder();
AwsBasicCredentials cred = AwsBasicCredentials.create(accessKey, secretKey);
clientBuilder = clientBuilder.credentialsProvider(StaticCredentialsProvider.create(cred));
clientBuilder.region(Region.of(region));
sqsClient = isOverrideEndpoint
? clientBuilder.endpointOverride(URI.create(uriEndpointOverride)).build() : clientBuilder.build();
} else if (useDefaultCredentialsProvider && ObjectHelper.isNotEmpty(region)) {
SqsClientBuilder clientBuilder = SqsClient.builder();
clientBuilder.region(Region.of(region));
sqsClient = clientBuilder.build();
} else if (useProfileCredentialsProvider && ObjectHelper.isNotEmpty(profileName)) {
SqsClientBuilder clientBuilder = SqsClient.builder();
clientBuilder.credentialsProvider(ProfileCredentialsProvider.create(profileName));
clientBuilder.region(Region.of(region));
sqsClient = clientBuilder.build();
} else {
throw new RuntimeCamelException(
"Using the AWS Secrets Refresh Task requires setting AWS credentials as application properties or environment variables");
}
sqsClient = isOverrideEndpoint
? clientBuilder.endpointOverride(URI.create(uriEndpointOverride)).build() : clientBuilder.build();
}
}

Expand Down