Skip to content

Commit

Permalink
Update to fix a few comments on naming conventions and a missing max …
Browse files Browse the repository at this point in the history
…retry

Signed-off-by: Aindriu Lavelle <aindriu.lavelle@aiven.io>
  • Loading branch information
aindriu-aiven authored and RyanSkraba committed Dec 27, 2024
1 parent 65c60e4 commit ec1ccdf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ public void validateCredentials() {
}
} else {
final BasicAWSCredentials awsCredentials = getAwsCredentials();
final AwsBasicCredentials awsV2Credentials = getAwsV2Credentials();
if (awsCredentials == null && awsV2Credentials == null) {
final AwsBasicCredentials awsCredentialsV2 = getAwsCredentialsV2();
if (awsCredentials == null && awsCredentialsV2 == null) {
LOGGER.info(
"Connector use {} as credential Provider, "
+ "when configuration for {{}, {}} OR {{}, {}} are absent",
Expand Down Expand Up @@ -435,7 +435,7 @@ public BasicAWSCredentials getAwsCredentials() {
return null;
}

public AwsBasicCredentials getAwsV2Credentials() {
public AwsBasicCredentials getAwsCredentialsV2() {
if (Objects.nonNull(cfg.getPassword(AWS_ACCESS_KEY_ID_CONFIG))
&& Objects.nonNull(cfg.getPassword(AWS_SECRET_ACCESS_KEY_CONFIG))) {

Expand Down Expand Up @@ -467,7 +467,7 @@ public Region getAwsS3Region() {
}
}

public software.amazon.awssdk.regions.Region getAwsV2S3Region() {
public software.amazon.awssdk.regions.Region getAwsS3RegionV2() {
// we have priority of properties if old one not set or both old and new one set
// the new property value will be selected
if (Objects.nonNull(cfg.getString(AWS_S3_REGION_CONFIG))) {
Expand Down Expand Up @@ -515,7 +515,7 @@ public AWSCredentialsProvider getCustomCredentialsProvider() {
return cfg.getConfiguredInstance(AWS_CREDENTIALS_PROVIDER_CONFIG, AWSCredentialsProvider.class);
}

public AwsCredentialsProvider getCustomV2CredentialsProvider() {
public AwsCredentialsProvider getCustomCredentialsProviderV2() {
return cfg.getConfiguredInstance(AWS_CREDENTIALS_PROVIDER_CONFIG, AwsCredentialsProvider.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public AwsCredentialsProvider getAwsV2Provider(final S3ConfigFragment config) {
if (config.hasAwsStsRole()) {
return getV2StsProvider(config);
}
final AwsBasicCredentials awsCredentials = config.getAwsV2Credentials();
final AwsBasicCredentials awsCredentials = config.getAwsCredentialsV2();
if (Objects.isNull(awsCredentials)) {
return config.getCustomV2CredentialsProvider();
return config.getCustomCredentialsProviderV2();
}
return StaticCredentialsProvider.create(awsCredentials);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public S3Client createAmazonS3Client(final S3SourceConfig config) {
if (Objects.isNull(config.getAwsS3EndPoint())) {
return S3Client.builder()
.overrideConfiguration(clientOverrideConfiguration)
.overrideConfiguration(o -> o.retryStrategy(r -> r.backoffStrategy(backoffStrategy)))
.overrideConfiguration(o -> o.retryStrategy(
r -> r.backoffStrategy(backoffStrategy).maxAttempts(config.getS3RetryBackoffMaxRetries())))
.region(config.getAwsS3Region())
.credentialsProvider(credentialFactory.getAwsV2Provider(config.getS3ConfigFragment()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public AwsStsEndpointConfig getStsEndpointConfig() {
}

public AwsBasicCredentials getAwsCredentials() {
return s3ConfigFragment.getAwsV2Credentials();
return s3ConfigFragment.getAwsCredentialsV2();
}

public String getAwsS3EndPoint() {
return s3ConfigFragment.getAwsS3EndPoint();
}

public Region getAwsS3Region() {
return s3ConfigFragment.getAwsV2S3Region();
return s3ConfigFragment.getAwsS3RegionV2();
}

public String getAwsS3BucketName() {
Expand Down

0 comments on commit ec1ccdf

Please sign in to comment.