@@ -0,0 +1,3012 @@
+// snippet-sourcedescription:%5BDeleteCollection.java demonstrates how to delete an Amazon Rekognition collection.%5D%0A// snippet-service:%5BAmazon Rekognition%5D%0A// snippet-keyword:%5BJava%5D%0A// snippet-keyword:%5BAmazon Rekognition%5D%0A// snippet-keyword:%5BCode Sample%5D%0A// snippet-sourcetype:%5Bfull-example%5D%0A// snippet-sourcedate:%5B6-10-2020%5D%0A// snippet-sourceauthor:%5Bscmacdon - AWS%5D%0A%0A/**%0A * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A *%0A * This file is licensed under the Apache License, Version 2.0 (the %22License%22).%0A * You may not use this file except in compliance with the License. A copy of%0A * the License is located at%0A *%0A * http://aws.amazon.com/apache2.0/%0A *%0A * This file is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR%0A * CONDITIONS OF ANY KIND, either express or implied. See the License for the%0A * specific language governing permissions and limitations under the License.%0A */%0A%0Apackage com.example.rekognition;%0A%0A// snippet-start:%5Brekognition.java2.delete_collection.import%5D%0Aimport software.amazon.awssdk.regions.Region;%0Aimport software.amazon.awssdk.services.rekognition.RekognitionClient;%0Aimport software.amazon.awssdk.services.rekognition.model.DeleteCollectionRequest;%0Aimport software.amazon.awssdk.services.rekognition.model.DeleteCollectionResponse;%0Aimport software.amazon.awssdk.services.rekognition.model.RekognitionException;%0A// snippet-end:%5Brekognition.java2.delete_collection.import%5D%0A%0Apublic class DeleteCollection %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A%0A        final String USAGE = %22%5Cn%22 +%0A                %22DeleteCollection - deletes a collection%5Cn%5Cn%22 +%0A                %22Usage: DeleteCollection %3CcollectionName%3E %5Cn%5Cn%22 +%0A                %22Where:%5Cn%22 +%0A                %22  collectionName - the name of the collection %5Cn%5Cn%22;%0A%0A        if (args.length %3C 1) %7B%0A            System.out.println(USAGE);%0A            System.exit(1);%0A        %7D%0A%0A        String collectionId = args%5B0%5D;%0A%0A        Region region = Region.US_EAST_2;%0A        RekognitionClient rekClient = RekognitionClient.builder()%0A                .region(region)%0A                .build();%0A%0A        System.out.println(%22Deleting collection: %22 +%0A                collectionId);%0A%0A        deleteMyCollection(rekClient, collectionId);%0A    %7D%0A%0A    // snippet-start:%5Brekognition.java2.delete_collection.main%5D%0A    public static void deleteMyCollection(RekognitionClient rekClient,String collectionId ) %7B%0A%0A    try %7B%0A%0A        // Create a DeleteCollectionRequest object%0A        DeleteCollectionRequest deleteCollectionRequest = DeleteCollectionRequest.builder()%0A                .collectionId(collectionId)%0A                .build();%0A%0A        DeleteCollectionResponse deleteCollectionResponse = rekClient.deleteCollection(deleteCollectionRequest);%0A        System.out.println(collectionId + %22: %22 + deleteCollectionResponse.statusCode().toString());%0A%0A    %7D catch(RekognitionException e) %7B%0A        System.out.println(e.getMessage());%0A        System.exit(1);%0A    %7D%0A        // snippet-end:%5Brekognition.java2.delete_collection.main%5D%0A   %7D%0A %7D%0A%0A

Create DeleteCollection.java