Class AwsCredentials.Builder (1.27.0)

public static class AwsCredentials.Builder extends ExternalAccountCredentials.Builder

Methods

build()

public AwsCredentials build()
Returns
Type Description
AwsCredentials
Overrides

setAudience(String audience)

public AwsCredentials.Builder setAudience(String audience)

Sets the Security Token Service audience, which is usually the fully specified resource name of the workload/workforce pool provider.

Parameter
Name Description
audience String
Returns
Type Description
AwsCredentials.Builder
Overrides

setAwsSecurityCredentialsSupplier(AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier)

public AwsCredentials.Builder setAwsSecurityCredentialsSupplier(AwsSecurityCredentialsSupplier awsSecurityCredentialsSupplier)

Sets the AWS security credentials supplier. The supplier should return a valid AwsSecurityCredentials object and a valid AWS region.

Parameter
Name Description
awsSecurityCredentialsSupplier AwsSecurityCredentialsSupplier

the supplier to use.

Returns
Type Description
AwsCredentials.Builder

this Builder object

setClientId(String clientId)

public AwsCredentials.Builder setClientId(String clientId)

Sets the optional client ID of the service account from the console.

Parameter
Name Description
clientId String
Returns
Type Description
AwsCredentials.Builder
Overrides

setClientSecret(String clientSecret)

public AwsCredentials.Builder setClientSecret(String clientSecret)

Sets the optional client secret of the service account from the console.

Parameter
Name Description
clientSecret String
Returns
Type Description
AwsCredentials.Builder
Overrides

setCredentialSource(AwsCredentialSource credentialSource)

public AwsCredentials.Builder setCredentialSource(AwsCredentialSource credentialSource)
Parameter
Name Description
credentialSource AwsCredentialSource
Returns
Type Description
AwsCredentials.Builder

setHttpTransportFactory(HttpTransportFactory transportFactory)

public AwsCredentials.Builder setHttpTransportFactory(HttpTransportFactory transportFactory)

Sets the HTTP transport factory, creates the transport used to get access tokens.

Parameter
Name Description
transportFactory HttpTransportFactory
Returns
Type Description
AwsCredentials.Builder
Overrides

setQuotaProjectId(String quotaProjectId)

public AwsCredentials.Builder setQuotaProjectId(String quotaProjectId)

Sets the optional project used for quota and billing purposes.

Parameter
Name Description
quotaProjectId String
Returns
Type Description
AwsCredentials.Builder
Overrides

setRegionalCredentialVerificationUrlOverride(String regionalCredentialVerificationUrlOverride)

public AwsCredentials.Builder setRegionalCredentialVerificationUrlOverride(String regionalCredentialVerificationUrlOverride)

Sets the AWS regional credential verification URL. If set, will override any credential verification URL provided in the credential source. If not set, the credential verification URL will default to

<a href=https://sts.{region}.amazonaws.com?Action=GetCallerIdentity&Version=2011-06-15>

Parameter
Name Description
regionalCredentialVerificationUrlOverride String

the AWS credential verification url to set.

Returns
Type Description
AwsCredentials.Builder

this Builder object

setScopes(Collection<String> scopes)

public AwsCredentials.Builder setScopes(Collection<String> scopes)

Sets the optional scopes to request during the authorization grant.

Parameter
Name Description
scopes Collection<String>
Returns
Type Description
AwsCredentials.Builder
Overrides

setServiceAccountImpersonationOptions(Map<String,Object> optionsMap)

public AwsCredentials.Builder setServiceAccountImpersonationOptions(Map<String,Object> optionsMap)

Sets the optional service account impersonation options.

Parameter
Name Description
optionsMap Map<String,Object>
Returns
Type Description
AwsCredentials.Builder
Overrides

setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl)

public AwsCredentials.Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl)

Sets the optional URL used for service account impersonation, which is required for some APIs. If this URL is not available, the access token from the Security Token Service is used directly.

Parameter
Name Description
serviceAccountImpersonationUrl String
Returns
Type Description
AwsCredentials.Builder
Overrides

setSubjectTokenType(ExternalAccountCredentials.SubjectTokenTypes subjectTokenType)

public AwsCredentials.Builder setSubjectTokenType(ExternalAccountCredentials.SubjectTokenTypes subjectTokenType)

Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange spec. Indicates the type of the security token in the credential file.

Parameter
Name Description
subjectTokenType ExternalAccountCredentials.SubjectTokenTypes
Returns
Type Description
AwsCredentials.Builder
Overrides

setSubjectTokenType(String subjectTokenType)

public AwsCredentials.Builder setSubjectTokenType(String subjectTokenType)

Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange spec. Indicates the type of the security token in the credential file.

Parameter
Name Description
subjectTokenType String
Returns
Type Description
AwsCredentials.Builder
Overrides

setTokenInfoUrl(String tokenInfoUrl)

public AwsCredentials.Builder setTokenInfoUrl(String tokenInfoUrl)

Sets the optional endpoint used to retrieve account related information. Required for gCloud session account identification.

Parameter
Name Description
tokenInfoUrl String
Returns
Type Description
AwsCredentials.Builder
Overrides

setTokenUrl(String tokenUrl)

public AwsCredentials.Builder setTokenUrl(String tokenUrl)

Sets the Security Token Service token exchange endpoint.

Parameter
Name Description
tokenUrl String
Returns
Type Description
AwsCredentials.Builder
Overrides

setUniverseDomain(String universeDomain)

public AwsCredentials.Builder setUniverseDomain(String universeDomain)

Sets the optional universe domain.

Parameter
Name Description
universeDomain String
Returns
Type Description
AwsCredentials.Builder
Overrides

setWorkforcePoolUserProject(String workforcePoolUserProject)

public AwsCredentials.Builder setWorkforcePoolUserProject(String workforcePoolUserProject)

Sets the optional workforce pool user project number when the credential corresponds to a workforce pool and not a workload identity pool. The underlying principal must still have serviceusage.services.use IAM permission to use the project for billing/quota.

Parameter
Name Description
workforcePoolUserProject String
Returns
Type Description
AwsCredentials.Builder
Overrides