{
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-s3-storagelens",
  "tagging" : {
    "permissions" : [ "s3:PutStorageLensConfigurationTagging", "s3:GetStorageLensConfigurationTagging", "s3:DeleteStorageLensConfigurationTagging" ],
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "tagProperty" : "/properties/Tags",
    "cloudFormationSystemTags" : false
  },
  "handlers" : {
    "read" : {
      "permissions" : [ "s3:GetStorageLensConfiguration", "s3:GetStorageLensConfigurationTagging" ]
    },
    "create" : {
      "permissions" : [ "s3:PutStorageLensConfiguration", "s3:PutStorageLensConfigurationTagging", "s3:GetStorageLensConfiguration", "s3:GetStorageLensConfigurationTagging", "s3tables:CreateTableBucket", "s3tables:PutTableBucketPolicy", "organizations:DescribeOrganization", "organizations:ListAccounts", "organizations:ListAWSServiceAccessForOrganization", "organizations:ListDelegatedAdministrators", "iam:CreateServiceLinkedRole" ]
    },
    "update" : {
      "permissions" : [ "s3:PutStorageLensConfiguration", "s3:PutStorageLensConfigurationTagging", "s3:GetStorageLensConfiguration", "s3:GetStorageLensConfigurationTagging", "s3tables:CreateTableBucket", "s3tables:PutTableBucketPolicy", "organizations:DescribeOrganization", "organizations:ListAccounts", "organizations:ListAWSServiceAccessForOrganization", "organizations:ListDelegatedAdministrators", "iam:CreateServiceLinkedRole" ]
    },
    "list" : {
      "permissions" : [ "s3:ListStorageLensConfigurations" ]
    },
    "delete" : {
      "permissions" : [ "s3:DeleteStorageLensConfiguration", "s3:DeleteStorageLensConfigurationTagging" ]
    }
  },
  "typeName" : "AWS::S3::StorageLens",
  "readOnlyProperties" : [ "/properties/StorageLensConfiguration/StorageLensArn" ],
  "description" : "The AWS::S3::StorageLens resource is an Amazon S3 resource type that you can use to create Storage Lens configurations.",
  "createOnlyProperties" : [ "/properties/StorageLensConfiguration/Id" ],
  "additionalProperties" : false,
  "primaryIdentifier" : [ "/properties/StorageLensConfiguration/Id" ],
  "definitions" : {
    "PrefixLevel" : {
      "description" : "Prefix-level metrics configurations.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "StorageMetrics" : {
          "$ref" : "#/definitions/PrefixLevelStorageMetrics"
        }
      },
      "required" : [ "StorageMetrics" ]
    },
    "StorageLensConfiguration" : {
      "description" : "Specifies the details of Amazon S3 Storage Lens configuration.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "AccountLevel" : {
          "$ref" : "#/definitions/AccountLevel"
        },
        "Exclude" : {
          "$ref" : "#/definitions/BucketsAndRegions"
        },
        "IsEnabled" : {
          "description" : "Specifies whether the Amazon S3 Storage Lens configuration is enabled or disabled.",
          "type" : "boolean"
        },
        "Include" : {
          "$ref" : "#/definitions/BucketsAndRegions"
        },
        "PrefixDelimiter" : {
          "description" : "The delimiter to divide S3 key into hierarchy of prefixes.",
          "type" : "string"
        },
        "AwsOrg" : {
          "$ref" : "#/definitions/AwsOrg"
        },
        "Id" : {
          "$ref" : "#/definitions/Id"
        },
        "StorageLensArn" : {
          "description" : "The ARN for the Amazon S3 Storage Lens configuration.",
          "type" : "string"
        },
        "DataExport" : {
          "$ref" : "#/definitions/DataExport"
        },
        "ExpandedPrefixesDataExport" : {
          "$ref" : "#/definitions/StorageLensExpandedPrefixesDataExport"
        }
      },
      "required" : [ "Id", "AccountLevel", "IsEnabled" ]
    },
    "PrefixLevelStorageMetrics" : {
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether prefix-level storage metrics are enabled or disabled.",
          "type" : "boolean"
        },
        "SelectionCriteria" : {
          "$ref" : "#/definitions/SelectionCriteria"
        }
      }
    },
    "Encryption" : {
      "oneOf" : [ {
        "additionalProperties" : false,
        "properties" : {
          "SSES3" : {
            "description" : "S3 default server-side encryption.",
            "additionalProperties" : false,
            "type" : "object"
          }
        },
        "required" : [ "SSES3" ]
      }, {
        "additionalProperties" : false,
        "properties" : {
          "SSEKMS" : {
            "$ref" : "#/definitions/SSEKMS"
          }
        },
        "required" : [ "SSEKMS" ]
      } ],
      "description" : "Configures the server-side encryption for Amazon S3 Storage Lens report files with either S3-managed keys (SSE-S3) or KMS-managed keys (SSE-KMS).",
      "type" : "object"
    },
    "DetailedStatusCodesMetrics" : {
      "description" : "Enables detailed status codes metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether detailed status codes metrics are enabled or disabled.",
          "type" : "boolean"
        }
      }
    },
    "AdvancedDataProtectionMetrics" : {
      "description" : "Enables advanced data protection metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether advanced data protection metrics are enabled or disabled.",
          "type" : "boolean"
        }
      }
    },
    "StorageLensGroupSelectionCriteria" : {
      "description" : "Selection criteria for Storage Lens Group level metrics",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Exclude" : {
          "uniqueItems" : true,
          "insertionOrder" : false,
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/StorageLensGroupArn"
          }
        },
        "Include" : {
          "uniqueItems" : true,
          "insertionOrder" : false,
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/StorageLensGroupArn"
          }
        }
      }
    },
    "S3BucketDestination" : {
      "description" : "S3 bucket destination settings for the Amazon S3 Storage Lens metrics export.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "OutputSchemaVersion" : {
          "description" : "The version of the output schema to use when exporting Amazon S3 Storage Lens metrics.",
          "type" : "string",
          "enum" : [ "V_1" ]
        },
        "Format" : {
          "description" : "Specifies the file format to use when exporting Amazon S3 Storage Lens metrics export.",
          "type" : "string",
          "enum" : [ "CSV", "Parquet" ]
        },
        "AccountId" : {
          "description" : "The AWS account ID that owns the destination S3 bucket.",
          "type" : "string"
        },
        "Prefix" : {
          "description" : "The prefix to use for Amazon S3 Storage Lens export.",
          "type" : "string"
        },
        "Encryption" : {
          "$ref" : "#/definitions/Encryption"
        },
        "Arn" : {
          "description" : "The ARN of the bucket to which Amazon S3 Storage Lens exports will be placed.",
          "type" : "string"
        }
      },
      "required" : [ "OutputSchemaVersion", "Format", "AccountId", "Arn" ]
    },
    "BucketsAndRegions" : {
      "description" : "S3 buckets and Regions to include/exclude in the Amazon S3 Storage Lens configuration.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Regions" : {
          "uniqueItems" : true,
          "insertionOrder" : false,
          "type" : "array",
          "items" : {
            "description" : "An AWS Region.",
            "type" : "string"
          }
        },
        "Buckets" : {
          "uniqueItems" : true,
          "insertionOrder" : false,
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/Arn"
          }
        }
      }
    },
    "BucketLevel" : {
      "description" : "Bucket-level metrics configurations.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "AdvancedDataProtectionMetrics" : {
          "$ref" : "#/definitions/AdvancedDataProtectionMetrics"
        },
        "PrefixLevel" : {
          "$ref" : "#/definitions/PrefixLevel"
        },
        "ActivityMetrics" : {
          "$ref" : "#/definitions/ActivityMetrics"
        },
        "AdvancedPerformanceMetrics" : {
          "$ref" : "#/definitions/AdvancedPerformanceMetrics"
        },
        "AdvancedCostOptimizationMetrics" : {
          "$ref" : "#/definitions/AdvancedCostOptimizationMetrics"
        },
        "DetailedStatusCodesMetrics" : {
          "$ref" : "#/definitions/DetailedStatusCodesMetrics"
        }
      }
    },
    "DataExport" : {
      "description" : "Specifies how Amazon S3 Storage Lens metrics should be exported.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "StorageLensTableDestination" : {
          "$ref" : "#/definitions/StorageLensTableDestination"
        },
        "S3BucketDestination" : {
          "$ref" : "#/definitions/S3BucketDestination"
        },
        "CloudWatchMetrics" : {
          "$ref" : "#/definitions/CloudWatchMetrics"
        }
      }
    },
    "StorageLensGroupArn" : {
      "description" : "The ARN for the Amazon S3 Storage Lens Group configuration.",
      "type" : "string"
    },
    "AwsOrg" : {
      "description" : "The AWS Organizations ARN to use in the Amazon S3 Storage Lens configuration.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Arn" : {
          "$ref" : "#/definitions/Arn"
        }
      },
      "required" : [ "Arn" ]
    },
    "AccountLevel" : {
      "description" : "Account-level metrics configurations.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "AdvancedDataProtectionMetrics" : {
          "$ref" : "#/definitions/AdvancedDataProtectionMetrics"
        },
        "StorageLensGroupLevel" : {
          "$ref" : "#/definitions/StorageLensGroupLevel"
        },
        "ActivityMetrics" : {
          "$ref" : "#/definitions/ActivityMetrics"
        },
        "AdvancedPerformanceMetrics" : {
          "$ref" : "#/definitions/AdvancedPerformanceMetrics"
        },
        "BucketLevel" : {
          "$ref" : "#/definitions/BucketLevel"
        },
        "AdvancedCostOptimizationMetrics" : {
          "$ref" : "#/definitions/AdvancedCostOptimizationMetrics"
        },
        "DetailedStatusCodesMetrics" : {
          "$ref" : "#/definitions/DetailedStatusCodesMetrics"
        }
      },
      "required" : [ "BucketLevel" ]
    },
    "StorageLensGroupLevel" : {
      "description" : "Specifies the details of Amazon S3 Storage Lens Group configuration.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "StorageLensGroupSelectionCriteria" : {
          "$ref" : "#/definitions/StorageLensGroupSelectionCriteria"
        }
      }
    },
    "StorageLensTableDestination" : {
      "description" : "S3 Tables destination settings for the Amazon S3 Storage Lens metrics export.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether the export to S3 Tables is enabled or disabled.",
          "type" : "boolean"
        },
        "Encryption" : {
          "$ref" : "#/definitions/Encryption"
        }
      },
      "required" : [ "IsEnabled" ]
    },
    "ActivityMetrics" : {
      "description" : "Enables activity metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether activity metrics are enabled or disabled.",
          "type" : "boolean"
        }
      }
    },
    "SelectionCriteria" : {
      "description" : "Selection criteria for prefix-level metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Delimiter" : {
          "description" : "Delimiter to divide S3 key into hierarchy of prefixes.",
          "type" : "string"
        },
        "MaxDepth" : {
          "description" : "Max depth of prefixes of S3 key that Amazon S3 Storage Lens will analyze.",
          "type" : "integer"
        },
        "MinStorageBytesPercentage" : {
          "description" : "The minimum storage bytes threshold for the prefixes to be included in the analysis.",
          "type" : "number"
        }
      }
    },
    "CloudWatchMetrics" : {
      "description" : "CloudWatch metrics settings for the Amazon S3 Storage Lens metrics export.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether CloudWatch metrics are enabled or disabled.",
          "type" : "boolean"
        }
      },
      "required" : [ "IsEnabled" ]
    },
    "SSEKMS" : {
      "description" : "AWS KMS server-side encryption.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "KeyId" : {
          "description" : "The ARN of the KMS key to use for encryption.",
          "type" : "string"
        }
      },
      "required" : [ "KeyId" ]
    },
    "AdvancedPerformanceMetrics" : {
      "description" : "Advanced Performance Metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether the Advanced Performance Metrics is enabled or disabled.",
          "type" : "boolean"
        }
      }
    },
    "Id" : {
      "minLength" : 1,
      "pattern" : "^[a-zA-Z0-9\\-_.]+$",
      "description" : "The ID that identifies the Amazon S3 Storage Lens configuration.",
      "type" : "string",
      "maxLength" : 64
    },
    "Tag" : {
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Value" : {
          "minLength" : 1,
          "pattern" : "^(?!aws:.*)[a-zA-Z0-9\\s\\_\\.\\/\\=\\+\\-\\@\\:]+$",
          "type" : "string",
          "maxLength" : 255
        },
        "Key" : {
          "minLength" : 1,
          "pattern" : "^(?!aws:.*)[a-zA-Z0-9\\s\\_\\.\\/\\=\\+\\-\\@\\:]+$",
          "type" : "string",
          "maxLength" : 127
        }
      },
      "required" : [ "Key", "Value" ]
    },
    "Arn" : {
      "description" : "The Amazon Resource Name (ARN) of the specified resource.",
      "type" : "string"
    },
    "StorageLensExpandedPrefixesDataExport" : {
      "description" : "Expanded Prefixes Data Export.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "StorageLensTableDestination" : {
          "$ref" : "#/definitions/StorageLensTableDestination"
        },
        "S3BucketDestination" : {
          "$ref" : "#/definitions/S3BucketDestination"
        }
      }
    },
    "AdvancedCostOptimizationMetrics" : {
      "description" : "Enables advanced cost optimization metrics.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "IsEnabled" : {
          "description" : "Specifies whether advanced cost optimization metrics are enabled or disabled.",
          "type" : "boolean"
        }
      }
    }
  },
  "properties" : {
    "StorageLensConfiguration" : {
      "$ref" : "#/definitions/StorageLensConfiguration"
    },
    "Tags" : {
      "maxItems" : 50,
      "uniqueItems" : true,
      "description" : "A set of tags (key-value pairs) for this Amazon S3 Storage Lens configuration.",
      "insertionOrder" : false,
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "required" : [ "StorageLensConfiguration" ]
}