Example usage for com.amazonaws ClientConfiguration withUserAgentPrefix

List of usage examples for com.amazonaws ClientConfiguration withUserAgentPrefix

Introduction

In this page you can find the example usage for com.amazonaws ClientConfiguration withUserAgentPrefix.

Prototype

public ClientConfiguration withUserAgentPrefix(String prefix) 

Source Link

Document

Sets the HTTP user agent prefix header used in requests and returns the updated ClientConfiguration object.

Usage

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

License:Open Source License

/**
 * Creates S3 client's configuration.//from   w  ww. j  a v  a 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;
}