List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient
AmazonDynamoDBClient(AwsSyncClientParams clientParams)
From source file:com.netflix.config.sources.AbstractDynamoDbConfigurationSource.java
License:Apache License
public AbstractDynamoDbConfigurationSource(AWSCredentialsProvider credentialsProvider) { this(new AmazonDynamoDBClient(credentialsProvider)); setEndpoint(); }
From source file:com.netflix.hollow.example.consumer.infrastructure.DynamoDBAnnouncementWatcher.java
License:Apache License
public DynamoDBAnnouncementWatcher(AWSCredentials credentials, String tableName, String blobNamespace) { this.dynamoDB = new DynamoDB(new AmazonDynamoDBClient(credentials)); this.tableName = tableName; this.blobNamespace = blobNamespace; this.latestVersion = readLatestVersion(); }
From source file:com.netflix.hollow.example.producer.infrastructure.DynamoDBAnnouncer.java
License:Apache License
public DynamoDBAnnouncer(AWSCredentials credentials, String tableName, String blobNamespace) { this.dynamoDB = new DynamoDB(new AmazonDynamoDBClient(credentials)); this.tableName = tableName; this.blobNamespace = blobNamespace; }
From source file:com.numenta.taurus.service.TaurusClient.java
License:Open Source License
/** * Construct Taurus API client.//from w w w . j av a 2 s .c o m * * @param provider The AWS credential provider to use. * Usually {@link TaurusApplication#getAWSCredentialProvider()} * @param serverUrl DynamoDB Server. Use "http://10.0.2.2:8300" for local server or * null for AWS */ public TaurusClient(AWSCredentialsProvider provider, String serverUrl) { _server = serverUrl; AWSCredentialsProvider credentialsProvider = provider; if (credentialsProvider == null) { // Use Dummy credentials for local server credentialsProvider = new StaticCredentialsProvider(new AWSCredentials() { public String getAWSAccessKeyId() { // Returns dummy value return "taurus"; } @Override public String getAWSSecretKey() { // Returns dummy value return "taurus"; } }); } _awsClient = new AmazonDynamoDBClient(credentialsProvider); if (BuildConfig.REGION != null) { // Override default region _awsClient.setRegion(Region.getRegion(Regions.fromName(BuildConfig.REGION))); } if (_server != null) { // Override server endpoint, Usually the local DynamoDB server _awsClient.setEndpoint(_server); } }
From source file:com.optimalbi.AmazonAccount.java
License:Apache License
private void populateDynamoDB() throws AmazonClientException { getRegions().stream().filter(region -> region.isServiceSupported(ServiceAbbreviations.Dynamodb)) .forEach(region -> {//from w w w.j ava 2 s .c o m AmazonDynamoDBClient DDB = new AmazonDynamoDBClient(credentials.getCredentials()); DDB.setRegion(region); DynamoDB dynamoDB = new DynamoDB(DDB); TableCollection<ListTablesResult> tables = dynamoDB.listTables(); tables.forEach(table -> services.add(new LocalDynamoDBService(table.getTableName(), credentials, region, table.describe(), logger))); }); }
From source file:com.pa3.cloudkon.remote.Dynamodb.java
License:Open Source License
/** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * *///from ww w . j a va 2 s . co m public static void init() { AWSCredentials credentials = null; try { // InputStream credentialsFile = Dynamodb.class.getResourceAsStream("awsSecuCredentials.properties"); InputStream credentialsFile = new FileInputStream("./awsSecuCredentials.properties"); credentials = new PropertiesCredentials(credentialsFile); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential file. ", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usEast1 = Region.getRegion(Regions.US_EAST_1); dynamoDB.setRegion(usEast1); }
From source file:com.qubole.presto.kinesis.KinesisClientManager.java
License:Apache License
@Inject KinesisClientManager(KinesisConnectorConfig kinesisConnectorConfig) { log.info("Creating new client for Consumer"); if (nonEmpty(kinesisConnectorConfig.getAccessKey()) && nonEmpty(kinesisConnectorConfig.getSecretKey())) { this.kinesisAwsCredentials = new KinesisAwsCredentials(kinesisConnectorConfig.getAccessKey(), kinesisConnectorConfig.getSecretKey()); this.client = new AmazonKinesisClient(this.kinesisAwsCredentials); this.amazonS3Client = new AmazonS3Client(this.kinesisAwsCredentials); this.dynamoDBClient = new AmazonDynamoDBClient(this.kinesisAwsCredentials); } else {// ww w .j a v a2s . com this.kinesisAwsCredentials = null; DefaultAWSCredentialsProviderChain defaultChain = new DefaultAWSCredentialsProviderChain(); this.client = new AmazonKinesisClient(defaultChain); this.amazonS3Client = new AmazonS3Client(defaultChain); this.dynamoDBClient = new AmazonDynamoDBClient(defaultChain); } this.client.setEndpoint("kinesis." + kinesisConnectorConfig.getAwsRegion() + ".amazonaws.com"); this.dynamoDBClient.setEndpoint("dynamodb." + kinesisConnectorConfig.getAwsRegion() + ".amazonaws.com"); }
From source file:com.raoul.walkfoframe.web.DynamoDBManager.java
License:Open Source License
public static ArrayList<WOFPushNotification> getWofPushNotifications(int lastNotificationId) throws UnknownHostException { BasicAWSCredentials c = new BasicAWSCredentials("AKIAJRYXOB72QJQU3MQQ", "FOQ6TDEhxTqvZb6hb+5db1OQFd4nikDRh2tuGqy1"); AmazonDynamoDB clientManager = new AmazonDynamoDBClient(c); clientManager.setRegion(Region.getRegion(Regions.US_WEST_2)); AmazonDynamoDB ddb = clientManager;/*from w w w . j a v a2 s. co m*/ DynamoDBMapper mapper = new DynamoDBMapper(ddb); DynamoDBScanExpression scanExpression = new DynamoDBScanExpression(); scanExpression.addFilterCondition("ID", new Condition().withComparisonOperator(ComparisonOperator.GT.toString()) .withAttributeValueList(new AttributeValue().withN(lastNotificationId + ""))); try { PaginatedScanList<WOFPushNotification> result = mapper.scan(WOFPushNotification.class, scanExpression); ArrayList<WOFPushNotification> resultList = new ArrayList<WOFPushNotification>(); for (WOFPushNotification up : result) { resultList.add(up); } Log.e("Push notification result list", resultList.size() + ""); return resultList; } catch (AmazonServiceException ex) { //HWOFameApplication.clientManager.wipeCredentialsOnAuthError(ex); } return null; }
From source file:com.rorrell.personrest.data.DynamoDbConnector.java
private DynamoDbConnector() { BasicAWSCredentials cred = new BasicAWSCredentials("AKIAIBHWKCCV7G6N3MEA", "DVtEDwvUSS7xFVH4ATY0JohxhQLesJjD2V4i25kC"); AmazonDynamoDBClient client = new AmazonDynamoDBClient(cred); client.setEndpoint("dynamodb.us-west-2.amazonaws.com"); db = new DynamoDBMapper(client); }
From source file:com.stockcloud.deletestock.java
License:Open Source License
/** * The only information needed to create a client are security credentials * consisting of the AWS Access Key ID and Secret Access Key. All other * configuration, such as the service endpoints, are performed * automatically. Client parameters, such as proxies, can be specified in an * optional ClientConfiguration object when constructing a client. * /*w w w. j a v a2s .com*/ * @see com.amazonaws.auth.BasicAWSCredentials * @see com.amazonaws.auth.PropertiesCredentials * @see com.amazonaws.ClientConfiguration */ private static void init() throws Exception { /* * This credentials provider implementation loads your AWS credentials * from a properties file at the root of your classpath. */ dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider()); }