Amazon.DynamoDBv2.AmazonDynamoDBClient.ListTables C# (CSharp) Method

ListTables() public method

Returns an array of table names associated with the current account and endpoint. The output from ListTables is paginated, with each page returning a maximum of 100 table names.
/// An error occurred on the server side. ///
public ListTables ( ) : ListTablesResponse
return Amazon.DynamoDBv2.Model.ListTablesResponse
        public ListTablesResponse ListTables()
        {
            return ListTables(new ListTablesRequest());
        }

Same methods

AmazonDynamoDBClient::ListTables ( ListTablesRequest request ) : ListTablesResponse
AmazonDynamoDBClient::ListTables ( int limit ) : ListTablesResponse
AmazonDynamoDBClient::ListTables ( string exclusiveStartTableName ) : ListTablesResponse
AmazonDynamoDBClient::ListTables ( string exclusiveStartTableName, int limit ) : ListTablesResponse

Usage Example

Example #1
0
        /// <summary>
        /// Creates all samples defined in SampleTables map
        /// </summary>
        /// <param name="client"></param>
        public static void CreateSampleTables(AmazonDynamoDBClient client)
        {
            Console.WriteLine("Getting list of tables");
            List<string> currentTables = client.ListTables().TableNames;
            Console.WriteLine("Number of tables: " + currentTables.Count);

            bool tablesAdded = false;
            if (!currentTables.Contains("Businesses"))
            {
                Console.WriteLine("Table Businesses does not exist, creating");
                client.CreateTable(new CreateTableRequest
                {
                    TableName = "Businesses",
                    ProvisionedThroughput = new ProvisionedThroughput { ReadCapacityUnits = 3, WriteCapacityUnits = 1 },
                    KeySchema = new List<KeySchemaElement>
                    {
                        new KeySchemaElement
                        {
                            AttributeName = "Name",
                            KeyType = KeyType.HASH
                        },
                        new KeySchemaElement
                        {
                            AttributeName = "Id",
                            KeyType = KeyType.RANGE
                        }
                    },
                    AttributeDefinitions = new List<AttributeDefinition>
                    {
                        new AttributeDefinition { AttributeName = "Name", AttributeType = ScalarAttributeType.S },
                        new AttributeDefinition { AttributeName = "Id", AttributeType = ScalarAttributeType.N }
                    }
                });
                tablesAdded = true;
            }

            if (tablesAdded)
            {
                bool allActive;
                do
                {
                    allActive = true;
                    Console.WriteLine("While tables are still being created, sleeping for 5 seconds...");
                    Thread.Sleep(TimeSpan.FromSeconds(5));

                    foreach (var tableName in SAMPLE_TABLE_NAMES)
                    {
                        string tableStatus = GetTableStatus(client, tableName);
                        bool isTableActive = string.Equals(tableStatus, "ACTIVE", StringComparison.OrdinalIgnoreCase);
                        if (!isTableActive)
                            allActive = false;
                    }
                } while (!allActive);
            }

            Console.WriteLine("All sample tables created");
        }
All Usage Examples Of Amazon.DynamoDBv2.AmazonDynamoDBClient::ListTables