Example usage for com.amazonaws PredefinedClientConfigurations defaultConfig

List of usage examples for com.amazonaws PredefinedClientConfigurations defaultConfig

Introduction

In this page you can find the example usage for com.amazonaws PredefinedClientConfigurations defaultConfig.

Prototype

public static ClientConfiguration defaultConfig() 

Source Link

Document

Factory method for default ClientConfiguration for all services unless otherwise specified

Usage

From source file:io.confluent.connect.s3.storage.S3Storage.java

License:Open Source License

/**
 * Creates S3 client's configuration./*from ww  w  . j  a  va  2 s. c  om*/
 * This method currently configures the AWS client retry policy to use full jitter.
 * Visible for testing.
 *
 * @param config the S3 configuration.
 * @return S3 client's configuration
 */
public ClientConfiguration newClientConfiguration(S3SinkConnectorConfig config) {
    String version = String.format(VERSION_FORMAT, Version.getVersion());

    ClientConfiguration clientConfiguration = PredefinedClientConfigurations.defaultConfig();
    clientConfiguration.withUserAgentPrefix(version).withRetryPolicy(newFullJitterRetryPolicy(config));
    if (StringUtils.isNotBlank(config.getString(S3_PROXY_URL_CONFIG))) {
        S3ProxyConfig proxyConfig = new S3ProxyConfig(config);
        clientConfiguration.withProtocol(proxyConfig.protocol()).withProxyHost(proxyConfig.host())
                .withProxyPort(proxyConfig.port()).withProxyUsername(proxyConfig.user())
                .withProxyPassword(proxyConfig.pass());
    }
    clientConfiguration.withUseExpectContinue(config.useExpectContinue());

    return clientConfiguration;
}