Skip to content

Commit 9b6774d

Browse files
committed
Address PR feedback
1 parent 09c61e2 commit 9b6774d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

.changes/next-release/feature-AWSSDKforJavav2-c2d8ec6.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"type": "feature",
33
"category": "AWS SDK for Java v2",
44
"contributor": "",
5-
"description": "Adds business metrics tracking for credential providers and S3_Express_Bucket."
5+
"description": "Adds business metrics tracking for credential providers."
66
}

core/auth/src/main/java/software/amazon/awssdk/auth/credentials/StaticCredentialsProvider.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,14 @@ private StaticCredentialsProvider(AwsCredentials credentials) {
3636
private AwsCredentials withProviderName(AwsCredentials credentials) {
3737
if (credentials instanceof AwsBasicCredentials) {
3838
AwsBasicCredentials basicCreds = (AwsBasicCredentials) credentials;
39-
if (basicCreds.providerName()
40-
.map(BusinessMetricFeatureId.CREDENTIALS_PROFILE.value()::equals)
41-
.orElse(false)) {
39+
if (basicCreds.providerName().isPresent()) {
4240
return basicCreds;
4341
}
4442
return basicCreds.copy(c -> c.providerName(PROVIDER_NAME));
4543
}
4644
if (credentials instanceof AwsSessionCredentials) {
4745
AwsSessionCredentials sessionCreds = (AwsSessionCredentials) credentials;
48-
if (sessionCreds.providerName()
49-
.map(BusinessMetricFeatureId.CREDENTIALS_PROFILE.value()::equals)
50-
.orElse(false)) {
46+
if (sessionCreds.providerName().isPresent()) {
5147
return sessionCreds;
5248
}
5349
return sessionCreds.copy(c -> c.providerName(PROVIDER_NAME));

core/auth/src/main/java/software/amazon/awssdk/auth/credentials/internal/ProfileCredentialsUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ private Optional<AwsCredentialsProvider> credentialsProvider(Set<String> childre
117117
*/
118118
private Optional<CredentialsWithFeatureId> credentialsProviderWithFeatureID(Set<String> children) {
119119
if (properties.containsKey(ProfileProperty.ROLE_ARN) && properties.containsKey(ProfileProperty.WEB_IDENTITY_TOKEN_FILE)) {
120-
return Optional.ofNullable(roleAndWebIdentityTokenProfileCredentialsProvider());
120+
return Optional.of(roleAndWebIdentityTokenProfileCredentialsProvider());
121121
}
122122

123123
if (properties.containsKey(ProfileProperty.SSO_ROLE_NAME)
124124
|| properties.containsKey(ProfileProperty.SSO_ACCOUNT_ID)
125125
|| properties.containsKey(ProfileProperty.SSO_REGION)
126126
|| properties.containsKey(ProfileProperty.SSO_START_URL)
127127
|| properties.containsKey(ProfileSection.SSO_SESSION.getPropertyKeyName())) {
128-
return Optional.ofNullable(ssoProfileCredentialsProvider());
128+
return Optional.of(ssoProfileCredentialsProvider());
129129
}
130130

131131
if (properties.containsKey(ProfileProperty.ROLE_ARN)) {
@@ -136,16 +136,16 @@ private Optional<CredentialsWithFeatureId> credentialsProviderWithFeatureID(Set<
136136
ProfileProperty.SOURCE_PROFILE, ProfileProperty.CREDENTIAL_SOURCE);
137137

138138
if (hasSourceProfile) {
139-
return Optional.ofNullable(roleAndSourceProfileBasedProfileCredentialsProvider(children));
139+
return Optional.of(roleAndSourceProfileBasedProfileCredentialsProvider(children));
140140
}
141141

142142
if (hasCredentialSource) {
143-
return Optional.ofNullable(roleAndCredentialSourceBasedProfileCredentialsProvider());
143+
return Optional.of(roleAndCredentialSourceBasedProfileCredentialsProvider());
144144
}
145145
}
146146

147147
if (properties.containsKey(ProfileProperty.CREDENTIAL_PROCESS)) {
148-
return Optional.ofNullable(credentialProcessCredentialsProvider());
148+
return Optional.of(credentialProcessCredentialsProvider());
149149
}
150150

151151
if (properties.containsKey(ProfileProperty.AWS_SESSION_TOKEN)) {

0 commit comments

Comments
 (0)