Class StaticCredentialsProvider.StaticCredentialsProviderBuilder
java.lang.Object
software.amazon.awssdk.crt.auth.credentials.StaticCredentialsProvider.StaticCredentialsProviderBuilder
- Enclosing class:
- StaticCredentialsProvider
A simple builder class for a static credentials provider and its options
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new static credentials provider based on the builder configurationwithAccessKeyId
(byte[] accessKeyId) Sets the AWS access key id to use within the static credentialswithCredentials
(Credentials credentials) sets the entire credential set to use within the static credentials provider.withSecretAccessKey
(byte[] secretAccessKey) Sets the AWS secret access key to use within the static credentialswithSessionToken
(byte[] sessionToken) Sets the AWS session token to use within the static credentials.
-
Constructor Details
-
StaticCredentialsProviderBuilder
public StaticCredentialsProviderBuilder()Default constructor
-
-
Method Details
-
withAccessKeyId
public StaticCredentialsProvider.StaticCredentialsProviderBuilder withAccessKeyId(byte[] accessKeyId) Sets the AWS access key id to use within the static credentials- Parameters:
accessKeyId
- AWS access key id to use- Returns:
- this builder object
-
withSecretAccessKey
public StaticCredentialsProvider.StaticCredentialsProviderBuilder withSecretAccessKey(byte[] secretAccessKey) Sets the AWS secret access key to use within the static credentials- Parameters:
secretAccessKey
- AWS secret access key to use- Returns:
- this builder object
-
withSessionToken
public StaticCredentialsProvider.StaticCredentialsProviderBuilder withSessionToken(byte[] sessionToken) Sets the AWS session token to use within the static credentials. Session credentials are inherently time-bound; static providers do not provide any mechanism to update session-based credentials, and use of session-based credentials with a static provider is discouraged.- Parameters:
sessionToken
- AWS session token to use- Returns:
- this builder object
-
withCredentials
public StaticCredentialsProvider.StaticCredentialsProviderBuilder withCredentials(Credentials credentials) sets the entire credential set to use within the static credentials provider. Overrides all three components.- Parameters:
credentials
- AWS credentials to use- Returns:
- this builder object
-
build
Builds a new static credentials provider based on the builder configuration- Returns:
- a new static credentials provider
-