{
  "typeName" : "AWS::Cassandra::Table",
  "description" : "Resource schema for AWS::Cassandra::Table",
  "definitions" : {
    "Column" : {
      "type" : "object",
      "properties" : {
        "ColumnName" : {
          "type" : "string",
          "pattern" : "^[a-zA-Z0-9][a-zA-Z0-9_]{1,47}$"
        },
        "ColumnType" : {
          "type" : "string"
        }
      },
      "required" : [ "ColumnName", "ColumnType" ],
      "additionalProperties" : false
    },
    "ClusteringKeyColumn" : {
      "type" : "object",
      "properties" : {
        "Column" : {
          "$ref" : "#/definitions/Column"
        },
        "OrderBy" : {
          "type" : "string",
          "enum" : [ "ASC", "DESC" ],
          "default" : "ASC"
        }
      },
      "additionalProperties" : false,
      "required" : [ "Column" ]
    },
    "ProvisionedThroughput" : {
      "description" : "Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits",
      "type" : "object",
      "properties" : {
        "ReadCapacityUnits" : {
          "type" : "integer",
          "minimum" : 1
        },
        "WriteCapacityUnits" : {
          "type" : "integer",
          "minimum" : 1
        }
      },
      "additionalProperties" : false,
      "required" : [ "ReadCapacityUnits", "WriteCapacityUnits" ]
    },
    "Mode" : {
      "description" : "Capacity mode for the specified table",
      "type" : "string",
      "enum" : [ "PROVISIONED", "ON_DEMAND" ],
      "default" : "ON_DEMAND"
    },
    "BillingMode" : {
      "type" : "object",
      "properties" : {
        "Mode" : {
          "$ref" : "#/definitions/Mode"
        },
        "ProvisionedThroughput" : {
          "$ref" : "#/definitions/ProvisionedThroughput"
        }
      },
      "required" : [ "Mode" ],
      "additionalProperties" : false
    },
    "Tag" : {
      "description" : "A key-value pair to apply to the resource",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 256
        }
      },
      "required" : [ "Value", "Key" ]
    },
    "EncryptionSpecification" : {
      "description" : "Represents the settings used to enable server-side encryption",
      "type" : "object",
      "properties" : {
        "EncryptionType" : {
          "$ref" : "#/definitions/EncryptionType"
        },
        "KmsKeyIdentifier" : {
          "$ref" : "#/definitions/KmsKeyIdentifier"
        }
      },
      "required" : [ "EncryptionType" ],
      "additionalProperties" : false
    },
    "EncryptionType" : {
      "description" : "Server-side encryption type",
      "type" : "string",
      "enum" : [ "AWS_OWNED_KMS_KEY", "CUSTOMER_MANAGED_KMS_KEY" ],
      "default" : "AWS_OWNED_KMS_KEY"
    },
    "KmsKeyIdentifier" : {
      "description" : "The AWS KMS customer master key (CMK) that should be used for the AWS KMS encryption. To specify a CMK, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. ",
      "type" : "string"
    },
    "AutoScalingSpecification" : {
      "description" : "Represents the read and write settings used for AutoScaling.",
      "type" : "object",
      "properties" : {
        "WriteCapacityAutoScaling" : {
          "$ref" : "#/definitions/AutoScalingSetting"
        },
        "ReadCapacityAutoScaling" : {
          "$ref" : "#/definitions/AutoScalingSetting"
        }
      },
      "additionalProperties" : false
    },
    "AutoScalingSetting" : {
      "description" : "Represents configuration for auto scaling.",
      "type" : "object",
      "properties" : {
        "AutoScalingDisabled" : {
          "type" : "boolean",
          "default" : false
        },
        "MinimumUnits" : {
          "type" : "integer",
          "minimum" : 1
        },
        "MaximumUnits" : {
          "type" : "integer",
          "minimum" : 1
        },
        "ScalingPolicy" : {
          "$ref" : "#/definitions/ScalingPolicy"
        }
      },
      "additionalProperties" : false
    },
    "ScalingPolicy" : {
      "description" : "Represents scaling policy.",
      "type" : "object",
      "properties" : {
        "TargetTrackingScalingPolicyConfiguration" : {
          "$ref" : "#/definitions/TargetTrackingScalingPolicyConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "TargetTrackingScalingPolicyConfiguration" : {
      "description" : "Represents configuration for target tracking scaling policy.",
      "type" : "object",
      "properties" : {
        "DisableScaleIn" : {
          "type" : "boolean",
          "default" : "false"
        },
        "ScaleInCooldown" : {
          "type" : "integer",
          "default" : 0
        },
        "ScaleOutCooldown" : {
          "type" : "integer",
          "default" : 0
        },
        "TargetValue" : {
          "type" : "integer"
        }
      },
      "required" : [ "TargetValue" ],
      "additionalProperties" : false
    },
    "ReplicaSpecification" : {
      "description" : "Represents replica specifications.",
      "type" : "object",
      "properties" : {
        "Region" : {
          "type" : "string",
          "minLength" : 2,
          "maxLength" : 25
        },
        "ReadCapacityUnits" : {
          "type" : "integer"
        },
        "ReadCapacityAutoScaling" : {
          "$ref" : "#/definitions/AutoScalingSetting"
        }
      },
      "required" : [ "Region" ],
      "additionalProperties" : false
    },
    "CdcSpecification" : {
      "description" : "Represents the CDC configuration for the table",
      "type" : "object",
      "properties" : {
        "Status" : {
          "$ref" : "#/definitions/CdcStatus"
        },
        "ViewType" : {
          "$ref" : "#/definitions/CdcViewType"
        },
        "Tags" : {
          "description" : "An array of key-value pairs to apply to the CDC stream resource",
          "type" : "array",
          "uniqueItems" : true,
          "items" : {
            "$ref" : "#/definitions/Tag"
          },
          "minItems" : 0,
          "maxItems" : 50
        }
      },
      "required" : [ "Status" ],
      "additionalProperties" : false
    },
    "CdcStatus" : {
      "description" : "Indicates whether CDC is enabled or disabled for the table",
      "type" : "string",
      "enum" : [ "ENABLED", "DISABLED" ]
    },
    "CdcViewType" : {
      "description" : "Specifies what data should be captured in the change data stream",
      "type" : "string",
      "enum" : [ "NEW_IMAGE", "OLD_IMAGE", "KEYS_ONLY", "NEW_AND_OLD_IMAGES" ],
      "default" : "NEW_AND_OLD_IMAGES"
    },
    "WarmThroughput" : {
      "description" : "Warm throughput configuration for the table",
      "type" : "object",
      "properties" : {
        "ReadUnitsPerSecond" : {
          "type" : "integer",
          "minimum" : 1
        },
        "WriteUnitsPerSecond" : {
          "type" : "integer",
          "minimum" : 1
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "KeyspaceName" : {
      "description" : "Name for Cassandra keyspace",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9][a-zA-Z0-9_]{1,47}$"
    },
    "TableName" : {
      "description" : "Name for Cassandra table",
      "type" : "string",
      "pattern" : "^[a-zA-Z0-9][a-zA-Z0-9_]{1,47}$"
    },
    "RegularColumns" : {
      "description" : "Non-key columns of the table",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Column"
      }
    },
    "PartitionKeyColumns" : {
      "description" : "Partition key columns of the table",
      "type" : "array",
      "minItems" : 1,
      "uniqueItems" : true,
      "insertionOrder" : true,
      "items" : {
        "$ref" : "#/definitions/Column"
      }
    },
    "ClusteringKeyColumns" : {
      "description" : "Clustering key columns of the table",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : true,
      "items" : {
        "$ref" : "#/definitions/ClusteringKeyColumn"
      }
    },
    "BillingMode" : {
      "$ref" : "#/definitions/BillingMode"
    },
    "PointInTimeRecoveryEnabled" : {
      "description" : "Indicates whether point in time recovery is enabled (true) or disabled (false) on the table",
      "type" : "boolean"
    },
    "ClientSideTimestampsEnabled" : {
      "description" : "Indicates whether client side timestamps are enabled (true) or disabled (false) on the table. False by default, once it is enabled it cannot be disabled again.",
      "type" : "boolean"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource",
      "type" : "array",
      "uniqueItems" : true,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "minItems" : 0,
      "maxItems" : 50
    },
    "DefaultTimeToLive" : {
      "description" : "Default TTL (Time To Live) in seconds, where zero is disabled. If the value is greater than zero, TTL is enabled for the entire table and an expiration timestamp is added to each column.",
      "type" : "integer",
      "minimum" : 0
    },
    "EncryptionSpecification" : {
      "$ref" : "#/definitions/EncryptionSpecification"
    },
    "AutoScalingSpecifications" : {
      "$ref" : "#/definitions/AutoScalingSpecification"
    },
    "CdcSpecification" : {
      "$ref" : "#/definitions/CdcSpecification"
    },
    "ReplicaSpecifications" : {
      "type" : "array",
      "minItems" : 1,
      "uniqueItems" : true,
      "insertionOrder" : true,
      "items" : {
        "$ref" : "#/definitions/ReplicaSpecification"
      }
    },
    "WarmThroughput" : {
      "$ref" : "#/definitions/WarmThroughput"
    }
  },
  "additionalProperties" : false,
  "required" : [ "KeyspaceName", "PartitionKeyColumns" ],
  "createOnlyProperties" : [ "/properties/KeyspaceName", "/properties/TableName", "/properties/PartitionKeyColumns", "/properties/ClusteringKeyColumns", "/properties/ClientSideTimestampsEnabled" ],
  "writeOnlyProperties" : [ "/properties/AutoScalingSpecifications", "/properties/ReplicaSpecifications" ],
  "primaryIdentifier" : [ "/properties/KeyspaceName", "/properties/TableName" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "cassandra:TagResource", "cassandra:TagMultiRegionResource", "cassandra:UntagResource", "cassandra:UntagMultiRegionResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "cassandra:Create", "cassandra:CreateMultiRegionResource", "cassandra:Select", "cassandra:SelectMultiRegionResource", "cassandra:TagResource", "cassandra:TagMultiRegionResource", "kms:CreateGrant", "kms:DescribeKey", "kms:Encrypt", "kms:Decrypt", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:RegisterScalableTarget", "application-autoscaling:PutScalingPolicy", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:GetMetricData", "cloudwatch:PutMetricAlarm", "iam:CreateServiceLinkedRole" ]
    },
    "read" : {
      "permissions" : [ "cassandra:Select", "cassandra:SelectMultiRegionResource", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:RegisterScalableTarget", "application-autoscaling:PutScalingPolicy", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:GetMetricData", "cloudwatch:PutMetricAlarm" ]
    },
    "update" : {
      "permissions" : [ "cassandra:Alter", "cassandra:AlterMultiRegionResource", "cassandra:Select", "cassandra:SelectMultiRegionResource", "cassandra:TagResource", "cassandra:TagMultiRegionResource", "cassandra:UntagResource", "cassandra:UntagMultiRegionResource", "kms:CreateGrant", "kms:DescribeKey", "kms:Encrypt", "kms:Decrypt", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:RegisterScalableTarget", "application-autoscaling:PutScalingPolicy", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:GetMetricData", "cloudwatch:PutMetricAlarm", "iam:CreateServiceLinkedRole" ]
    },
    "delete" : {
      "permissions" : [ "cassandra:Drop", "cassandra:DropMultiRegionResource", "cassandra:Select", "cassandra:SelectMultiRegionResource", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:RegisterScalableTarget", "application-autoscaling:PutScalingPolicy", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:GetMetricData", "cloudwatch:PutMetricAlarm" ]
    },
    "list" : {
      "permissions" : [ "cassandra:Select", "cassandra:SelectMultiRegionResource", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:RegisterScalableTarget", "application-autoscaling:PutScalingPolicy", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:GetMetricData", "cloudwatch:PutMetricAlarm" ]
    }
  },
  "propertyTransform" : {
    "/properties/ClusteringKeyColumns/*/Column/ColumnType" : "$lowercase(ColumnType)",
    "/properties/PartitionKeyColumns/*/ColumnType" : "$lowercase(ColumnType)",
    "/properties/RegularColumns/*/ColumnType" : "$lowercase(ColumnType)"
  }
}