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

The following examples show how to use com.amazonaws.services.dynamodbv2.model.DescribeTableRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamoDBClient.java    From emr-dynamodb-connector with Apache License 2.0 6 votes vote down vote up
public TableDescription describeTable(String tableName) {
  final DescribeTableRequest describeTablesRequest = new DescribeTableRequest()
      .withTableName(tableName);
  try {
    RetryResult<DescribeTableResult> describeResult = getRetryDriver().runWithRetry(
        new Callable<DescribeTableResult>() {
          @Override
          public DescribeTableResult call() {
            DescribeTableResult result = dynamoDB.describeTable(describeTablesRequest);
            log.info("Describe table output: " + result);
            return result;
          }
        }, null, null);
    return describeResult.result.getTable();
  } catch (Exception e) {
    throw new RuntimeException("Could not lookup table " + tableName + " in DynamoDB.", e);
  }
}
 
Example #2
Source File: LowLevelTableExample.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        TableDescription tableDescription = client.describeTable(request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e) {
        }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #3
Source File: LowLevelLocalSecondaryIndexExample.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        TableDescription tableDescription = client.describeTable(request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e) {
        }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #4
Source File: LowLevelGlobalSecondaryIndexExample.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);

    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        TableDescription tableDescription = client.describeTable(request).getTable();
        String tableStatus = tableDescription.getTableStatus();

        System.out.println("  - current state: " + tableStatus);

        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #5
Source File: LowLevelParallelScan.java    From aws-doc-sdk-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        TableDescription tableDescription = client.describeTable(request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e) {
        }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #6
Source File: TableHelper.java    From dynamodb-transactions with Apache License 2.0 6 votes vote down vote up
public void waitForTableDeleted(String tableName, long waitTimeSeconds) throws InterruptedException {
    
    if(waitTimeSeconds < 0) {
        throw new IllegalArgumentException("Invalid waitTimeSeconds " + waitTimeSeconds);
    }
    
    long startTimeMs = System.currentTimeMillis();
    long elapsedMs = 0;
    do {
        try {
            DescribeTableResult describe = client.describeTable(new DescribeTableRequest().withTableName(tableName));
            String status = describe.getTable().getTableStatus();
            if(! TableStatus.DELETING.toString().equals(status)) {
                throw new ResourceInUseException("Table " + tableName + " is " + status + ", and waiting for it to not exist is only useful if it is DELETING.");
            }
        } catch (ResourceNotFoundException e) {
            return;
        }
        Thread.sleep(10 * 1000);
        elapsedMs = System.currentTimeMillis() - startTimeMs; 
    } while(elapsedMs / 1000.0 < waitTimeSeconds);
    
    throw new ResourceInUseException("Table " + tableName + " was not deleted after " + waitTimeSeconds + " seconds.");
}
 
Example #7
Source File: TableHelper.java    From dynamodb-transactions with Apache License 2.0 6 votes vote down vote up
public void waitForTableActive(String tableName, long waitTimeSeconds) throws InterruptedException {
    if(waitTimeSeconds < 0) {
        throw new IllegalArgumentException("Invalid waitTimeSeconds " + waitTimeSeconds);
    }
    
    long startTimeMs = System.currentTimeMillis();
    long elapsedMs = 0;
    do {
        DescribeTableResult describe = client.describeTable(new DescribeTableRequest().withTableName(tableName));
        String status = describe.getTable().getTableStatus();
        if(TableStatus.ACTIVE.toString().equals(status)) {
            return;
        }
        if(TableStatus.DELETING.toString().equals(status)) {
            throw new ResourceInUseException("Table " + tableName + " is " + status + ", and waiting for it to become ACTIVE is not useful.");
        }
        Thread.sleep(10 * 1000);
        elapsedMs = System.currentTimeMillis() - startTimeMs; 
    } while(elapsedMs / 1000.0 < waitTimeSeconds);
    
    throw new ResourceInUseException("Table " + tableName + " did not become ACTIVE after " + waitTimeSeconds + " seconds.");
}
 
Example #8
Source File: Utilities.java    From reinvent2013-mobile-photo-share with Apache License 2.0 6 votes vote down vote up
public void setupTable() {
	setupGeoDataManager();

	GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();
	DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());

	try {
		config.getDynamoDBClient().describeTable(describeTableRequest);

		if (status == Status.NOT_STARTED) {
			status = Status.READY;
		}
	} catch (ResourceNotFoundException e) {
		PhotoLocationsTable photoLocationsTable = new PhotoLocationsTable();
		photoLocationsTable.start();
	}

}
 
Example #9
Source File: LowLevelTableExample.java    From aws-dynamodb-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest()
                .withTableName(tableName);
        TableDescription tableDescription = client.describeTable(
                request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try { Thread.sleep(1000 * 20); } catch (Exception e) { }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #10
Source File: Utilities.java    From dynamodb-geo with Apache License 2.0 6 votes vote down vote up
public void setupTable() {
	setupGeoDataManager();

	GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();
	DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());

	try {
		config.getDynamoDBClient().describeTable(describeTableRequest);

		if (status == Status.NOT_STARTED) {
			status = Status.READY;
		}
	} catch (ResourceNotFoundException e) {
		SchoolDataLoader schoolDataLoader = new SchoolDataLoader();
		schoolDataLoader.start();
	}

}
 
Example #11
Source File: LowLevelLocalSecondaryIndexExample.java    From aws-dynamodb-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest()
                .withTableName(tableName);
        TableDescription tableDescription = client.describeTable(
                request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try { Thread.sleep(1000 * 20); } catch (Exception e) { }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #12
Source File: LowLevelParallelScan.java    From aws-dynamodb-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = new DescribeTableRequest()
                .withTableName(tableName);
        TableDescription tableDescription = client.describeTable(
                request).getTable();
        String tableStatus = tableDescription.getTableStatus();
        System.out.println("  - current state: " + tableStatus);
        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
        try { Thread.sleep(1000 * 20); } catch (Exception e) { }
    }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #13
Source File: LowLevelGlobalSecondaryIndexExample.java    From aws-dynamodb-examples with Apache License 2.0 6 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    System.out.println("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);

    while (System.currentTimeMillis() < endTime) {
        DescribeTableRequest request = 
            new DescribeTableRequest().withTableName(tableName);
        TableDescription tableDescription = 
            client.describeTable(request).getTable();
        String tableStatus = tableDescription.getTableStatus();

        System.out.println("  - current state: " + tableStatus);

        if (tableStatus.equals(TableStatus.ACTIVE.toString()))
            return;
            try {
                Thread.sleep(1000 * 20);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #14
Source File: LowLevelTableExample.java    From aws-dynamodb-examples with Apache License 2.0 5 votes vote down vote up
static void getTableInformation() {
    
    TableDescription tableDescription = client.describeTable(
            new DescribeTableRequest().withTableName(tableName)).getTable();
    System.out.format("Name: %s:\n" +
            "Status: %s \n" + 
            "Provisioned Throughput (read capacity units/sec): %d \n" +
            "Provisioned Throughput (write capacity units/sec): %d \n",
            tableDescription.getTableName(),
            tableDescription.getTableStatus(),
            tableDescription.getProvisionedThroughput().getReadCapacityUnits(),
            tableDescription.getProvisionedThroughput().getWriteCapacityUnits());
}
 
Example #15
Source File: DynamoDBUtils.java    From amazon-kinesis-connectors with Apache License 2.0 5 votes vote down vote up
/**
 * Helper method to determine if an Amazon DynamoDB table exists.
 * 
 * @param client
 *        The {@link AmazonDynamoDBClient} with Amazon DynamoDB read privileges
 * @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;
    }
}
 
Example #16
Source File: DynamoDBDynamicFaultInjection.java    From aws-dynamodb-examples with Apache License 2.0 5 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName)
{
    logger.info("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime)
    {
        try
        {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e)
        {
        }
        try
        {
            DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
            TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable();
            String tableStatus = tableDescription.getTableStatus();
            logger.info("  - current state: " + tableStatus);
            if (tableStatus.equals(TableStatus.ACTIVE.toString()))
                return;
        }
        catch (AmazonServiceException ase)
        {
            if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == false)
                throw ase;
        }
    }

    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #17
Source File: Utilities.java    From dynamodb-geo with Apache License 2.0 5 votes vote down vote up
private void waitForTableToBeReady() {
	GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();

	DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());
	DescribeTableResult describeTableResult = config.getDynamoDBClient().describeTable(describeTableRequest);

	while (!describeTableResult.getTable().getTableStatus().equalsIgnoreCase("ACTIVE")) {
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			throw new RuntimeException(e);
		}
		describeTableResult = config.getDynamoDBClient().describeTable(describeTableRequest);
	}
}
 
Example #18
Source File: TransactionManager.java    From dynamodb-transactions with Apache License 2.0 5 votes vote down vote up
protected List<KeySchemaElement> getTableSchema(String tableName) throws ResourceNotFoundException {
    List<KeySchemaElement> schema = tableSchemaCache.get(tableName);
    if(schema == null) {
        DescribeTableResult result = client.describeTable(new DescribeTableRequest().withTableName(tableName));
        schema = Collections.unmodifiableList(result.getTable().getKeySchema());
        tableSchemaCache.put(tableName, schema);
    }
    return schema;
}
 
Example #19
Source File: DynamoDBUtils.java    From amazon-kinesis-connectors with Apache License 2.0 5 votes vote down vote up
/**
 * Verifies if the table has the expected schema.
 * 
 * @param client
 *        The {@link AmazonDynamoDBClient} with Amazon DynamoDB read privileges
 * @param tableName
 *        The Amazon DynamoDB table to check
 * @param key
 *        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;
    }
    AttributeDefinition attributeDefinition = tableDescription.getAttributeDefinitions().get(0);
    if (!attributeDefinition.getAttributeName().equals(key)
            || !attributeDefinition.getAttributeType().equals(ScalarAttributeType.S.toString())) {
        LOG.error("Attribute name or type does not match existing table.");
        return false;
    }
    List<KeySchemaElement> KSEs = tableDescription.getKeySchema();
    if (KSEs.size() != 1) {
        LOG.error("The number of key schema elements does not match the existing table.");
        return false;
    }
    KeySchemaElement kse = KSEs.get(0);
    if (!kse.getAttributeName().equals(key) || !kse.getKeyType().equals(KeyType.HASH.toString())) {
        LOG.error("The hash key does not match the existing table.");
        return false;
    }
    return true;

}
 
Example #20
Source File: BaseAdmin.java    From reinvent2013-mobile-photo-share with Apache License 2.0 5 votes vote down vote up
protected boolean doesTableExist(String tableName) {
    try {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        DescribeTableResult result = ddb.describeTable(request);
        return (result != null && "ACTIVE".equals(result.getTable().getTableStatus()));
    } catch (ResourceNotFoundException e) {
        return false;
    }
}
 
Example #21
Source File: Utilities.java    From reinvent2013-mobile-photo-share with Apache License 2.0 5 votes vote down vote up
private void waitForTableToBeReady() {
	GeoDataManagerConfiguration config = geoDataManager.getGeoDataManagerConfiguration();

	DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(config.getTableName());
	DescribeTableResult describeTableResult = config.getDynamoDBClient().describeTable(describeTableRequest);

	while (!describeTableResult.getTable().getTableStatus().equalsIgnoreCase("ACTIVE")) {
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			throw new RuntimeException(e);
		}
		describeTableResult = config.getDynamoDBClient().describeTable(describeTableRequest);
	}
}
 
Example #22
Source File: BaseAdmin.java    From reinvent2013-mobile-photo-share with Apache License 2.0 5 votes vote down vote up
protected boolean doesTableExist(String tableName) {
    try {
        DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
        DescribeTableResult result = ddb.describeTable(request);
        return (result != null && "ACTIVE".equals(result.getTable().getTableStatus()));
    } catch (ResourceNotFoundException e) {
        return false;
    }
}
 
Example #23
Source File: LowLevelTableExample.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
static void getTableInformation() {

        TableDescription tableDescription = client.describeTable(new DescribeTableRequest().withTableName(tableName))
            .getTable();
        System.out.format(
            "Name: %s:\n" + "Status: %s \n" + "Provisioned Throughput (read capacity units/sec): %d \n"
                + "Provisioned Throughput (write capacity units/sec): %d \n",
            tableDescription.getTableName(), tableDescription.getTableStatus(),
            tableDescription.getProvisionedThroughput().getReadCapacityUnits(),
            tableDescription.getProvisionedThroughput().getWriteCapacityUnits());
    }
 
Example #24
Source File: KinesisSource.java    From datacollector with Apache License 2.0 5 votes vote down vote up
private boolean leaseTableExists() {
  DescribeTableRequest request = new DescribeTableRequest();
  request.setTableName(conf.applicationName);
  DescribeTableResult result;
  try {
    result = dynamoDBClient.describeTable(request);
  } catch (ResourceNotFoundException e) {
    LOG.debug("Lease table '{}' does not exist", conf.applicationName);
    return false;
  }

  TableStatus tableStatus = TableStatus.fromValue(result.getTable().getTableStatus());
  LOG.debug("Lease table exists and is in '{}' state", tableStatus);
  return tableStatus == TableStatus.ACTIVE;
}
 
Example #25
Source File: DynamoDbDelegate.java    From dynamodb-janusgraph-storage-backend with Apache License 2.0 5 votes vote down vote up
private DescribeTableResult describeTable(final DescribeTableRequest request) throws BackendException {
    controlPlaneRateLimiter.acquire();
    final Timer.Context apiTimerContext = getTimerContext(DESCRIBE_TABLE, request.getTableName());
    DescribeTableResult result;
    try {
        result = client.describeTable(request);
    } catch (final Exception e) {
        throw processDynamoDbApiException(e, DESCRIBE_TABLE, request.getTableName());
    } finally {
        apiTimerContext.stop();
    }
    return result;
}
 
Example #26
Source File: DynamoDBDynamicFaultInjection.java    From aws-doc-sdk-examples with Apache License 2.0 5 votes vote down vote up
private static void waitForTableToBecomeAvailable(String tableName) {
    logger.info("Waiting for " + tableName + " to become ACTIVE...");

    long startTime = System.currentTimeMillis();
    long endTime = startTime + (10 * 60 * 1000);
    while (System.currentTimeMillis() < endTime) {
        try {
            Thread.sleep(1000 * 20);
        }
        catch (Exception e) {
        }
        try {
            DescribeTableRequest request = new DescribeTableRequest().withTableName(tableName);
            TableDescription tableDescription = dynamoDBClient.describeTable(request).getTable();
            String tableStatus = tableDescription.getTableStatus();
            logger.info("  - current state: " + tableStatus);
            if (tableStatus.equals(TableStatus.ACTIVE.toString()))
                return;
        }
        catch (AmazonServiceException ase) {
            if (ase.getErrorCode().equalsIgnoreCase("ResourceNotFoundException") == false)
                throw ase;
        }
    }

    throw new RuntimeException("Table " + tableName + " never went active");
}
 
Example #27
Source File: PostgresDynamoDB.java    From podyn with Apache License 2.0 4 votes vote down vote up
@Override
public DescribeTableResult describeTable(DescribeTableRequest describeTableRequest) {
	
	throw new UnsupportedOperationException();
}
 
Example #28
Source File: StreamsAdapterDemoHelper.java    From aws-doc-sdk-examples with Apache License 2.0 4 votes vote down vote up
public static DescribeTableResult describeTable(AmazonDynamoDB client, String tableName) {
    return client.describeTable(new DescribeTableRequest().withTableName(tableName));
}
 
Example #29
Source File: DynamoDBDynamicFaultInjection.java    From aws-doc-sdk-examples with Apache License 2.0 4 votes vote down vote up
private static void describeTable() {
    DescribeTableRequest describeTableRequest = new DescribeTableRequest().withTableName(TABLENAME);
    TableDescription tableDescription = dynamoDBClient.describeTable(describeTableRequest).getTable();
    logger.info("Table Description: " + tableDescription);
}
 
Example #30
Source File: TableHelper.java    From dynamodb-transactions with Apache License 2.0 4 votes vote down vote up
public String verifyTableExists( 
    String tableName, 
    List<AttributeDefinition> definitions, 
    List<KeySchemaElement> keySchema,
    List<LocalSecondaryIndex> localIndexes) {
    
    DescribeTableResult describe = client.describeTable(new DescribeTableRequest().withTableName(tableName));
    if(! new HashSet<AttributeDefinition>(definitions).equals(new HashSet<AttributeDefinition>(describe.getTable().getAttributeDefinitions()))) {
        throw new ResourceInUseException("Table " + tableName + " had the wrong AttributesToGet." 
            + " Expected: " + definitions + " "
            + " Was: " + describe.getTable().getAttributeDefinitions());
    }
    
    if(! keySchema.equals(describe.getTable().getKeySchema())) {
        throw new ResourceInUseException("Table " + tableName + " had the wrong KeySchema." 
            + " Expected: " + keySchema + " "
            + " Was: " + describe.getTable().getKeySchema());
    }
    
    List<LocalSecondaryIndex> theirLSIs = null;
    if(describe.getTable().getLocalSecondaryIndexes() != null) {
        theirLSIs = new ArrayList<LocalSecondaryIndex>();
        for(LocalSecondaryIndexDescription description : describe.getTable().getLocalSecondaryIndexes()) {
            LocalSecondaryIndex lsi = new LocalSecondaryIndex()
                .withIndexName(description.getIndexName())
                .withKeySchema(description.getKeySchema())
                .withProjection(description.getProjection());
            theirLSIs.add(lsi);
        }
    }
    
    if(localIndexes != null) {
        if(! new HashSet<LocalSecondaryIndex>(localIndexes).equals(new HashSet<LocalSecondaryIndex>(theirLSIs))) {
            throw new ResourceInUseException("Table " + tableName + " did not have the expected LocalSecondaryIndexes."
                + " Expected: " + localIndexes
                + " Was: " + theirLSIs);
        }
    } else {
        if(theirLSIs != null) {
            throw new ResourceInUseException("Table " + tableName + " had local secondary indexes, but expected none."
                + " Indexes: " + theirLSIs);
        }
    }

    return describe.getTable().getTableStatus();
}