{
  "typeName" : "AWS::ECS::ClusterCapacityProviderAssociations",
  "description" : "Associate a set of ECS Capacity Providers with a specified ECS Cluster",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-rpdk.git",
  "definitions" : {
    "CapacityProviders" : {
      "description" : "List of capacity providers to associate with the cluster",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/CapacityProvider"
      },
      "uniqueItems" : true
    },
    "CapacityProvider" : {
      "description" : "If using ec2 auto-scaling, the name of the associated capacity provider. Otherwise FARGATE, FARGATE_SPOT.",
      "type" : "string",
      "anyOf" : [ {
        "type" : "string",
        "enum" : [ "FARGATE", "FARGATE_SPOT" ]
      }, {
        "type" : "string",
        "minLength" : 1,
        "maxLength" : 2048
      } ]
    },
    "Cluster" : {
      "description" : "The name of the cluster",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 2048
    },
    "DefaultCapacityProviderStrategy" : {
      "description" : "List of capacity providers to associate with the cluster",
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/CapacityProviderStrategy"
      }
    },
    "CapacityProviderStrategy" : {
      "type" : "object",
      "properties" : {
        "Base" : {
          "type" : "integer",
          "minimum" : 0,
          "maximum" : 100000
        },
        "Weight" : {
          "type" : "integer",
          "minimum" : 0,
          "maximum" : 1000
        },
        "CapacityProvider" : {
          "$ref" : "#/definitions/CapacityProvider"
        }
      },
      "required" : [ "CapacityProvider" ],
      "additionalProperties" : false
    }
  },
  "additionalProperties" : false,
  "properties" : {
    "CapacityProviders" : {
      "$ref" : "#/definitions/CapacityProviders"
    },
    "Cluster" : {
      "$ref" : "#/definitions/Cluster"
    },
    "DefaultCapacityProviderStrategy" : {
      "$ref" : "#/definitions/DefaultCapacityProviderStrategy"
    }
  },
  "required" : [ "CapacityProviders", "Cluster", "DefaultCapacityProviderStrategy" ],
  "createOnlyProperties" : [ "/properties/Cluster" ],
  "primaryIdentifier" : [ "/properties/Cluster" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "ecs:DescribeClusters", "ecs:PutClusterCapacityProviders" ]
    },
    "read" : {
      "permissions" : [ "ecs:DescribeClusters" ]
    },
    "update" : {
      "permissions" : [ "ecs:DescribeClusters", "ecs:PutClusterCapacityProviders" ]
    },
    "delete" : {
      "permissions" : [ "ecs:PutClusterCapacityProviders", "ecs:DescribeClusters" ]
    },
    "list" : {
      "permissions" : [ "ecs:DescribeClusters", "ecs:ListClusters" ]
    }
  }
}