当前位置: 首页>>代码示例>>Java>>正文


Java AwsClientBuilder类代码示例

本文整理汇总了Java中com.amazonaws.client.builder.AwsClientBuilder的典型用法代码示例。如果您正苦于以下问题:Java AwsClientBuilder类的具体用法?Java AwsClientBuilder怎么用?Java AwsClientBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AwsClientBuilder类属于com.amazonaws.client.builder包,在下文中一共展示了AwsClientBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: obtainResource

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
@Override
protected void obtainResource() throws Exception {
	// See https://github.com/mhart/kinesalite#cbor-protocol-issues-with-the-java-sdk
	System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");

	this.resource = AmazonKinesisAsyncClientBuilder.standard()
			.withClientConfiguration(
					new ClientConfiguration()
							.withMaxErrorRetry(0)
							.withConnectionTimeout(1000))
			.withEndpointConfiguration(
					new AwsClientBuilder.EndpointConfiguration("http://localhost:" + this.port,
							Regions.DEFAULT_REGION.getName()))
			.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", "")))
			.build();

	// Check connection
	this.resource.listStreams();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-aws-kinesis,代码行数:20,代码来源:LocalKinesisResource.java

示例2: setup

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
@Before
public void setup() throws IllegalAccessException, NoSuchFieldException {

	Assume.assumeTrue(System.getProperty("skip.long") == null);
	TestUtils.disableSslCertChecking();

	amazonS3Client = AmazonS3ClientBuilder.standard()
			.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(
					LocalstackTestRunner.getEndpointS3(),
					LocalstackTestRunner.getDefaultRegion()))
			.withChunkedEncodingDisabled(true)
			.withPathStyleAccessEnabled(true).build();
	amazonS3Client.createBucket(bucketName);

	S3Config config = new S3Config();

	Field field = StorageServiceImpl.class.getDeclaredField("s3TransferManager");
	field.setAccessible(true);
	field.set(underTest, config.s3TransferManager(amazonS3Client));

	field = StorageServiceImpl.class.getDeclaredField("environment");
	field.setAccessible(true);
	field.set(underTest, environment);
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:25,代码来源:StorageServiceImplIntegration.java

示例3: GetMediaWorker

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
private GetMediaWorker(Regions region,
        AWSCredentialsProvider credentialsProvider,
        String streamName,
        StartSelector startSelector,
        String endPoint,
        MkvElementVisitor elementVisitor) {
    super(region, credentialsProvider, streamName);

    AmazonKinesisVideoMediaClientBuilder builder = AmazonKinesisVideoMediaClientBuilder.standard()
            .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endPoint, region.getName()))
            .withCredentials(getCredentialsProvider());

    this.videoMedia = builder.build();
    this.elementVisitor = elementVisitor;
    this.startSelector = startSelector;
}
 
开发者ID:aws,项目名称:amazon-kinesis-video-streams-parser-library,代码行数:17,代码来源:GetMediaWorker.java

示例4: amazonS3Client

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
/**
 * S3 储存客户端
 *
 * @return 客户端
 */
@Bean
@ConditionalOnProperty(value = "bigbug.storage.s3.enable", havingValue = "true")
AmazonS3Client amazonS3Client() {
    ClientConfiguration clientConfig = new ClientConfiguration();
    clientConfig.setProtocol(Protocol.HTTP);

    BasicAWSCredentials basicAWSCredentials =
            new BasicAWSCredentials(
                    storageProperties.getStorage().getS3().getAccessKey(),
                    storageProperties.getStorage().getS3().getSecretKey());

    return (AmazonS3Client) AmazonS3ClientBuilder.standard()
            .withClientConfiguration(clientConfig)
            .withEndpointConfiguration(
                    new AwsClientBuilder.EndpointConfiguration(
                            storageProperties.getStorage().getS3().getEndpoint(), Regions.DEFAULT_REGION.getName()))
            .withCredentials(new AWSStaticCredentialsProvider(basicAWSCredentials))
            .build();
}
 
开发者ID:bigbug-studio,项目名称:generator-jhipster-storage,代码行数:25,代码来源:_StorageConfiguration.java

示例5: newS3Client

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
public AmazonS3 newS3Client(S3SinkConnectorConfig config) {
  ClientConfiguration clientConfiguration = newClientConfiguration(config);
  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard()
                                      .withAccelerateModeEnabled(
                                          config.getBoolean(WAN_MODE_CONFIG)
                                      )
                                      .withPathStyleAccessEnabled(true)
                                      .withCredentials(config.getCredentialsProvider())
                                      .withClientConfiguration(clientConfiguration);

  String region = config.getString(REGION_CONFIG);
  if (StringUtils.isBlank(url)) {
    builder = "us-east-1".equals(region)
              ? builder.withRegion(Regions.US_EAST_1)
              : builder.withRegion(region);
  } else {
    builder = builder.withEndpointConfiguration(
        new AwsClientBuilder.EndpointConfiguration(url, region)
    );
  }

  return builder.build();
}
 
开发者ID:confluentinc,项目名称:kafka-connect-storage-cloud,代码行数:24,代码来源:S3Storage.java

示例6: newS3Client

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
@Override
public AmazonS3 newS3Client(S3SinkConnectorConfig config) {
  final AWSCredentialsProvider provider = new AWSCredentialsProvider() {
    private final AnonymousAWSCredentials credentials = new AnonymousAWSCredentials();
    @Override
    public AWSCredentials getCredentials() {
      return credentials;
    }

    @Override
    public void refresh() {
    }
  };

  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard()
             .withAccelerateModeEnabled(config.getBoolean(S3SinkConnectorConfig.WAN_MODE_CONFIG))
             .withPathStyleAccessEnabled(true)
             .withCredentials(provider);

  builder = url == null ?
                builder.withRegion(config.getString(S3SinkConnectorConfig.REGION_CONFIG)) :
                builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(url, ""));

  return builder.build();
}
 
开发者ID:confluentinc,项目名称:kafka-connect-storage-cloud,代码行数:26,代码来源:TestWithMockedS3.java

示例7: create

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
/**
 * Creates an {@link S3Connector} instance  with embedded {@link AmazonS3 Amazon Web Services S3 SDK Client} from
 * {@link S3ServiceInfo}.
 * @param serviceInfo S3ServiceInfo provided by {@link org.springframework.cloud.cloudfoundry.CloudFoundryServiceInfoCreator}
 *                    implementation included within the application.
 * @param serviceConnectorConfig
 * @return
 */
@Override
public S3Connector create(S3ServiceInfo serviceInfo, ServiceConnectorConfig serviceConnectorConfig) {
    AWSCredentials credentials = new BasicAWSCredentials(serviceInfo.getAccessKey(), serviceInfo.getSecretKey());
    AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);
    AwsClientBuilder.EndpointConfiguration endpointConfig = new AwsClientBuilder.EndpointConfiguration(
            serviceInfo.getEndpoint(), Region.getRegion(Regions.DEFAULT_REGION).getName());
    AmazonS3 amazonS3 = AmazonS3ClientBuilder
            .standard()
            .withEndpointConfiguration(endpointConfig)
            .withCredentials(credentialsProvider)
            .enablePathStyleAccess()
            .build();
    if (serviceInfo.getBucket() != null) {
        log.debug("Creating connector addressing ECS bucket: " + serviceInfo.getBucket());
        return new S3Connector(amazonS3, serviceInfo.getEndpoint(), serviceInfo.getBucket());
    } else {
        log.debug("Creating connector addressing ECS namespace.");
        return new S3Connector(amazonS3, serviceInfo.getEndpoint());
    }
}
 
开发者ID:spiegela,项目名称:spring-cloud-ecs-connector,代码行数:29,代码来源:S3ServiceConnectorCreator.java

示例8: createKinesisClient

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:AWSUtil.java

示例9: setUpClass

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws IOException, InterruptedException {
  File dir = new File(new File("target", UUID.randomUUID().toString()), "fakes3_root").getAbsoluteFile();
  Assert.assertTrue(dir.mkdirs());
  fakeS3Root = dir.getAbsolutePath();
  port = TestUtil.getFreePort();
  fakeS3 = new FakeS3(fakeS3Root, port);
  Assume.assumeTrue("Please install fakes3 in your system", fakeS3.fakes3Installed());
  //Start the fakes3 server
  executorService = Executors.newSingleThreadExecutor();
  executorService.submit(fakeS3);

  BasicAWSCredentials credentials = new BasicAWSCredentials("foo", "bar");
  s3client = AmazonS3ClientBuilder
      .standard()
      .withCredentials(new AWSStaticCredentialsProvider(credentials))
      .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:" + port, null))
      .withPathStyleAccessEnabled(true)
      .withChunkedEncodingDisabled(true) // FakeS3 does not correctly calculate checksums with chunked encoding enabled.
      .build();

  TestUtil.createBucket(s3client, BUCKET_NAME);
  TestUtil.createBucket(s3client, SECOND_BUCKET_NAME);
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:25,代码来源:TestAmazonS3Executor.java

示例10: createAmazonS3

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
protected AmazonS3 createAmazonS3() {
    return AmazonS3ClientBuilder
            .standard()
            .withCredentials(new AWSStaticCredentialsProvider(credentials))
            .withEndpointConfiguration(new AwsClientBuilder
                    .EndpointConfiguration(env("S3_HOST"), "eu-west"))
            .withPathStyleAccessEnabled(true)
            .build();
}
 
开发者ID:mentegy,项目名称:s3-channels,代码行数:10,代码来源:AbstractS3Suite.java

示例11: createLogsClient

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
static AWSLogs createLogsClient(CloudwatchLogsConfig config) {
    AWSLogsClientBuilder builder = AWSLogsClientBuilder.standard();
    if (config.getEndpoint() != null) {
        // Non-AWS mock endpoint
        builder.setCredentials(new AWSStaticCredentialsProvider(new AnonymousAWSCredentials()));
        builder.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(config.getEndpoint(), config.getRegion()));
    } else {
        builder.setRegion(config.getRegion());
    }
    return builder.build();
}
 
开发者ID:boxfuse,项目名称:cloudwatchlogs-java-appender,代码行数:12,代码来源:CloudwatchLogsLogEventPutter.java

示例12: whenBogusEndpointIsSet_constructionFails

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void whenBogusEndpointIsSet_constructionFails() throws Exception {
    KmsMasterKeyProvider.builder()
                        .withClientBuilder(
                                AWSKMSClientBuilder.standard()
                                                   .withEndpointConfiguration(
                                                           new AwsClientBuilder.EndpointConfiguration(
                                                                   "https://this.does.not.exist.example.com",
                                                                   "bad-region")
                                                   )
                        );
}
 
开发者ID:awslabs,项目名称:aws-encryption-sdk-java,代码行数:13,代码来源:KMSProviderBuilderIntegrationTests.java

示例13: getAsyncClient

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
public static AmazonEC2AsyncClient getAsyncClient(
        AuthCredentialsServiceState credentials, String region,
        ExecutorService executorService) {

    ClientConfiguration configuration = new ClientConfiguration();
    configuration.setMaxConnections(100);
    configuration.withRetryPolicy(new RetryPolicy(new CustomRetryCondition(),
            DEFAULT_BACKOFF_STRATEGY,
            DEFAULT_MAX_ERROR_RETRY,
            false));

    AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(credentials.privateKeyId,
                    EncryptionUtils.decrypt(credentials.privateKey)));

    AmazonEC2AsyncClientBuilder ec2AsyncClientBuilder = AmazonEC2AsyncClientBuilder
            .standard()
            .withClientConfiguration(configuration)
            .withCredentials(awsStaticCredentialsProvider)
            .withExecutorFactory(() -> executorService);

    if (region == null) {
        region = Regions.DEFAULT_REGION.getName();
    }

    if (isAwsClientMock()) {
        configuration.addHeader(AWS_REGION_HEADER, region);
        ec2AsyncClientBuilder.setClientConfiguration(configuration);
        AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
                getAWSMockHost() + AWS_MOCK_EC2_ENDPOINT, region);
        ec2AsyncClientBuilder.setEndpointConfiguration(endpointConfiguration);
    } else {
        ec2AsyncClientBuilder.setRegion(region);
    }

    return (AmazonEC2AsyncClient) ec2AsyncClientBuilder.build();
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:38,代码来源:AWSUtils.java

示例14: getStatsAsyncClient

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
public static AmazonCloudWatchAsyncClient getStatsAsyncClient(
        AuthCredentialsServiceState credentials, String region,
        ExecutorService executorService, boolean isMockRequest) {

    ClientConfiguration configuration = new ClientConfiguration();
    configuration.withRetryPolicy(new RetryPolicy(new CustomRetryCondition(),
            DEFAULT_BACKOFF_STRATEGY,
            DEFAULT_MAX_ERROR_RETRY,
            false));

    AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(credentials.privateKeyId,
                    EncryptionUtils.decrypt(credentials.privateKey)));

    AmazonCloudWatchAsyncClientBuilder amazonCloudWatchAsyncClientBuilder = AmazonCloudWatchAsyncClientBuilder
            .standard()
            .withClientConfiguration(configuration)
            .withCredentials(awsStaticCredentialsProvider)
            .withExecutorFactory(() -> executorService);

    if (region == null) {
        region = Regions.DEFAULT_REGION.getName();
    }

    if (isAwsClientMock()) {
        configuration.addHeader(AWS_REGION_HEADER, region);
        amazonCloudWatchAsyncClientBuilder.setClientConfiguration(configuration);
        AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
                getAWSMockHost() + AWS_MOCK_CLOUDWATCH_ENDPOINT, region);
        amazonCloudWatchAsyncClientBuilder.setEndpointConfiguration(endpointConfiguration);
    } else {
        amazonCloudWatchAsyncClientBuilder.setRegion(region);
    }

    return (AmazonCloudWatchAsyncClient) amazonCloudWatchAsyncClientBuilder.build();
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:37,代码来源:AWSUtils.java

示例15: getS3TransferManager

import com.amazonaws.client.builder.AwsClientBuilder; //导入依赖的package包/类
public static TransferManager getS3TransferManager(AuthCredentialsServiceState credentials,
        String region, ExecutorService executorService) {

    AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(credentials.privateKeyId,
                    EncryptionUtils.decrypt(credentials.privateKey)));

    AmazonS3ClientBuilder amazonS3ClientBuilder = AmazonS3ClientBuilder.standard()
            .withCredentials(awsStaticCredentialsProvider)
            .withForceGlobalBucketAccessEnabled(true);

    if (region == null) {
        region = Regions.DEFAULT_REGION.getName();
    }

    if (isAwsS3Proxy()) {
        AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
                getAwsS3ProxyHost(), region);
        amazonS3ClientBuilder.setEndpointConfiguration(endpointConfiguration);
    } else {
        amazonS3ClientBuilder.setRegion(region);
    }

    TransferManagerBuilder transferManagerBuilder = TransferManagerBuilder.standard()
            .withS3Client(amazonS3ClientBuilder.build())
            .withExecutorFactory(() -> executorService)
            .withShutDownThreadPools(false);

    return transferManagerBuilder.build();
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:31,代码来源:AWSUtils.java


注:本文中的com.amazonaws.client.builder.AwsClientBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。