Class AwsClientBuilderUtil

java.lang.Object
org.apache.camel.component.aws.common.AwsClientBuilderUtil

public final class AwsClientBuilderUtil extends Object
Utility class for building AWS SDK clients with common configuration.

This class eliminates code duplication across all AWS Camel components by providing a centralized way to configure AWS clients with credentials, proxy, region, endpoint, and other common settings.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkAsyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient>
    C
    buildAsyncClient(AwsCommonConfiguration config, Supplier<B> builderSupplier)
    Build an AWS async client with the given configuration, without service-specific configuration.
    static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkAsyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient>
    C
    buildAsyncClient(AwsCommonConfiguration config, Supplier<B> builderSupplier, Consumer<B> serviceSpecificConfig)
    Build an AWS async client with the given configuration.
    static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkSyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient>
    C
    buildClient(AwsCommonConfiguration config, Supplier<B> builderSupplier)
    Build an AWS client with the given configuration, without service-specific configuration.
    static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkSyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient>
    C
    buildClient(AwsCommonConfiguration config, Supplier<B> builderSupplier, Consumer<B> serviceSpecificConfig)
    Build an AWS client with the given configuration.

    Methods inherited from class Object

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

    • buildClient

      public static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkSyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient> C buildClient(AwsCommonConfiguration config, Supplier<B> builderSupplier, Consumer<B> serviceSpecificConfig)
      Build an AWS client with the given configuration.
      Type Parameters:
      B - The builder type (must extend both AwsClientBuilder and SdkSyncClientBuilder)
      C - The client type
      Parameters:
      config - The common AWS configuration
      builderSupplier - Supplier for the service-specific client builder (e.g., S3Client::builder)
      serviceSpecificConfig - Optional consumer for service-specific configuration (e.g., S3's forcePathStyle)
      Returns:
      The configured AWS client
    • buildClient

      public static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkSyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient> C buildClient(AwsCommonConfiguration config, Supplier<B> builderSupplier)
      Build an AWS client with the given configuration, without service-specific configuration.
      Type Parameters:
      B - The builder type
      C - The client type
      Parameters:
      config - The common AWS configuration
      builderSupplier - Supplier for the service-specific client builder
      Returns:
      The configured AWS client
    • buildAsyncClient

      public static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkAsyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient> C buildAsyncClient(AwsCommonConfiguration config, Supplier<B> builderSupplier, Consumer<B> serviceSpecificConfig)
      Build an AWS async client with the given configuration.
      Type Parameters:
      B - The builder type (must extend both AwsClientBuilder and SdkAsyncClientBuilder)
      C - The client type
      Parameters:
      config - The common AWS configuration
      builderSupplier - Supplier for the service-specific async client builder (e.g., KinesisAsyncClient::builder)
      serviceSpecificConfig - Optional consumer for service-specific configuration
      Returns:
      The configured AWS async client
    • buildAsyncClient

      public static <B extends software.amazon.awssdk.awscore.client.builder.AwsClientBuilder<B,C> & software.amazon.awssdk.core.client.builder.SdkAsyncClientBuilder<B,C>, C extends software.amazon.awssdk.core.SdkClient> C buildAsyncClient(AwsCommonConfiguration config, Supplier<B> builderSupplier)
      Build an AWS async client with the given configuration, without service-specific configuration.
      Type Parameters:
      B - The builder type
      C - The client type
      Parameters:
      config - The common AWS configuration
      builderSupplier - Supplier for the service-specific async client builder
      Returns:
      The configured AWS async client