Search in sources :

Example 6 with DeleteTableRequest

use of com.amazonaws.services.dynamodbv2.model.DeleteTableRequest in project aws-doc-sdk-examples by awsdocs.

the class LowLevelParallelScan method deleteTable.

private static void deleteTable(String tableName) {
    try {
        DeleteTableRequest request = new DeleteTableRequest().withTableName(tableName);
        client.deleteTable(request);
    } catch (AmazonServiceException ase) {
        System.err.println("Failed to delete table " + tableName + " " + ase);
    }
}
Also used : DeleteTableRequest(com.amazonaws.services.dynamodbv2.model.DeleteTableRequest) AmazonServiceException(com.amazonaws.AmazonServiceException)

Example 7 with DeleteTableRequest

use of com.amazonaws.services.dynamodbv2.model.DeleteTableRequest in project aws-doc-sdk-examples by awsdocs.

the class LowLevelTableExample method deleteExampleTable.

static void deleteExampleTable() {
    DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName);
    client.deleteTable(deleteTableRequest);
    waitForTableToBeDeleted(tableName);
}
Also used : DeleteTableRequest(com.amazonaws.services.dynamodbv2.model.DeleteTableRequest)

Example 8 with DeleteTableRequest

use of com.amazonaws.services.dynamodbv2.model.DeleteTableRequest in project gora by apache.

the class DynamoDBStore method executeDeleteTableRequest.

/**
 * Executes a delete table request using the DynamoDB client
 *
 * @param pTableName
 */
public void executeDeleteTableRequest(String pTableName) {
    try {
        DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(pTableName);
        DeleteTableResult result = getDynamoDBClient().deleteTable(deleteTableRequest);
        waitForTableToBeDeleted(pTableName);
        LOG.debug("Schema: " + result.getTableDescription() + " deleted successfully.");
    } catch (Exception e) {
        LOG.debug("Schema: {} deleted.", pTableName, e.getMessage());
        throw new RuntimeException(e);
    }
}
Also used : DeleteTableRequest(com.amazonaws.services.dynamodbv2.model.DeleteTableRequest) DeleteTableResult(com.amazonaws.services.dynamodbv2.model.DeleteTableResult) GoraException(org.apache.gora.util.GoraException) AmazonServiceException(com.amazonaws.AmazonServiceException) IOException(java.io.IOException) ResourceNotFoundException(com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException)

Aggregations

DeleteTableRequest (com.amazonaws.services.dynamodbv2.model.DeleteTableRequest)8 TableDescription (com.amazonaws.services.dynamodbv2.model.TableDescription)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2 AttributeDefinition (com.amazonaws.services.dynamodbv2.model.AttributeDefinition)2 CreateTableRequest (com.amazonaws.services.dynamodbv2.model.CreateTableRequest)2 DescribeTableRequest (com.amazonaws.services.dynamodbv2.model.DescribeTableRequest)2 KeySchemaElement (com.amazonaws.services.dynamodbv2.model.KeySchemaElement)2 ProvisionedThroughput (com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput)2 ResourceNotFoundException (com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException)2 SneakyThrows (lombok.SneakyThrows)2 AmazonDynamoDB (com.amazonaws.services.dynamodbv2.AmazonDynamoDB)1 Table (com.amazonaws.services.dynamodbv2.document.Table)1 DeleteTableResult (com.amazonaws.services.dynamodbv2.model.DeleteTableResult)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 GoraException (org.apache.gora.util.GoraException)1