Class AwsClientProperties

  • All Implemented Interfaces:
    java.io.Serializable

    public class AwsClientProperties
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder>
      void
      applyClientCredentialConfigurations​(T builder)
      Configure the credential provider for AWS clients.
      <T extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder>
      void
      applyClientRegionConfiguration​(T builder)
      Configure a client AWS region.
      java.lang.String clientRegion()  
      software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider​(java.lang.String accessKeyId, java.lang.String secretAccessKey, java.lang.String sessionToken)
      Returns a credentials provider instance.
      void setClientRegion​(java.lang.String clientRegion)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CLIENT_CREDENTIALS_PROVIDER

        public static final java.lang.String CLIENT_CREDENTIALS_PROVIDER
        Configure the AWS credentials provider used to create AWS clients. A fully qualified concrete class with package that implements the AwsCredentialsProvider interface is required.

        Additionally, the implementation class must also have a create() or create(Map) method implemented, which returns an instance of the class that provides aws credentials provider.

        Example: client.credentials-provider=software.amazon.awssdk.auth.credentials.SystemPropertyCredentialsProvider

        When set, the default client factory AwsClientFactories.defaultFactory() and other AWS client factory classes will use this provider to get AWS credentials provided instead of reading the default credential chain to get AWS access credentials.

        See Also:
        Constant Field Values
      • CLIENT_CREDENTIAL_PROVIDER_PREFIX

        protected static final java.lang.String CLIENT_CREDENTIAL_PROVIDER_PREFIX
        Used by the client.credentials-provider configured value that will be used by AwsClientFactories.defaultFactory() and other AWS client factory classes to pass provider-specific properties. Each property consists of a key name and an associated value.
        See Also:
        Constant Field Values
      • CLIENT_REGION

        public static final java.lang.String CLIENT_REGION
        Used by AwsClientFactories.DefaultAwsClientFactory and also other client factory classes. If set, all AWS clients except STS client will use the given region instead of the default region chain.
        See Also:
        Constant Field Values
      • REFRESH_CREDENTIALS_ENDPOINT

        public static final java.lang.String REFRESH_CREDENTIALS_ENDPOINT
        When set, the VendedCredentialsProvider will be used to fetch and refresh vended credentials from this endpoint.
        See Also:
        Constant Field Values
      • REFRESH_CREDENTIALS_ENABLED

        public static final java.lang.String REFRESH_CREDENTIALS_ENABLED
        Controls whether vended credentials should be refreshed or not. Defaults to true.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AwsClientProperties

        public AwsClientProperties()
      • AwsClientProperties

        public AwsClientProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
    • Method Detail

      • clientRegion

        public java.lang.String clientRegion()
      • setClientRegion

        public void setClientRegion​(java.lang.String clientRegion)
      • applyClientRegionConfiguration

        public <T extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder> void applyClientRegionConfiguration​(T builder)
        Configure a client AWS region.

        Sample usage:

             S3Client.builder().applyMutation(awsClientProperties::applyClientRegionConfiguration)
         
      • applyClientCredentialConfigurations

        public <T extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder> void applyClientCredentialConfigurations​(T builder)
        Configure the credential provider for AWS clients.

        Sample usage:

             DynamoDbClient.builder().applyMutation(awsClientProperties::applyClientCredentialConfigurations)
         
      • credentialsProvider

        public software.amazon.awssdk.auth.credentials.AwsCredentialsProvider credentialsProvider​(java.lang.String accessKeyId,
                                                                                                  java.lang.String secretAccessKey,
                                                                                                  java.lang.String sessionToken)
        Returns a credentials provider instance. If refreshCredentialsEndpoint is set, an instance of VendedCredentialsProvider is returned. If params were set, we return a new credentials instance. If none of the params are set, we try to dynamically load the provided credentials provider class. Upon loading the class, we try to invoke create(Map<String, String>) static method. If that fails, we fall back to create(). If credential provider class wasn't set, we fall back to default credentials provider.
        Parameters:
        accessKeyId - the AWS access key ID
        secretAccessKey - the AWS secret access key
        sessionToken - the AWS session token
        Returns:
        a credentials provider instance