Skip to content

Commit 14b2f71

Browse files
committed
Renaming source to sourceFeatureId and modifying java docs
1 parent e20c919 commit 14b2f71

22 files changed

+151
-134
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"type": "feature",
3+
"category": "AWS SDK for Java v2",
4+
"contributor": "",
5+
"description": "Adds business metrics tracking for credential providers and S3_Express_Bucket."
6+
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ default AwsCredentialsProvider create(AwsCredentialsProvider sourceCredentialsPr
5959
final class ChildProfileCredentialsRequest {
6060
private final AwsCredentialsProvider sourceCredentialsProvider;
6161
private final Profile profile;
62-
private final String source;
62+
private final String sourceFeatureId;
6363

6464
public ChildProfileCredentialsRequest(AwsCredentialsProvider sourceCredentialsProvider,
6565
Profile profile,
66-
String source) {
66+
String sourceFeatureId) {
6767
this.sourceCredentialsProvider = sourceCredentialsProvider;
6868
this.profile = profile;
69-
this.source = source;
69+
this.sourceFeatureId = sourceFeatureId;
7070
}
7171

7272
public AwsCredentialsProvider sourceCredentialsProvider() {
@@ -77,8 +77,8 @@ public Profile profile() {
7777
return profile;
7878
}
7979

80-
public String source() {
81-
return source;
80+
public String sourceFeatureId() {
81+
return sourceFeatureId;
8282
}
8383
}
8484
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public final class ContainerCredentialsProvider
9292
private final Boolean asyncCredentialUpdateEnabled;
9393

9494
private final String asyncThreadName;
95-
private final String source;
95+
private final String sourceFeatureId;
9696
private final String providerName;
9797

9898
/**
@@ -102,10 +102,10 @@ private ContainerCredentialsProvider(BuilderImpl builder) {
102102
this.endpoint = builder.endpoint;
103103
this.asyncCredentialUpdateEnabled = builder.asyncCredentialUpdateEnabled;
104104
this.asyncThreadName = builder.asyncThreadName;
105-
this.source = builder.source;
106-
this.providerName = StringUtils.isEmpty(builder.source)
105+
this.sourceFeatureId = builder.sourceFeatureId;
106+
this.providerName = StringUtils.isEmpty(builder.sourceFeatureId)
107107
? PROVIDER_NAME
108-
: builder.source + "," + PROVIDER_NAME;
108+
: builder.sourceFeatureId + "," + PROVIDER_NAME;
109109
this.httpCredentialsLoader = HttpCredentialsLoader.create(providerName());
110110

111111
if (Boolean.TRUE.equals(builder.asyncCredentialUpdateEnabled)) {
@@ -330,7 +330,7 @@ private static final class BuilderImpl implements Builder {
330330
private String endpoint;
331331
private Boolean asyncCredentialUpdateEnabled;
332332
private String asyncThreadName;
333-
private String source;
333+
private String sourceFeatureId;
334334

335335
private BuilderImpl() {
336336
asyncThreadName("container-credentials-provider");
@@ -340,7 +340,7 @@ private BuilderImpl(ContainerCredentialsProvider credentialsProvider) {
340340
this.endpoint = credentialsProvider.endpoint;
341341
this.asyncCredentialUpdateEnabled = credentialsProvider.asyncCredentialUpdateEnabled;
342342
this.asyncThreadName = credentialsProvider.asyncThreadName;
343-
this.source = credentialsProvider.source;
343+
this.sourceFeatureId = credentialsProvider.sourceFeatureId;
344344
}
345345

346346
@Override
@@ -374,13 +374,13 @@ public void setAsyncThreadName(String asyncThreadName) {
374374
}
375375

376376
@Override
377-
public Builder source(String source) {
378-
this.source = source;
377+
public Builder sourceFeatureId(String sourceFeatureId) {
378+
this.sourceFeatureId = sourceFeatureId;
379379
return this;
380380
}
381381

382-
public void setSource(String source) {
383-
source(source);
382+
public void setSourceFeatureId(String sourceFeatureId) {
383+
sourceFeatureId(sourceFeatureId);
384384
}
385385

386386
@Override

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ interface Builder<TypeToBuildT extends HttpCredentialsProvider, BuilderT extends
5252
/**
5353
* An optional string list of {@link BusinessMetricFeatureId} denoting previous credentials providers
5454
* that are chained with this one.
55+
* <p><b>Note:</b> This method is primarily intended for use by AWS SDK internal components
56+
* and should not be used directly by external users.</p>
5557
*/
56-
default BuilderT source(String source) {
58+
default BuilderT sourceFeatureId(String sourceFeatureId) {
5759
throw new UnsupportedOperationException();
5860
}
5961

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public final class InstanceProfileCredentialsProvider
9393

9494
private final Duration staleTime;
9595

96-
private final String source;
96+
private final String sourceFeatureId;
9797
private final String providerName;
9898

9999
/**
@@ -108,10 +108,10 @@ private InstanceProfileCredentialsProvider(BuilderImpl builder) {
108108
.orElseGet(() -> ProfileFileSupplier.fixedProfileFile(ProfileFile.defaultProfileFile()));
109109
this.profileName = Optional.ofNullable(builder.profileName)
110110
.orElseGet(ProfileFileSystemSetting.AWS_PROFILE::getStringValueOrThrow);
111-
this.source = builder.source;
112-
this.providerName = StringUtils.isEmpty(builder.source)
111+
this.sourceFeatureId = builder.sourceFeatureId;
112+
this.providerName = StringUtils.isEmpty(builder.sourceFeatureId)
113113
? PROVIDER_NAME
114-
: builder.source + "," + PROVIDER_NAME;
114+
: builder.sourceFeatureId + "," + PROVIDER_NAME;
115115

116116
this.httpCredentialsLoader = HttpCredentialsLoader.create(providerName());
117117
this.configProvider =
@@ -386,7 +386,7 @@ static final class BuilderImpl implements Builder {
386386
private Supplier<ProfileFile> profileFile;
387387
private String profileName;
388388
private Duration staleTime;
389-
private String source;
389+
private String sourceFeatureId;
390390

391391
private BuilderImpl() {
392392
asyncThreadName("instance-profile-credentials-provider");
@@ -400,7 +400,7 @@ private BuilderImpl(InstanceProfileCredentialsProvider provider) {
400400
this.profileFile = provider.profileFile;
401401
this.profileName = provider.profileName;
402402
this.staleTime = provider.staleTime;
403-
this.source = provider.source;
403+
this.sourceFeatureId = provider.sourceFeatureId;
404404
}
405405

406406
Builder clock(Clock clock) {
@@ -480,13 +480,13 @@ public void setStaleTime(Duration duration) {
480480
}
481481

482482
@Override
483-
public Builder source(String source) {
484-
this.source = source;
483+
public Builder sourceFeatureId(String sourceFeatureId) {
484+
this.sourceFeatureId = sourceFeatureId;
485485
return this;
486486
}
487487

488-
public void setSource(String source) {
489-
source(source);
488+
public void setSourceFeatureId(String sourceFeatureId) {
489+
sourceFeatureId(sourceFeatureId);
490490
}
491491

492492
@Override

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public final class ProcessCredentialsProvider
8585

8686
private final Boolean asyncCredentialUpdateEnabled;
8787

88-
private final String source;
88+
private final String sourceFeatureId;
8989
private final String providerName;
9090

9191
/**
@@ -99,10 +99,10 @@ private ProcessCredentialsProvider(Builder builder) {
9999
this.commandAsListOfStringsFromBuilder = builder.commandAsListOfStrings;
100100
this.asyncCredentialUpdateEnabled = builder.asyncCredentialUpdateEnabled;
101101
this.staticAccountId = builder.staticAccountId;
102-
this.source = builder.source;
103-
this.providerName = StringUtils.isEmpty(builder.source)
102+
this.sourceFeatureId = builder.sourceFeatureId;
103+
this.providerName = StringUtils.isEmpty(builder.sourceFeatureId)
104104
? PROVIDER_NAME
105-
: builder.source + "," + PROVIDER_NAME;
105+
: builder.sourceFeatureId + "," + PROVIDER_NAME;
106106

107107
CachedSupplier.Builder<AwsCredentials> cacheBuilder = CachedSupplier.builder(this::refreshCredentials)
108108
.cachedValueName(toString());
@@ -284,7 +284,7 @@ public static class Builder implements CopyableBuilder<Builder, ProcessCredentia
284284
private Duration credentialRefreshThreshold = Duration.ofSeconds(15);
285285
private long processOutputLimit = 64000;
286286
private String staticAccountId;
287-
private String source;
287+
private String sourceFeatureId;
288288

289289
/**
290290
* @see #builder()
@@ -299,7 +299,7 @@ private Builder(ProcessCredentialsProvider provider) {
299299
this.credentialRefreshThreshold = provider.credentialRefreshThreshold;
300300
this.processOutputLimit = provider.processOutputLimit;
301301
this.staticAccountId = provider.staticAccountId;
302-
this.source = provider.source;
302+
this.sourceFeatureId = provider.sourceFeatureId;
303303
}
304304

305305
/**
@@ -376,8 +376,8 @@ public Builder staticAccountId(String staticAccountId) {
376376
/**
377377
* Configure the source of this credentials provider. This is used for business metrics tracking.
378378
*/
379-
public Builder source(String source) {
380-
this.source = source;
379+
public Builder sourceFeatureId(String sourceFeatureId) {
380+
this.sourceFeatureId = sourceFeatureId;
381381
return this;
382382
}
383383

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.Objects;
2020
import software.amazon.awssdk.annotations.SdkProtectedApi;
21+
import software.amazon.awssdk.core.useragent.BusinessMetricFeatureId;
2122
import software.amazon.awssdk.profiles.Profile;
2223
import software.amazon.awssdk.profiles.ProfileFile;
2324

@@ -29,12 +30,12 @@ public final class ProfileProviderCredentialsContext {
2930

3031
private final Profile profile;
3132
private final ProfileFile profileFile;
32-
private final String source;
33+
private final String sourceFeatureId;
3334

3435
private ProfileProviderCredentialsContext(Builder builder) {
3536
this.profile = builder.profile;
3637
this.profileFile = builder.profileFile;
37-
this.source = builder.source;
38+
this.sourceFeatureId = builder.sourceFeatureId;
3839
}
3940

4041
public static Builder builder() {
@@ -61,8 +62,8 @@ public ProfileFile profileFile() {
6162
* An optional string list of {@link software.amazon.awssdk.core.useragent.BusinessMetricFeatureId} denoting previous
6263
* credentials providers that are chained with this one.
6364
*/
64-
public String source() {
65-
return source;
65+
public String sourceFeatureId() {
66+
return sourceFeatureId;
6667
}
6768

6869
@Override
@@ -88,7 +89,7 @@ public int hashCode() {
8889
public static final class Builder {
8990
private Profile profile;
9091
private ProfileFile profileFile;
91-
private String source;
92+
private String sourceFeatureId;
9293

9394
private Builder() {
9495
}
@@ -116,12 +117,15 @@ public Builder profileFile(ProfileFile profileFile) {
116117

117118
/**
118119
* Builder interface to set source.
119-
* @param source An optional string list of {@link software.amazon.awssdk.core.useragent.BusinessMetricFeatureId}
120-
* denoting previous credentials providers that are chained with this one.
120+
* @param sourceFeatureId An optional string list of {@link BusinessMetricFeatureId} denoting previous credentials
121+
* providers that are chained with this one. This method is primarily
122+
* intended for use by AWS SDK internal components
123+
* and should not be used directly by external users.
124+
*
121125
* @return Returns a reference to this object so that method calls can be chained together.
122126
*/
123-
public Builder source(String source) {
124-
this.source = source;
127+
public Builder sourceFeatureId(String sourceFeatureId) {
128+
this.sourceFeatureId = sourceFeatureId;
125129
return this;
126130
}
127131

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ private WebIdentityTokenFileCredentialsProvider(BuilderImpl builder) {
109109
.prefetchTime(prefetchTime)
110110
.staleTime(staleTime)
111111
.roleSessionDuration(roleSessionDuration)
112-
.source(BusinessMetricFeatureId.CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN.value())
112+
.sourceFeatureId(BusinessMetricFeatureId
113+
.CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN.value())
113114
.build();
114115

115116
credentialsProvider = WebIdentityCredentialsUtils.factory().create(credentialProperties);

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private AwsCredentialsProvider credentialProcessCredentialsProvider() {
190190
return ProcessCredentialsProvider.builder()
191191
.command(properties.get(ProfileProperty.CREDENTIAL_PROCESS))
192192
.staticAccountId(properties.get(ProfileProperty.AWS_ACCOUNT_ID))
193-
.source(BusinessMetricFeatureId.CREDENTIALS_PROFILE_PROCESS.value())
193+
.sourceFeatureId(BusinessMetricFeatureId.CREDENTIALS_PROFILE_PROCESS.value())
194194
.build();
195195
}
196196

@@ -208,7 +208,7 @@ private AwsCredentialsProvider ssoProfileCredentialsProvider() {
208208
ProfileProviderCredentialsContext.builder()
209209
.profile(profile)
210210
.profileFile(profileFile)
211-
.source(sourceFeatureId)
211+
.sourceFeatureId(sourceFeatureId)
212212
.build());
213213
}
214214

@@ -237,7 +237,8 @@ private AwsCredentialsProvider roleAndWebIdentityTokenProfileCredentialsProvider
237237
.roleArn(roleArn)
238238
.roleSessionName(roleSessionName)
239239
.webIdentityTokenFile(webIdentityTokenFile)
240-
.source(BusinessMetricFeatureId.CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN.value())
240+
.sourceFeatureId(BusinessMetricFeatureId
241+
.CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN.value())
241242
.build();
242243

243244
return WebIdentityCredentialsUtils.factory().create(credentialProperties);

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class WebIdentityTokenCredentialProperties {
3232
private final Duration prefetchTime;
3333
private final Duration staleTime;
3434
private final Duration roleSessionDuration;
35-
private final String source;
35+
private final String sourceFeatureId;
3636

3737
private WebIdentityTokenCredentialProperties(Builder builder) {
3838
this.roleArn = builder.roleArn;
@@ -42,7 +42,7 @@ private WebIdentityTokenCredentialProperties(Builder builder) {
4242
this.prefetchTime = builder.prefetchTime;
4343
this.staleTime = builder.staleTime;
4444
this.roleSessionDuration = builder.roleSessionDuration;
45-
this.source = builder.source;
45+
this.sourceFeatureId = builder.sourceFeatureId;
4646
}
4747

4848
public String roleArn() {
@@ -73,8 +73,8 @@ public Duration roleSessionDuration() {
7373
return this.roleSessionDuration;
7474
}
7575

76-
public String source() {
77-
return source;
76+
public String sourceFeatureId() {
77+
return sourceFeatureId;
7878
}
7979

8080
public static Builder builder() {
@@ -89,7 +89,7 @@ public static final class Builder {
8989
private Duration prefetchTime;
9090
private Duration staleTime;
9191
private Duration roleSessionDuration;
92-
private String source;
92+
private String sourceFeatureId;
9393

9494
public Builder roleArn(String roleArn) {
9595
this.roleArn = roleArn;
@@ -126,8 +126,8 @@ public Builder roleSessionDuration(Duration roleSessionDuration) {
126126
return this;
127127
}
128128

129-
public Builder source(String source) {
130-
this.source = source;
129+
public Builder sourceFeatureId(String sourceFeatureId) {
130+
this.sourceFeatureId = sourceFeatureId;
131131
return this;
132132
}
133133

0 commit comments

Comments
 (0)