/** * 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 = dynamoDBClient.describeTable(describeTableRequest).getTable(); } catch(ResourceNotFoundException e){ LOG.error("Error while getting table schema: " + tableName); return tableDescription; } return tableDescription; }
/** * 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; }