{
  "typeName" : "AWS::MemoryDB::Cluster",
  "description" : "The AWS::MemoryDB::Cluster resource creates an Amazon MemoryDB Cluster.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-memorydb",
  "definitions" : {
    "Endpoint" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Address" : {
          "description" : "The DNS address of the primary read-write node.",
          "type" : "string"
        },
        "Port" : {
          "description" : "The port number that the engine is listening on. ",
          "type" : "integer"
        }
      }
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "description" : "The key for the tag. May not be null.",
          "pattern" : "^(?!aws:)(?!memorydb:)[a-zA-Z0-9 _\\.\\/=+:\\-@]{1,128}$",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128
        },
        "Value" : {
          "description" : "The tag's value. May be null.",
          "type" : "string",
          "pattern" : "^(?!aws:)(?!memorydb:)[a-zA-Z0-9 _\\.\\/=+:\\-@]{1,256}$",
          "minLength" : 1,
          "maxLength" : 256
        }
      },
      "required" : [ "Key", "Value" ]
    },
    "DataTieringStatus" : {
      "type" : "string",
      "enum" : [ "true", "false" ]
    },
    "SupportedNetworkTypes" : {
      "type" : "string",
      "enum" : [ "ipv4", "ipv6", "dual_stack" ]
    },
    "SupportedIpDiscoveryTypes" : {
      "type" : "string",
      "enum" : [ "ipv4", "ipv6" ]
    }
  },
  "properties" : {
    "ClusterName" : {
      "description" : "The name of the cluster. This value must be unique as it also serves as the cluster identifier.",
      "pattern" : "[a-z][a-z0-9\\-]*",
      "type" : "string"
    },
    "Description" : {
      "description" : "An optional description of the cluster.",
      "type" : "string"
    },
    "MultiRegionClusterName" : {
      "description" : "The name of the Global Datastore, it is generated by MemoryDB adding a prefix to MultiRegionClusterNameSuffix.",
      "type" : "string"
    },
    "Status" : {
      "description" : "The status of the cluster. For example, Available, Updating, Creating.",
      "type" : "string"
    },
    "NodeType" : {
      "description" : "The compute and memory capacity of the nodes in the cluster.",
      "type" : "string"
    },
    "NumShards" : {
      "description" : "The number of shards the cluster will contain.",
      "type" : "integer"
    },
    "NumReplicasPerShard" : {
      "description" : "The number of replicas to apply to each shard. The limit is 5.",
      "type" : "integer"
    },
    "SubnetGroupName" : {
      "description" : "The name of the subnet group to be used for the cluster.",
      "type" : "string"
    },
    "SecurityGroupIds" : {
      "description" : "One or more Amazon VPC security groups associated with this cluster.",
      "type" : "array",
      "uniqueItems" : false,
      "insertionOrder" : false,
      "items" : {
        "type" : "string"
      }
    },
    "MaintenanceWindow" : {
      "description" : "Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.",
      "type" : "string"
    },
    "ParameterGroupName" : {
      "description" : "The name of the parameter group associated with the cluster.",
      "type" : "string"
    },
    "ParameterGroupStatus" : {
      "description" : "The status of the parameter group used by the cluster.",
      "type" : "string"
    },
    "Port" : {
      "description" : "The port number on which each member of the cluster accepts connections.",
      "type" : "integer"
    },
    "SnapshotRetentionLimit" : {
      "description" : "The number of days for which MemoryDB retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.",
      "type" : "integer"
    },
    "SnapshotWindow" : {
      "description" : "The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your cluster.",
      "type" : "string"
    },
    "ACLName" : {
      "description" : "The name of the Access Control List to associate with the cluster.",
      "type" : "string",
      "pattern" : "[a-zA-Z][a-zA-Z0-9\\-]*"
    },
    "SnsTopicArn" : {
      "description" : "The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.",
      "type" : "string"
    },
    "SnsTopicStatus" : {
      "description" : "The status of the Amazon SNS notification topic. Notifications are sent only if the status is enabled.",
      "type" : "string"
    },
    "TLSEnabled" : {
      "description" : "A flag that enables in-transit encryption when set to true.\n\nYou cannot modify the value of TransitEncryptionEnabled after the cluster is created. To enable in-transit encryption on a cluster you must set TransitEncryptionEnabled to true when you create a cluster.",
      "type" : "boolean"
    },
    "DataTiering" : {
      "type" : "object",
      "description" : "Enables data tiering. Data tiering is only supported for clusters using the r6gd node type. This parameter must be set when using r6gd nodes.",
      "$ref" : "#/definitions/DataTieringStatus"
    },
    "NetworkType" : {
      "type" : "object",
      "description" : "Must be either ipv4 | ipv6 | dual_stack.",
      "$ref" : "#/definitions/SupportedNetworkTypes"
    },
    "IpDiscovery" : {
      "type" : "object",
      "description" : "For clusters wth dual stack NetworkType, IpDiscovery controls the Ip protocol (ipv4 or ipv6) returned by the engine commands such as `cluster info` and `cluster nodes` which are used by clients to connect to the nodes in the cluster.",
      "$ref" : "#/definitions/SupportedIpDiscoveryTypes"
    },
    "KmsKeyId" : {
      "description" : "The ID of the KMS key used to encrypt the cluster.",
      "type" : "string"
    },
    "SnapshotArns" : {
      "description" : "A list of Amazon Resource Names (ARN) that uniquely identify the RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new cluster. The Amazon S3 object name in the ARN cannot contain any commas.",
      "type" : "array",
      "uniqueItems" : false,
      "insertionOrder" : false,
      "items" : {
        "type" : "string"
      }
    },
    "SnapshotName" : {
      "description" : "The name of a snapshot from which to restore data into the new cluster. The snapshot status changes to restoring while the new cluster is being created.",
      "type" : "string"
    },
    "FinalSnapshotName" : {
      "description" : "The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. MemoryDB creates the snapshot, and then deletes the cluster immediately afterward.",
      "type" : "string"
    },
    "ARN" : {
      "description" : "The Amazon Resource Name (ARN) of the cluster.",
      "type" : "string"
    },
    "Engine" : {
      "description" : "The engine type used by the cluster.",
      "type" : "string"
    },
    "EngineVersion" : {
      "description" : "The Redis engine version used by the cluster.",
      "type" : "string"
    },
    "ClusterEndpoint" : {
      "description" : "The cluster endpoint.",
      "$ref" : "#/definitions/Endpoint"
    },
    "AutoMinorVersionUpgrade" : {
      "description" : "A flag that enables automatic minor version upgrade when set to true.\n\nYou cannot modify the value of AutoMinorVersionUpgrade after the cluster is created. To enable AutoMinorVersionUpgrade on a cluster you must set AutoMinorVersionUpgrade to true when you create a cluster.",
      "type" : "boolean"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this cluster.",
      "type" : "array",
      "maxItems" : 50,
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "memorydb:TagResource", "memorydb:ListTags", "memorydb:UntagResource" ]
  },
  "additionalProperties" : false,
  "readOnlyProperties" : [ "/properties/Status", "/properties/ClusterEndpoint/Address", "/properties/ClusterEndpoint/Port", "/properties/ARN", "/properties/ParameterGroupStatus" ],
  "required" : [ "ClusterName", "NodeType", "ACLName" ],
  "createOnlyProperties" : [ "/properties/ClusterName", "/properties/TLSEnabled", "/properties/DataTiering", "/properties/KmsKeyId", "/properties/Port", "/properties/SubnetGroupName", "/properties/SnapshotArns", "/properties/MultiRegionClusterName", "/properties/SnapshotName", "/properties/NetworkType" ],
  "writeOnlyProperties" : [ "/properties/SnapshotArns", "/properties/SnapshotName", "/properties/MultiRegionClusterName", "/properties/FinalSnapshotName" ],
  "primaryIdentifier" : [ "/properties/ClusterName" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "kms:DescribeKey", "kms:CreateGrant", "memorydb:CreateCluster", "memorydb:DescribeClusters", "memorydb:TagResource", "memorydb:ListTags", "iam:CreateServiceLinkedRole" ],
      "timeoutInMinutes" : 720
    },
    "read" : {
      "permissions" : [ "memorydb:DescribeClusters", "memorydb:ListTags" ]
    },
    "update" : {
      "permissions" : [ "memorydb:UpdateCluster", "memorydb:DescribeClusters", "memorydb:ListTags", "memorydb:TagResource", "memorydb:UntagResource" ],
      "timeoutInMinutes" : 2160
    },
    "delete" : {
      "permissions" : [ "memorydb:DeleteCluster", "memorydb:DescribeClusters" ]
    },
    "list" : {
      "permissions" : [ "memorydb:DescribeClusters" ]
    }
  }
}