/** * * @{inheritDoc */ @Override public void deleteTable(String tableName) { try { if (hasTable(tableName)) { logger.info("Deleting table: " + tableName); DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName); DeleteTableResult result = dynamoDb.deleteTable(deleteTableRequest); logger.info("Deleted table: " + result.getTableDescription().getTableName()); waitForDelete(tableName); } } catch (Exception t) { logger.error(t, t); throw new RuntimeException(t); } }
@Override public boolean deleteTable(String tableName) { try { DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName); DeleteTableResult deleteTableResult = dynamoDBClient.deleteTable(deleteTableRequest); if (deleteTableRequest != null) { LOG.info("Deleting table description: " + deleteTableResult); // Waiting for table deleted waitForTableDeleted(tableName); LOG.info("Successfully deleted table " + tableName); return true; } } catch (ResourceInUseException rie) { LOG.warn("Table " + tableName + " already exists"); } catch (AmazonServiceException ase) { LOG.error(ase.getMessage(), ase); } catch (AmazonClientException ace) { LOG.error(ace.getMessage(), ace); } return false; }
@Override public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) { this.deleteTableRequest = deleteTableRequest; return new DeleteTableResult().withTableDescription(new TableDescription() .withProvisionedThroughput(new ProvisionedThroughputDescription()) .withTableName(deleteTableRequest.getTableName()) .withCreationDateTime(new Date(NOW)) .withItemCount(10L) .withKeySchema(new ArrayList<KeySchemaElement>()) .withTableSizeBytes(20L) .withTableStatus(TableStatus.ACTIVE)); }
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; }
/** * 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); } }
@After public void after() { DeleteTableResult result = deletePlanoRequestsTable(); Assert.assertEquals(TABLE_NAME, result.getTableDescription().getTableName()); }
private DeleteTableResult deletePlanoRequestsTable() { DeleteTableRequest request = mapper.generateDeleteTableRequest(DynamoDBPlanoRequest.class); DeleteTableResult deleteTableResult = dynamoDB.deleteTable(request); return deleteTableResult; }
private DeleteTableResult deletePlanoRequestsTable() { DeleteTableRequest request = sDynamoDBMapper.generateDeleteTableRequest(DynamoDBPlanoRequest.class); DeleteTableResult deleteTableResult = sDynamoDB.deleteTable(request); return deleteTableResult; }
DeleteTableResult deleteTable(final String tableName) throws BackendException { return deleteTable(new DeleteTableRequest().withTableName(tableName)); }
@Override public void execute() throws MetaModelException { final String tableName = getTable().getName(); final DeleteTableResult result = _dataContext.getDynamoDb().deleteTable(tableName); logger.debug("Dropped table {} in request ID: {}", tableName, result.getSdkResponseMetadata().getRequestId()); }
@Test public void test_deleteTable() throws Exception { createTable(); DeleteTableResult deleteResult = dynamoDb.deleteTable(TEST_TABLE_NAME); String tableName = deleteResult.getTableDescription().getTableName(); assertThat(tableName, equalTo(TEST_TABLE_NAME)); ListTablesResult listResult = listTables(); assertThat(listResult.getTableNames().size(), equalTo(0)); }