本文整理汇总了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);
}
}
}
示例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!");
}
示例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");
}
}
}
示例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);
}
示例5: deleteTableUser
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //导入方法依赖的package包/类
public static void deleteTableUser(AmazonDynamoDB dynamoDbClient) {
dynamoDbClient.deleteTable(UserRepositoryImpl.TableName);
}
示例6: deleteTableProduct
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //导入方法依赖的package包/类
public static void deleteTableProduct(AmazonDynamoDB dynamoDbClient) {
dynamoDbClient.deleteTable(ProductRepositoryImpl.TableName);
}
示例7: deleteTableShoppingCart
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //导入方法依赖的package包/类
public static void deleteTableShoppingCart(AmazonDynamoDB dynamoDbClient) {
dynamoDbClient.deleteTable(ShoppingCartRepositoryImpl.TableName);
}
示例8: deleteTableOrder
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; //导入方法依赖的package包/类
public static void deleteTableOrder(AmazonDynamoDB dynamoDbClient) {
dynamoDbClient.deleteTable(OrderRepositoryImpl.TableName);
}