Java 类com.amazonaws.ClientConfigurationFactory 实例源码

项目:flink    文件:AWSUtil.java   
/**
 * Creates an AmazonKinesis client.
 * @param configProps configuration properties containing the access key, secret key, and region
 * @return a new AmazonKinesis client
 */
public static AmazonKinesis createKinesisClient(Properties configProps) {
    // set a Flink-specific user agent
    ClientConfiguration awsClientConfig = new ClientConfigurationFactory().getConfig()
            .withUserAgentPrefix(String.format(USER_AGENT_FORMAT,
                                                    EnvironmentInformation.getVersion(),
                                                    EnvironmentInformation.getRevisionInformation().commitId));

    // utilize automatic refreshment of credentials by directly passing the AWSCredentialsProvider
    AmazonKinesisClientBuilder builder = AmazonKinesisClientBuilder.standard()
            .withCredentials(AWSUtil.getCredentialsProvider(configProps))
            .withClientConfiguration(awsClientConfig)
            .withRegion(Regions.fromName(configProps.getProperty(AWSConfigConstants.AWS_REGION)));

    if (configProps.containsKey(AWSConfigConstants.AWS_ENDPOINT)) {
        // Set signingRegion as null, to facilitate mocking Kinesis for local tests
        builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
                                                configProps.getProperty(AWSConfigConstants.AWS_ENDPOINT),
                                                null));
    }
    return builder.build();
}
项目:flink    文件:AWSUtil.java   
/**
 * Creates an Amazon Kinesis Client.
 * @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;
}
项目:ibm-cos-sdk-java    文件:AmazonS3Builder.java   
@SdkTestInternalApi
AmazonS3Builder(SdkFunction<AmazonS3ClientParamsWrapper, AmazonS3> clientFactory,
                ClientConfigurationFactory clientConfigFactory,
                AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
    this.clientFactory = clientFactory;
}
项目:georocket    文件:S3Store.java   
/**
 * Get or initialize the S3 client.
 * Note: this method must be synchronized because we're accessing the
 * {@link #s3Client} field and we're calling this method from a worker thread.
 * @return the S3 client
 */
private synchronized AmazonS3 getS3Client() {
  if (s3Client == null) {
    BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);

    AmazonS3ClientBuilder builder = AmazonS3ClientBuilder
      .standard()
      .withCredentials(new AWSStaticCredentialsProvider(credentials));

    if (forceSignatureV2) {
      ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
      ClientConfiguration config = configFactory.getConfig();
      config.setSignerOverride("S3SignerType");
      builder = builder.withClientConfiguration(config);
    }

    String endpoint = "http://" + host + ":" + port;
    String clientRegion = null;
    if (!ServiceUtils.isS3USStandardEndpoint(endpoint)) {
      clientRegion = AwsHostNameUtils.parseRegion(host,
          AmazonS3Client.S3_SERVICE_NAME);
    }

    builder = builder.withEndpointConfiguration(new EndpointConfiguration(
        endpoint, clientRegion));
    builder = builder.withPathStyleAccessEnabled(pathStyleAccess);

    s3Client = builder.build();
  }
  return s3Client;
}
项目:zeppelin    文件:S3NotebookRepo.java   
/**
 * Create AWS client configuration and return it.
 * @return AWS client configuration
 */
private ClientConfiguration createClientConfiguration() {
  ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
  ClientConfiguration config = configFactory.getConfig();

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

  return config;
}
项目:graylog-plugin-aws    文件:Proxy.java   
public static ClientConfiguration forAWS(@NotNull HttpUrl proxyUrl) {
    return new ClientConfigurationFactory().getConfig()
            .withProxyHost(proxyUrl.host())
            .withProxyPort(proxyUrl.port())
            .withProxyUsername(proxyUrl.username())
            .withProxyPassword(proxyUrl.password());
}
项目:ibm-cos-sdk-java    文件:AwsSyncClientBuilder.java   
protected AwsSyncClientBuilder(ClientConfigurationFactory clientConfigFactory) {
    super(clientConfigFactory);
}
项目:ibm-cos-sdk-java    文件:AwsSyncClientBuilder.java   
@SdkTestInternalApi
protected AwsSyncClientBuilder(ClientConfigurationFactory clientConfigFactory,
                               AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
}
项目:ibm-cos-sdk-java    文件:AwsAsyncClientBuilder.java   
protected AwsAsyncClientBuilder(ClientConfigurationFactory clientConfigFactory) {
    super(clientConfigFactory);
}
项目:ibm-cos-sdk-java    文件:AwsAsyncClientBuilder.java   
@SdkTestInternalApi
protected AwsAsyncClientBuilder(ClientConfigurationFactory clientConfigFactory,
                                AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilder.java   
protected AwsClientBuilder(ClientConfigurationFactory clientConfigFactory) {
    this(clientConfigFactory, DEFAULT_REGION_PROVIDER);
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilder.java   
@SdkTestInternalApi
protected AwsClientBuilder(ClientConfigurationFactory clientConfigFactory,
                           AwsRegionProvider regionProvider) {
    this.clientConfigFactory = clientConfigFactory;
    this.regionProvider = regionProvider;
}
项目:ibm-cos-sdk-java    文件:AmazonS3ClientBuilder.java   
@SdkTestInternalApi
AmazonS3ClientBuilder(SdkFunction<AmazonS3ClientParamsWrapper, AmazonS3> clientFactory,
                      ClientConfigurationFactory clientConfigFactory,
                      AwsRegionProvider regionProvider) {
    super(clientFactory, clientConfigFactory, regionProvider);
}
项目:spring-cloud-aws    文件:AmazonTestWebserviceClientBuilder.java   
private AmazonTestWebserviceClientBuilder() {
    super(new ClientConfigurationFactory());
}