private void init() { if (endpointDiscoveryEnabled) { cache = new AmazonDynamoDBEndpointCache(this); } setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("https://dynamodb.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/dynamodbv2/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/dynamodbv2/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); }
cconfig.setMaxConnections(maxConnects); dynamoDB = new AmazonDynamoDBClient(credentials, cconfig); dynamoDB.setEndpoint(this.endpoint); primaryKeyName = primaryKey; LOGGER.info("dynamodb connection created with " + this.endpoint);
this.setEndpoint("dynamodb.us-east-1.amazonaws.com"); this.endpointPrefix = "dynamodb";
private void init() { if (endpointDiscoveryEnabled) { cache = new AmazonDynamoDBEndpointCache(this); } setServiceNameIntern(DEFAULT_SIGNING_NAME); setEndpointPrefix(ENDPOINT_PREFIX); // calling this.setEndPoint(...) will also modify the signer accordingly setEndpoint("https://dynamodb.us-east-1.amazonaws.com"); HandlerChainFactory chainFactory = new HandlerChainFactory(); requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/dynamodbv2/request.handlers")); requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/dynamodbv2/request.handler2s")); requestHandler2s.addAll(chainFactory.getGlobalHandlers()); }
@Inject public DynamodbUserStorage(AWSConfig config, DynamodbUserConfig tableConfig) { dynamoDBClient = new AmazonDynamoDBClient(config.getCredentials()); dynamoDBClient.setRegion(config.getAWSRegion()); if (config.getDynamodbEndpoint() != null) { dynamoDBClient.setEndpoint(config.getDynamodbEndpoint()); } this.tableConfig = tableConfig; }
@Inject public DynamodbMetastore(AWSConfig config, DynamodbMetastoreConfig tableConfig, FieldDependencyBuilder.FieldDependency fieldDependency, EventBus eventBus) { super(eventBus); dynamoDBClient = new AmazonDynamoDBClient(config.getCredentials()); dynamoDBClient.setRegion(config.getAWSRegion()); if (config.getDynamodbEndpoint() != null) { dynamoDBClient.setEndpoint(config.getDynamodbEndpoint()); } this.tableConfig = tableConfig; }
@Inject public DynamodbConfigManager(AWSConfig config, DynamodbConfigManagerConfig tableConfig) { dynamoDBClient = new AmazonDynamoDBClient(config.getCredentials()); dynamoDBClient.setRegion(config.getAWSRegion()); if (config.getDynamodbEndpoint() != null) { dynamoDBClient.setEndpoint(config.getDynamodbEndpoint()); } this.tableConfig = tableConfig; }
@Inject public DynamodbQueryMetastore(AWSConfig config, DynamodbQueryMetastoreConfig tableConfig) { dynamoDBClient = new AmazonDynamoDBClient(config.getCredentials()); dynamoDBClient.setRegion(config.getAWSRegion()); if (config.getDynamodbEndpoint() != null) { dynamoDBClient.setEndpoint(config.getDynamodbEndpoint()); } this.tableConfig = tableConfig; }
AmazonDynamoDBClient amazonDynamoDBClient = new AmazonDynamoDBClient(CredentialsManager.dummyCreds); amazonDynamoDBClient.setEndpoint("http://localhost:8000");
public DynamoDBEmitter(KinesisConnectorConfiguration configuration) { // Amazon DynamoDB Config this.dynamoDBEndpoint = configuration.DYNAMODB_ENDPOINT; this.dynamoDBTableName = configuration.DYNAMODB_DATA_TABLE_NAME; // Client this.dynamoDBClient = new AmazonDynamoDBClient(configuration.AWS_CREDENTIALS_PROVIDER); this.dynamoDBClient.setEndpoint(this.dynamoDBEndpoint); }
public DynamoDBEmitter(KinesisConnectorConfiguration configuration) { // Amazon DynamoDB Config this.dynamoDBEndpoint = configuration.DYNAMODB_ENDPOINT; this.dynamoDBTableName = configuration.DYNAMODB_DATA_TABLE_NAME; // Client this.dynamoDBClient = new AmazonDynamoDBClient(configuration.AWS_CREDENTIALS_PROVIDER); this.dynamoDBClient.setEndpoint(this.dynamoDBEndpoint); }
public DynamoDBClient(Configuration conf, String region) { Preconditions.checkNotNull(conf, "conf cannot be null."); config = conf; dynamoDB = getDynamoDBClient(conf); dynamoDB.setEndpoint(getDynamoDBEndpoint(conf, region)); maxBatchSize = config.getLong(MAX_BATCH_SIZE, DEFAULT_MAX_BATCH_SIZE); maxItemByteSize = config.getLong(MAX_ITEM_SIZE, DEFAULT_MAX_ITEM_SIZE); }
public DynamoDBClient(Configuration conf, String region) { Preconditions.checkNotNull(conf, "conf cannot be null."); config = conf; dynamoDB = getDynamoDBClient(conf); dynamoDB.setEndpoint(getDynamoDBEndpoint(conf, region)); maxBatchSize = config.getLong(MAX_BATCH_SIZE, DEFAULT_MAX_BATCH_SIZE); maxItemByteSize = config.getLong(MAX_ITEM_SIZE, DEFAULT_MAX_ITEM_SIZE); }
@Override public IRecordProcessor createProcessor() { AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient(dynamoDBCredentials, new ClientConfiguration()); dynamoDBClient.setEndpoint(dynamoDBEndpoint); return new StreamsRecordProcessor(dynamoDBClient, tableName); }
public static void main(String[] args) { AmazonDynamoDBClient client = new AmazonDynamoDBClient(); client.setEndpoint("http://localhost:8000"); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.getTable("Movies"); table.delete(); System.out.println("Table is being deleted"); } }
AmazonDynamoDBClient client = new AmazonDynamoDBClient(); DynamoDBMapper mapper = new DynamoDBMapper(client); client.setEndpoint("http://localhost:8000/"); String tableName="User"; User user = new User(); user.setName("Ohelig"); TableNameOverride config = new DynamoDBMapperConfig.TableNameOverride(tableName); mapper.save(user, new DynamoDBMapperConfig(config));
public DynamoDBService2(Tenant tenant) { super(tenant); String accessKey = getParamString("ddb-access-key"); String secretKey = getParamString("ddb-secret-key"); String endpoint = getParamString("ddb-endpoint"); m_readCapacityUnits = getParamInt("ddb-read-capacity-units", 1); m_writeCapacityUnits = getParamInt("ddb-write-capacity-units", 1); BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey); m_client = new AmazonDynamoDBClient(awsCredentials); m_client.setEndpoint(endpoint); // try to connect to check the connection m_client.listTables(); m_logger.info("Started DynamoDB service. Endpoint: {}, read/write capacity units for new namespaces: {}/{}", new Object[] {endpoint, m_readCapacityUnits, m_writeCapacityUnits}); }
private AmazonDynamoDBClient createDynamoClient() { AWSCredentialsProvider credentialsProvider = initCredentials(); ClientConfiguration clientConfiguration = initClientConfiguration(); AmazonDynamoDBClient dynamoClient = new AmazonDynamoDBClient(credentialsProvider, clientConfiguration); if (this.regionId != null) { dynamoClient.setRegion(RegionUtils.getRegion(this.regionId)); } if (this.endpoint != null) { dynamoClient.setEndpoint(this.endpoint); } return dynamoClient; }
private void setRegionOrEndPoint() { String regionName = getParamString("ddb_region"); if (regionName != null) { Regions regionEnum = Regions.fromName(regionName); Utils.require(regionEnum != null, "Unknown 'ddb_region': " + regionName); m_logger.info("Using region: {}", regionName); m_ddbClient.setRegion(Region.getRegion(regionEnum)); } else { String ddbEndpoint = getParamString("ddb_endpoint"); Utils.require(ddbEndpoint != null, "Either 'ddb_region' or 'ddb_endpoint' must be defined for tenant: " + m_tenant.getName()); m_logger.info("Using endpoint: {}", ddbEndpoint); m_ddbClient.setEndpoint(ddbEndpoint); } }
public static void main(String[] args) { AmazonDynamoDBClient client = new AmazonDynamoDBClient(); client.setEndpoint("http://localhost:8000"); DynamoDB dynamoDB = new DynamoDB(client); Table table = dynamoDB.getTable("Movies"); ScanSpec scanSpec = new ScanSpec() .withProjectionExpression("#yr, title, info.rating") .withFilterExpression("#yr between :start_yr and :end_yr") .withNameMap(new NameMap().with("#yr", "year")) .withValueMap(new ValueMap().withNumber(":start_yr", 1950).withNumber(":end_yr", 1959)); ItemCollection<ScanOutcome> items = table.scan(scanSpec); Iterator<Item> iter = items.iterator(); while (iter.hasNext()) { Item item = iter.next(); System.out.println(item.toString()); } } }