@@ -0,0 +1,1896 @@
+/*%0A   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.%0A   SPDX-License-Identifier: Apache-2.0%0A*/%0A%0Apackage com.example.tags;%0A%0Aimport com.amazonaws.services.lambda.runtime.Context;%0Aimport com.amazonaws.services.lambda.runtime.RequestHandler;%0Aimport com.amazonaws.services.lambda.runtime.LambdaLogger;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Apublic class Handler implements RequestHandler%3CMap%3CString,String%3E, String%3E %7B%0A%0A    @Override%0A    public String handleRequest(Map%3CString, String%3E event, Context context) %7B%0A        LambdaLogger logger = context.getLogger();%0A        String delFag = event.get(%22flag%22);%0A        logger.log(%22FLAG IS: %22 + delFag);%0A        S3Service s3Service = new S3Service();%0A        AnalyzePhotos photos = new AnalyzePhotos();%0A%0A        String bucketName = %22%3CEnter your bucket name%3E%22;%0A        List%3CString%3E myKeys = s3Service.listBucketObjects(bucketName);%0A        if (delFag.compareTo(%22true%22) == 0) %7B%0A%0A            // Create a List to store the data.%0A            List%3CArrayList%3CWorkItem%3E%3E myList = new ArrayList%3C%3E();%0A%0A            // loop through each element in the List and tag the assets.%0A            for (String key : myKeys) %7B%0A%0A                byte%5B%5D keyData = s3Service.getObjectBytes(bucketName, key);%0A%0A                // Analyze the photo and return a list where each element is a WorkItem.%0A                ArrayList%3CWorkItem%3E item = photos.detectLabels(keyData, key);%0A                myList.add(item);%0A            %7D%0A%0A            s3Service.tagAssets(myList, bucketName);%0A            logger.log(%22All Assets in the bucket are tagged!%22);%0A%0A        %7D else %7B%0A%0A            // Delete all object tags.%0A            for (String key : myKeys) %7B%0A                s3Service.deleteTagFromObject(bucketName, key);%0A                logger.log(%22All Assets in the bucket are deleted!%22);%0A            %7D%0A         %7D%0A        return delFag;%0A    %7D%0A%7D%0A

Create Handler.java