List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient AmazonDynamoDBClient
AmazonDynamoDBClient(AwsSyncClientParams clientParams)
From source file:edu.gatech.foodaggregate.FavoritesListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.favorites);/*from w w w . ja va 2 s .co m*/ ids = new ArrayList<>(); titles = new ArrayList<>(); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); CognitoUserPool userPool = new CognitoUserPool(getApplicationContext(), "us-east-1_ZPUPIylup", "72lqi02sjv18jsgom0722tmisa", "1opq49mtggjo0r2ul0jq6mtj2ej78ofph293pfb7kf53gvv7ee7f"); user = userPool.getCurrentUser(); credentialsProvider = new CognitoCachingCredentialsProvider(getApplicationContext(), // Context "us-east-1:654d88ee-2726-41e0-960f-3be89f3530db", // Identity Pool ID Regions.US_EAST_1); // Region AmazonDynamoDBClient ddbClient = new AmazonDynamoDBClient(credentialsProvider); mapper = new DynamoDBMapper(ddbClient); StrictMode.setThreadPolicy(policy); }
From source file:edu.hawaii.kscmfeedprocessor.AmazonKinesisApplicationSample.java
License:Open Source License
public void deleteResources() { AWSCredentials credentials = credentialsProvider.getCredentials(); // Delete the stream AmazonKinesis kinesis = new AmazonKinesisClient(credentials); System.out.printf("Deleting the Amazon Kinesis stream used by the sample. Stream Name = %s.\n", SAMPLE_APPLICATION_STREAM_NAME); try {/*from w w w . j a va2 s .c o m*/ kinesis.deleteStream(SAMPLE_APPLICATION_STREAM_NAME); } catch (ResourceNotFoundException ex) { // The stream doesn't exist. } // Delete the table AmazonDynamoDBClient dynamoDB = new AmazonDynamoDBClient(credentialsProvider.getCredentials()); System.out.printf( "Deleting the Amazon DynamoDB table used by the Amazon Kinesis Client Library. Table Name = %s.\n", SAMPLE_APPLICATION_NAME); try { dynamoDB.deleteTable(SAMPLE_APPLICATION_NAME); } catch (com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException ex) { // The table doesn't exist. } }
From source file:examples.csci567.demo.userpreferencesom.AmazonClientManager.java
License:Open Source License
private void initClients() { Map<String, String> logins = new HashMap<String, String>(); logins.put("accounts.google.com", token); // initiate a credentials provider CognitoCachingCredentialsProvider credentials = new CognitoCachingCredentialsProvider(context, Constants.IDENTITY_POOL_ID, Regions.US_EAST_1); credentials.setLogins(logins);/*ww w . j av a2s.com*/ ddb = new AmazonDynamoDBClient(credentials); ddb.setRegion(Region.getRegion(Regions.US_WEST_2)); }
From source file:il.co.togetthere.db.AmazonClientManager.java
License:Open Source License
private void initClients() { CognitoCachingCredentialsProvider credentials = new CognitoCachingCredentialsProvider(context, Constants.ACCOUNT_ID, Constants.IDENTITY_POOL_ID, Constants.UNAUTH_ROLE_ARN, null, Regions.US_EAST_1);// w ww.jav a2 s . c o m ddb = new AmazonDynamoDBClient(credentials); ddb.setRegion(Region.getRegion(Regions.US_WEST_2)); }
From source file:io.exemplary.aws.DynamoDBServer.java
License:Apache License
private void deleteAllTables() { AmazonDynamoDBClient client = new AmazonDynamoDBClient(new BasicAWSCredentials("accessKey", "secretKey")); client.setEndpoint(getEndpoint());/*w w w .j ava 2 s. c o m*/ ListTablesResult result = client.listTables(new ListTablesRequest()); for (String tableName : result.getTableNames()) { client.deleteTable(new DeleteTableRequest(tableName)); } client.shutdown(); }
From source file:io.fineo.dynamo.LocalDynamoTestUtil.java
License:Apache License
public AmazonDynamoDBClient getClient() { return withProvider(new AmazonDynamoDBClient(credentials)); }
From source file:io.ignitr.dispatchr.manager.Application.java
License:Apache License
@Autowired @Bean//from www . j a v a 2 s . com public AmazonDynamoDBClient amazonDynamoDBClient(DeploymentContext deploymentContext) { AmazonDynamoDBClient client = new AmazonDynamoDBClient(new DefaultAWSCredentialsProviderChain()); client.setRegion(Region.getRegion(Regions.fromName(deploymentContext.getRegion()))); return client; }
From source file:io.milton.s3.db.DynamoDBServiceImpl.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. * * @see com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider * @see com.amazonaws.regions.Region/*from www .j av a 2 s . com*/ */ public DynamoDBServiceImpl(Region region) { LOG.info("Initialize Amazon DynamoDB environment...!!!"); dynamoDBClient = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider()); dynamoDBClient.setRegion(region); }
From source file:io.robrose.hop.watermap.aws.DynamoGeoClient.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. * * @see com.amazonaws.auth.BasicAWSCredentials // * @see com.amazonaws.auth.ProfilesConfigFile * @see com.amazonaws.ClientConfiguration */// w ww .java 2s . c o m public static void init() { if (initialized) return; /* * The ProfileCredentialsProvider will return your [default] * credential profile by reading from the credentials file located at * (C:\\Users\\Robert\\.aws\\credentials). */ AWSCredentials credentials; try { credentials = new BasicAWSCredentials(accessKey, secretKey); } catch (Exception e) { throw new AmazonClientException("Cannot load the credentials from the credential profiles file. " + "Please make sure that your credentials file is at the correct " + "location (C:\\Users\\Robert\\.aws\\credentials), and is in valid format.", e); } dynamoDB = new AmazonDynamoDBClient(credentials); Region usEast1 = Region.getRegion(Regions.US_EAST_1); dynamoDB.setRegion(usEast1); initialized = true; }
From source file:jp.buyee.glover.KinesisConnectorExecutor.java
License:Open Source License
/** * Helper method to create the Amazon DynamoDB table. * // w w w.j av a 2s.c om * @param key * The name of the hashkey field in the Amazon DynamoDB table * @param readCapacityUnits * Read capacity of the Amazon DynamoDB table * @param writeCapacityUnits * Write capacity of the Amazon DynamoDB table */ private void createDynamoDBTable(String key, long readCapacityUnits, long writeCapacityUnits) { LOG.info("Creating Amazon DynamoDB table " + config.DYNAMODB_DATA_TABLE_NAME); AmazonDynamoDBClient dynamodbClient = new AmazonDynamoDBClient(config.AWS_CREDENTIALS_PROVIDER); dynamodbClient.setEndpoint(config.DYNAMODB_ENDPOINT); DynamoDBUtils.createTable(dynamodbClient, config.DYNAMODB_DATA_TABLE_NAME, key, readCapacityUnits, writeCapacityUnits); }