{
  "$schema" : "https://schema.cloudformation.us-east-1.amazonaws.com/provider.definition.schema.v1.json",
  "typeName" : "AWS::GameLift::ContainerGroupDefinition",
  "description" : "The AWS::GameLift::ContainerGroupDefinition resource creates an Amazon GameLift container group definition.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-gamelift.git",
  "tagging" : {
    "taggable" : true,
    "cloudFormationSystemTags" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "gamelift:ListTagsForResource", "gamelift:TagResource", "gamelift:UntagResource" ]
  },
  "definitions" : {
    "ContainerPortRange" : {
      "description" : "A set of one or more port numbers that can be opened on the container.",
      "type" : "object",
      "properties" : {
        "FromPort" : {
          "description" : "A starting value for the range of allowed port numbers.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 60000
        },
        "Protocol" : {
          "description" : "Defines the protocol of these ports.",
          "type" : "string",
          "enum" : [ "TCP", "UDP" ]
        },
        "ToPort" : {
          "description" : "An ending value for the range of allowed port numbers. Port numbers are end-inclusive. This value must be equal to or greater than FromPort.",
          "type" : "integer",
          "minimum" : 1,
          "maximum" : 60000
        }
      },
      "required" : [ "FromPort", "Protocol", "ToPort" ],
      "additionalProperties" : false
    },
    "ContainerHealthCheck" : {
      "description" : "Specifies how the process manager checks the health of containers.",
      "type" : "object",
      "properties" : {
        "Command" : {
          "description" : "A string array representing the command that the container runs to determine if it is healthy.",
          "type" : "array",
          "uniqueItems" : false,
          "insertionOrder" : true,
          "minItems" : 1,
          "maxItems" : 20,
          "items" : {
            "type" : "string",
            "minLength" : 1,
            "maxLength" : 255,
            "pattern" : "^.*$"
          }
        },
        "Interval" : {
          "description" : "How often (in seconds) the health is checked.",
          "type" : "integer",
          "minimum" : 60,
          "maximum" : 300
        },
        "Timeout" : {
          "description" : "How many seconds the process manager allows the command to run before canceling it.",
          "type" : "integer",
          "minimum" : 30,
          "maximum" : 60
        },
        "Retries" : {
          "description" : "How many times the process manager will retry the command after a timeout. (The first run of the command does not count as a retry.)",
          "type" : "integer",
          "minimum" : 5,
          "maximum" : 10
        },
        "StartPeriod" : {
          "description" : "The optional grace period (in seconds) to give a container time to boostrap before teh health check is declared failed.",
          "type" : "integer",
          "minimum" : 0,
          "maximum" : 300
        }
      },
      "required" : [ "Command" ],
      "additionalProperties" : false
    },
    "PortConfiguration" : {
      "description" : "Defines the ports on a container.",
      "type" : "object",
      "properties" : {
        "ContainerPortRanges" : {
          "description" : "Specifies one or more ranges of ports on a container.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 100,
          "items" : {
            "$ref" : "#/definitions/ContainerPortRange"
          }
        }
      },
      "required" : [ "ContainerPortRanges" ],
      "additionalProperties" : false
    },
    "ContainerEnvironment" : {
      "description" : "An environment variable to set inside a container, in the form of a key-value pair.",
      "type" : "object",
      "properties" : {
        "Name" : {
          "description" : "The environment variable name.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255,
          "pattern" : "^.*$"
        },
        "Value" : {
          "description" : "The environment variable value.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255,
          "pattern" : "^.*$"
        }
      },
      "required" : [ "Name", "Value" ],
      "additionalProperties" : false
    },
    "ContainerMountPoint" : {
      "description" : "Defines the mount point configuration within a container.",
      "type" : "object",
      "properties" : {
        "InstancePath" : {
          "description" : "The path on the host that will be mounted in the container.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1024,
          "pattern" : "^\\/[\\s\\S]*$"
        },
        "ContainerPath" : {
          "description" : "The path inside the container where the mount is accessible.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 1024,
          "pattern" : "^(\\/+[^\\/]+\\/*)+$"
        },
        "AccessLevel" : {
          "description" : "The access permissions for the mounted path.",
          "type" : "string",
          "enum" : [ "READ_ONLY", "READ_AND_WRITE" ]
        }
      },
      "required" : [ "InstancePath" ],
      "additionalProperties" : false
    },
    "ContainerDependency" : {
      "description" : "A dependency that impacts a container's startup and shutdown.",
      "type" : "object",
      "properties" : {
        "ContainerName" : {
          "description" : "A descriptive label for the container definition. The container being defined depends on this container's condition.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^[a-zA-Z0-9-]+$"
        },
        "Condition" : {
          "description" : "The type of dependency.",
          "type" : "string",
          "enum" : [ "START", "COMPLETE", "SUCCESS", "HEALTHY" ]
        }
      },
      "required" : [ "ContainerName", "Condition" ],
      "additionalProperties" : false
    },
    "LinuxCapabilities" : {
      "description" : "A set of Linux capabilities that are added to a container's default Docker configuration. For more detailed information, see the capabilities(7) Linux manual page.",
      "type" : "object",
      "properties" : {
        "Include" : {
          "description" : "The list of Linux capabilities to add to the container's default configuration.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 0,
          "maxItems" : 37,
          "items" : {
            "type" : "string",
            "enum" : [ "AUDIT_CONTROL", "AUDIT_WRITE", "BLOCK_SUSPEND", "CHOWN", "DAC_OVERRIDE", "DAC_READ_SEARCH", "FOWNER", "FSETID", "IPC_LOCK", "IPC_OWNER", "KILL", "LEASE", "LINUX_IMMUTABLE", "MAC_ADMIN", "MAC_OVERRIDE", "MKNOD", "NET_ADMIN", "NET_BIND_SERVICE", "NET_BROADCAST", "NET_RAW", "SETFCAP", "SETGID", "SETPCAP", "SETUID", "SYS_ADMIN", "SYS_BOOT", "SYS_CHROOT", "SYS_MODULE", "SYS_NICE", "SYS_PACCT", "SYS_PTRACE", "SYS_RAWIO", "SYS_RESOURCE", "SYS_TIME", "SYS_TTY_CONFIG", "SYSLOG", "WAKE_ALARM" ]
          }
        }
      },
      "additionalProperties" : false
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "description" : "The key name of the tag. You can specify a value that is 1 to 128 Unicode characters in length.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^.*$"
        },
        "Value" : {
          "description" : "The value for the tag. You can specify a value that is 0 to 256 Unicode characters in length.",
          "type" : "string",
          "minLength" : 0,
          "maxLength" : 256,
          "pattern" : "^.*$"
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "GameServerContainerDefinition" : {
      "description" : "Specifies the information required to run game servers with this container group",
      "type" : "object",
      "properties" : {
        "ContainerName" : {
          "description" : "A descriptive label for the container definition. Container definition names must be unique with a container group definition.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^[a-zA-Z0-9-]+$"
        },
        "DependsOn" : {
          "description" : "A list of container dependencies that determines when this container starts up and shuts down. For container groups with multiple containers, dependencies let you define a startup/shutdown sequence across the containers.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : true,
          "minItems" : 1,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/ContainerDependency"
          }
        },
        "ServerSdkVersion" : {
          "description" : "The version of the server SDK used in this container group",
          "type" : "string",
          "maxLength" : 128,
          "pattern" : "^\\d+\\.\\d+\\.\\d+$"
        },
        "ImageUri" : {
          "description" : "Specifies the image URI of this container.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255,
          "pattern" : "^[a-zA-Z0-9-_\\.@\\/:]+$"
        },
        "ResolvedImageDigest" : {
          "description" : "The digest of the container image.",
          "type" : "string",
          "pattern" : "^sha256:[a-fA-F0-9]{64}$"
        },
        "EnvironmentOverride" : {
          "description" : "The environment variables to pass to a container.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 20,
          "items" : {
            "$ref" : "#/definitions/ContainerEnvironment"
          }
        },
        "PortConfiguration" : {
          "description" : "Defines the ports on the container.",
          "$ref" : "#/definitions/PortConfiguration"
        },
        "MountPoints" : {
          "description" : "A list of mount point configurations to be used in a container.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/ContainerMountPoint"
          }
        },
        "LinuxCapabilities" : {
          "description" : "Linux-specific modifications applied to the default Docker container configuration, such as Linux capabilities.",
          "$ref" : "#/definitions/LinuxCapabilities"
        }
      },
      "required" : [ "ContainerName", "ImageUri", "ServerSdkVersion" ],
      "additionalProperties" : false
    },
    "SupportContainerDefinition" : {
      "description" : "Supports the function of the main container group",
      "type" : "object",
      "properties" : {
        "ContainerName" : {
          "description" : "A descriptive label for the container definition.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 128,
          "pattern" : "^[a-zA-Z0-9-]+$"
        },
        "Vcpu" : {
          "description" : "The number of virtual CPUs to give to the support group",
          "type" : "number",
          "minimum" : 0.125,
          "maximum" : 10
        },
        "DependsOn" : {
          "description" : "A list of container dependencies that determines when this container starts up and shuts down. For container groups with multiple containers, dependencies let you define a startup/shutdown sequence across the containers.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : true,
          "minItems" : 1,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/ContainerDependency"
          }
        },
        "Essential" : {
          "description" : "Specifies if the container is essential. If an essential container fails a health check, then all containers in the container group will be restarted. You must specify exactly 1 essential container in a container group.",
          "type" : "boolean"
        },
        "ImageUri" : {
          "description" : "Specifies the image URI of this container.",
          "type" : "string",
          "minLength" : 1,
          "maxLength" : 255,
          "pattern" : "^[a-zA-Z0-9-_\\.@\\/:]+$"
        },
        "ResolvedImageDigest" : {
          "description" : "The digest of the container image.",
          "type" : "string",
          "pattern" : "^sha256:[a-fA-F0-9]{64}$"
        },
        "MemoryHardLimitMebibytes" : {
          "description" : "The total memory limit of container groups following this definition in MiB",
          "type" : "integer",
          "minimum" : 4,
          "maximum" : 1024000
        },
        "EnvironmentOverride" : {
          "description" : "The environment variables to pass to a container.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 20,
          "items" : {
            "$ref" : "#/definitions/ContainerEnvironment"
          }
        },
        "PortConfiguration" : {
          "description" : "Defines the ports on the container.",
          "$ref" : "#/definitions/PortConfiguration"
        },
        "HealthCheck" : {
          "description" : "Specifies how the health of the containers will be checked.",
          "$ref" : "#/definitions/ContainerHealthCheck"
        },
        "MountPoints" : {
          "description" : "A list of mount point configurations to be used in a container.",
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "minItems" : 1,
          "maxItems" : 10,
          "items" : {
            "$ref" : "#/definitions/ContainerMountPoint"
          }
        },
        "LinuxCapabilities" : {
          "description" : "Linux-specific modifications applied to the default Docker container configuration, such as Linux capabilities.",
          "$ref" : "#/definitions/LinuxCapabilities"
        }
      },
      "required" : [ "ContainerName", "ImageUri" ],
      "additionalProperties" : false
    }
  },
  "properties" : {
    "ContainerGroupDefinitionArn" : {
      "description" : "The Amazon Resource Name (ARN) that is assigned to a Amazon GameLift container group resource and uniquely identifies it across all AWS Regions.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 512,
      "pattern" : "^arn:.*:containergroupdefinition\\/[a-zA-Z0-9\\-]+(:[0-9]+)?$"
    },
    "CreationTime" : {
      "description" : "A time stamp indicating when this data object was created. Format is a number expressed in Unix time as milliseconds (for example \"1469498468.057\").",
      "type" : "string"
    },
    "OperatingSystem" : {
      "description" : "The operating system of the container group",
      "type" : "string",
      "enum" : [ "AMAZON_LINUX_2023" ]
    },
    "Name" : {
      "description" : "A descriptive label for the container group definition.",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 128,
      "pattern" : "^[a-zA-Z0-9-]+$"
    },
    "ContainerGroupType" : {
      "description" : "The scope of the container group",
      "type" : "string",
      "enum" : [ "GAME_SERVER", "PER_INSTANCE" ]
    },
    "TotalMemoryLimitMebibytes" : {
      "description" : "The total memory limit of container groups following this definition in MiB",
      "type" : "integer",
      "minimum" : 4,
      "maximum" : 1024000
    },
    "TotalVcpuLimit" : {
      "description" : "The total amount of virtual CPUs on the container group definition",
      "type" : "number",
      "minimum" : 0.125,
      "maximum" : 10
    },
    "GameServerContainerDefinition" : {
      "$ref" : "#/definitions/GameServerContainerDefinition"
    },
    "SupportContainerDefinitions" : {
      "description" : "A collection of support container definitions that define the containers in this group.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "minItems" : 1,
      "maxItems" : 10,
      "items" : {
        "$ref" : "#/definitions/SupportContainerDefinition"
      }
    },
    "VersionNumber" : {
      "description" : "The version of this ContainerGroupDefinition",
      "type" : "integer",
      "minimum" : 0
    },
    "SourceVersionNumber" : {
      "description" : "A specific ContainerGroupDefinition version to be updated",
      "type" : "integer",
      "minimum" : 0
    },
    "VersionDescription" : {
      "description" : "The description of this version",
      "type" : "string",
      "minLength" : 1,
      "maxLength" : 1024
    },
    "Status" : {
      "description" : "A string indicating ContainerGroupDefinition status.",
      "type" : "string",
      "enum" : [ "READY", "COPYING", "FAILED" ]
    },
    "StatusReason" : {
      "description" : "A string indicating the reason for ContainerGroupDefinition status.",
      "type" : "string"
    },
    "Tags" : {
      "description" : "An array of key-value pairs to apply to this resource.",
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "minItems" : 0,
      "maxItems" : 200,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    }
  },
  "additionalProperties" : false,
  "required" : [ "Name", "OperatingSystem", "TotalMemoryLimitMebibytes", "TotalVcpuLimit" ],
  "createOnlyProperties" : [ "/properties/Name", "/properties/ContainerGroupType" ],
  "readOnlyProperties" : [ "/properties/ContainerGroupDefinitionArn", "/properties/CreationTime", "/properties/VersionNumber", "/properties/Status", "/properties/StatusReason" ],
  "writeOnlyProperties" : [ "/properties/SourceVersionNumber" ],
  "primaryIdentifier" : [ "/properties/Name" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "gamelift:CreateContainerGroupDefinition", "gamelift:DescribeContainerGroupDefinition", "gamelift:ListTagsForResource", "gamelift:TagResource", "ecr:BatchCheckLayerAvailability", "ecr:BatchGetImage", "ecr:GetDownloadUrlForLayer", "ecr:DescribeImages", "ecr:GetAuthorizationToken" ]
    },
    "read" : {
      "permissions" : [ "gamelift:DescribeContainerGroupDefinition", "gamelift:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "gamelift:DescribeContainerGroupDefinition", "gamelift:UpdateContainerGroupDefinition", "gamelift:ListTagsForResource", "gamelift:TagResource", "gamelift:UntagResource" ]
    },
    "delete" : {
      "permissions" : [ "gamelift:DeleteContainerGroupDefinition" ]
    },
    "list" : {
      "permissions" : [ "gamelift:ListContainerGroupDefinitions" ]
    }
  }
}