Class AwsClientFactory<SB extends software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder<SB,SC> & software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<SB,SC>,AB extends software.amazon.awssdk.awscore.client.builder.AwsAsyncClientBuilder<AB,AC> & software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<AB,AC>,SC,AC extends software.amazon.awssdk.core.SdkClient>

java.lang.Object
io.micronaut.aws.sdk.v2.service.AwsClientFactory<SB,AB,SC,AC>
Type Parameters:
SB - The sync builder
AB - The async builder
SC - The sync client
AC - The async client
Direct Known Subclasses:
ApiGatewayManagementApiClientFactory, CloudwatchLogsClientFactory, DynamoDbClientFactory, S3ClientFactory, SecretsManagerClientFactory, ServiceDiscoveryAsyncClientFactory, SesClientFactory, SnsClientFactory, SqsClientFactory, SsmClientFactory

public abstract class AwsClientFactory<SB extends software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder<SB,SC> & software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<SB,SC>,AB extends software.amazon.awssdk.awscore.client.builder.AwsAsyncClientBuilder<AB,AC> & software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<AB,AC>,SC,AC extends software.amazon.awssdk.core.SdkClient> extends Object
Abstract class that eases creation of AWS client factories.
Since:
2.0.0
Author:
Álvaro Sánchez-Mariscal
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final @Nullable AWSServiceConfiguration
     
    protected final software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain
     
    protected final software.amazon.awssdk.regions.providers.AwsRegionProviderChain
     
    protected final @Nullable UserAgentProvider
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AwsClientFactory(software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain credentialsProvider, software.amazon.awssdk.regions.providers.AwsRegionProviderChain regionProvider, @Nullable UserAgentProvider userAgentProvider, @Nullable AWSServiceConfiguration configuration)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    asyncBuilder(software.amazon.awssdk.http.async.SdkAsyncHttpClient httpClient)
    Configures the builder so that it uses the appropriate HTTP client, credentials and region providers.
    asyncClient(AB builder)
    Creates the async client.
    protected abstract AB
    Implementations need to create the builder, eg: S3AsyncClient.builder();.
    protected abstract SB
    Implementations need to create the builder, eg: S3Client.builder();.
    syncBuilder(software.amazon.awssdk.http.SdkHttpClient httpClient)
    Configures the builder so that it uses the appropriate HTTP client, credentials and region providers.
    syncClient(SB builder)
    Creates the sync client.

    Methods inherited from class java.lang.Object

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

    • credentialsProvider

      protected final software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain credentialsProvider
    • regionProvider

      protected final software.amazon.awssdk.regions.providers.AwsRegionProviderChain regionProvider
    • configuration

      @Nullable protected final @Nullable AWSServiceConfiguration configuration
    • userAgentProvider

      @Nullable protected final @Nullable UserAgentProvider userAgentProvider
  • Constructor Details

    • AwsClientFactory

      protected AwsClientFactory(software.amazon.awssdk.auth.credentials.AwsCredentialsProviderChain credentialsProvider, software.amazon.awssdk.regions.providers.AwsRegionProviderChain regionProvider, @Nullable @Nullable UserAgentProvider userAgentProvider, @Nullable @Nullable AWSServiceConfiguration configuration)
      Constructor.
      Parameters:
      credentialsProvider - The credentials provider
      regionProvider - The region provider
      userAgentProvider - User-Agent Provider
      configuration - AWS Service Configuration
  • Method Details

    • syncBuilder

      public SB syncBuilder(software.amazon.awssdk.http.SdkHttpClient httpClient)
      Configures the builder so that it uses the appropriate HTTP client, credentials and region providers. Subclasses may want to override this method and annotate it with @Singleton.
      Parameters:
      httpClient - The sync HTTP client
      Returns:
      The sync builder
    • syncClient

      public SC syncClient(SB builder)
      Creates the sync client. It requires a bean of type SB.
      Parameters:
      builder - The sync builder
      Returns:
      The sync AWS client
      See Also:
    • asyncBuilder

      public AB asyncBuilder(software.amazon.awssdk.http.async.SdkAsyncHttpClient httpClient)
      Configures the builder so that it uses the appropriate HTTP client, credentials and region providers. Subclasses may want to override this method and annotate it with @Singleton.
      Parameters:
      httpClient - The async HTTP client
      Returns:
      The async builder
    • asyncClient

      public AC asyncClient(AB builder)
      Creates the async client. It requires a bean of type AB.
      Parameters:
      builder - The async builder
      Returns:
      The async AWS client
    • createSyncBuilder

      protected abstract SB createSyncBuilder()
      Implementations need to create the builder, eg: S3Client.builder();.
      Returns:
      The sync builder
    • createAsyncBuilder

      protected abstract AB createAsyncBuilder()
      Implementations need to create the builder, eg: S3AsyncClient.builder();.
      Returns:
      The async builder