public static AmazonDynamoDBClientBuilder builder() { return AmazonDynamoDBClientBuilder.standard(); }
/** * @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AmazonDynamoDB defaultClient() { return standard().build(); }
/** * Gets a preconfigured {@link AmazonDynamoDB} client object for connecting to this * container. * * @return preconfigured client */ public AmazonDynamoDB getClient() { return AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(getEndpointConfiguration()) .withCredentials(getCredentials()) .build(); }
@Test public void simpleTestWithManualClientCreation() { final AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(dynamoDB.getEndpointConfiguration()) .withCredentials(dynamoDB.getCredentials()) .build(); runTest(client); }
private DynamoDbPersistenceAdapter(Builder builder) { this.tableName = ValidationUtils.assertStringNotEmpty(builder.tableName, "table name"); this.dynamoDb = builder.dynamoDb != null ? builder.dynamoDb : AmazonDynamoDBClientBuilder.standard().build(); this.partitionKeyName = builder.partitionKeyName; this.attributesKeyName = builder.attributesKeyName; this.partitionKeyGenerator = builder.partitionKeyGenerator; this.autoCreateTable = builder.autoCreateTable; autoCreateTableIfNotExists(); }
public static AmazonDynamoDBClientBuilder builder() { return AmazonDynamoDBClientBuilder.standard(); }
/** * @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and * {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain */ public static AmazonDynamoDB defaultClient() { return standard().build(); }
private DynamoDbPersistenceAdapter(Builder builder) { this.tableName = ValidationUtils.assertStringNotEmpty(builder.tableName, "table name"); this.dynamoDb = builder.dynamoDb != null ? builder.dynamoDb : AmazonDynamoDBClientBuilder.standard().build(); this.partitionKeyName = builder.partitionKeyName; this.attributesKeyName = builder.attributesKeyName; this.partitionKeyGenerator = builder.partitionKeyGenerator; this.autoCreateTable = builder.autoCreateTable; autoCreateTableIfNotExists(); }
client = AmazonDynamoDBClientBuilder.standard() .withCredentials(provider) .withClientConfiguration(clientConfig)
public AmazonDynamoDB getClient() { return AmazonDynamoDBClientBuilder.standard().withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(getEndpoint(), "us-west-2")) .build(); }
@Override public void start() { try { super.start(); PropertiesCredentials credentials = new PropertiesCredentials( getClass().getClassLoader().getResourceAsStream(dynamodbCredentialFilePath)); this.dynamoClient = AmazonDynamoDBClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)) .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration( dynamodbEndpoint, dynamodbRegion)) .build(); this.id = getLastId(outputTableName, instanceName, dynamoClient); } catch (Exception e) { addWarn("Could not initialize " + DynamoDBLogbackAppender.class.getCanonicalName() + " ( will try to initialize again later ): " + e); } }
public static AmazonDynamoDBClient createDynamoDBClient() { BasicCredentialsProvider credentials = BasicCredentialsProvider.standard(); AmazonDynamoDBClient client = !credentials.isValid() ? null : (AmazonDynamoDBClient) AmazonDynamoDBClientBuilder.standard() .withCredentials(credentials) .withRegion("eu-west-1") .build(); return client; }
public static AmazonDynamoDBClient createDynamoDBClient() { BasicCredentialsProvider credentials = BasicCredentialsProvider.standard(); AmazonDynamoDBClient client = !credentials.isValid() ? null : (AmazonDynamoDBClient) AmazonDynamoDBClientBuilder.standard() .withCredentials(credentials) .withRegion("eu-west-1") .build(); return client; }
@Override public AmazonDynamoDB createDynamoDBClient(String defaultRegion, final String bucket, final AWSCredentialsProvider credentials) throws IOException { Preconditions.checkNotNull(getConf(), "Should have been configured before usage"); final Configuration conf = getConf(); final ClientConfiguration awsConf = S3AUtils.createAwsConf(conf, bucket); final String region = getRegion(conf, defaultRegion); LOG.debug("Creating DynamoDB client in region {}", region); return AmazonDynamoDBClientBuilder.standard() .withCredentials(credentials) .withClientConfiguration(awsConf) .withRegion(region) .build(); }
/** * Returns a client instance for AWS DynamoDB. * @return a client that talks to DynamoDB */ public static AmazonDynamoDB getClient() { if (ddbClient != null) { return ddbClient; } if (Config.IN_PRODUCTION) { ddbClient = AmazonDynamoDBClientBuilder.standard().build(); } else { ddbClient = AmazonDynamoDBClientBuilder.standard(). withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("local", "null"))). withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build(); } if (!existsTable(Config.getRootAppIdentifier())) { createTable(Config.getRootAppIdentifier()); } ddb = new DynamoDB(ddbClient); Para.addDestroyListener(new DestroyListener() { public void onDestroy() { shutdownClient(); } }); return ddbClient; }
/** * Returns a client instance for AWS DynamoDB. * @return a client that talks to DynamoDB */ public static AmazonDynamoDB getClient() { if (ddbClient != null) { return ddbClient; } if (Config.IN_PRODUCTION) { ddbClient = AmazonDynamoDBClientBuilder.standard().build(); } else { ddbClient = AmazonDynamoDBClientBuilder.standard(). withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("local", "null"))). withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build(); } if (!existsTable(Config.getRootAppIdentifier())) { createTable(Config.getRootAppIdentifier()); } ddb = new DynamoDB(ddbClient); Para.addDestroyListener(new DestroyListener() { public void onDestroy() { shutdownClient(); } }); return ddbClient; }
try{ if(!skipRegions.contains(region.getName())){ AmazonDynamoDB awsClient= AmazonDynamoDBClientBuilder.standard(). withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build(); ListTablesResult listTableResult = awsClient.listTables();
protected void createAndSetDynamoDBClient() { AmazonDynamoDBClientBuilder dynamoDbBuilder = AmazonDynamoDBClientBuilder.standard(); dynamoDbBuilder.withClientConfiguration(new ClientConfiguration() .withMaxConnections(config.getMaxConnections()) .withRequestTimeout(config.getMaxRequestTimeout()) //milliseconds .withRetryPolicy(config.getMaxRetries() <= 0 ? NO_RETRY_POLICY : new RetryPolicy(DEFAULT_RETRY_CONDITION, DYNAMODB_DEFAULT_BACKOFF_STRATEGY, config.getMaxRetries(), DO_HONOR_MAX_ERROR_RETRY_IN_CLIENT_CONFIG)) .withGzip(config.isCompressing())); dynamoDbBuilder.withCredentials(awsCredentialsProvider); if (StringUtils.isNotEmpty(this.config.getEndpoint())) { Preconditions.checkState(StringUtils.isNotEmpty(config.getRegion()), "If you set the endpoint you must set the region"); dynamoDbBuilder.withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(config.getEndpoint(), config.getRegion())); } this.dynamoDB = dynamoDbBuilder.build(); }
final AmazonDynamoDB dynamodbClient = AmazonDynamoDBClientBuilder.standard() .withCredentials(credentialsProvider) .withEndpointConfiguration(createEndpointConfiguration(sourceRegion, sourceDynamodbEndpoint, AmazonDynamoDB.ENDPOINT_PREFIX)) final AmazonDynamoDB kclDynamoDBClient = AmazonDynamoDBClientBuilder.standard() .withCredentials(credentialsProvider) .withEndpointConfiguration(createKclDynamoDbEndpointConfiguration())