List of usage examples for com.amazonaws.services.dynamodbv2 AmazonDynamoDBClient listTables
@Override
public ListTablesResult listTables()
From source file:aws.example.dynamodb.ListTables.java
License:Open Source License
public static void main(String[] args) { System.out.println("Your DynamoDB tables:\n"); final AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(); boolean more_tables = true; while (more_tables) { String last_name = null;/*from www . ja v a 2 s.c o m*/ try { ListTablesResult table_list = null; if (last_name == null) { table_list = ddb.listTables(); } else { table_list = ddb.listTables(last_name); } 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!"); }
From source file:com.example.rafa.myapplication.DynamoDBManager.java
License:Open Source License
public static List<String> getTablesList() { AmazonDynamoDBClient ddb = MainActivity.clientManager.ddb(); try {/*from w ww.ja v a 2s . c o m*/ return ddb.listTables().getTableNames(); } catch (AmazonServiceException ex) { MainActivity.clientManager.wipeCredentialsOnAuthError(ex); } return null; }
From source file:org.wildfly.camel.test.common.aws.DynamoDBUtils.java
License:Apache License
public static void assertNoStaleTables(AmazonDynamoDBClient client, String when) { /* Get the list of tables without the ones in the deleting state */ List<String> tables = client.listTables().getTableNames().stream() .filter(t -> System.currentTimeMillis() - AWSUtils.toEpochMillis(t) > AWSUtils.HOUR || !"DELETING".equals(client.describeTable(t).getTable().getTableStatus())) .collect(Collectors.toList()); Assert.assertEquals(String.format("Found stale DynamoDB tables %s running the test: %s", when, tables), 0, tables.size());/*from w ww. j a va 2 s. com*/ }