def create_manifest_file()

in functions/CreateManifestFileInS3/lambda_function.py [0:0]


def create_manifest_file(event, context):
    bucket_name = event['ResourceProperties']['BucketName']
    prefix = event['ResourceProperties']['Prefix']
    manifest_file_name = event['ResourceProperties']['ManifestFileName']
    try:
        uri_prefixes = { "URIPrefixes" : [ prefix ] }
        global_upload_settings = {"format" : "JSON"}
        file_locations = [uri_prefixes]

        data_set = {
            "fileLocations" : file_locations,
            "globalUploadSettings" : global_upload_settings
        }

        json_dump = json.dumps(data_set)
        print(json_dump)
        response = client.put_object(
            Bucket = bucket_name,
            Key = manifest_file_name,
            Body = json_dump.encode('utf-8')
        )
        print(response)
    except Exception as e:
        print(e)
        raise e