Class StaticCredentialsProvider.StaticCredentialsProviderBuilder

java.lang.Object
software.amazon.awssdk.crt.auth.credentials.StaticCredentialsProvider.StaticCredentialsProviderBuilder
Enclosing class:
StaticCredentialsProvider

public static class StaticCredentialsProvider.StaticCredentialsProviderBuilder extends Object
A simple builder class for a static credentials provider and its options
  • 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

      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

      public StaticCredentialsProvider build()
      Builds a new static credentials provider based on the builder configuration
      Returns:
      a new static credentials provider