{
  "typeName" : "AWS::ECS::Service",
  "description" : "Resource Type definition for AWS::ECS::Service",
  "definitions" : {
    "AwsVpcConfiguration" : {
      "type" : "object",
      "properties" : {
        "AssignPublicIp" : {
          "type" : "string",
          "enum" : [ "DISABLED", "ENABLED" ]
        },
        "SecurityGroups" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          }
        },
        "Subnets" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          }
        }
      },
      "additionalProperties" : false
    },
    "CapacityProviderStrategyItem" : {
      "type" : "object",
      "properties" : {
        "Base" : {
          "type" : "integer"
        },
        "CapacityProvider" : {
          "type" : "string"
        },
        "Weight" : {
          "type" : "integer"
        }
      },
      "additionalProperties" : false
    },
    "DeploymentAlarms" : {
      "type" : "object",
      "properties" : {
        "AlarmNames" : {
          "type" : "array",
          "items" : {
            "type" : "string"
          }
        },
        "Rollback" : {
          "type" : "boolean"
        },
        "Enable" : {
          "type" : "boolean"
        }
      },
      "required" : [ "AlarmNames", "Rollback", "Enable" ],
      "additionalProperties" : false
    },
    "DeploymentCircuitBreaker" : {
      "type" : "object",
      "properties" : {
        "Enable" : {
          "type" : "boolean"
        },
        "Rollback" : {
          "type" : "boolean"
        }
      },
      "required" : [ "Enable", "Rollback" ],
      "additionalProperties" : false
    },
    "DeploymentConfiguration" : {
      "type" : "object",
      "properties" : {
        "DeploymentCircuitBreaker" : {
          "$ref" : "#/definitions/DeploymentCircuitBreaker"
        },
        "MaximumPercent" : {
          "type" : "integer"
        },
        "MinimumHealthyPercent" : {
          "type" : "integer"
        },
        "Alarms" : {
          "$ref" : "#/definitions/DeploymentAlarms"
        }
      },
      "additionalProperties" : false
    },
    "DeploymentController" : {
      "type" : "object",
      "properties" : {
        "Type" : {
          "type" : "string",
          "enum" : [ "CODE_DEPLOY", "ECS", "EXTERNAL" ]
        }
      },
      "additionalProperties" : false
    },
    "LoadBalancer" : {
      "type" : "object",
      "properties" : {
        "ContainerName" : {
          "type" : "string"
        },
        "ContainerPort" : {
          "type" : "integer"
        },
        "LoadBalancerName" : {
          "type" : "string"
        },
        "TargetGroupArn" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "LogConfiguration" : {
      "type" : "object",
      "properties" : {
        "LogDriver" : {
          "type" : "string"
        },
        "Options" : {
          "type" : "object",
          "patternProperties" : {
            ".{1,}" : {
              "type" : "string"
            }
          },
          "additionalProperties" : false
        },
        "SecretOptions" : {
          "type" : "array",
          "insertionOrder" : false,
          "items" : {
            "$ref" : "#/definitions/Secret"
          }
        }
      },
      "additionalProperties" : false
    },
    "NetworkConfiguration" : {
      "type" : "object",
      "properties" : {
        "AwsvpcConfiguration" : {
          "$ref" : "#/definitions/AwsVpcConfiguration"
        }
      },
      "additionalProperties" : false
    },
    "PlacementConstraint" : {
      "type" : "object",
      "properties" : {
        "Expression" : {
          "type" : "string"
        },
        "Type" : {
          "type" : "string",
          "enum" : [ "distinctInstance", "memberOf" ]
        }
      },
      "required" : [ "Type" ],
      "additionalProperties" : false
    },
    "PlacementStrategy" : {
      "type" : "object",
      "properties" : {
        "Field" : {
          "type" : "string"
        },
        "Type" : {
          "type" : "string",
          "enum" : [ "binpack", "random", "spread" ]
        }
      },
      "required" : [ "Type" ],
      "additionalProperties" : false
    },
    "Secret" : {
      "type" : "object",
      "required" : [ "Name", "ValueFrom" ],
      "properties" : {
        "Name" : {
          "type" : "string"
        },
        "ValueFrom" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "ServiceConnectClientAlias" : {
      "type" : "object",
      "properties" : {
        "Port" : {
          "type" : "integer"
        },
        "DnsName" : {
          "type" : "string"
        }
      },
      "required" : [ "Port" ],
      "additionalProperties" : false
    },
    "ServiceConnectConfiguration" : {
      "type" : "object",
      "properties" : {
        "Enabled" : {
          "type" : "boolean"
        },
        "Namespace" : {
          "type" : "string"
        },
        "Services" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ServiceConnectService"
          }
        },
        "LogConfiguration" : {
          "$ref" : "#/definitions/LogConfiguration"
        }
      },
      "required" : [ "Enabled" ],
      "additionalProperties" : false
    },
    "ServiceConnectService" : {
      "type" : "object",
      "properties" : {
        "PortName" : {
          "type" : "string"
        },
        "DiscoveryName" : {
          "type" : "string"
        },
        "ClientAliases" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/ServiceConnectClientAlias"
          }
        },
        "IngressPortOverride" : {
          "type" : "integer"
        }
      },
      "required" : [ "PortName" ],
      "additionalProperties" : false
    },
    "ServiceRegistry" : {
      "type" : "object",
      "properties" : {
        "ContainerName" : {
          "type" : "string"
        },
        "ContainerPort" : {
          "type" : "integer"
        },
        "Port" : {
          "type" : "integer"
        },
        "RegistryArn" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string"
        },
        "Value" : {
          "type" : "string"
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "ServiceArn" : {
      "type" : "string"
    },
    "CapacityProviderStrategy" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/CapacityProviderStrategyItem"
      }
    },
    "Cluster" : {
      "type" : "string"
    },
    "DeploymentConfiguration" : {
      "$ref" : "#/definitions/DeploymentConfiguration"
    },
    "DeploymentController" : {
      "$ref" : "#/definitions/DeploymentController"
    },
    "DesiredCount" : {
      "type" : "integer"
    },
    "EnableECSManagedTags" : {
      "type" : "boolean"
    },
    "EnableExecuteCommand" : {
      "type" : "boolean"
    },
    "HealthCheckGracePeriodSeconds" : {
      "type" : "integer"
    },
    "LaunchType" : {
      "type" : "string",
      "enum" : [ "EC2", "FARGATE", "EXTERNAL" ]
    },
    "LoadBalancers" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/LoadBalancer"
      }
    },
    "Name" : {
      "type" : "string"
    },
    "NetworkConfiguration" : {
      "$ref" : "#/definitions/NetworkConfiguration"
    },
    "PlacementConstraints" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/PlacementConstraint"
      }
    },
    "PlacementStrategies" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/PlacementStrategy"
      }
    },
    "PlatformVersion" : {
      "type" : "string",
      "default" : "LATEST"
    },
    "PropagateTags" : {
      "type" : "string",
      "enum" : [ "SERVICE", "TASK_DEFINITION" ]
    },
    "Role" : {
      "type" : "string"
    },
    "SchedulingStrategy" : {
      "type" : "string",
      "enum" : [ "DAEMON", "REPLICA" ]
    },
    "ServiceConnectConfiguration" : {
      "$ref" : "#/definitions/ServiceConnectConfiguration"
    },
    "ServiceName" : {
      "type" : "string"
    },
    "ServiceRegistries" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/ServiceRegistry"
      }
    },
    "Tags" : {
      "type" : "array",
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "TaskDefinition" : {
      "type" : "string"
    }
  },
  "primaryIdentifier" : [ "/properties/ServiceArn", "/properties/Cluster" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "ecs:CreateService", "ecs:DescribeServices", "iam:PassRole" ],
      "timeoutInMinutes" : 180
    },
    "read" : {
      "permissions" : [ "ecs:DescribeServices" ]
    },
    "update" : {
      "permissions" : [ "ecs:DescribeServices", "ecs:ListTagsForResource", "ecs:TagResource", "ecs:UntagResource", "ecs:UpdateService" ],
      "timeoutInMinutes" : 180
    },
    "delete" : {
      "permissions" : [ "ecs:DeleteService", "ecs:DescribeServices" ],
      "timeoutInMinutes" : 30
    },
    "list" : {
      "permissions" : [ "ecs:DescribeServices", "ecs:ListClusters", "ecs:ListServices" ]
    }
  },
  "readOnlyProperties" : [ "/properties/ServiceArn", "/properties/Name" ],
  "createOnlyProperties" : [ "/properties/Cluster", "/properties/DeploymentController", "/properties/LaunchType", "/properties/Role", "/properties/SchedulingStrategy", "/properties/ServiceName" ],
  "writeOnlyProperties" : [ "/properties/ServiceConnectConfiguration" ],
  "additionalProperties" : false
}