{
  "typeName" : "AWS::Deadline::Fleet",
  "description" : "Resource Type definition for AWS::Deadline::Fleet",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-deadline",
  "definitions" : {
    "AcceleratorCountRange" : {
      "type" : "object",
      "properties" : {
        "Min" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        },
        "Max" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        }
      },
      "required" : [ "Min" ],
      "additionalProperties" : false
    },
    "AcceleratorTotalMemoryMiBRange" : {
      "type" : "object",
      "properties" : {
        "Min" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        },
        "Max" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        }
      },
      "required" : [ "Min" ],
      "additionalProperties" : false
    },
    "AcceleratorType" : {
      "type" : "string",
      "enum" : [ "gpu" ]
    },
    "AutoScalingMode" : {
      "type" : "string",
      "enum" : [ "NO_SCALING", "EVENT_BASED_AUTO_SCALING" ]
    },
    "CpuArchitectureType" : {
      "type" : "string",
      "enum" : [ "x86_64", "arm64" ]
    },
    "CustomerManagedAutoScalingConfiguration" : {
      "type" : "object",
      "properties" : {
        "StandbyWorkerCount" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        },
        "WorkerIdleDurationSeconds" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        },
        "ScaleOutWorkersPerMinute" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 1
        }
      },
      "additionalProperties" : false
    },
    "CustomerManagedFleetConfiguration" : {
      "type" : "object",
      "properties" : {
        "Mode" : {
          "$ref" : "#/definitions/AutoScalingMode"
        },
        "AutoScalingConfiguration" : {
          "$ref" : "#/definitions/CustomerManagedAutoScalingConfiguration"
        },
        "WorkerCapabilities" : {
          "$ref" : "#/definitions/CustomerManagedWorkerCapabilities"
        },
        "StorageProfileId" : {
          "type" : "string",
          "pattern" : "^sp-[0-9a-f]{32}$"
        },
        "TagPropagationMode" : {
          "$ref" : "#/definitions/TagPropagationMode"
        }
      },
      "required" : [ "Mode", "WorkerCapabilities" ],
      "additionalProperties" : false
    },
    "CustomerManagedFleetOperatingSystemFamily" : {
      "type" : "string",
      "enum" : [ "WINDOWS", "LINUX", "MACOS" ]
    },
    "CustomerManagedWorkerCapabilities" : {
      "type" : "object",
      "properties" : {
        "VCpuCount" : {
          "$ref" : "#/definitions/VCpuCountRange"
        },
        "MemoryMiB" : {
          "$ref" : "#/definitions/MemoryMiBRange"
        },
        "AcceleratorTypes" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/AcceleratorType"
          }
        },
        "AcceleratorCount" : {
          "$ref" : "#/definitions/AcceleratorCountRange"
        },
        "AcceleratorTotalMemoryMiB" : {
          "$ref" : "#/definitions/AcceleratorTotalMemoryMiBRange"
        },
        "OsFamily" : {
          "$ref" : "#/definitions/CustomerManagedFleetOperatingSystemFamily"
        },
        "CpuArchitectureType" : {
          "$ref" : "#/definitions/CpuArchitectureType"
        },
        "CustomAmounts" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAmountCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        },
        "CustomAttributes" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAttributeCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        }
      },
      "required" : [ "CpuArchitectureType", "MemoryMiB", "OsFamily", "VCpuCount" ],
      "additionalProperties" : false
    },
    "Ec2EbsVolume" : {
      "type" : "object",
      "properties" : {
        "SizeGiB" : {
          "type" : "integer",
          "default" : 250
        },
        "Iops" : {
          "type" : "integer",
          "default" : 3000,
          "maximum" : 16000,
          "minimum" : 3000
        },
        "ThroughputMiB" : {
          "type" : "integer",
          "default" : 125,
          "maximum" : 1000,
          "minimum" : 125
        }
      },
      "additionalProperties" : false
    },
    "AcceleratorSelection" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "enum" : [ "t4", "a10g", "l4", "l40s", "rtx-pro-server-6000" ]
        },
        "Runtime" : {
          "type" : "string",
          "maxLength" : 100,
          "minLength" : 1
        }
      },
      "required" : [ "Name" ],
      "additionalProperties" : false
    },
    "AcceleratorCapabilities" : {
      "type" : "object",
      "properties" : {
        "Selections" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/AcceleratorSelection"
          },
          "minItems" : 1
        },
        "Count" : {
          "$ref" : "#/definitions/AcceleratorCountRange"
        }
      },
      "required" : [ "Selections" ],
      "additionalProperties" : false
    },
    "Ec2MarketType" : {
      "type" : "string",
      "enum" : [ "on-demand", "spot", "wait-and-save" ]
    },
    "FleetAmountCapability" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "maxLength" : 100,
          "minLength" : 1,
          "pattern" : "^([a-zA-Z][a-zA-Z0-9]{0,63}:)?amount(\\.[a-zA-Z][a-zA-Z0-9]{0,63})+$"
        },
        "Min" : {
          "type" : "number"
        },
        "Max" : {
          "type" : "number"
        }
      },
      "required" : [ "Min", "Name" ],
      "additionalProperties" : false
    },
    "FleetAttributeCapability" : {
      "type" : "object",
      "properties" : {
        "Name" : {
          "type" : "string",
          "maxLength" : 100,
          "minLength" : 1,
          "pattern" : "^([a-zA-Z][a-zA-Z0-9]{0,63}:)?attr(\\.[a-zA-Z][a-zA-Z0-9]{0,63})+$"
        },
        "Values" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "maxLength" : 100,
            "minLength" : 1,
            "pattern" : "^[a-zA-Z_]([a-zA-Z0-9_\\-]{0,99})$"
          },
          "maxItems" : 10,
          "minItems" : 1
        }
      },
      "required" : [ "Name", "Values" ],
      "additionalProperties" : false
    },
    "FleetCapabilities" : {
      "type" : "object",
      "properties" : {
        "Amounts" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAmountCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        },
        "Attributes" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAttributeCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        }
      },
      "additionalProperties" : false
    },
    "FleetConfiguration" : {
      "oneOf" : [ {
        "type" : "object",
        "title" : "CustomerManaged",
        "properties" : {
          "CustomerManaged" : {
            "$ref" : "#/definitions/CustomerManagedFleetConfiguration"
          }
        },
        "required" : [ "CustomerManaged" ],
        "additionalProperties" : false
      }, {
        "type" : "object",
        "title" : "ServiceManagedEc2",
        "properties" : {
          "ServiceManagedEc2" : {
            "$ref" : "#/definitions/ServiceManagedEc2FleetConfiguration"
          }
        },
        "required" : [ "ServiceManagedEc2" ],
        "additionalProperties" : false
      } ]
    },
    "FleetStatus" : {
      "type" : "string",
      "enum" : [ "ACTIVE", "CREATE_IN_PROGRESS", "UPDATE_IN_PROGRESS", "CREATE_FAILED", "UPDATE_FAILED", "SUSPENDED" ]
    },
    "HostConfiguration" : {
      "type" : "object",
      "properties" : {
        "ScriptBody" : {
          "type" : "string",
          "maxLength" : 15000,
          "minLength" : 0
        },
        "ScriptTimeoutSeconds" : {
          "type" : "integer",
          "default" : 300,
          "maximum" : 3600,
          "minimum" : 300
        }
      },
      "required" : [ "ScriptBody" ],
      "additionalProperties" : false
    },
    "MemoryMiBRange" : {
      "type" : "object",
      "properties" : {
        "Min" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 512
        },
        "Max" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 512
        }
      },
      "required" : [ "Min" ],
      "additionalProperties" : false
    },
    "ServiceManagedEc2AutoScalingConfiguration" : {
      "type" : "object",
      "properties" : {
        "StandbyWorkerCount" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 0
        },
        "WorkerIdleDurationSeconds" : {
          "type" : "integer",
          "maximum" : 86400,
          "minimum" : 0
        },
        "ScaleOutWorkersPerMinute" : {
          "type" : "integer",
          "maximum" : 2147483647,
          "minimum" : 1
        }
      },
      "additionalProperties" : false
    },
    "PersistentVolumeConfiguration" : {
      "type" : "object",
      "properties" : {
        "SizeGiB" : {
          "type" : "integer",
          "default" : 250,
          "maximum" : 65536,
          "minimum" : 1
        },
        "Iops" : {
          "type" : "integer",
          "default" : 3000,
          "maximum" : 80000,
          "minimum" : 100
        },
        "ThroughputMiB" : {
          "type" : "integer",
          "default" : 125,
          "maximum" : 2000,
          "minimum" : 125
        },
        "MountPath" : {
          "type" : "string",
          "maxLength" : 255,
          "minLength" : 1
        },
        "LastUsedTtlHours" : {
          "type" : "integer",
          "default" : 168,
          "maximum" : 8760,
          "minimum" : 1
        }
      },
      "required" : [ "MountPath" ],
      "additionalProperties" : false
    },
    "ServiceManagedEc2FleetConfiguration" : {
      "type" : "object",
      "properties" : {
        "InstanceCapabilities" : {
          "$ref" : "#/definitions/ServiceManagedEc2InstanceCapabilities"
        },
        "InstanceMarketOptions" : {
          "$ref" : "#/definitions/ServiceManagedEc2InstanceMarketOptions"
        },
        "VpcConfiguration" : {
          "$ref" : "#/definitions/VpcConfiguration"
        },
        "StorageProfileId" : {
          "type" : "string",
          "pattern" : "^sp-[0-9a-f]{32}$"
        },
        "PersistentVolumeConfiguration" : {
          "$ref" : "#/definitions/PersistentVolumeConfiguration"
        },
        "AutoScalingConfiguration" : {
          "$ref" : "#/definitions/ServiceManagedEc2AutoScalingConfiguration"
        }
      },
      "required" : [ "InstanceCapabilities", "InstanceMarketOptions" ],
      "additionalProperties" : false
    },
    "ServiceManagedEc2InstanceMarketOptions" : {
      "type" : "object",
      "properties" : {
        "Type" : {
          "$ref" : "#/definitions/Ec2MarketType"
        }
      },
      "required" : [ "Type" ],
      "additionalProperties" : false
    },
    "ServiceManagedEc2InstanceCapabilities" : {
      "type" : "object",
      "properties" : {
        "VCpuCount" : {
          "$ref" : "#/definitions/VCpuCountRange"
        },
        "MemoryMiB" : {
          "$ref" : "#/definitions/MemoryMiBRange"
        },
        "OsFamily" : {
          "$ref" : "#/definitions/ServiceManagedFleetOperatingSystemFamily"
        },
        "CpuArchitectureType" : {
          "$ref" : "#/definitions/CpuArchitectureType"
        },
        "RootEbsVolume" : {
          "$ref" : "#/definitions/Ec2EbsVolume"
        },
        "AcceleratorCapabilities" : {
          "$ref" : "#/definitions/AcceleratorCapabilities"
        },
        "AllowedInstanceTypes" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "maxLength" : 100,
            "minLength" : 1
          },
          "maxItems" : 100,
          "minItems" : 1
        },
        "ExcludedInstanceTypes" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "maxLength" : 100,
            "minLength" : 1
          },
          "maxItems" : 100,
          "minItems" : 1
        },
        "CustomAmounts" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAmountCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        },
        "CustomAttributes" : {
          "type" : "array",
          "items" : {
            "$ref" : "#/definitions/FleetAttributeCapability"
          },
          "maxItems" : 15,
          "minItems" : 1
        }
      },
      "required" : [ "CpuArchitectureType", "MemoryMiB", "OsFamily", "VCpuCount" ],
      "additionalProperties" : false
    },
    "ServiceManagedFleetOperatingSystemFamily" : {
      "type" : "string",
      "enum" : [ "LINUX", "WINDOWS" ]
    },
    "TagPropagationMode" : {
      "type" : "string",
      "enum" : [ "NO_PROPAGATION", "PROPAGATE_TAGS_TO_WORKERS_AT_LAUNCH" ]
    },
    "Tag" : {
      "description" : "A key-value pair to associate with a resource.",
      "type" : "object",
      "properties" : {
        "Key" : {
          "type" : "string",
          "description" : "The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. ",
          "minLength" : 1,
          "maxLength" : 127
        },
        "Value" : {
          "type" : "string",
          "description" : "The value for the tag. You can specify a value that is 1 to 255 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following characters: the set of Unicode letters, digits, whitespace, _, ., /, =, +, and -. ",
          "minLength" : 1,
          "maxLength" : 255
        }
      },
      "required" : [ "Key", "Value" ],
      "additionalProperties" : false
    },
    "VCpuCountRange" : {
      "type" : "object",
      "properties" : {
        "Min" : {
          "type" : "integer",
          "maximum" : 10000,
          "minimum" : 1
        },
        "Max" : {
          "type" : "integer",
          "maximum" : 10000,
          "minimum" : 1
        }
      },
      "required" : [ "Min" ],
      "additionalProperties" : false
    },
    "VpcConfiguration" : {
      "type" : "object",
      "properties" : {
        "ResourceConfigurationArns" : {
          "type" : "array",
          "items" : {
            "type" : "string",
            "maxLength" : 2048,
            "minLength" : 1
          }
        }
      },
      "additionalProperties" : false
    }
  },
  "properties" : {
    "Capabilities" : {
      "$ref" : "#/definitions/FleetCapabilities"
    },
    "Configuration" : {
      "$ref" : "#/definitions/FleetConfiguration"
    },
    "Description" : {
      "type" : "string",
      "default" : "",
      "maxLength" : 100,
      "minLength" : 0
    },
    "DisplayName" : {
      "type" : "string",
      "maxLength" : 100,
      "minLength" : 1
    },
    "FarmId" : {
      "type" : "string",
      "pattern" : "^farm-[0-9a-f]{32}$"
    },
    "FleetId" : {
      "type" : "string",
      "pattern" : "^fleet-[0-9a-f]{32}$"
    },
    "HostConfiguration" : {
      "$ref" : "#/definitions/HostConfiguration"
    },
    "MaxWorkerCount" : {
      "type" : "integer",
      "maximum" : 2147483647,
      "minimum" : 0
    },
    "MinWorkerCount" : {
      "type" : "integer",
      "default" : 0,
      "maximum" : 2147483647,
      "minimum" : 0
    },
    "RoleArn" : {
      "type" : "string",
      "pattern" : "^arn:(aws[a-zA-Z-]*):iam::\\d{12}:role(/[!-.0-~]+)*/[\\w+=,.@-]+$"
    },
    "Status" : {
      "$ref" : "#/definitions/FleetStatus"
    },
    "StatusMessage" : {
      "type" : "string"
    },
    "WorkerCount" : {
      "type" : "integer"
    },
    "Arn" : {
      "type" : "string",
      "pattern" : "^arn:(aws[a-zA-Z-]*):deadline:[a-z0-9-]+:[0-9]+:farm/farm-[0-9a-z]{32}/fleet/fleet-[0-9a-z]{32}"
    },
    "Tags" : {
      "type" : "array",
      "maxItems" : 50,
      "description" : "An array of key-value pairs to apply to this resource.",
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "insertionOrder" : false,
      "uniqueItems" : true
    }
  },
  "required" : [ "Configuration", "DisplayName", "FarmId", "MaxWorkerCount", "RoleArn" ],
  "readOnlyProperties" : [ "/properties/Capabilities", "/properties/FleetId", "/properties/Status", "/properties/StatusMessage", "/properties/WorkerCount", "/properties/Arn" ],
  "createOnlyProperties" : [ "/properties/FarmId" ],
  "primaryIdentifier" : [ "/properties/Arn" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "deadline:TagResource", "deadline:UntagResource", "deadline:ListTagsForResource" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "deadline:CreateFleet", "deadline:GetFleet", "iam:PassRole", "identitystore:ListGroupMembershipsForMember", "logs:CreateLogGroup", "deadline:TagResource", "deadline:ListTagsForResource", "vpc-lattice:GetResourceGateway", "vpc-lattice:GetResourceConfiguration", "ec2:CreateVpcEndpoint", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups", "ec2:DescribeVpcs" ]
    },
    "read" : {
      "permissions" : [ "deadline:GetFleet", "identitystore:ListGroupMembershipsForMember", "deadline:ListTagsForResource" ]
    },
    "update" : {
      "permissions" : [ "deadline:UpdateFleet", "deadline:GetFleet", "iam:PassRole", "identitystore:ListGroupMembershipsForMember", "deadline:TagResource", "deadline:UntagResource", "deadline:ListTagsForResource", "vpc-lattice:GetResourceGateway", "vpc-lattice:GetResourceConfiguration", "ec2:CreateVpcEndpoint", "ec2:DescribeSubnets", "ec2:DescribeSecurityGroups", "ec2:DescribeVpcs" ]
    },
    "delete" : {
      "permissions" : [ "deadline:DeleteFleet", "deadline:GetFleet", "identitystore:ListGroupMembershipsForMember" ]
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "FarmId" : {
            "$ref" : "resource-schema.json#/properties/FarmId"
          }
        },
        "required" : [ "FarmId" ]
      },
      "permissions" : [ "deadline:ListFleets", "identitystore:DescribeGroup", "identitystore:DescribeUser", "identitystore:ListGroupMembershipsForMember" ]
    }
  },
  "additionalProperties" : false
}