Examples of DescribeTableResult


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

        if ("activeTable".equals(tableName)) {
            return tableWithStatus(TableStatus.ACTIVE);
        } else if ("creatibleTable".equals(tableName) && createTableRequest != null) {
            return tableWithStatus(TableStatus.ACTIVE);
        } else if ("FULL_DESCRIBE_TABLE".equals(tableName)) {
            return new DescribeTableResult().withTable(new TableDescription()
                    .withTableName(tableName)
                    .withTableStatus(TableStatus.ACTIVE)
                    .withCreationDateTime(new Date(NOW))
                    .withItemCount(100L)
                    .withKeySchema(new KeySchema(new KeySchemaElement().withAttributeName("name")))
View Full Code Here

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

        }
        throw new ResourceNotFoundException(tableName + " is missing");
    }

    private DescribeTableResult tableWithStatus(TableStatus active) {
        return new DescribeTableResult().withTable(new TableDescription().withTableStatus(active));
    }
View Full Code Here

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

        super(ddbClient, configuration, exchange);
    }

    @Override
    public void execute() {
        DescribeTableResult result = ddbClient.describeTable(new DescribeTableRequest()
                .withTableName(determineTableName()));

        Message msg = getMessageForResponse(exchange);
        msg.setHeader(DdbConstants.TABLE_NAME, result.getTable().getTableName());
        msg.setHeader(DdbConstants.TABLE_STATUS, result.getTable().getTableStatus());
        msg.setHeader(DdbConstants.CREATION_DATE, result.getTable().getCreationDateTime());
        msg.setHeader(DdbConstants.ITEM_COUNT, result.getTable().getItemCount());
        msg.setHeader(DdbConstants.KEY_SCHEMA, result.getTable().getKeySchema());
        msg.setHeader(DdbConstants.READ_CAPACITY,
                result.getTable().getProvisionedThroughput().getReadCapacityUnits());
        msg.setHeader(DdbConstants.WRITE_CAPACITY,
                result.getTable().getProvisionedThroughput().getWriteCapacityUnits());
        msg.setHeader(DdbConstants.TABLE_SIZE, result.getTable().getTableSizeBytes());
    }
View Full Code Here

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

      throw new AmazonServiceException(errors.toString());
    }

    // get information
    String tableName = request.getTableName();
    DescribeTableResult result = null;

    // Check to make sure table with same name doesn't exist
    if (this.tables.containsKey(tableName)) {
      Table table = this.tables.get(tableName);
      result = new DescribeTableResult().withTable(table.getTableDescription());
    } else {
      throw new ResourceNotFoundException("The table '" + tableName + "' does not exist.");
    }
    return result;
  }
View Full Code Here

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

    return result;
  }

  public com.amazonaws.services.dynamodbv2.model.DescribeTableResult describeTableV2(com.amazonaws.services.dynamodbv2.model.DescribeTableRequest v2Request) throws InternalServerErrorException, ResourceNotFoundException {
        DescribeTableRequest request = AlternatorDBApiVersion2Mapper.MapV2DescribeTableRequestToV1(v2Request);
        DescribeTableResult result = describeTable(request);
        return AlternatorDBApiVersion2Mapper.MapV1DescribeTableResultToV2(result);
  }
View Full Code Here

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

  @Test
  public void describeTable() {
    String name = createTableName();
    createTable(name);
    DescribeTableResult res = getClient().describeTable(new DescribeTableRequest().withTableName(name));
    Assert.assertNotNull(res.getTable());
    Assert.assertEquals(res.getTable().getTableName(), name);
  }
View Full Code Here

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

  @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.DescribeTableResult

     * @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.DescribeTableResult

     *         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;
        }
        AttributeDefinition attributeDefinition = tableDescription.getAttributeDefinitions().get(0);
View Full Code Here

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

    public boolean leaseTableExists() throws DependencyException {
        DescribeTableRequest request = new DescribeTableRequest();

        request.setTableName(table);

        DescribeTableResult result;
        try {
            result = dynamoDBClient.describeTable(request);
        } catch (ResourceNotFoundException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(String.format("Got ResourceNotFoundException for table %s in leaseTableExists, returning false.",
                        table));
            }

            return false;
        } catch (AmazonClientException e) {
            throw new DependencyException(e);
        }

        String tableStatus = result.getTable().getTableStatus();

        if (LOG.isDebugEnabled()) {
            LOG.debug("Lease table exists and is in status " + tableStatus);
        }
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.