List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient deleteTable
@Override
public DeleteTableResult deleteTable(String tableName)
From source file:DynamoDBUtils.java
License:Open Source License
/** * Deletes an Amazon DynamoDB table if it exists. * * @param client// ww w. ja va2 s .c o m * The {@link AmazonDynamoDBClient} with Amazon DynamoDB read and write privileges * @param tableName * The Amazon DynamoDB table to delete */ public static void deleteTable(AmazonDynamoDBClient client, String tableName) { if (tableExists(client, tableName)) { DeleteTableRequest deleteTableRequest = new DeleteTableRequest(); deleteTableRequest.setTableName(tableName); client.deleteTable(deleteTableRequest); LOG.info("Deleted table " + tableName); } else { LOG.warn("Table " + tableName + " does not exist"); } }
From source file:AmazonKinesisAuditVerify.java
License:Open Source License
public static 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 {//ww w. ja v a 2s . 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:aws.example.dynamodb.DeleteTable.java
License:Open Source License
public static void main(String[] args) { final String USAGE = "\n" + "Usage:\n" + " DeleteTable <table>\n\n" + "Where:\n" + " table - the table to delete.\n\n" + "Example:\n" + " DeleteTable Greetings\n\n" + "**Warning** This program will actually delete the table\n" + " that you specify!\n"; if (args.length < 1) { System.out.println(USAGE); System.exit(1);//ww w .ja v a 2 s . c o m } String table_name = args[0]; System.out.format("Deleting table %s...\n", table_name); final AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(); try { ddb.deleteTable(table_name); } catch (AmazonServiceException e) { System.err.println(e.getErrorMessage()); System.exit(1); } System.out.println("Done!"); }
From source file:awskinesis.AmazonKinesisApplicationSample.java
License:Apache License
public static void deleteResources() { AWSCredentials credentials = credentialsProvider.getCredentials(); // Delete the stream AmazonKinesis kinesis = new AmazonKinesisClient(credentials); kinesis.setEndpoint("kinesis.cn-north-1.amazonaws.com.cn"); 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 av a 2 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()); dynamoDB.setEndpoint("dynamodb.cn-north-1.amazonaws.com.cn"); 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:awslabs.lab22.SolutionCode.java
License:Open Source License
@Override public void deleteTable(AmazonDynamoDBClient ddbClient, String tableName) { String tableStatus = getTableStatus(ddbClient, tableName); if (tableStatus.equals("ACTIVE")) { System.out.println("Deleting pre-existing table."); DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName); ddbClient.deleteTable(deleteTableRequest); waitForStatus(ddbClient, tableName, "NOTFOUND"); System.out.println("Table deletion confirmed."); } else if (tableStatus.equals("NOTFOUND")) { System.out.println("Skipped deletion operation. Table not found."); } else {/*from ww w . j av a 2 s . c om*/ System.out.println("Skipped deletion operation. Table not in correct state."); } }
From source file:awslabs.lab51.SolutionCode.java
License:Open Source License
@Override public void deleteTable(AmazonDynamoDBClient ddbClient, String tableName) { ddbClient.deleteTable(new DeleteTableRequest().withTableName(tableName)); }
From source file:com.acer.batterycapacitydemo.DynamoDBManager.java
License:Open Source License
public static void cleanUp() { AmazonDynamoDBClient ddb = MainActivity.clientManager.ddb(); DeleteTableRequest request = new DeleteTableRequest() .withTableName(CognitoSyncClientManager.TEST_TABLE_NAME); try {// w ww. ja v a 2s . co m ddb.deleteTable(request); } catch (AmazonServiceException ex) { MainActivity.clientManager.wipeCredentialsOnAuthError(ex); } }
From source file:com.example.kwang27.secmap.DynamoDBManager.java
License:Open Source License
public static void cleanUp() { AmazonDynamoDBClient ddb = MainActivity.clientManager.ddb(); DeleteTableRequest request = new DeleteTableRequest().withTableName(Constants.TEST_TABLE_NAME); try {// w w w . j a va 2s . c om ddb.deleteTable(request); } catch (AmazonServiceException ex) { MainActivity.clientManager.wipeCredentialsOnAuthError(ex); } }
From source file:com.trk.aboutme.DynamoDB.DynamoDBManagerBooks.java
License:Open Source License
public static void cleanUp() { AmazonDynamoDBClient ddb = Shelf.clientManager.ddb(); DeleteTableRequest request = new DeleteTableRequest().withTableName(Constants.TEST_TABLE_NAME); try {//from ww w . ja v a2 s.c o m ddb.deleteTable(request); } catch (AmazonServiceException ex) { Shelf.clientManager.wipeCredentialsOnAuthError(ex); } }
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 {/*ww w .j av a2s . co 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. } }