{
  "typeName" : "AWS::S3Tables::TableBucket",
  "description" : "Creates an Amazon S3 Tables table bucket in the same AWS Region where you create the AWS CloudFormation stack.",
  "properties" : {
    "TableBucketARN" : {
      "$ref" : "#/definitions/TableBucketARN"
    },
    "TableBucketName" : {
      "$ref" : "#/definitions/TableBucketName"
    },
    "UnreferencedFileRemoval" : {
      "$ref" : "#/definitions/UnreferencedFileRemoval"
    },
    "EncryptionConfiguration" : {
      "$ref" : "#/definitions/EncryptionConfiguration"
    },
    "MetricsConfiguration" : {
      "$ref" : "#/definitions/MetricsConfiguration"
    },
    "StorageClassConfiguration" : {
      "$ref" : "#/definitions/StorageClassConfiguration"
    },
    "ReplicationConfiguration" : {
      "$ref" : "#/definitions/ReplicationConfiguration"
    },
    "Tags" : {
      "description" : "User tags (key-value pairs) to associate with the table bucket.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "definitions" : {
    "TableBucketARN" : {
      "description" : "The Amazon Resource Name (ARN) of the specified table bucket.",
      "type" : "string",
      "examples" : [ "arn:aws:s3tables:us-west-2:123456789012:bucket/mytablebucket" ]
    },
    "TableBucketName" : {
      "description" : "A name for the table bucket.",
      "type" : "string",
      "minLength" : 3,
      "maxLength" : 63
    },
    "UnreferencedFileRemoval" : {
      "description" : "Settings governing the Unreferenced File Removal maintenance action. Unreferenced file removal identifies and deletes all objects that are not referenced by any table snapshots.",
      "additionalProperties" : false,
      "type" : "object",
      "properties" : {
        "Status" : {
          "description" : "Indicates whether the Unreferenced File Removal maintenance action is enabled.",
          "type" : "string",
          "enum" : [ "Enabled", "Disabled" ]
        },
        "UnreferencedDays" : {
          "description" : "For any object not referenced by your table and older than the UnreferencedDays property, S3 creates a delete marker and marks the object version as noncurrent.",
          "type" : "integer",
          "minimum" : 1
        },
        "NoncurrentDays" : {
          "description" : "S3 permanently deletes noncurrent objects after the number of days specified by the NoncurrentDays property.",
          "type" : "integer",
          "minimum" : 1
        }
      }
    },
    "EncryptionConfiguration" : {
      "type" : "object",
      "description" : "Specifies encryption settings for the table bucket",
      "properties" : {
        "SSEAlgorithm" : {
          "type" : "string",
          "description" : "Server-side encryption algorithm",
          "enum" : [ "AES256", "aws:kms" ]
        },
        "KMSKeyArn" : {
          "type" : "string",
          "description" : "ARN of the KMS key to use for encryption"
        }
      },
      "additionalProperties" : false
    },
    "MetricsConfiguration" : {
      "type" : "object",
      "description" : "Settings governing the Metric configuration for the table bucket.",
      "properties" : {
        "Status" : {
          "description" : "Indicates whether Metrics are enabled.",
          "type" : "string",
          "default" : "Disabled",
          "enum" : [ "Enabled", "Disabled" ]
        }
      },
      "additionalProperties" : false
    },
    "StorageClassConfiguration" : {
      "type" : "object",
      "description" : "Specifies storage class settings for the table bucket",
      "properties" : {
        "StorageClass" : {
          "type" : "string",
          "description" : "The storage class for the table bucket",
          "enum" : [ "STANDARD", "INTELLIGENT_TIERING" ]
        }
      },
      "additionalProperties" : false
    },
    "ReplicationConfiguration" : {
      "type" : "object",
      "description" : "Specifies replication configuration for the table bucket",
      "properties" : {
        "Role" : {
          "type" : "string",
          "description" : "The ARN of the IAM role to use for replication"
        },
        "Rules" : {
          "type" : "array",
          "description" : "List of replication rules",
          "items" : {
            "$ref" : "#/definitions/ReplicationRule"
          },
          "minItems" : 1,
          "maxItems" : 1
        }
      },
      "required" : [ "Role", "Rules" ],
      "additionalProperties" : false
    },
    "ReplicationRule" : {
      "type" : "object",
      "description" : "A replication rule for the table bucket",
      "properties" : {
        "Destinations" : {
          "type" : "array",
          "description" : "List of replication destinations",
          "items" : {
            "$ref" : "#/definitions/ReplicationDestination"
          },
          "minItems" : 1,
          "maxItems" : 5
        }
      },
      "required" : [ "Destinations" ],
      "additionalProperties" : false
    },
    "ReplicationDestination" : {
      "type" : "object",
      "description" : "A replication destination",
      "properties" : {
        "DestinationTableBucketARN" : {
          "type" : "string",
          "description" : "The ARN of the destination table bucket"
        }
      },
      "required" : [ "DestinationTableBucketARN" ],
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "description" : "Tag key must be between 1 to 128 characters in length. Tag key cannot start with 'aws:' and can only contain alphanumeric characters, spaces, _, ., /, =, +, -, and @.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "description" : "Tag value must be between 0 to 256 characters in length. Tag value can only contain alphanumeric characters, spaces, _, ., /, =, +, -, and @.",
          "type" : "string",
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ]
    }
  },
  "additionalProperties" : false,
  "required" : [ "TableBucketName" ],
  "createOnlyProperties" : [ "/properties/TableBucketName" ],
  "readOnlyProperties" : [ "/properties/TableBucketARN" ],
  "primaryIdentifier" : [ "/properties/TableBucketARN" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "s3tables:TagResource", "s3tables:UntagResource", "s3tables:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "s3tables:CreateTableBucket", "s3tables:PutTableBucketMaintenanceConfiguration", "s3tables:PutTableBucketMetricsConfiguration", "s3tables:PutTableBucketEncryption", "s3tables:PutTableBucketStorageClass", "s3tables:PutTableBucketReplication", "s3tables:GetTableBucket", "s3tables:GetTableBucketMaintenanceConfiguration", "s3tables:GetTableBucketMetricsConfiguration", "s3tables:GetTableBucketEncryption", "s3tables:GetTableBucketStorageClass", "s3tables:GetTableBucketReplication", "kms:DescribeKey", "s3tables:TagResource", "s3tables:ListTagsForResource", "iam:PassRole" ]
    },
    "read" : {
      "permissions" : [ "s3tables:GetTableBucket", "s3tables:GetTableBucketMaintenanceConfiguration", "s3tables:GetTableBucketMetricsConfiguration", "s3tables:GetTableBucketEncryption", "s3tables:GetTableBucketStorageClass", "s3tables:GetTableBucketReplication", "s3tables:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "s3tables:DeleteTableBucketMetricsConfiguration", "s3tables:PutTableBucketMaintenanceConfiguration", "s3tables:PutTableBucketMetricsConfiguration", "s3tables:PutTableBucketEncryption", "s3tables:PutTableBucketStorageClass", "s3tables:PutTableBucketReplication", "s3tables:DeleteTableBucketReplication", "s3tables:GetTableBucketMaintenanceConfiguration", "s3tables:GetTableBucketMetricsConfiguration", "s3tables:GetTableBucketEncryption", "s3tables:GetTableBucketStorageClass", "s3tables:GetTableBucketReplication", "s3tables:DeleteTableBucketEncryption", "s3tables:GetTableBucket", "kms:DescribeKey", "s3tables:TagResource", "s3tables:UntagResource", "s3tables:ListTagsForResource", "iam:PassRole" ]
    },
    "delete" : {
      "permissions" : [ "s3tables:DeleteTableBucket" ]
    },
    "list" : {
      "permissions" : [ "s3tables:ListTableBuckets" ]
    }
  }
}