# at.happyproto.admin.listInstances

> Every instance, whoever owns it, with its placement. Staff only.

- Kind: query
- Authority: admin.happyproto.at
- Lexicon: 1
- Published by [happyproto.at](https://lexicon.garden/identity/did:plc:mo7vq4jbioxwafy5zkcc3eux), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listInstances)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listInstances/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:mo7vq4jbioxwafy5zkcc3eux/at.happyproto.admin.listInstances/analytics)

## Query (`at.happyproto.admin.listInstances`)

Type: query · GET

### Parameters (query string)

- `owner` (string · did): Only this owner's instances.

### Output (application/json)

- `instances` (array, required)
  - `items` (ref)
    - Reference: `#adminInstance`

### Errors

- `AuthRequired`: This endpoint requires an authenticated caller.
- `Forbidden`: The caller is not HappyProto staff, or the provisioner does not treat them as staff.
- `InvalidRequest`: owner is not a DID, or the provisioner refused the request as malformed.
- `NotFound`: Passed through from the provisioner.
- `InvalidSlug`: Passed through from the provisioner.
- `SlugTaken`: Passed through from the provisioner.
- `NotEntitled`: Passed through from the provisioner.
- `InstanceLimit`: Passed through from the provisioner.
- `NoCapacity`: Passed through from the provisioner.
- `OperationInProgress`: Passed through from the provisioner.
- `Upstream`: The provisioner is unreachable, not configured, or answered with an error it does not explain to callers.

## #adminInstance (`at.happyproto.admin.listInstances#adminInstance`)

Type: object

An instance as staff see it: the customer's view, plus its owner, placement and raw states.

### Properties

- `availableVersion` (ref): A newer release, when one is on offer.
  - Reference: `#availableVersion`
- `createdAt` (string · datetime, required)
- `desiredState` (string, required): The provisioner's desired_state.
- `encryptionStage` (string): Where its encryption key is in a rotation: none, rotating (the new key is not live yet), sealing (HappyView is re-sealing with it), retiring (the old key is being removed) or failed (a rotate_key or retire_key failed and the instance with it). From the provisioner's database alone.
  - Constraints: knownValues: none | rotating | sealing | retiring | failed
- `hostId` (string): The host it is placed on. Absent until it is placed.
- `hostName` (string): That host's name. Absent when the hosts list does not have it.
- `id` (string, required): A UUID.
- `observedState` (string, required): The provisioner's observed_state.
- `operation` (ref): The change in progress, if any.
  - Reference: `#operation`
- `ownerDid` (string · did, required)
- `plan` (string, required): The plan's id.
- `routed` (boolean, required): Whether its public URL routes to it.
- `slug` (string, required)
- `state` (string, required)
  - Constraints: knownValues: provisioning | running | stopped | failed | deleting
- `url` (string · uri, required)
- `version` (string, required): The HappyView release it runs.
- `versionLabel` (string): The HappyView version the release carries, e.g. 3.0.0-alpha.41, when known.

## #availableVersion (`at.happyproto.admin.listInstances#availableVersion`)

Type: object

A newer HappyView release the instance can upgrade to.

### Properties

- `label` (string): The HappyView version the release carries, e.g. 3.0.0-alpha.41, when known.
- `releasedAt` (string · datetime, required): When HappyProto first offered it.
- `version` (string, required): The release to pass to at.happyproto.server.upgradeInstance.

## #operation (`at.happyproto.admin.listInstances#operation`)

Type: object

### Properties

- `error` (string): The provisioner's error code, when it failed.
- `id` (string, required)
- `kind` (string, required)
  - Constraints: knownValues: create | update | upgrade | stop | start | destroy | rotate_key | retire_key
- `status` (string, required)
  - Constraints: knownValues: pending | running | succeeded | failed
- `step` (string): The step it last reached.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "adminInstance": {
      "description": "An instance as staff see it: the customer's view, plus its owner, placement and raw states.",
      "properties": {
        "availableVersion": {
          "description": "A newer release, when one is on offer.",
          "ref": "#availableVersion",
          "type": "ref"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "desiredState": {
          "description": "The provisioner's desired_state.",
          "type": "string"
        },
        "encryptionStage": {
          "description": "Where its encryption key is in a rotation: none, rotating (the new key is not live yet), sealing (HappyView is re-sealing with it), retiring (the old key is being removed) or failed (a rotate_key or retire_key failed and the instance with it). From the provisioner's database alone.",
          "knownValues": [
            "none",
            "rotating",
            "sealing",
            "retiring",
            "failed"
          ],
          "type": "string"
        },
        "hostId": {
          "description": "The host it is placed on. Absent until it is placed.",
          "type": "string"
        },
        "hostName": {
          "description": "That host's name. Absent when the hosts list does not have it.",
          "type": "string"
        },
        "id": {
          "description": "A UUID.",
          "type": "string"
        },
        "observedState": {
          "description": "The provisioner's observed_state.",
          "type": "string"
        },
        "operation": {
          "description": "The change in progress, if any.",
          "ref": "#operation",
          "type": "ref"
        },
        "ownerDid": {
          "format": "did",
          "type": "string"
        },
        "plan": {
          "description": "The plan's id.",
          "type": "string"
        },
        "routed": {
          "description": "Whether its public URL routes to it.",
          "type": "boolean"
        },
        "slug": {
          "type": "string"
        },
        "state": {
          "knownValues": [
            "provisioning",
            "running",
            "stopped",
            "failed",
            "deleting"
          ],
          "type": "string"
        },
        "url": {
          "format": "uri",
          "type": "string"
        },
        "version": {
          "description": "The HappyView release it runs.",
          "type": "string"
        },
        "versionLabel": {
          "description": "The HappyView version the release carries, e.g. 3.0.0-alpha.41, when known.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "slug",
        "url",
        "plan",
        "version",
        "state",
        "createdAt",
        "ownerDid",
        "desiredState",
        "observedState",
        "routed"
      ],
      "type": "object"
    },
    "availableVersion": {
      "description": "A newer HappyView release the instance can upgrade to.",
      "properties": {
        "label": {
          "description": "The HappyView version the release carries, e.g. 3.0.0-alpha.41, when known.",
          "type": "string"
        },
        "releasedAt": {
          "description": "When HappyProto first offered it.",
          "format": "datetime",
          "type": "string"
        },
        "version": {
          "description": "The release to pass to at.happyproto.server.upgradeInstance.",
          "type": "string"
        }
      },
      "required": [
        "version",
        "releasedAt"
      ],
      "type": "object"
    },
    "main": {
      "description": "Every instance, whoever owns it, with its placement. Staff only.",
      "errors": [
        {
          "description": "This endpoint requires an authenticated caller.",
          "name": "AuthRequired"
        },
        {
          "description": "The caller is not HappyProto staff, or the provisioner does not treat them as staff.",
          "name": "Forbidden"
        },
        {
          "description": "owner is not a DID, or the provisioner refused the request as malformed.",
          "name": "InvalidRequest"
        },
        {
          "description": "Passed through from the provisioner.",
          "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": {
            "instances": {
              "items": {
                "ref": "#adminInstance",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "instances"
          ],
          "type": "object"
        }
      },
      "parameters": {
        "properties": {
          "owner": {
            "description": "Only this owner's instances.",
            "format": "did",
            "type": "string"
          }
        },
        "type": "params"
      },
      "type": "query"
    },
    "operation": {
      "properties": {
        "error": {
          "description": "The provisioner's error code, when it failed.",
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "kind": {
          "knownValues": [
            "create",
            "update",
            "upgrade",
            "stop",
            "start",
            "destroy",
            "rotate_key",
            "retire_key"
          ],
          "type": "string"
        },
        "status": {
          "knownValues": [
            "pending",
            "running",
            "succeeded",
            "failed"
          ],
          "type": "string"
        },
        "step": {
          "description": "The step it last reached.",
          "type": "string"
        }
      },
      "required": [
        "id",
        "kind",
        "status"
      ],
      "type": "object"
    }
  },
  "id": "at.happyproto.admin.listInstances",
  "lexicon": 1
}
```
