当前位置: 首页>>代码示例>>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;未经允许,请勿转载。