Java Code Examples for com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder#build()

The following examples show how to use com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder#build() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Aws1ITest.java    From java-specialagent with Apache License 2.0 5 votes vote down vote up
private static AmazonDynamoDB buildClient() {
  final AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration("http://localhost:8000", "us-west-2");
  final BasicAWSCredentials awsCreds = new BasicAWSCredentials("access_key_id", "secret_key_id");
  final AmazonDynamoDBClientBuilder builder = AmazonDynamoDBClientBuilder
    .standard()
    .withEndpointConfiguration(endpointConfiguration)
    .withCredentials(new AWSStaticCredentialsProvider(awsCreds))
    .withClientConfiguration(new ClientConfiguration().withConnectionTimeout(1));
  return builder.build();
}
 
Example 2
Source File: DynamoDBSourceConfig.java    From pulsar with Apache License 2.0 5 votes vote down vote up
public AmazonDynamoDB buildDynamoDBClient(AwsCredentialProviderPlugin credPlugin) {
    AmazonDynamoDBClientBuilder builder = AmazonDynamoDBClientBuilder.standard();

    if (!this.getAwsEndpoint().isEmpty()) {
        builder.setEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(this.getDynamoEndpoint(), this.getAwsRegion()));
    }
    if (!this.getAwsRegion().isEmpty()) {
        builder.setRegion(this.getAwsRegion());
    }
    builder.setCredentials(credPlugin.getCredentialProvider());
    return builder.build();
}