本文整理汇总了Java中com.amazonaws.services.dynamodbv2.model.DeleteTableRequest类的典型用法代码示例。如果您正苦于以下问题:Java DeleteTableRequest类的具体用法?Java DeleteTableRequest怎么用?Java DeleteTableRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeleteTableRequest类属于com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了DeleteTableRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
*
* @{inheritDoc
*/
@Override
public void deleteTable(String tableName) {
try {
if (hasTable(tableName)) {
logger.info("Deleting table: " + tableName);
DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName);
DeleteTableResult result = dynamoDb.deleteTable(deleteTableRequest);
logger.info("Deleted table: " + result.getTableDescription().getTableName());
waitForDelete(tableName);
}
} catch (Exception t) {
logger.error(t, t);
throw new RuntimeException(t);
}
}
示例2: clean
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
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))));
}
示例3: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
@Override
public boolean deleteTable(String tableName) {
try {
DeleteTableRequest deleteTableRequest = new DeleteTableRequest().withTableName(tableName);
DeleteTableResult deleteTableResult = dynamoDBClient.deleteTable(deleteTableRequest);
if (deleteTableRequest != null) {
LOG.info("Deleting table description: " + deleteTableResult);
// Waiting for table deleted
waitForTableDeleted(tableName);
LOG.info("Successfully deleted table " + tableName);
return true;
}
} catch (ResourceInUseException rie) {
LOG.warn("Table " + tableName + " already exists");
} catch (AmazonServiceException ase) {
LOG.error(ase.getMessage(), ase);
} catch (AmazonClientException ace) {
LOG.error(ace.getMessage(), ace);
}
return false;
}
示例4: createTicketTables
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
* Create ticket tables.
*
* @param deleteTables the delete tables
*/
public void createTicketTables(final boolean deleteTables) {
final Collection<TicketDefinition> metadata = this.ticketCatalog.findAll();
metadata.forEach(Unchecked.consumer(r -> {
final CreateTableRequest request = new CreateTableRequest()
.withAttributeDefinitions(new AttributeDefinition(ColumnNames.ID.getName(), ScalarAttributeType.S))
.withKeySchema(new KeySchemaElement(ColumnNames.ID.getName(), KeyType.HASH))
.withProvisionedThroughput(new ProvisionedThroughput(dynamoDbProperties.getReadCapacity(),
dynamoDbProperties.getWriteCapacity()))
.withTableName(r.getProperties().getStorageName());
if (deleteTables) {
final DeleteTableRequest delete = new DeleteTableRequest(r.getProperties().getStorageName());
LOGGER.debug("Sending delete request [{}] to remove table if necessary", delete);
TableUtils.deleteTableIfExists(amazonDynamoDBClient, delete);
}
LOGGER.debug("Sending delete request [{}] to create table", request);
TableUtils.createTableIfNotExists(amazonDynamoDBClient, request);
LOGGER.debug("Waiting until table [{}] becomes active...", request.getTableName());
TableUtils.waitUntilActive(amazonDynamoDBClient, request.getTableName());
final DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(request.getTableName());
LOGGER.debug("Sending request [{}] to obtain table description...", describeTableRequest);
final TableDescription tableDescription = amazonDynamoDBClient.describeTable(describeTableRequest).getTable();
LOGGER.debug("Located newly created table with description: [{}]", tableDescription);
}));
}
示例5: createServicesTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
* Create tables.
*
* @param deleteTables the delete tables
*/
public void createServicesTable(final boolean deleteTables) {
try {
final CreateTableRequest request = new CreateTableRequest()
.withAttributeDefinitions(new AttributeDefinition(ColumnNames.ID.getName(), ScalarAttributeType.S))
.withKeySchema(new KeySchemaElement(ColumnNames.ID.getName(), KeyType.HASH))
.withProvisionedThroughput(new ProvisionedThroughput(dynamoDbProperties.getReadCapacity(),
dynamoDbProperties.getWriteCapacity()))
.withTableName(TABLE_NAME);
if (deleteTables) {
final DeleteTableRequest delete = new DeleteTableRequest(request.getTableName());
LOGGER.debug("Sending delete request [{}] to remove table if necessary", delete);
TableUtils.deleteTableIfExists(amazonDynamoDBClient, delete);
}
LOGGER.debug("Sending delete request [{}] to create table", request);
TableUtils.createTableIfNotExists(amazonDynamoDBClient, request);
LOGGER.debug("Waiting until table [{}] becomes active...", request.getTableName());
TableUtils.waitUntilActive(amazonDynamoDBClient, request.getTableName());
final DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(request.getTableName());
LOGGER.debug("Sending request [{}] to obtain table description...", describeTableRequest);
final TableDescription tableDescription = amazonDynamoDBClient.describeTable(describeTableRequest).getTable();
LOGGER.debug("Located newly created table with description: [{}]", tableDescription);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
示例6: createSettingsTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
private static void createSettingsTable(final AmazonDynamoDBClient amazonDynamoDBClient, final boolean deleteTables) {
try {
final CreateTableRequest request = new CreateTableRequest()
.withAttributeDefinitions(new AttributeDefinition(ColumnNames.ID.getName(), ScalarAttributeType.S))
.withKeySchema(new KeySchemaElement(ColumnNames.ID.getName(), KeyType.HASH))
.withProvisionedThroughput(new ProvisionedThroughput(PROVISIONED_THROUGHPUT, PROVISIONED_THROUGHPUT))
.withTableName(TABLE_NAME);
if (deleteTables) {
final DeleteTableRequest delete = new DeleteTableRequest(request.getTableName());
LOGGER.debug("Sending delete request [{}] to remove table if necessary", delete);
TableUtils.deleteTableIfExists(amazonDynamoDBClient, delete);
}
LOGGER.debug("Sending delete request [{}] to create table", request);
TableUtils.createTableIfNotExists(amazonDynamoDBClient, request);
LOGGER.debug("Waiting until table [{}] becomes active...", request.getTableName());
TableUtils.waitUntilActive(amazonDynamoDBClient, request.getTableName());
final DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(request.getTableName());
LOGGER.debug("Sending request [{}] to obtain table description...", describeTableRequest);
final TableDescription tableDescription = amazonDynamoDBClient.describeTable(describeTableRequest).getTable();
LOGGER.debug("Located newly created table with description: [{}]", tableDescription);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
示例7: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
@AfterClass
public static void deleteTable() {
final DeleteTableRequest deleteTableRequest = new DeleteTableRequest(tableName);
// credentials need to be set in local environment
// see http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html
TableUtils.deleteTableIfExists(new AmazonDynamoDBClient(), deleteTableRequest);
}
示例8: execute
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
@Override
public void execute() {
TableDescription tableDescription = ddbClient
.deleteTable(new DeleteTableRequest(determineTableName())).getTableDescription();
Map tmp = new HashMap<>();
tmp.put(DdbConstants.PROVISIONED_THROUGHPUT, tableDescription.getProvisionedThroughput());
tmp.put(DdbConstants.CREATION_DATE, tableDescription.getCreationDateTime());
tmp.put(DdbConstants.ITEM_COUNT, tableDescription.getItemCount());
tmp.put(DdbConstants.KEY_SCHEMA, tableDescription.getKeySchema());
tmp.put(DdbConstants.TABLE_NAME, tableDescription.getTableName());
tmp.put(DdbConstants.TABLE_SIZE, tableDescription.getTableSizeBytes());
tmp.put(DdbConstants.TABLE_STATUS, tableDescription.getTableStatus());
addToResults(tmp);
}
示例9: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
@Override
public DeleteTableResult deleteTable(DeleteTableRequest deleteTableRequest) {
this.deleteTableRequest = deleteTableRequest;
return new DeleteTableResult().withTableDescription(new TableDescription()
.withProvisionedThroughput(new ProvisionedThroughputDescription())
.withTableName(deleteTableRequest.getTableName())
.withCreationDateTime(new Date(NOW))
.withItemCount(10L)
.withKeySchema(new ArrayList<KeySchemaElement>())
.withTableSizeBytes(20L)
.withTableStatus(TableStatus.ACTIVE));
}
示例10: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
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;
}
示例11: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
* Delete the table with given name
*
* @param tableName
*/
public static void deleteTable(String tableName) {
try {
DynamoDbHandler.CLIENT
.deleteTable(new DeleteTableRequest(tableName));
} catch (Exception e) {
//Table does not exist
}
}
示例12: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
* Deletes the main table from AWS DynamoDB.
* @param appid name of the {@link com.erudika.para.core.App}
* @return true if deleted
*/
public static boolean deleteTable(String appid) {
if (StringUtils.isBlank(appid) || !existsTable(appid)) {
return false;
}
try {
String table = getTableNameForAppid(appid);
getClient().deleteTable(new DeleteTableRequest().withTableName(table));
logger.info("Deleted DynamoDB table '{}'.", table);
} catch (Exception e) {
logger.error(null, e);
return false;
}
return true;
}
示例13: executeDeleteTableRequest
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
/**
* Executes a delete table request using the DynamoDB client
*
* @param pTableName
*/
public void executeDeleteTableRequest(String pTableName) {
try {
DeleteTableRequest deleteTableRequest = new DeleteTableRequest()
.withTableName(pTableName);
DeleteTableResult result = getDynamoDBClient().deleteTable(
deleteTableRequest);
waitForTableToBeDeleted(pTableName);
LOG.debug("Schema: " + result.getTableDescription()
+ " deleted successfully.");
} catch (Exception e) {
LOG.debug("Schema: {} deleted.", pTableName, e.getMessage());
throw new RuntimeException(e);
}
}
示例14: deleteTable
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
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);
}
}
示例15: cleanupAndExit
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest; //导入依赖的package包/类
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);
}