{
  "typeName" : "AWS::ElastiCache::CacheCluster",
  "$schema" : "https://raw.githubusercontent.com/aws-cloudformation/cloudformation-resource-schema/master/src/main/resources/schema/provider.definition.schema.v1.json",
  "description" : "Resource type definition for AWS::ElastiCache::CacheCluster",
  "additionalProperties" : false,
  "properties" : {
    "AutoMinorVersionUpgrade" : {
      "description" : "If you are running Redis engine version 6.0 or later, set this parameter to yes if you want to opt-in to the next minor version upgrade campaign.",
      "type" : "boolean"
    },
    "AZMode" : {
      "description" : "Specifies whether the nodes in this Memcached cluster are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region.",
      "type" : "string"
    },
    "CacheNodeType" : {
      "description" : "The compute and memory capacity of the nodes in the node group (shard).",
      "type" : "string"
    },
    "CacheParameterGroupName" : {
      "description" : "The name of the parameter group to associate with this cluster.",
      "type" : "string"
    },
    "CacheSecurityGroupNames" : {
      "description" : "A list of security group names to associate with this cluster.",
      "type" : "array",
      "uniqueItems" : true,
      "items" : {
        "type" : "string"
      },
      "insertionOrder" : false
    },
    "CacheSubnetGroupName" : {
      "description" : "The name of the subnet group to be used for the cluster.",
      "type" : "string"
    },
    "NotificationTopicArn" : {
      "description" : "The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.",
      "type" : "string"
    },
    "SnapshotArns" : {
      "description" : "A single-element string list containing an Amazon Resource Name (ARN) that uniquely identifies a Redis RDB snapshot file stored in Amazon S3.",
      "type" : "array",
      "uniqueItems" : true,
      "items" : {
        "type" : "string"
      },
      "insertionOrder" : false
    },
    "Port" : {
      "description" : "The port number on which each of the cache nodes accepts connections.",
      "type" : "integer"
    },
    "NumCacheNodes" : {
      "description" : "The number of cache nodes that the cache cluster should have.",
      "type" : "integer"
    },
    "SnapshotName" : {
      "description" : "The name of a Redis snapshot from which to restore data into the new node group (shard).",
      "type" : "string"
    },
    "PreferredAvailabilityZones" : {
      "description" : "A list of the Availability Zones in which cache nodes are created. The order of the zones in the list is not important.",
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "type" : "string"
      },
      "insertionOrder" : false
    },
    "VpcSecurityGroupIds" : {
      "description" : "One or more VPC security groups associated with the cluster.",
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "type" : "string"
      },
      "insertionOrder" : false
    },
    "ClusterName" : {
      "description" : "A name for the cache cluster.",
      "type" : "string"
    },
    "Engine" : {
      "description" : "The name of the cache engine to be used for this cluster.",
      "type" : "string"
    },
    "Tags" : {
      "description" : "A list of tags to be added to this resource.",
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "insertionOrder" : false
    },
    "EngineVersion" : {
      "description" : "The version number of the cache engine to be used for this cluster",
      "type" : "string"
    },
    "PreferredMaintenanceWindow" : {
      "description" : "Specifies the weekly time range during which maintenance on the cluster is performed.",
      "type" : "string"
    },
    "PreferredAvailabilityZone" : {
      "description" : "The EC2 Availability Zone in which the cluster is created.",
      "type" : "string"
    },
    "SnapshotWindow" : {
      "description" : "The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).",
      "type" : "string"
    },
    "NetworkType" : {
      "description" : "The network type parameter for cachecluster.",
      "type" : "string"
    },
    "IpDiscovery" : {
      "description" : "The Ip Discovery parameter for cachecluster.",
      "type" : "string"
    },
    "SnapshotRetentionLimit" : {
      "description" : "The number of days for which ElastiCache retains automatic snapshots before deleting them.",
      "type" : "integer"
    },
    "LogDeliveryConfigurations" : {
      "description" : "Specifies the destination, format and type of the logs",
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "$ref" : "#/definitions/LogDeliveryConfigurationRequest"
      },
      "insertionOrder" : false
    },
    "TransitEncryptionEnabled" : {
      "description" : "A flag that enables in-transit encryption when set to true. You cannot modify the value of TransitEncryptionEnabled after the cluster is created",
      "type" : "boolean"
    },
    "ConfigurationEndpoint" : {
      "description" : "Specifies the ConfigurationEndpoint address and port",
      "$ref" : "#/definitions/Endpoint"
    },
    "RedisEndpoint" : {
      "description" : "Specifies the RedisEndPoint address and port",
      "$ref" : "#/definitions/Endpoint"
    }
  },
  "definitions" : {
    "Endpoint" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Address" : {
          "type" : "string"
        },
        "Port" : {
          "type" : "string"
        }
      }
    },
    "LogDeliveryConfigurationRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LogType" : {
          "description" : "Valid value is either slow-log, which refers to slow-log or engine-log",
          "type" : "string"
        },
        "LogFormat" : {
          "description" : "Valid values are either json or text",
          "type" : "string"
        },
        "DestinationType" : {
          "description" : "Specify either CloudWatch Logs or Kinesis Data Firehose as the destination type. ",
          "type" : "string"
        },
        "DestinationDetails" : {
          "description" : "Configuration details of either a CloudWatch Logs destination or Kinesis Data Firehose destination.",
          "$ref" : "#/definitions/DestinationDetails"
        }
      },
      "required" : [ "LogFormat", "LogType", "DestinationType", "DestinationDetails" ]
    },
    "KinesisFirehoseDestinationDetails" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DeliveryStream" : {
          "description" : "The name of the Kinesis Data Firehose delivery stream",
          "type" : "string"
        }
      },
      "required" : [ "DeliveryStream" ]
    },
    "CloudWatchLogsDestinationDetails" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LogGroup" : {
          "description" : "The name of the CloudWatch Logs log group.",
          "type" : "string"
        }
      },
      "required" : [ "LogGroup" ]
    },
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Value" : {
          "type" : "string"
        },
        "Key" : {
          "type" : "string"
        }
      },
      "required" : [ "Value", "Key" ]
    },
    "DestinationDetails" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CloudWatchLogsDetails" : {
          "description" : "The configuration details of the CloudWatch Logs destination",
          "$ref" : "#/definitions/CloudWatchLogsDestinationDetails"
        },
        "KinesisFirehoseDetails" : {
          "description" : "The configuration details of the Kinesis Data Firehose destination.",
          "$ref" : "#/definitions/KinesisFirehoseDestinationDetails"
        }
      }
    }
  },
  "required" : [ "CacheNodeType", "NumCacheNodes", "Engine" ],
  "createOnlyProperties" : [ "/properties/Port", "/properties/SnapshotArns", "/properties/SnapshotName", "/properties/CacheSubnetGroupName", "/properties/ClusterName", "/properties/Engine", "/properties/NetworkType" ],
  "writeOnlyProperties" : [ "/properties/SnapshotArns", "/properties/SnapshotName", "/properties/CacheSecurityGroupNames", "/properties/PreferredAvailabilityZone" ],
  "conditionalCreateOnlyProperties" : [ "/properties/PreferredAvailabilityZones", "/properties/IpDiscovery" ],
  "primaryIdentifier" : [ "/properties/ClusterName" ],
  "readOnlyProperties" : [ "/properties/ConfigurationEndpoint", "/properties/ConfigurationEndpoint/Port", "/properties/ConfigurationEndpoint/Address", "/properties/RedisEndpoint", "/properties/RedisEndpoint/Port", "/properties/RedisEndpoint/Address" ],
  "deprecatedProperties" : [ "/properties/CacheSecurityGroupNames" ],
  "propertyTransform" : {
    "/properties/EngineVersion" : "$join($split(EngineVersion, \".\", 2), \".\")"
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "elasticache:AddTagsToResource", "elasticache:RemoveTagsFromResource", "elasticache:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "elasticache:DescribeCacheClusters", "elasticache:CreateCacheCluster", "elasticache:AddTagsToResource", "elasticache:DeleteCacheCluster", "s3:GetObject", "logs:CreateLogDelivery", "logs:GetLogDelivery", "logs:ListLogDeliveries", "logs:UpdateLogDelivery", "logs:DeleteLogDelivery", "logs:PutResourcePolicy", "logs:DescribeResourcePolicies", "logs:DescribeLogGroups", "logs:CreateLogStream", "firehose:TagDeliveryStream", "iam:CreateServiceLinkedRole" ],
      "timeoutInMinutes" : 240
    },
    "read" : {
      "permissions" : [ "elasticache:ListTagsForResource", "elasticache:DescribeCacheClusters", "logs:GetLogDelivery", "logs:DescribeLogGroups" ]
    },
    "update" : {
      "permissions" : [ "elasticache:DescribeCacheClusters", "elasticache:ModifyCacheCluster", "elasticache:AddTagsToResource", "elasticache:RemoveTagsFromResource", "elasticache:RebootCacheCluster", "logs:CreateLogDelivery", "logs:GetLogDelivery", "logs:ListLogDeliveries", "logs:UpdateLogDelivery", "logs:DeleteLogDelivery", "logs:PutResourcePolicy", "logs:DescribeResourcePolicies", "logs:DescribeLogGroups", "logs:CreateLogStream", "s3:GetObject", "firehose:TagDeliveryStream", "iam:CreateServiceLinkedRole" ],
      "timeoutInMinutes" : 240
    },
    "delete" : {
      "permissions" : [ "elasticache:DescribeCacheClusters", "elasticache:DeleteCacheCluster", "elasticache:CreateSnapshot" ],
      "timeoutInMinutes" : 240
    },
    "list" : {
      "permissions" : [ "elasticache:DescribeCacheClusters" ]
    }
  }
}