本文整理匯總了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);
}