當前位置: 首頁>>代碼示例>>Java>>正文


Java AmazonDynamoDB.deleteTable方法代碼示例

本文整理匯總了Java中com.amazonaws.services.dynamodbv2.AmazonDynamoDB.deleteTable方法的典型用法代碼示例。如果您正苦於以下問題:Java AmazonDynamoDB.deleteTable方法的具體用法?Java AmazonDynamoDB.deleteTable怎麽用?Java AmazonDynamoDB.deleteTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.amazonaws.services.dynamodbv2.AmazonDynamoDB的用法示例。


在下文中一共展示了AmazonDynamoDB.deleteTable方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cleanUpDynamoDBTables

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
private static void cleanUpDynamoDBTables(Regions testRegion, String testResourcePrefix, Date createdBeforeThreshold,
                                          AWSCredentialsProvider awsCredentials) {
    LOG.info("Cleaning DynamoDB...");
    AmazonDynamoDB dynamoDBClient = AmazonDynamoDBClientBuilder.standard()
            .withCredentials(awsCredentials)
            .withRegion(testRegion)
            .build();

    List<String> tableNames = dynamoDBClient.listTables().getTableNames();
    for (String tableName: tableNames) {
        if (!tableName.startsWith(testResourcePrefix)) {
            continue;
        }
        LOG.info(String.format("Checking if table %s needs cleaning...", tableName));

        try {
            TableDescription desc = dynamoDBClient.describeTable(tableName).getTable();
            if (!desc.getTableName().equals(TableStatus.DELETING.toString()) &&
                    desc.getCreationDateTime() != null &&
                    desc.getCreationDateTime().before(createdBeforeThreshold)) {
                LOG.info("Cleaning up table: " + tableName);
                dynamoDBClient.deleteTable(tableName);
            }
        } catch (ResourceNotFoundException e) {
            LOG.info("Looks like table was already cleaned up: " + tableName);
        }
    }
}
 
開發者ID:schibsted,項目名稱:strongbox,代碼行數:29,代碼來源:IntegrationTestHelper.java

示例2: main

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
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);
    }

    String table_name = args[0];

    System.out.format("Deleting table %s...\n", table_name);

    final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient();

    try {
        ddb.deleteTable(table_name);
    } catch (AmazonServiceException e) {
        System.err.println(e.getErrorMessage());
        System.exit(1);
    }
    System.out.println("Done!");
}
 
開發者ID:awsdocs,項目名稱:aws-doc-sdk-examples,代碼行數:32,代碼來源:DeleteTable.java

示例3: dropTable

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
public static void dropTable(final AmazonDynamoDB dynamoClient,
		final String dynamoTable) throws Exception {
	if (dynamoTable != null) {
		LOG.info(String.format("Dropping Dynamo Table %s", dynamoTable));
		try {
			dynamoClient.deleteTable(dynamoTable);
			waitForTableState(dynamoClient, dynamoTable,
					TableStatus.DELETING);
		} catch (ResourceNotFoundException e) {
			LOG.info("OK - Table Not Found");
		}
	}
}
 
開發者ID:awslabs,項目名稱:amazon-kinesis-aggregators,代碼行數:14,代碼來源:DynamoUtils.java

示例4: drop

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
/**
 * Drop table.
 * @throws InterruptedException If something fails
 */
public void drop() throws InterruptedException {
    final AmazonDynamoDB aws = this.region.aws();
    final String name = this.request.getTableName();
    aws.deleteTable(new DeleteTableRequest().withTableName(name));
    Logger.info(this, "DynamoDB table '%s' deletion requested", name);
    while (this.exists()) {
        Logger.info(this, "DynamoDB table '%s' still exists", name);
        TimeUnit.SECONDS.sleep((long) Tv.TEN);
    }
    Logger.info(this, "DynamoDB table '%s' deleted", name);
}
 
開發者ID:jcabi,項目名稱:jcabi-dynamo,代碼行數:16,代碼來源:MadeTable.java

示例5: deleteTableUser

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
public static void deleteTableUser(AmazonDynamoDB dynamoDbClient) {
    dynamoDbClient.deleteTable(UserRepositoryImpl.TableName);
}
 
開發者ID:satr,項目名稱:aws-amazon-shopping-bot-lambda-func,代碼行數:4,代碼來源:TestRepositoryHelper.java

示例6: deleteTableProduct

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
public static void deleteTableProduct(AmazonDynamoDB dynamoDbClient) {
    dynamoDbClient.deleteTable(ProductRepositoryImpl.TableName);
}
 
開發者ID:satr,項目名稱:aws-amazon-shopping-bot-lambda-func,代碼行數:4,代碼來源:TestRepositoryHelper.java

示例7: deleteTableShoppingCart

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
public static void deleteTableShoppingCart(AmazonDynamoDB dynamoDbClient) {
    dynamoDbClient.deleteTable(ShoppingCartRepositoryImpl.TableName);
}
 
開發者ID:satr,項目名稱:aws-amazon-shopping-bot-lambda-func,代碼行數:4,代碼來源:TestRepositoryHelper.java

示例8: deleteTableOrder

import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //導入方法依賴的package包/類
public static void deleteTableOrder(AmazonDynamoDB dynamoDbClient) {
    dynamoDbClient.deleteTable(OrderRepositoryImpl.TableName);
}
 
開發者ID:satr,項目名稱:aws-amazon-shopping-bot-lambda-func,代碼行數:4,代碼來源:TestRepositoryHelper.java


注:本文中的com.amazonaws.services.dynamodbv2.AmazonDynamoDB.deleteTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。