Examples of DescribeTableRequest


Examples of com.amazonaws.services.dynamodb.model.DescribeTableRequest

  @Test
  public void describeTableWithoutTableName() {
    createTable();
    boolean wasError = false;
    try {
      DescribeTableResult res = getClient().describeTable(new DescribeTableRequest());
      wasError = res.getTable() == null;
    } catch (Exception e) {
      wasError = true;
    }
    Assert.assertTrue(wasError);
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

     * @return True if a table already exists with the specified name, otherwise
     *         false.
     */
    public static boolean doesTableExist(AmazonDynamoDB dynamo, String tableName) {
        try {
            TableDescription table = dynamo.describeTable(new DescribeTableRequest(tableName)).getTable();
            return TableStatus.ACTIVE.toString().equals(table.getTableStatus());
        } catch (ResourceNotFoundException rnfe) {
            // This means the table doesn't exist in the account yet
            return false;
        }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

    public static void waitForTableToBecomeActive(AmazonDynamoDB dynamo, String tableName) {
        long startTime = System.currentTimeMillis();
        long endTime = startTime + (10 * 60 * 1000);
        while (System.currentTimeMillis() < endTime) {
            try {
                TableDescription table = dynamo.describeTable(new DescribeTableRequest(tableName)).getTable();
                if (table != null && table.getTableStatus().equals(TableStatus.ACTIVE.toString()))
                    return;
            } catch (ResourceNotFoundException rnfe) {
                // ResourceNotFound means the table doesn't exist yet,
                // so ignore this error and just keep polling.
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

     * @return True if a table already exists with the specified name, otherwise
     *         false.
     */
    public static boolean doesTableExist(AmazonDynamoDB dynamo, String tableName) {
        try {
            TableDescription table = dynamo.describeTable(new DescribeTableRequest(tableName)).getTable();
            return TableStatus.ACTIVE.toString().equals(table.getTableStatus());
        } catch (ResourceNotFoundException rnfe) {
            // This means the table doesn't exist in the account yet
            return false;
        }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

            throw new AmazonClientException("Interval must be > 0 and < timeout");
        long startTime = System.currentTimeMillis();
        long endTime = startTime + timeout;
        while (System.currentTimeMillis() < endTime) {
            try {
                TableDescription table = dynamo.describeTable(new DescribeTableRequest(tableName)).getTable();
                if (table != null && table.getTableStatus().equals(TableStatus.ACTIVE.toString()))
                    return;
            } catch (ResourceNotFoundException rnfe) {
                // ResourceNotFound means the table doesn't exist yet,
                // so ignore this error and just keep polling.
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

                System.out.println("Waiting for " + tableName + " to become ACTIVE...");
                Tables.waitForTableToBecomeActive(dynamoDB, tableName);
            }

            // Describe our new table
            DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(tableName);
            TableDescription tableDescription = dynamoDB.describeTable(describeTableRequest).getTable();
            System.out.println("Table Description: " + tableDescription);

            // Add an item
            Map<String, AttributeValue> item = newItem("Bill & Ted's Excellent Adventure", 1989, "****", "James", "Sara");
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

     * @param tableName
     *        The Amazon DynamoDB table to get the status of
     * @return
     */
    private static TableStatus getTableStatus(AmazonDynamoDBClient client, String tableName) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        DescribeTableResult describeTableResult = client.describeTable(describeTableRequest);
        String status = describeTableResult.getTable().getTableStatus();
        return TableStatus.fromValue(status);
    }
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

     *        The expected hashkey for the Amazon DynamoDB table
     * @return true if the Amazon DynamoDB table exists and the expected hashkey matches the table schema,
     *         otherwise return false
     */
    private static boolean tableHasCorrectSchema(AmazonDynamoDBClient client, String tableName, String key) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        DescribeTableResult describeTableResult = client.describeTable(describeTableRequest);
        TableDescription tableDescription = describeTableResult.getTable();
        if (tableDescription.getAttributeDefinitions().size() != 1) {
            LOG.error("The number of attribute definitions does not match the existing table.");
            return false;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

     * @param tableName
     *        The Amazon DynamoDB table to check for
     * @return true if the Amazon DynamoDB table exists, otherwise return false
     */
    private static boolean tableExists(AmazonDynamoDBClient client, String tableName) {
        DescribeTableRequest describeTableRequest = new DescribeTableRequest();
        describeTableRequest.setTableName(tableName);
        try {
            client.describeTable(describeTableRequest);
            return true;
        } catch (ResourceNotFoundException e) {
            return false;
View Full Code Here

Examples of com.amazonaws.services.dynamodbv2.model.DescribeTableRequest

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean leaseTableExists() throws DependencyException {
        DescribeTableRequest request = new DescribeTableRequest();

        request.setTableName(table);

        DescribeTableResult result;
        try {
            result = dynamoDBClient.describeTable(request);
        } catch (ResourceNotFoundException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.