{
  "openapi": "3.1.0",
  "info": {
    "title": "Virtana API",
    "version": "1.0.0",
    "summary": "Drive Virtana LXC containers with personal access tokens.",
    "description": "JSON API of Virtana (Atelink). Authenticate with a personal access token created on the account page of the customer area (`Authorization: Bearer vtn_…`). A token reads, or reads and acts, on the containers its owner may open (owner, collaborator, project member), all of them or the ones it is limited to. Errors always have the shape `{\"error\": {\"code\", \"message\", \"details\"?}}`; `code` is stable, `message` follows `Accept-Language` (French by default, or English). Guide: https://virtana.fr/documentation/api",
    "contact": {
      "name": "Virtana support",
      "url": "https://virtana.fr/contact"
    }
  },
  "servers": [
    {
      "url": "https://virtana.fr/api/v1"
    }
  ],
  "security": [
    {
      "bearerToken": []
    }
  ],
  "tags": [
    {
      "name": "Token",
      "description": "The token of the request."
    },
    {
      "name": "Containers",
      "description": "Containers the token reaches."
    },
    {
      "name": "Operations",
      "description": "Actions on a container and their progress."
    }
  ],
  "paths": {
    "/token": {
      "get": {
        "tags": [
          "Token"
        ],
        "operationId": "getToken",
        "summary": "Describe the current token",
        "description": "Name, rights, containers and expiry of the token used for the request. Needs the `read` ability.",
        "responses": {
          "200": {
            "description": "The token.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Token"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/containers": {
      "get": {
        "tags": [
          "Containers"
        ],
        "operationId": "listContainers",
        "summary": "List the containers",
        "description": "Containers the token reaches, newest first: the owner's and those shared with them, or only the ones the token is limited to. Cancelled orders and erased containers are left out.",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "description": "Keep only the containers in this state.",
            "schema": {
              "$ref": "#/components/schemas/ContainerState"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of containers.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "422": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/containers/{container}": {
      "parameters": [
        {
          "$ref": "#/components/parameters/container"
        }
      ],
      "get": {
        "tags": [
          "Containers"
        ],
        "operationId": "getContainer",
        "summary": "Show a container",
        "responses": {
          "200": {
            "description": "The container.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Container"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/containers/{container}/backups": {
      "parameters": [
        {
          "$ref": "#/components/parameters/container"
        }
      ],
      "get": {
        "tags": [
          "Containers"
        ],
        "operationId": "listBackups",
        "summary": "List the backups and snapshots",
        "description": "Copies still kept, newest first; deleted ones are left out. A collaborator needs the `backups.read` permission.",
        "responses": {
          "200": {
            "description": "Backups and snapshots.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Backup"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/containers/{container}/metrics": {
      "parameters": [
        {
          "$ref": "#/components/parameters/container"
        }
      ],
      "get": {
        "tags": [
          "Containers"
        ],
        "operationId": "getMetrics",
        "summary": "Latest measurements",
        "description": "Last sample of the collector. `fresh` is true when it is under five minutes old; `available` when it is fresh and the collection succeeded.",
        "responses": {
          "200": {
            "description": "Latest sample.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Metrics"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/containers/{container}/actions": {
      "parameters": [
        {
          "$ref": "#/components/parameters/container"
        }
      ],
      "post": {
        "tags": [
          "Operations"
        ],
        "operationId": "requestAction",
        "summary": "Start, stop, restart, back up or snapshot",
        "description": "Queues an action, with the same checks as the customer area: permissions of a collaborator (`system.write`, or `backups.write` for `backup` and `snapshot`), state of the container, paid period, backups included in the offer, launch scope. Needs a token with the `actions` ability. The same `Idempotency-Key` sent again gives back the same operation with `Idempotent-Replayed: true`; reused for another action, it is refused with 409. One operation at a time per container.",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionRequest"
              },
              "examples": {
                "restart": {
                  "value": {
                    "action": "restart"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The operation, queued (or the one already asked with this key).",
            "headers": {
              "Location": {
                "description": "Address of the operation.",
                "schema": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "Idempotent-Replayed": {
                "description": "`true` when the key had already been used for this action.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                }
              },
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/ActionRefused"
          }
        }
      }
    },
    "/operations/{operation}": {
      "parameters": [
        {
          "name": "operation",
          "in": "path",
          "required": true,
          "description": "Identifier of the operation (`id`).",
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "tags": [
          "Operations"
        ],
        "operationId": "getOperation",
        "summary": "Follow an operation",
        "description": "Any operation of a container the token reaches, including those asked from the customer area.",
        "responses": {
          "200": {
            "description": "The operation.",
            "headers": {
              "X-RateLimit-Limit": {
                "$ref": "#/components/headers/X-RateLimit-Limit"
              },
              "X-RateLimit-Remaining": {
                "$ref": "#/components/headers/X-RateLimit-Remaining"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Operation"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthenticated"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "vtn_<48 characters>",
        "description": "Personal access token created on https://virtana.fr/mon-infrastructure/compte#api. Shown once; only its SHA-256 is kept."
      }
    },
    "parameters": {
      "container": {
        "name": "container",
        "in": "path",
        "required": true,
        "description": "Identifier of the container (`id`), the same as in the address of its page.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": true,
        "description": "A UUID generated by the client once per action (case does not matter). It is the `request_id` of the customer area's forms.",
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "headers": {
      "X-RateLimit-Limit": {
        "description": "Requests allowed per minute for this token.",
        "schema": {
          "type": "integer"
        }
      },
      "X-RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before the next request.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "`idempotency_key_required` or `idempotency_key_invalid`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthenticated": {
        "description": "`unauthenticated`, `invalid_token`, `token_expired` or `token_revoked`.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "description": "`Bearer realm=\"virtana\"`, with `error=\"invalid_token\"` for a token refused."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "token_expired",
                "message": "This access token has expired: create a new one from your account."
              }
            }
          }
        }
      },
      "Forbidden": {
        "description": "`insufficient_scope` (read-only token asked to act), `forbidden` (permission missing on the container) or `account_suspended`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "`container_not_found` or `operation_not_found`: it does not exist, or the token does not reach it.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "`idempotency_key_reused`: the key was already used for another action on this container.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ValidationFailed": {
        "description": "`validation_failed`, with `details` field by field.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "ActionRefused": {
        "description": "`action_refused` (state of the container, paid period, offer, launch scope, operation in progress), `action_not_supported` (action kept for the customer area) or `validation_failed`.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "action_refused",
                "message": "Renew the paid period before starting this instance.",
                "details": {
                  "action": [
                    "Renew the paid period before starting this instance."
                  ]
                }
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "`rate_limited`: too many requests for this token, too many actions, or too many invalid tokens from one address.",
        "headers": {
          "Retry-After": {
            "$ref": "#/components/headers/Retry-After"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable identifier of the error.",
                "examples": [
                  "container_not_found"
                ]
              },
              "message": {
                "type": "string",
                "description": "Explanation in the language of `Accept-Language` (fr or en)."
              },
              "details": {
                "type": "object",
                "description": "Messages field by field, for a refused input.",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "Token": {
        "type": "object",
        "required": [
          "id",
          "name",
          "prefix",
          "abilities",
          "containers",
          "expires_at",
          "last_used_at",
          "created_at",
          "account"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "First characters of the token.",
            "examples": [
              "vtn_AbCd1234"
            ]
          },
          "abilities": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "actions"
              ]
            }
          },
          "containers": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Containers the token is limited to; null for every one its owner reaches."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Null for a token without expiry."
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "account": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "ContainerState": {
        "type": "string",
        "enum": [
          "awaiting_payment",
          "queued",
          "provisioning",
          "running",
          "stopped",
          "archived",
          "suspended",
          "retention"
        ],
        "description": "State known to Virtana. New states may be added."
      },
      "Container": {
        "type": "object",
        "required": [
          "id",
          "name",
          "state",
          "role",
          "permissions",
          "resources",
          "access",
          "billing",
          "links"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "state": {
            "$ref": "#/components/schemas/ContainerState"
          },
          "observed_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State last read on the hypervisor."
          },
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "role": {
            "type": "string",
            "enum": [
              "owner",
              "collaborator"
            ]
          },
          "permissions": {
            "type": "array",
            "description": "What the token's owner may do on this container.",
            "items": {
              "type": "string",
              "enum": [
                "console.read",
                "files.read",
                "files.write",
                "network.read",
                "network.write",
                "backups.read",
                "backups.write",
                "system.read",
                "system.write"
              ]
            }
          },
          "resources": {
            "type": "object",
            "required": [
              "vcpu",
              "ram_mb",
              "disk_gb"
            ],
            "properties": {
              "vcpu": {
                "type": "integer"
              },
              "ram_mb": {
                "type": "integer"
              },
              "disk_gb": {
                "type": "integer"
              }
            }
          },
          "access": {
            "description": "SSH and HTTPS access, once the container is published and with the `console.read` permission; null otherwise.",
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "properties": {
                  "ssh": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "host": {
                            "type": "string"
                          },
                          "port": {
                            "type": "integer"
                          },
                          "user": {
                            "type": "string"
                          },
                          "command": {
                            "type": "string",
                            "examples": [
                              "ssh -p 22001 root@203.0.113.10"
                            ]
                          }
                        }
                      }
                    ]
                  },
                  "https": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "hostname": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "target_port": {
                            "type": "integer"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            ]
          },
          "billing": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "subscription",
                  "usage"
                ]
              },
              "period": {
                "type": "string",
                "enum": [
                  "monthly",
                  "quarterly",
                  "semiannual",
                  "annual"
                ]
              },
              "paid_until": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "cancel_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Date a cancelled subscription stops."
              },
              "term": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Term of the container: `cancel_at` when cancelled, else `paid_until`."
              }
            }
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "links": {
            "type": "object",
            "properties": {
              "self": {
                "type": "string",
                "format": "uri"
              },
              "backups": {
                "type": "string",
                "format": "uri"
              },
              "metrics": {
                "type": "string",
                "format": "uri"
              },
              "dashboard": {
                "type": "string",
                "format": "uri",
                "description": "Page of the container in the customer area."
              }
            }
          }
        }
      },
      "ContainerList": {
        "type": "object",
        "required": [
          "data",
          "meta",
          "links"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Container"
            }
          },
          "meta": {
            "type": "object",
            "properties": {
              "page": {
                "type": "integer"
              },
              "per_page": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "last_page": {
                "type": "integer"
              }
            }
          },
          "links": {
            "type": "object",
            "properties": {
              "next": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "prev": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              }
            }
          }
        }
      },
      "ActionRequest": {
        "type": "object",
        "required": [
          "action"
        ],
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "start",
              "stop",
              "restart",
              "backup",
              "snapshot"
            ]
          }
        }
      },
      "Operation": {
        "type": "object",
        "required": [
          "id",
          "container",
          "action",
          "status",
          "phase",
          "requested_by",
          "created_at",
          "links"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "container": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "type": "string",
            "description": "start, stop, restart, backup, snapshot, or another operation of the customer area."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "succeeded",
              "failed",
              "uncertain"
            ],
            "description": "`uncertain`: the result is checked by an operator."
          },
          "phase": {
            "type": "string"
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "idempotency_key": {
            "type": [
              "string",
              "null"
            ],
            "description": "Idempotency-Key of an action asked through the API."
          },
          "backup": {
            "type": [
              "string",
              "null"
            ],
            "format": "uuid",
            "description": "Copy made by a backup or snapshot, once created."
          },
          "requested_by": {
            "type": "object",
            "properties": {
              "user": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Name of the person; null for an operation of the system."
              },
              "token": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "name": {
                        "type": "string"
                      }
                    }
                  }
                ],
                "description": "Token through which it was asked; null from the customer area."
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "links": {
            "type": "object",
            "properties": {
              "self": {
                "type": "string",
                "format": "uri"
              },
              "container": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "Backup": {
        "type": "object",
        "required": [
          "id",
          "kind",
          "state"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "kind": {
            "type": "string",
            "enum": [
              "backup",
              "snapshot"
            ]
          },
          "state": {
            "type": "string",
            "examples": [
              "available",
              "verified"
            ]
          },
          "bytes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "verified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Metrics": {
        "type": "object",
        "required": [
          "observed_at",
          "fresh",
          "available",
          "values"
        ],
        "properties": {
          "observed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "fresh": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "values": {
            "type": "object",
            "description": "Raw sample: `cpu` (share of the allocated processors, 0–1), `mem`/`maxmem` and `disk`/`maxdisk` (bytes), `uptime` (seconds), `netin`/`netout` and `diskread`/`diskwrite` (bytes since start), `state`; `error_code` when the collection failed.",
            "properties": {
              "available": {
                "type": "boolean"
              },
              "state": {
                "type": "string"
              },
              "cpu": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "mem": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "maxmem": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "disk": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "maxdisk": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "uptime": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "netin": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "netout": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "diskread": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "diskwrite": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "error_code": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
