use of com.amazonaws.services.dynamodbv2.model.ListTablesResult in project aws-doc-sdk-examples by awsdocs.
the class DocumentAPITableExample method listMyTables.
static void listMyTables() {
TableCollection<ListTablesResult> tables = dynamoDB.listTables();
Iterator<Table> iterator = tables.iterator();
System.out.println("Listing table names");
while (iterator.hasNext()) {
Table table = iterator.next();
System.out.println(table.getTableName());
}
}
use of com.amazonaws.services.dynamodbv2.model.ListTablesResult in project aws-doc-sdk-examples by awsdocs.
the class LowLevelTableExample method listMyTables.
static void listMyTables() {
String lastEvaluatedTableName = null;
do {
ListTablesRequest listTablesRequest = new ListTablesRequest().withLimit(10).withExclusiveStartTableName(lastEvaluatedTableName);
ListTablesResult result = client.listTables(listTablesRequest);
lastEvaluatedTableName = result.getLastEvaluatedTableName();
for (String name : result.getTableNames()) {
System.out.println(name);
}
} while (lastEvaluatedTableName != null);
}
use of com.amazonaws.services.dynamodbv2.model.ListTablesResult in project aws-doc-sdk-examples by awsdocs.
the class ListTables method main.
public static void main(String[] args) {
System.out.println("Your DynamoDB tables:\n");
final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient();
ListTablesRequest request;
boolean more_tables = true;
String last_name = null;
while (more_tables) {
try {
if (last_name == null) {
request = new ListTablesRequest().withLimit(10);
} else {
request = new ListTablesRequest().withLimit(10).withExclusiveStartTableName(last_name);
}
ListTablesResult table_list = ddb.listTables(request);
List<String> table_names = table_list.getTableNames();
if (table_names.size() > 0) {
for (String cur_name : table_names) {
System.out.format("* %s\n", cur_name);
}
} else {
System.out.println("No tables found!");
System.exit(0);
}
last_name = table_list.getLastEvaluatedTableName();
if (last_name == null) {
more_tables = false;
}
} catch (AmazonServiceException e) {
System.err.println(e.getErrorMessage());
System.exit(1);
}
}
System.out.println("\nDone!");
}
Aggregations