{
  "components": {
    "schemas": {
      "ContainerSpec": {
        "description": "Everything needed to run one plugin container.\n\nThe gateway builds it from spot.yaml; the plugin-manager applies it.\n``identity()`` is what the plugin-manager fingerprints: two specs with\nthe same identity produce the same container.",
        "properties": {
          "environment": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "The plugin's plain settings and the platform variables, never a secret",
            "title": "Environment",
            "type": "object"
          },
          "image": {
            "description": "Container image reference",
            "title": "Image",
            "type": "string"
          },
          "isolated": {
            "default": false,
            "description": "No route out: every plugin from 2.1 (spot/spot#113, #148)",
            "title": "Isolated",
            "type": "boolean"
          },
          "kind": {
            "$ref": "#/components/schemas/PluginKind",
            "description": "Plugin kind"
          },
          "plugin_id": {
            "description": "Plugin ID",
            "title": "Plugin Id",
            "type": "string"
          },
          "reach": {
            "description": "host:port the plugin reaches through the egress gateway; only an isolated plugin's (#143)",
            "items": {
              "type": "string"
            },
            "title": "Reach",
            "type": "array"
          },
          "registry_auth": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "Credentials for pulling the image; never part of the identity",
            "title": "Registry Auth"
          },
          "resources": {
            "$ref": "#/components/schemas/Resources"
          },
          "secrets": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "Written to /run/secrets/<name> before the container starts",
            "title": "Secrets",
            "type": "object"
          },
          "version": {
            "description": "Plugin version",
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "plugin_id",
          "kind",
          "version",
          "image"
        ],
        "title": "ContainerSpec",
        "type": "object"
      },
      "ContainerStatus": {
        "description": "State of one plugin container, as the plugin-manager reports it.",
        "properties": {
          "container_id": {
            "description": "Docker container ID",
            "title": "Container Id",
            "type": "string"
          },
          "health": {
            "description": "Docker health status, or unknown",
            "title": "Health",
            "type": "string"
          },
          "plugin_id": {
            "description": "Plugin ID",
            "title": "Plugin Id",
            "type": "string"
          },
          "recreated": {
            "default": false,
            "description": "Whether this call created a new container",
            "title": "Recreated",
            "type": "boolean"
          },
          "status": {
            "description": "Docker status, e.g. running or exited",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "plugin_id",
          "container_id",
          "status",
          "health"
        ],
        "title": "ContainerStatus",
        "type": "object"
      },
      "EnsureRequest": {
        "description": "The container a plugin should have, and whether it should be running.",
        "properties": {
          "running": {
            "description": "Whether the container should be running",
            "title": "Running",
            "type": "boolean"
          },
          "spec": {
            "$ref": "#/components/schemas/ContainerSpec",
            "description": "What the container is created from"
          }
        },
        "required": [
          "spec",
          "running"
        ],
        "title": "EnsureRequest",
        "type": "object"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "title": "Detail",
            "type": "array"
          }
        },
        "title": "HTTPValidationError",
        "type": "object"
      },
      "PluginKind": {
        "description": "What a plugin does; a plugin has exactly one kind.",
        "enum": [
          "analyzer",
          "context_provider",
          "mail_retriever",
          "responder"
        ],
        "title": "PluginKind",
        "type": "string"
      },
      "Resources": {
        "description": "Memory and CPU a plugin container may use.",
        "properties": {
          "cpus": {
            "default": 1.0,
            "description": "CPU cores",
            "exclusiveMinimum": 0.0,
            "maximum": 64.0,
            "title": "Cpus",
            "type": "number"
          },
          "memory_mb": {
            "default": 1024,
            "description": "Memory in MB",
            "minimum": 128.0,
            "title": "Memory Mb",
            "type": "integer"
          }
        },
        "title": "Resources",
        "type": "object"
      },
      "ValidationError": {
        "properties": {
          "ctx": {
            "title": "Context",
            "type": "object"
          },
          "input": {
            "title": "Input"
          },
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "title": "Location",
            "type": "array"
          },
          "msg": {
            "title": "Message",
            "type": "string"
          },
          "type": {
            "title": "Error Type",
            "type": "string"
          }
        },
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError",
        "type": "object"
      }
    },
    "securitySchemes": {
      "MetricsToken": {
        "description": "The metrics token (METRICS_TOKEN)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Runs plugin containers on behalf of the api-gateway.",
    "title": "SPOT Plugin Manager",
    "version": "2.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/health": {
      "get": {
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "title": "Response Health Health Get",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Health",
        "tags": [
          "Health"
        ]
      }
    },
    "/metrics": {
      "get": {
        "operationId": "metrics_metrics_get",
        "responses": {
          "200": {
            "content": {
              "text/plain": {}
            },
            "description": "Prometheus text format"
          },
          "401": {
            "description": "Without the metrics token"
          },
          "503": {
            "description": "Metrics are off: METRICS_TOKEN is not set"
          }
        },
        "security": [
          {
            "MetricsToken": []
          }
        ],
        "summary": "Metrics",
        "tags": [
          "Metrics"
        ]
      }
    },
    "/plugins/{plugin_id}": {
      "delete": {
        "operationId": "remove_plugin_plugins__plugin_id__delete",
        "parameters": [
          {
            "in": "path",
            "name": "plugin_id",
            "required": true,
            "schema": {
              "title": "Plugin Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Internal-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Api-Key"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Remove Plugin",
        "tags": [
          "Plugin Containers"
        ]
      },
      "get": {
        "operationId": "get_plugin_plugins__plugin_id__get",
        "parameters": [
          {
            "in": "path",
            "name": "plugin_id",
            "required": true,
            "schema": {
              "title": "Plugin Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Internal-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Get Plugin",
        "tags": [
          "Plugin Containers"
        ]
      },
      "put": {
        "operationId": "ensure_plugin_plugins__plugin_id__put",
        "parameters": [
          {
            "in": "path",
            "name": "plugin_id",
            "required": true,
            "schema": {
              "title": "Plugin Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Internal-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Api-Key"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnsureRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Ensure Plugin",
        "tags": [
          "Plugin Containers"
        ]
      }
    },
    "/plugins/{plugin_id}/restart": {
      "post": {
        "operationId": "restart_plugin_plugins__plugin_id__restart_post",
        "parameters": [
          {
            "in": "path",
            "name": "plugin_id",
            "required": true,
            "schema": {
              "title": "Plugin Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Internal-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Restart Plugin",
        "tags": [
          "Plugin Containers"
        ]
      }
    },
    "/plugins/{plugin_id}/stop": {
      "post": {
        "operationId": "stop_plugin_plugins__plugin_id__stop_post",
        "parameters": [
          {
            "in": "path",
            "name": "plugin_id",
            "required": true,
            "schema": {
              "title": "Plugin Id",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Internal-API-Key",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Internal-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContainerStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            },
            "description": "Validation Error"
          }
        },
        "summary": "Stop Plugin",
        "tags": [
          "Plugin Containers"
        ]
      }
    }
  }
}
