/** * * @return the constructed DynamoDBMapper */ public DynamoDBMapper build() { if (this.dynamoDB == null) { throw new IllegalArgumentException("AmazonDynamoDB client is required please set using .dynamoDBClient(yourClient)"); } if (this.awsConfig != null) { try { final JSONObject ddbConfig = awsConfig.optJsonObject("DynamoDBObjectMapper"); final String regionString = ddbConfig.getString("Region"); dynamoDB.setRegion(com.amazonaws.regions.Region.getRegion(com.amazonaws.regions.Regions.fromName(regionString))); DynamoDBMapper.setUserAgentFromConfig(awsConfig.getUserAgent()); } catch (Exception e) { throw new IllegalArgumentException("Failed to read Region from AWSConfiguration please check your setup or awsconfiguration.json file", e); } } return new DynamoDBMapper( this.dynamoDB, this.config == null ? DynamoDBMapperConfig.DEFAULT : this.config, this.transformer, this.s3CredentialProvider, this.awsConfig); } }
@Override public void setRegion(Region request) throws IllegalArgumentException { getBackend().setRegion(request); }
@Override public AmazonDynamoDB aws() { final com.amazonaws.regions.Region reg = RegionUtils.getRegion(this.region); if (reg == null) { throw new IllegalStateException( String.format("Failed to detect region '%s'", this.region) ); } final AmazonDynamoDB aws = new AmazonDynamoDBClient(); aws.setRegion(reg); return aws; } }
@Override public AmazonDynamoDB aws() { final com.amazonaws.regions.Region reg = RegionUtils.getRegion(this.region); if (reg == null) { throw new IllegalStateException( String.format("Failed to find region '%s'", this.region) ); } final AmazonDynamoDB aws = new AmazonDynamoDBClient( new BasicAWSCredentials(this.key, this.secret) ); aws.setRegion(reg); return aws; } }
@Override public AmazonDynamoDB aws() { final com.amazonaws.regions.Region reg = RegionUtils.getRegion(this.region); if (reg == null) { throw new IllegalStateException( String.format("Failed to detect region '%s'", this.region) ); } final AmazonDynamoDB aws = new AmazonDynamoDBClient(); aws.setRegion(reg); return aws; } }
@Override public AmazonDynamoDB aws() { final com.amazonaws.regions.Region reg = RegionUtils.getRegion(this.region); if (reg == null) { throw new IllegalStateException( String.format("Failed to find region '%s'", this.region) ); } final AmazonDynamoDB aws = new AmazonDynamoDBClient( new BasicAWSCredentials(this.key, this.secret) ); aws.setRegion(reg); return aws; } }
@Override public void initialise() throws Exception { if (!this.online) { if (this.region != null) { this.dynamoClient.setRegion(this.region); if (this.streamName != null) { this.kinesisClient.setRegion(this.region); } } initAggTable(this.labelAttribute, this.dateAttribute, this.readCapacity, this.writeCapacity); this.queryEngine = new DynamoQueryEngine(this.dynamoClient, this.tableName, this.labelAttribute, this.dateAttribute); this.online = true; } }
final AmazonDynamoDB dynamoClient = new AmazonDynamoDBClient(credentialsProvider); if (region != null) dynamoClient.setRegion(region);
credentials); if (region != null) dynamoClient.setRegion(region); final AmazonDynamoDBAsyncClient deleteCli = new AmazonDynamoDBAsyncClient( credentials);
amazonDynamoDb.setRegion(Region.getRegion(Regions.US_WEST_2)); final DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(amazonDynamoDb); final UserRepository userRepository = new UserRepositoryImpl(dynamoDBMapper);
this.config.getDynamoDBCredentialsProvider(), clientConfig); if (region != null) this.dynamoClient.setRegion(region);