/*
   Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   This file is licensed under the Apache License, Version 2.0 (the "License").
   You may not use this file except in compliance with the License. A copy of
   the License is located at
    http://aws.amazon.com/apache2.0/
   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied. See the License for the
   specific language governing permissions and limitations under the License.
*/


//snippet-sourcedescription:[DeleteTable.java demonstrates how to delete an AWS DynamoDB table]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[dynamodb]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[2/5/2020]
//snippet-sourceauthor:[soo-aws]

package com.example.dynamodb;
// snippet-start:[dynamodb.java2.delete_table.complete]
// snippet-start:[dynamodb.java2.delete_table.import]
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.model.DynamoDbException;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.DeleteTableRequest;

// snippet-end:[dynamodb.java2.delete_table.import]

/**
 * Deletes an AWS DynamoDB table.
 *
 * **Warning** The named table will actually be deleted!
 *
 * This code expects that you have AWS credentials set up, as described here:
 * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html
 */
public class DeleteTable {

    public static void main(String[] args) {
        final String USAGE = "\n" +
                "Usage:\n" +
                "    DeleteTable <table>\n\n" +
                "Where:\n" +
                "    table - the table to delete (i.e., Music3)\n\n" +
                "Example:\n" +
                "    DeleteTable Music3\n\n" +
                "**Warning** This program will actually delete the table\n" +
                "            that you specify!\n";

        if (args.length < 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        String tableName = args[0];

        System.out.format("Deleting table %s...\n", tableName);

        // snippet-start:[dynamodb.java2.delete_table.main]
        // Create the DynamoDbClient object
        Region region = Region.US_WEST_2;
        DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();

        DeleteTableRequest request = DeleteTableRequest.builder()
                .tableName(tableName)
                .build();

        try {
            ddb.deleteTable(request);

        } catch (DynamoDbException e) {
            System.err.println(e.getMessage());
            System.exit(1);
        }
        // snippet-end:[dynamodb.java2.delete_table.main]
        System.out.println(tableName +" was successfully deleted!");
    }
}
// snippet-end:[dynamodb.java2.delete_table.complete]

@@ -1,8 +1,329 @@
+//snippet-sourcedescription:%5BDeleteTable.java demonstrates how to delete an Amazon DynamoDB table%5D%0D%0A//snippet-keyword:%5BSDK for Java 2.0%5D%0D%0A//snippet-keyword:%5BCode Sample%5D%0D%0A//snippet-service:%5BAmazon DynamoDB%5D%0D%0A//snippet-sourcetype:%5Bfull-example%5D%0D%0A//snippet-sourcedate:%5B2/5/2020%5D%0D%0A//snippet-sourceauthor:%5Bscmacdon-aws%5D%0D%0A%0D%0A%0D%0A
 /*%0D%0A   C
@@ -335,18 +335,8 @@
 ght 
-2010-2020 
 Amaz
@@ -855,402 +855,39 @@
 */%0D%0A
-%0D%0A%0D%0A//snippet-sourcedescription:%5BDeleteTable.java demonstrates how to delete an AWS DynamoDB table%5D%0D%0A//snippet-keyword:%5BSDK for Java 2.0%5D%0D%0A//snippet-keyword:%5BCode Sample%5D%0D%0A//snippet-service:%5Bdynamodb%5D%0D%0A//snippet-sourcetype:%5Bfull-example%5D%0D%0A//snippet-sourcedate:%5B2/5/2020%5D%0D%0A//snippet-sourceauthor:%5Bsoo-aws%5D%0D%0A%0D%0Apackage com.example.dynamodb;%0D%0A// snippet-start:%5Bdynamodb.java2.delete_table.complete%5D
+package com.example.dynamodb;%0D%0A
 %0D%0A//
@@ -1200,18 +1200,16 @@
 quest;%0D%0A
-%0D%0A
 // snipp
@@ -2189,18 +2189,16 @@
 gs%5B0%5D;%0D%0A
-%0D%0A
         
@@ -2260,67 +2260,8 @@
 %0D%0A%0D%0A
-        // snippet-start:%5Bdynamodb.java2.delete_table.main%5D
 %0D%0A  
@@ -2341,14 +2341,14 @@
 .US_
-W
 E
+A
 ST_
-2
+1
 ;%0D%0A 
@@ -2403,32 +2403,266 @@
 er()
-.region(region).build();
+%0D%0A                .region(region)%0D%0A                .build();%0D%0A%0D%0A        deleteDynamoDBTable(ddb, tableName);%0D%0A    %7D%0D%0A%0D%0A    // snippet-start:%5Bdynamodb.java2.delete_table.main%5D%0D%0A    public static void deleteDynamoDBTable(DynamoDbClient ddb, String tableName) %7B
 %0D%0A%0D%0A
@@ -3125,59 +3125,4 @@
 %0A%7D%0D%0A
-// snippet-end:%5Bdynamodb.java2.delete_table.complete%5D%0D%0A

Update DeleteTable.java