{
  "$id": "https://firefox-ci-tc.services.mozilla.com/schemas/worker-manager/v1/worker-response.json#",
  "$schema": "https://firefox-ci-tc.services.mozilla.com/schemas/common/metaschema.json#",
  "additionalProperties": false,
  "description": "Response containing information about a worker.\n",
  "properties": {
    "actions": {
      "items": {
        "additionalProperties": false,
        "description": "Actions provide a generic mechanism to expose additional features of a\nprovisioner, worker type, or worker to Taskcluster clients.\n\nAn action is comprised of metadata describing the feature it exposes,\ntogether with a webhook for triggering it.\n\nThe Taskcluster tools site, for example, retrieves actions when displaying\nprovisioners, worker types and workers. It presents the provisioner/worker\ntype/worker specific actions to the user. When the user triggers an action,\nthe web client takes the registered webhook, substitutes parameters into the\nURL (see `url`), signs the requests with the Taskcluster credentials of the\nuser operating the web interface, and issues the HTTP request.\n\nThe level to which the action relates (provisioner, worker type, worker) is\ncalled the action context. All actions, regardless of the action contexts,\nare registered against the provisioner when calling\n`queue.declareProvisioner`.\n\nThe action context is used by the web client to determine where in the web\ninterface to present the action to the user as follows:\n\n| `context`   | Tool where action is displayed |\n|-------------|--------------------------------|\n| provisioner | Provisioner Explorer           |\n| worker-type | Workers Explorer               |\n| worker      | Worker Explorer                |\n\nSee [actions docs](/docs/reference/platform/taskcluster-queue/docs/actions)\nfor more information.\n",
        "properties": {
          "context": {
            "description": "Only actions with the context `worker` are included.\n",
            "enum": [
              "worker"
            ],
            "title": "Context",
            "type": "string"
          },
          "description": {
            "description": "Description of the provisioner.\n",
            "title": "Description",
            "type": "string"
          },
          "method": {
            "description": "Method to indicate the desired action to be performed for a given resource.\n",
            "enum": [
              "POST",
              "PUT",
              "DELETE",
              "PATCH"
            ],
            "title": "Method",
            "type": "string"
          },
          "name": {
            "description": "Short names for things like logging/error messages.\n",
            "title": "Name",
            "type": "string"
          },
          "title": {
            "description": "Appropriate title for any sort of Modal prompt.\n",
            "title": "Title"
          },
          "url": {
            "description": "When an action is triggered, a request is made using the `url` and `method`.\nDepending on the `context`, the following parameters will be substituted in the url:\n\n| `context`   | Path parameters                                          |\n|-------------|----------------------------------------------------------|\n| provisioner | <provisionerId>                                          |\n| worker-type | <provisionerId>, <workerType>                            |\n| worker      | <provisionerId>, <workerType>, <workerGroup>, <workerId> |\n\n_Note: The request needs to be signed with the user's Taskcluster credentials._\n",
            "title": "URL",
            "type": "string"
          }
        },
        "required": [
          "name",
          "title",
          "context",
          "url",
          "method",
          "description"
        ],
        "title": "Worker Action",
        "type": "object"
      },
      "title": "Worker Actions",
      "type": "array",
      "uniqueItems": false
    },
    "capacity": {
      "description": "Number of tasks this worker can handle at once. A worker capacity of 0 means\nthe worker is not managed by worker manager and is only known to the queue, the\ntrue capacity is not known.\n",
      "minimum": 0,
      "title": "Worker Capacity",
      "type": "integer"
    },
    "expires": {
      "description": "Date and time after which the worker will be automatically\ndeleted by the queue.\n",
      "format": "date-time",
      "title": "Worker Expiration",
      "type": "string"
    },
    "firstClaim": {
      "description": "Date of the first time this worker claimed a task.\n",
      "format": "date-time",
      "title": "First task claimed",
      "type": "string"
    },
    "lastDateActive": {
      "description": "Date of the last time this worker was seen active. Updated each time a worker calls\n`queue.claimWork`, `queue.reclaimTask`, and `queue.declareWorker` for this task queue.\n`lastDateActive` is updated every half hour but may be off by up-to half an hour.\nNonetheless, `lastDateActive` is a good indicator of when the worker was last seen active.\nThis defaults to null in the database, and is set to the current time when the worker\nis first seen.\n",
      "format": "date-time",
      "title": "Worker Last Date Active",
      "type": "string"
    },
    "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"
    },
    "providerId": {
      "description": "The provider that had started the worker and responsible for managing it.\nCan be different from the provider that's currently in the worker pool config.\nA providerId of \"none\" is used when the worker is not managed by worker manager.\n",
      "maxLength": 38,
      "minLength": 1,
      "pattern": "^([a-zA-Z0-9-_]*)$",
      "title": "Provider",
      "type": "string"
    },
    "provisionerId": {
      "$ref": "task.json#/properties/provisionerId"
    },
    "quarantineDetails": {
      "description": "This is a list of changes to the worker's quarantine status. Each entry is an object\ncontaining information about the time, clientId and reason for the change.\n",
      "items": {
        "additionalProperties": false,
        "description": "Information about when and why a worker was quarantined.\n",
        "properties": {
          "clientId": {
            "description": "The clientId of the client that made the request to quarantine the worker.\n",
            "title": "Quarantine ClientId",
            "type": "string"
          },
          "quarantineInfo": {
            "description": "Usually a reason for the quarantine.\n",
            "title": "Quarantine Info",
            "type": "string"
          },
          "quarantineUntil": {
            "description": "Value of the worker's quarantineUntil property at the moment of the quarantine.\n",
            "format": "date-time",
            "title": "Quarantine Until",
            "type": "string"
          },
          "updatedAt": {
            "description": "Time when the quarantine was updated.\n",
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "clientId",
          "updatedAt",
          "quarantineUntil",
          "quarantineInfo"
        ],
        "title": "Quarantine Details",
        "type": "object"
      },
      "title": "Worker Quarantine Details",
      "type": "array",
      "uniqueItems": true
    },
    "quarantineUntil": {
      "description": "Quarantining a worker allows the machine to remain alive but not accept jobs.\nOnce the quarantineUntil time has elapsed, the worker resumes accepting jobs.\nNote that a quarantine can be lifted by setting `quarantineUntil` to the present time (or\nsomewhere in the past).\n",
      "format": "date-time",
      "title": "Worker Quarantine",
      "type": "string"
    },
    "recentTasks": {
      "description": "List of 20 most recent tasks claimed by the worker.\n",
      "items": {
        "$ref": "task-run.json#"
      },
      "title": "Most Recent Tasks",
      "type": "array",
      "uniqueItems": false
    },
    "state": {
      "description": "A string specifying the state this worker is in so far as worker-manager knows.\nA \"requested\" worker is in the process of starting up, and if successful will enter\nthe \"running\" state once it has registered with the `registerWorker` API method.  A\n\"stopping\" worker is in the process of shutting down and deleting resources, while\na \"stopped\" worker is completely stopped.  Stopped workers are kept for historical\npurposes and are purged when they expire.  Note that some providers transition workers\ndirectly from \"running\" to \"stopped\".\nAn \"standalone\" worker is a worker that is not managed by worker-manager, these workers\nare only known by the queue.\n",
      "enum": [
        "requested",
        "running",
        "stopping",
        "stopped",
        "standalone"
      ],
      "title": "State",
      "type": "string"
    },
    "workerGroup": {
      "description": "Identifier for group that worker who executes this run is a part of,\nthis identifier is mainly used for efficient routing.\n",
      "maxLength": 38,
      "minLength": 1,
      "pattern": "^([a-zA-Z0-9-_]*)$",
      "title": "Worker Group",
      "type": "string"
    },
    "workerId": {
      "description": "Identifier for worker evaluating this run within given\n`workerGroup`.\n",
      "maxLength": 38,
      "minLength": 1,
      "pattern": "^([a-zA-Z0-9-_]*)$",
      "title": "Worker Identifier",
      "type": "string"
    },
    "workerPoolId": {
      "$ref": "task.json#/properties/workerPoolId"
    },
    "workerType": {
      "$ref": "task.json#/properties/workerType"
    }
  },
  "required": [
    "provisionerId",
    "workerType",
    "workerGroup",
    "workerId",
    "recentTasks",
    "expires",
    "firstClaim",
    "actions"
  ],
  "title": "Worker Response",
  "type": "object"
}