Example usage for com.amazonaws ClientConfigurationFactory ClientConfigurationFactory

List of usage examples for com.amazonaws ClientConfigurationFactory ClientConfigurationFactory

Introduction

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

Prototype

ClientConfigurationFactory

Source Link

Usage

From source file:org.apache.druid.storage.s3.S3StorageDruidModule.java

License:Apache License

@Provides
@LazySingleton/*from   w  w w. j  a  va  2  s  .  c om*/
public ServerSideEncryptingAmazonS3 getAmazonS3Client(AWSCredentialsProvider provider,
        AWSProxyConfig proxyConfig, AWSEndpointConfig endpointConfig, AWSClientConfig clientConfig,
        S3StorageConfig storageConfig) {
    final ClientConfiguration configuration = new ClientConfigurationFactory().getConfig();
    final Protocol protocol = determineProtocol(clientConfig, endpointConfig);
    final AmazonS3ClientBuilder builder = AmazonS3Client.builder().withCredentials(provider)
            .withClientConfiguration(setProxyConfig(configuration, proxyConfig).withProtocol(protocol))
            .withChunkedEncodingDisabled(clientConfig.isDisableChunkedEncoding())
            .withPathStyleAccessEnabled(clientConfig.isEnablePathStyleAccess())
            .withForceGlobalBucketAccessEnabled(clientConfig.isForceGlobalBucketAccessEnabled());

    if (StringUtils.isNotEmpty(endpointConfig.getUrl())) {
        builder.setEndpointConfiguration(
                new EndpointConfiguration(endpointConfig.getUrl(), endpointConfig.getSigningRegion()));
    }

    return new ServerSideEncryptingAmazonS3(builder.build(), storageConfig.getServerSideEncryption());
}

From source file:org.apache.flink.streaming.connectors.kinesis.proxy.DynamoDBStreamsProxy.java

License:Apache License

/**
 * Creates an AmazonDynamoDBStreamsAdapterClient.
 * Uses it as the internal client interacting with the DynamoDB streams.
 *
 * @param configProps configuration properties
 * @return an AWS DynamoDB streams adapter client
 *//*from www.ja  va2  s  . c  o  m*/
@Override
protected AmazonKinesis createKinesisClient(Properties configProps) {
    ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
    setAwsClientConfigProperties(awsClientConfig, configProps);

    AWSCredentialsProvider credentials = getCredentialsProvider(configProps);
    awsClientConfig.setUserAgentPrefix(String.format(USER_AGENT_FORMAT, EnvironmentInformation.getVersion(),
            EnvironmentInformation.getRevisionInformation().commitId));

    AmazonDynamoDBStreamsAdapterClient adapterClient = new AmazonDynamoDBStreamsAdapterClient(credentials,
            awsClientConfig);

    if (configProps.containsKey(AWS_ENDPOINT)) {
        adapterClient.setEndpoint(configProps.getProperty(AWS_ENDPOINT));
    } else {
        adapterClient.setRegion(Region.getRegion(Regions.fromName(configProps.getProperty(AWS_REGION))));
    }

    return adapterClient;
}

From source file:org.apache.flink.streaming.connectors.kinesis.util.AWSUtil.java

License:Apache License

/**
 * Creates an Amazon Kinesis Client.// w ww .  j  ava 2s. c  om
 * @param configProps configuration properties containing the access key, secret key, and region
 * @return a new Amazon Kinesis Client
 */
public static AmazonKinesisClient createKinesisClient(Properties configProps) {
    // set a Flink-specific user agent
    ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig();
    awsClientConfig.setUserAgent("Apache Flink " + EnvironmentInformation.getVersion() + " ("
            + EnvironmentInformation.getRevisionInformation().commitId + ") Kinesis Connector");

    // utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider
    AmazonKinesisClient client = new AmazonKinesisClient(AWSUtil.getCredentialsProvider(configProps),
            awsClientConfig);

    client.setRegion(
            Region.getRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION))));
    if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
        client.setEndpoint(configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT));
    }
    return client;
}

From source file:org.apache.zeppelin.notebook.repo.OldS3NotebookRepo.java

License:Apache License

/**
 * Create AWS client configuration and return it.
 * @return AWS client configuration/*from w w w. j a  va  2s  . c om*/
 */
private ClientConfiguration createClientConfiguration() {
    ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
    ClientConfiguration config = configFactory.getConfig();

    String s3SignerOverride = conf.getS3SignerOverride();
    if (StringUtils.isNotBlank(s3SignerOverride)) {
        config.setSignerOverride(s3SignerOverride);
    }

    return config;
}

From source file:org.springframework.cloud.aws.core.config.AmazonTestWebserviceClientBuilder.java

License:Apache License

private AmazonTestWebserviceClientBuilder() {
    super(new ClientConfigurationFactory());
}