类com.amazonaws.services.dynamodbv2.model.DeleteTableRequest源码实例Demo

下面列出了怎么用com.amazonaws.services.dynamodbv2.model.DeleteTableRequest的API类实例代码及写法,或者点击链接到github查看源代码。

@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;
}
 
源代码2 项目: nfscan   文件: BaseDatabaseControllerTest.java
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))));
}
 
@After
public void destroy() throws Exception {
	if (tableWasCreatedForTest) {
		DeleteTableRequest dtr = mapper.generateDeleteTableRequest(User.class);
		TableUtils.deleteTableIfExists(amazonDynamoDB, dtr);
		log.info("Deleted table {}", dtr.getTableName());
	}
}
 
源代码4 项目: aws-doc-sdk-examples   文件: StreamsAdapterDemo.java
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);
}
 
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);
    }
}
 
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;
}
 
/**
 * 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));
    }
}
 
源代码8 项目: geowave   文件: DynamoDBOperations.java
@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();
}
 
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);
    }
}
 
源代码10 项目: aws-dynamodb-examples   文件: StreamsAdapterDemo.java
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);
}
 
源代码11 项目: amazon-kinesis-connectors   文件: DynamoDBUtils.java
/**
 * 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");
    }
}
 
源代码12 项目: podyn   文件: PostgresDynamoDB.java
@Override
public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) {
	
	throw new UnsupportedOperationException();
}
 
static void deleteExampleTable() {
    DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName);
    client.deleteTable(deleteTableRequest);
    waitForTableToBeDeleted(tableName);
}
 
public static void deleteTable(String tableName) {
    System.out.println("Deleting table " + tableName + "...");
    client.deleteTable(new DeleteTableRequest().withTableName(tableName));
    waitForTableToBeDeleted(tableName);
}
 
public static void deleteTable(String tableName) {
    System.out.println("Deleting table " + tableName + "...");
    client.deleteTable(new DeleteTableRequest().withTableName(tableName));
    waitForTableToBeDeleted(tableName);
}
 
DeleteTableResult deleteTable(final String tableName) throws BackendException {
    return deleteTable(new DeleteTableRequest().withTableName(tableName));
}
 
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);
    }
}
 
static void deleteExampleTable() {
    DeleteTableRequest deleteTableRequest = new DeleteTableRequest()
        .withTableName(tableName);
    client.deleteTable(deleteTableRequest);
    waitForTableToBeDeleted(tableName);  
}
 
public static void deleteTable(String tableName) {
    System.out.println("Deleting table " + tableName + "...");
    client.deleteTable(new DeleteTableRequest().withTableName(tableName));
    waitForTableToBeDeleted(tableName);
}
 
public static void deleteTable(String tableName) {
    System.out.println("Deleting table " + tableName + "...");
    client.deleteTable(new DeleteTableRequest().withTableName(tableName));
    waitForTableToBeDeleted(tableName);
}
 
@Override
public DeleteTableResult deleteTable(DeleteTableRequest arg0)
        throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Use the underlying client instance instead");
}
 
@Override
public DeleteTableResult deleteTable(DeleteTableRequest request) throws AmazonServiceException, AmazonClientException {
    return getBackend().deleteTable(request);
}
 
@Override
public DeleteTableResult deleteTable(DeleteTableRequest arg0)
        throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Use the underlying client instance instead");
}
 
 类方法
 同包方法