{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "autoscale": {
      "description": "The autoscaler's settings and what it is waiting on.",
      "properties": {
        "blockedBy": {
          "description": "A failed request that holds off new ones until staff retry or cancel it.",
          "type": "string"
        },
        "cooldownUntil": {
          "description": "No new request before this. Absent once it has passed.",
          "format": "datetime",
          "type": "string"
        },
        "costEur": {
          "description": "What each host it orders costs a month, in euros, as a decimal string.",
          "type": "string"
        },
        "current": {
          "ref": "#freeCapacity",
          "type": "ref"
        },
        "enabled": {
          "description": "On in the provisioner's config, with the GitHub App set up.",
          "type": "boolean"
        },
        "hosts": {
          "description": "Hosts that are not retired.",
          "type": "integer"
        },
        "inFlight": {
          "description": "Requests under way: 0 or 1.",
          "type": "integer"
        },
        "lowSince": {
          "description": "Since when free capacity has been below a threshold. Absent while it is fine.",
          "format": "datetime",
          "type": "string"
        },
        "maxHosts": {
          "description": "The most hosts it may bring the fleet to.",
          "type": "integer"
        },
        "paused": {
          "description": "Paused by staff: no new requests, though one under way carries on.",
          "type": "boolean"
        },
        "pausedAt": {
          "format": "datetime",
          "type": "string"
        },
        "pausedBy": {
          "description": "The staff DID that paused it.",
          "format": "did",
          "type": "string"
        },
        "thresholds": {
          "ref": "#thresholds",
          "type": "ref"
        }
      },
      "required": [
        "enabled",
        "paused",
        "current"
      ],
      "type": "object"
    },
    "event": {
      "description": "One line of a request's timeline.",
      "properties": {
        "at": {
          "format": "datetime",
          "type": "string"
        },
        "kind": {
          "knownValues": [
            "requested",
            "dispatched",
            "step_started",
            "step_finished",
            "ordering",
            "configuring",
            "verifying",
            "registered",
            "failed",
            "cancelled",
            "retried",
            "cancel_requested",
            "deploy_cancelled"
          ],
          "type": "string"
        },
        "message": {
          "description": "What happened, in the provisioner's words.",
          "type": "string"
        },
        "runUrl": {
          "description": "The GitHub Actions run the event came from.",
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "at",
        "kind"
      ],
      "type": "object"
    },
    "freeCapacity": {
      "description": "Free capacity across the active hosts. An over-committed host counts as none.",
      "properties": {
        "freeDiskGb": {
          "type": "integer"
        },
        "freeMemoryMb": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "hostRequest": {
      "description": "A tenant host the autoscaler asked for.",
      "properties": {
        "cancelRunUrl": {
          "format": "uri",
          "type": "string"
        },
        "costEur": {
          "description": "The host's monthly cost in euros, as a decimal string.",
          "type": "string"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "currentStep": {
          "description": "The workflow step running now.",
          "type": "string"
        },
        "deployRunUrl": {
          "format": "uri",
          "type": "string"
        },
        "dispatchedAt": {
          "format": "datetime",
          "type": "string"
        },
        "error": {
          "description": "Why it failed.",
          "type": "string"
        },
        "events": {
          "description": "Oldest first. Only on a single request.",
          "items": {
            "ref": "#event",
            "type": "ref"
          },
          "type": "array"
        },
        "finishedAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "description": "A UUID.",
          "type": "string"
        },
        "name": {
          "description": "The host's name, like tenant-4.",
          "type": "string"
        },
        "requestedBy": {
          "description": "system, or the staff DID.",
          "type": "string"
        },
        "state": {
          "knownValues": [
            "requested",
            "ordering",
            "configuring",
            "verifying",
            "registered",
            "failed",
            "cancelling",
            "cancelled"
          ],
          "type": "string"
        },
        "trigger": {
          "ref": "#trigger",
          "type": "ref"
        },
        "updatedAt": {
          "format": "datetime",
          "type": "string"
        },
        "workflowRunUrl": {
          "format": "uri",
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "state",
        "createdAt"
      ],
      "type": "object"
    },
    "thresholds": {
      "description": "When the autoscaler orders a host: free capacity across active hosts below either figure for sustainSecs, and no request in the last cooldownSecs.",
      "properties": {
        "cooldownSecs": {
          "type": "integer"
        },
        "freeDiskGb": {
          "type": "integer"
        },
        "freeMemoryMb": {
          "type": "integer"
        },
        "sustainSecs": {
          "type": "integer"
        }
      },
      "type": "object"
    },
    "trigger": {
      "description": "Free capacity when the request was made, and the thresholds it was below.",
      "properties": {
        "freeDiskGb": {
          "type": "integer"
        },
        "freeMemoryMb": {
          "type": "integer"
        },
        "hosts": {
          "items": {
            "ref": "#triggerHost",
            "type": "ref"
          },
          "type": "array"
        },
        "lowSince": {
          "format": "datetime",
          "type": "string"
        },
        "thresholds": {
          "ref": "#thresholds",
          "type": "ref"
        }
      },
      "type": "object"
    },
    "triggerHost": {
      "properties": {
        "freeDiskGb": {
          "type": "integer"
        },
        "freeMemoryMb": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "id": "at.happyproto.admin.defs",
  "lexicon": 1
}
