Search in sources :

Example 11 with TableDescription

use of com.amazonaws.services.dynamodbv2.model.TableDescription in project camel by apache.

the class DeleteTableCommand method execute.

@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);
}
Also used : DeleteTableRequest(com.amazonaws.services.dynamodbv2.model.DeleteTableRequest) HashMap(java.util.HashMap) TableDescription(com.amazonaws.services.dynamodbv2.model.TableDescription) Map(java.util.Map) HashMap(java.util.HashMap)

Example 12 with TableDescription

use of com.amazonaws.services.dynamodbv2.model.TableDescription in project gora by apache.

the class DynamoDBStore method getTableSchema.

/**
   * Retrieves the table description for the specific resource name
   * 
   * @param tableName
   * @return
   */
private TableDescription getTableSchema(String tableName) {
    TableDescription tableDescription = null;
    try {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
        tableDescription = getDynamoDBClient().describeTable(describeTableRequest).getTable();
    } catch (ResourceNotFoundException e) {
        LOG.error("Error while getting table schema: " + tableName);
        return tableDescription;
    }
    return tableDescription;
}
Also used : DescribeTableRequest(com.amazonaws.services.dynamodbv2.model.DescribeTableRequest) ResourceNotFoundException(com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException) TableDescription(com.amazonaws.services.dynamodbv2.model.TableDescription)

Example 13 with TableDescription

use of com.amazonaws.services.dynamodbv2.model.TableDescription in project gora by apache.

the class GoraDynamoDBTestDriver method checkResource.

/**
   * Checks if a resource exists or not
   * 
   * @param tableName
   *          Table name to be checked
   * @return
   */
public TableDescription checkResource(String tableName) {
    TableDescription tableDescription = null;
    try {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
        tableDescription = dynamoDBClient.describeTable(describeTableRequest).getTable();
    } catch (ResourceNotFoundException e) {
        tableDescription = null;
    }
    return tableDescription;
}
Also used : DescribeTableRequest(com.amazonaws.services.dynamodbv2.model.DescribeTableRequest) ResourceNotFoundException(com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException) TableDescription(com.amazonaws.services.dynamodbv2.model.TableDescription)

Aggregations

TableDescription (com.amazonaws.services.dynamodbv2.model.TableDescription)13 DescribeTableRequest (com.amazonaws.services.dynamodbv2.model.DescribeTableRequest)8 ResourceNotFoundException (com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException)6 AmazonServiceException (com.amazonaws.AmazonServiceException)4 AttributeDefinition (com.amazonaws.services.dynamodbv2.model.AttributeDefinition)3 DeleteTableRequest (com.amazonaws.services.dynamodbv2.model.DeleteTableRequest)3 KeySchemaElement (com.amazonaws.services.dynamodbv2.model.KeySchemaElement)3 CreateTableRequest (com.amazonaws.services.dynamodbv2.model.CreateTableRequest)2 ProvisionedThroughput (com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput)2 ProvisionedThroughputDescription (com.amazonaws.services.dynamodbv2.model.ProvisionedThroughputDescription)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AmazonClientException (com.amazonaws.AmazonClientException)1 AmazonDynamoDB (com.amazonaws.services.dynamodbv2.AmazonDynamoDB)1 AmazonDynamoDBClient (com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient)1 AttributeValue (com.amazonaws.services.dynamodbv2.model.AttributeValue)1 DeleteItemRequest (com.amazonaws.services.dynamodbv2.model.DeleteItemRequest)1 DeleteItemResult (com.amazonaws.services.dynamodbv2.model.DeleteItemResult)1 DescribeTableResult (com.amazonaws.services.dynamodbv2.model.DescribeTableResult)1