{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "change": {
      "description": "What the change was for.",
      "properties": {
        "plan": {
          "description": "The plan, for a resize.",
          "ref": "#fromTo",
          "type": "ref"
        },
        "reason": {
          "description": "Why an update ran, when it was not a plan or version change.",
          "knownValues": [
            "retry",
            "drift",
            "domains",
            "primary",
            "primary_forced"
          ],
          "type": "string"
        },
        "version": {
          "description": "The HappyView release, for an upgrade.",
          "ref": "#fromTo",
          "type": "ref"
        }
      },
      "type": "object"
    },
    "deploymentView": {
      "description": "A change with its steps.",
      "properties": {
        "change": {
          "ref": "#change",
          "type": "ref"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "error": {
          "ref": "#error",
          "type": "ref"
        },
        "finishedAt": {
          "format": "datetime",
          "type": "string"
        },
        "id": {
          "description": "The change's UUID.",
          "type": "string"
        },
        "isDeployment": {
          "description": "Whether the change started the instance's container. Stopping, deleting, and domain-only updates are not deployments.",
          "type": "boolean"
        },
        "kind": {
          "knownValues": [
            "create",
            "update",
            "upgrade",
            "stop",
            "start",
            "destroy"
          ],
          "type": "string"
        },
        "requestedBy": {
          "description": "Who asked: the instance's owner, HappyProto staff, or HappyProto's own reconciler.",
          "knownValues": [
            "owner",
            "staff",
            "system"
          ],
          "type": "string"
        },
        "startedAt": {
          "description": "When a worker last picked it up.",
          "format": "datetime",
          "type": "string"
        },
        "status": {
          "knownValues": [
            "pending",
            "running",
            "succeeded",
            "failed"
          ],
          "type": "string"
        },
        "steps": {
          "description": "In the order they ran.",
          "items": {
            "ref": "#step",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "id",
        "kind",
        "isDeployment",
        "change",
        "requestedBy",
        "status",
        "createdAt",
        "steps"
      ],
      "type": "object"
    },
    "error": {
      "properties": {
        "code": {
          "description": "The provisioner's error code.",
          "type": "string"
        },
        "message": {
          "description": "Present only for codes whose message is written for the owner.",
          "type": "string"
        }
      },
      "required": [
        "code"
      ],
      "type": "object"
    },
    "fromTo": {
      "description": "A value before and after the change. Either side is absent when unknown.",
      "properties": {
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "main": {
      "description": "One change to one of the caller's own instances, with its steps. Customers only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not a HappyProto customer, or the provisioner refused them.",
          "name": "Forbidden"
        },
        {
          "description": "id or deploymentId is not a UUID.",
          "name": "InvalidRequest"
        },
        {
          "description": "No such instance or change, or either is not the caller's, or the change belongs to another instance. These are indistinguishable.",
          "name": "NotFound"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InvalidSlug"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "SlugTaken"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NotEntitled"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "InstanceLimit"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "NoCapacity"
        },
        {
          "description": "Passed through from the provisioner.",
          "name": "OperationInProgress"
        },
        {
          "description": "The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.",
          "name": "Upstream"
        }
      ],
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "deployment": {
              "ref": "#deploymentView",
              "type": "ref"
            }
          },
          "required": [
            "deployment"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "deploymentId": {
            "description": "The change's UUID, as listDeployments returns it.",
            "type": "string"
          },
          "id": {
            "description": "The instance's UUID.",
            "type": "string"
          }
        },
        "required": [
          "id",
          "deploymentId"
        ],
        "type": "params"
      },
      "type": "query"
    },
    "step": {
      "properties": {
        "at": {
          "format": "datetime",
          "type": "string"
        },
        "detail": {
          "description": "Why the step failed, present only when the change's error code is one written for the owner.",
          "type": "string"
        },
        "name": {
          "knownValues": [
            "apply",
            "healthy",
            "stopped",
            "owner",
            "route",
            "dns",
            "store",
            "domain",
            "remove",
            "rollback"
          ],
          "type": "string"
        },
        "status": {
          "knownValues": [
            "succeeded",
            "failed"
          ],
          "type": "string"
        }
      },
      "required": [
        "name",
        "status",
        "at"
      ],
      "type": "object"
    }
  },
  "id": "at.happyproto.server.getDeployment",
  "lexicon": 1
}
