com.amazonaws.services.dynamodbv2.model.DeleteTableRequest Java Examples
The following examples show how to use
com.amazonaws.services.dynamodbv2.model.DeleteTableRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDSETranslatorJSONBlob.java From dynamo-cassandra-proxy with Apache License 2.0 | 6 votes |
@Override public DynamoDBResponse deleteTable(DeleteTableRequest deleteTableRequest) { logger.info("deleting JSON table"); String keyspace = keyspaceName; String table = deleteTableRequest.getTableName(); String statement = String.format("DROP TABLE %s.\"%s\";\n", keyspace, table); ResultSet result = session().execute(statement); if (result.wasApplied()) { logger.info("deleted table " + table); cassandraManager.refreshSchema(); TableDescription newTableDesc = this.getTableDescription(table, null,null); DeleteTableResult createResult = (new DeleteTableResult()).withTableDescription(newTableDesc); return new DynamoDBResponse(createResult, 200); } return null; }
Example #2
Source File: BaseDatabaseControllerTest.java From nfscan with MIT License | 6 votes |
protected void clean(){ /* I had to hardcode the DES- prefix due to the fact that DynamoDBMapper doesn't currently have a generateDeleteTableRequest which takes into account the TableNameOverride settings. I've submited a PR to aws-sdk-java repository. https://github.com/aws/aws-sdk-java/pull/606#issuecomment-172940752 As soon as it gets merged I'll remove it */ String prefix = "DES-"; amazonDynamoDBClient.deleteTable(new DeleteTableRequest(prefix.concat(extractTableName(OCRTransaction.class)))); amazonDynamoDBClient.deleteTable(new DeleteTableRequest(prefix.concat(extractTableName(TaxReceipt.class)))); amazonDynamoDBClient.deleteTable(new DeleteTableRequest(prefix.concat(extractTableName(TaxReceiptArchive.class)))); amazonDynamoDBClient.deleteTable(new DeleteTableRequest(prefix.concat(extractTableName(ElectronicTaxReceipt.class)))); amazonDynamoDBClient.deleteTable(new DeleteTableRequest(prefix.concat(extractTableName(ElectronicTaxReceiptArchive.class)))); }
Example #3
Source File: DynamoDBCryptoIntegrationTestBase.java From aws-dynamodb-encryption-java with Apache License 2.0 | 5 votes |
/** * Utility method to delete tables used in the integration test */ public static void deleteCryptoIntegrationTestTables() { List<String> integrationTestTables = new ArrayList<>(); integrationTestTables.add(TABLE_NAME); integrationTestTables.add(TABLE_WITH_INDEX_RANGE_ATTRIBUTE); integrationTestTables.add(TABLE_WITH_RANGE_ATTRIBUTE); for (String name : integrationTestTables) { dynamo.deleteTable(new DeleteTableRequest().withTableName(name)); } }
Example #4
Source File: DynamoDBUtils.java From amazon-kinesis-connectors with Apache License 2.0 | 5 votes |
/** * Deletes an Amazon DynamoDB table if it exists. * * @param client * 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"); } }
Example #5
Source File: StreamsAdapterDemo.java From aws-dynamodb-examples with Apache License 2.0 | 5 votes |
private static void cleanupAndExit(Integer returnValue) { String srcTable = tablePrefix + "-src"; String destTable = tablePrefix + "-dest"; dynamoDBClient.deleteTable(new DeleteTableRequest().withTableName(srcTable)); dynamoDBClient.deleteTable(new DeleteTableRequest().withTableName(destTable)); System.exit(returnValue); }
Example #6
Source File: LowLevelParallelScan.java From aws-dynamodb-examples with Apache License 2.0 | 5 votes |
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); } }
Example #7
Source File: DynamoDBOperations.java From geowave with Apache License 2.0 | 5 votes |
@Override public void deleteAll() throws Exception { final ListTablesResult tables = client.listTables(); for (final String tableName : tables.getTableNames()) { if ((gwNamespace == null) || tableName.startsWith(gwNamespace)) { client.deleteTable(new DeleteTableRequest(tableName)); } } tableExistsCache.clear(); }
Example #8
Source File: DynamoDbDelegate.java From dynamodb-janusgraph-storage-backend with Apache License 2.0 | 5 votes |
public DeleteTableResult deleteTable(final DeleteTableRequest request) throws BackendException { controlPlaneRateLimiter.acquire(); final Timer.Context apiTimerContext = getTimerContext(DELETE_TABLE, request.getTableName()); DeleteTableResult result; try { result = client.deleteTable(request); } catch (Exception e) { throw processDynamoDbApiException(e, DELETE_TABLE, request.getTableName()); } finally { apiTimerContext.stop(); } return result; }
Example #9
Source File: LowLevelParallelScan.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
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); } }
Example #10
Source File: StreamsAdapterDemo.java From aws-doc-sdk-examples with Apache License 2.0 | 5 votes |
private static void cleanupAndExit(Integer returnValue) { String srcTable = tablePrefix + "-src"; String destTable = tablePrefix + "-dest"; dynamoDBClient.deleteTable(new DeleteTableRequest().withTableName(srcTable)); dynamoDBClient.deleteTable(new DeleteTableRequest().withTableName(destTable)); System.exit(returnValue); }
Example #11
Source File: UserRepositoryIT.java From spring-data-dynamodb-examples with Apache License 2.0 | 5 votes |
@After public void destroy() throws Exception { if (tableWasCreatedForTest) { DeleteTableRequest dtr = mapper.generateDeleteTableRequest(User.class); TableUtils.deleteTableIfExists(amazonDynamoDB, dtr); log.info("Deleted table {}", dtr.getTableName()); } }
Example #12
Source File: DynamoDbDelegate.java From dynamodb-janusgraph-storage-backend with Apache License 2.0 | 4 votes |
DeleteTableResult deleteTable(final String tableName) throws BackendException { return deleteTable(new DeleteTableRequest().withTableName(tableName)); }
Example #13
Source File: LowLevelGlobalSecondaryIndexExample.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
public static void deleteTable(String tableName) { System.out.println("Deleting table " + tableName + "..."); client.deleteTable(new DeleteTableRequest().withTableName(tableName)); waitForTableToBeDeleted(tableName); }
Example #14
Source File: LowLevelLocalSecondaryIndexExample.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
public static void deleteTable(String tableName) { System.out.println("Deleting table " + tableName + "..."); client.deleteTable(new DeleteTableRequest().withTableName(tableName)); waitForTableToBeDeleted(tableName); }
Example #15
Source File: DynamoDBCryptoIntegrationTestBase.java From aws-dynamodb-encryption-java with Apache License 2.0 | 4 votes |
protected static void setUpTableWithIndexRangeAttribute(boolean recreateTable) throws Exception { setUp(); if (recreateTable) { dynamo.deleteTable(new DeleteTableRequest().withTableName(TABLE_WITH_INDEX_RANGE_ATTRIBUTE)); waitForTableToBecomeDeleted(TABLE_WITH_INDEX_RANGE_ATTRIBUTE); } String keyName = DynamoDBCryptoIntegrationTestBase.KEY_NAME; String rangeKeyAttributeName = "rangeKey"; String indexFooRangeKeyAttributeName = "indexFooRangeKey"; String indexBarRangeKeyAttributeName = "indexBarRangeKey"; String multipleIndexRangeKeyAttributeName = "multipleIndexRangeKey"; String indexFooName = "index_foo"; String indexBarName = "index_bar"; String indexFooCopyName = "index_foo_copy"; String indexBarCopyName = "index_bar_copy"; CreateTableRequest createTableRequest = new CreateTableRequest() .withTableName(TABLE_WITH_INDEX_RANGE_ATTRIBUTE) .withKeySchema( new KeySchemaElement().withAttributeName(keyName).withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName(rangeKeyAttributeName).withKeyType(KeyType.RANGE)) .withLocalSecondaryIndexes( new LocalSecondaryIndex() .withIndexName(indexFooName) .withKeySchema( new KeySchemaElement().withAttributeName(keyName).withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName(indexFooRangeKeyAttributeName).withKeyType(KeyType.RANGE)) .withProjection(new Projection().withProjectionType(ProjectionType.ALL)), new LocalSecondaryIndex() .withIndexName(indexBarName) .withKeySchema( new KeySchemaElement().withAttributeName(keyName).withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName(indexBarRangeKeyAttributeName).withKeyType(KeyType.RANGE)) .withProjection(new Projection() .withProjectionType(ProjectionType.ALL)), new LocalSecondaryIndex() .withIndexName(indexFooCopyName) .withKeySchema( new KeySchemaElement().withAttributeName(keyName).withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName(multipleIndexRangeKeyAttributeName).withKeyType(KeyType.RANGE)) .withProjection(new Projection() .withProjectionType(ProjectionType.ALL)), new LocalSecondaryIndex() .withIndexName(indexBarCopyName) .withKeySchema( new KeySchemaElement().withAttributeName(keyName).withKeyType(KeyType.HASH), new KeySchemaElement().withAttributeName(multipleIndexRangeKeyAttributeName).withKeyType(KeyType.RANGE)) .withProjection(new Projection() .withProjectionType(ProjectionType.ALL))) .withAttributeDefinitions( new AttributeDefinition().withAttributeName(keyName).withAttributeType(ScalarAttributeType.N), new AttributeDefinition().withAttributeName(rangeKeyAttributeName).withAttributeType(ScalarAttributeType.N), new AttributeDefinition().withAttributeName(indexFooRangeKeyAttributeName).withAttributeType(ScalarAttributeType.N), new AttributeDefinition().withAttributeName(indexBarRangeKeyAttributeName).withAttributeType(ScalarAttributeType.N), new AttributeDefinition().withAttributeName(multipleIndexRangeKeyAttributeName).withAttributeType(ScalarAttributeType.N)); createTableRequest.setProvisionedThroughput(new ProvisionedThroughput().withReadCapacityUnits(10L) .withWriteCapacityUnits(5L)); if (TableUtils.createTableIfNotExists(dynamo, createTableRequest)) { TableUtils.waitUntilActive(dynamo, TABLE_WITH_INDEX_RANGE_ATTRIBUTE); } }
Example #16
Source File: LowLevelTableExample.java From aws-doc-sdk-examples with Apache License 2.0 | 4 votes |
static void deleteExampleTable() { DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName); client.deleteTable(deleteTableRequest); waitForTableToBeDeleted(tableName); }
Example #17
Source File: LowLevelTableExample.java From aws-dynamodb-examples with Apache License 2.0 | 4 votes |
static void deleteExampleTable() { DeleteTableRequest deleteTableRequest = new DeleteTableRequest() .withTableName(tableName); client.deleteTable(deleteTableRequest); waitForTableToBeDeleted(tableName); }
Example #18
Source File: LowLevelLocalSecondaryIndexExample.java From aws-dynamodb-examples with Apache License 2.0 | 4 votes |
public static void deleteTable(String tableName) { System.out.println("Deleting table " + tableName + "..."); client.deleteTable(new DeleteTableRequest().withTableName(tableName)); waitForTableToBeDeleted(tableName); }
Example #19
Source File: LowLevelGlobalSecondaryIndexExample.java From aws-dynamodb-examples with Apache License 2.0 | 4 votes |
public static void deleteTable(String tableName) { System.out.println("Deleting table " + tableName + "..."); client.deleteTable(new DeleteTableRequest().withTableName(tableName)); waitForTableToBeDeleted(tableName); }
Example #20
Source File: PostgresDynamoDB.java From podyn with Apache License 2.0 | 4 votes |
@Override public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) { throw new UnsupportedOperationException(); }
Example #21
Source File: TransactionManagerDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public DeleteTableResult deleteTable(DeleteTableRequest arg0) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Use the underlying client instance instead"); }
Example #22
Source File: ThreadLocalDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public DeleteTableResult deleteTable(DeleteTableRequest request) throws AmazonServiceException, AmazonClientException { return getBackend().deleteTable(request); }
Example #23
Source File: TransactionDynamoDBFacade.java From dynamodb-transactions with Apache License 2.0 | 4 votes |
@Override public DeleteTableResult deleteTable(DeleteTableRequest arg0) throws AmazonServiceException, AmazonClientException { throw new UnsupportedOperationException("Use the underlying client instance instead"); }