{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/worker-manager/v1/config-aws.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": false,
  "description": "Object with an array of possible options for different regions",
  "properties": {
    "launchConfigs": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "additionalUserData": {
            "additionalProperties": true,
            "properties": {
              "providerId": {
                "not": {}
              },
              "rootUrl": {
                "not": {}
              },
              "workerConfig": {
                "not": {}
              },
              "workerGroup": {
                "not": {}
              },
              "workerPoolId": {
                "not": {}
              }
            },
            "required": [],
            "type": "object"
          },
          "capacityPerInstance": {
            "description": "Deprecated - please use `workerManager.capacityPerInstance` instead",
            "minimum": 1,
            "title": "Capacity Per Instance (Deprecated)",
            "type": "integer"
          },
          "launchConfig": {
            "additionalProperties": true,
            "description": "An object to be passed in to AWS runInstances method.\nSee the documentation [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/EC2.html#runInstances-property)\nYou can configure any properties you need. Note, however, that we disallow passing in arbitrary IAM instance profiles.\n",
            "not": {
              "required": [
                "IamInstanceProfile",
                "UserData",
                "MinCount",
                "MaxCount"
              ]
            },
            "properties": {
              "ImageId": {
                "description": "The ID of the AMI to launch an instance from.",
                "type": "string"
              }
            },
            "required": [
              "ImageId"
            ],
            "title": "Launch Configuration",
            "type": "object"
          },
          "region": {
            "description": "AWS region (not to be confused with AZ) to launch the instances in",
            "title": "Region",
            "type": "string"
          },
          "workerConfig": {
            "additionalProperties": true,
            "description": "This value is supplied unchanged as the `workerConfig` property of the `taskcluster` instance metadata attribute.\nThe expectation is that the worker will merge this information with configuration from other sources,\nand this is precisely what [worker-runner](https://docs.taskcluster.net/docs/reference/workers/worker-runner) does.\nThis property must not be used for secret configuration, as it is visible both in the worker pool configuration and in the worker instance's metadata.\nInstead, put secret configuration in the [secrets service](https://docs.taskcluster.net/docs/reference/workers/worker-runner).\n",
            "title": "Worker Config",
            "type": "object"
          },
          "workerManager": {
            "additionalProperties": false,
            "description": "Worker Manager's own configuration settings per launch configuration.\nThe other properties of the launch configuration section are passed directly through to\nAWS APIs, whereas this section is interpreted directly by Worker Manager.",
            "properties": {
              "capacityPerInstance": {
                "description": "The number of tasks a single worker of this type can run at any given time.",
                "minimum": 1,
                "title": "Capacity Per Instance",
                "type": "integer"
              },
              "initialWeight": {
                "description": "The initial weight of the launch configuration at the provisionining time.\nLaunch configurations with higher weight will be more likely to be selected.\nIf not specified, the default weight is `1`.\nSpecifying a weight of `0` will prevent the launch configuration from being selected.\nWhena all launch configurations have same weight, they will be selected in a round-robin fashion.",
                "maximum": 1,
                "minimum": 0,
                "title": "Initial Weight",
                "type": "number"
              },
              "launchConfigId": {
                "description": "The ID of the launch configuration. Must be unique forever within the worker pool.\nAny change to the launch configuration (except `workerManager` fields) must use a new ID\nto ensure proper tracking of configuration metrics.\nIf not provided, worker-manager will generate a unique ID.\nMust be between 1 and 38 characters long and contain only alphanumeric\ncharacters, dashes, and underscores.\n",
                "maxLength": 38,
                "minLength": 1,
                "pattern": "^([a-zA-Z0-9-_]*)$",
                "title": "Launch Configuration ID",
                "type": "string"
              },
              "maxCapacity": {
                "description": "The maximum capacity of workers of this type (launch configuration)\nthat can be running at any given time.\nThis value is independent from worker pool's `maxCapacity`, which\ncontrols total number of workers for the whole pool.\nEffective max capacity for the launch config would be\n`min(workerPool.maxCapacity, launchConfigMaxCapacity)`.",
                "minimum": 0,
                "title": "Max Capacity",
                "type": "integer"
              }
            },
            "title": "Worker Manager Config",
            "type": "object"
          }
        },
        "required": [
          "region",
          "launchConfig"
        ],
        "type": "object"
      },
      "title": "Launch Configurations",
      "type": "array",
      "uniqueItems": true
    },
    "lifecycle": {
      "$ref": "worker-lifecycle.json#"
    },
    "maxCapacity": {
      "description": "The maximum amount of capacity that worker-manager should make\navailable at any given time for the entire workerpool.\n",
      "minimum": 0,
      "title": "Maximum Capacity",
      "type": "integer"
    },
    "minCapacity": {
      "description": "The minimum amount of capacity that worker-manager should make\navailable at any given time for the entire workerpool.\n",
      "minimum": 0,
      "title": "Minimum Capacity",
      "type": "integer"
    },
    "scalingRatio": {
      "description": "The scaling ratio is a ratio of worker capacity to pending tasks - a ratio\nof 1.0 means that 1 capacity will be added for each pending task\n",
      "maximum": 1,
      "minimum": 0,
      "title": "Scaling Ratio",
      "type": "number"
    }
  },
  "required": [
    "launchConfigs",
    "minCapacity",
    "maxCapacity"
  ],
  "title": "AWS Provider Config",
  "type": "object"
}