Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HTTP/OAS] Added response schemas for
/api/status
(#181277)
## Summary Part #180056. Adds new response schemas to the `/api/status` endpoint for the purposes of OAS generation. ## How to test 1. Start ES 2. Add `server.oas.enabled: true` to `kibana.dev.yml` 3. Start Kibana `yarn start --no-base-path` 4. `curl -s -uelastic:changeme http://localhost:5601/api/oas\?pathStartsWith\=/api/status | jq` <details> <summary>output</summary> ```json { "openapi": "3.0.0", "info": { "title": "Kibana HTTP APIs", "version": "0.0.0" }, "servers": [ { "url": "http://localhost:5601" } ], "paths": { "/api/status": { "get": { "summary": "Get Kibana's current status.", "responses": { "200": { "description": "Get Kibana's current status.", "content": { "application/json; Elastic-Api-Version=2023-10-31": { "schema": { "description": "Kibana's operational status. A minimal response is sent for unauthorized users.", "anyOf": [ { "$ref": "#/components/schemas/core.status.response" }, { "$ref": "#/components/schemas/core.status.redactedResponse" } ] } } } }, "503": { "description": "Get Kibana's current status.", "content": { "application/json; Elastic-Api-Version=2023-10-31": { "schema": { "description": "Kibana's operational status. A minimal response is sent for unauthorized users.", "anyOf": [ { "$ref": "#/components/schemas/core.status.response" }, { "$ref": "#/components/schemas/core.status.redactedResponse" } ] } } } } }, "parameters": [ { "in": "header", "name": "elastic-api-version", "description": "The version of the API to use", "schema": { "type": "string", "enum": [ "2023-10-31" ], "default": "2023-10-31" } }, { "name": "v7format", "in": "query", "required": false, "schema": { "type": "boolean" }, "description": "Set to \"true\" to get the response in v7 format." }, { "name": "v8format", "in": "query", "required": false, "schema": { "type": "boolean" }, "description": "Set to \"true\" to get the response in v8 format." } ], "operationId": "/api/status#0" } } }, "components": { "schemas": { "core.status.response": { "description": "Kibana's operational status as well as a detailed breakdown of plugin statuses indication of various loads (like event loop utilization and network traffic) at time of request.", "type": "object", "properties": { "name": { "description": "Kibana instance name.", "type": "string" }, "uuid": { "description": "Unique, generated Kibana instance UUID. This UUID should persist even if the Kibana process restarts.", "type": "string" }, "version": { "type": "object", "properties": { "number": { "description": "A semantic version number.", "type": "string" }, "build_hash": { "description": "A unique hash value representing the git commit of this Kibana build.", "type": "string" }, "build_number": { "description": "A monotonically increasing number, each subsequent build will have a higher number.", "type": "number" }, "build_snapshot": { "description": "Whether this build is a snapshot build.", "type": "boolean" }, "build_flavor": { "description": "The build flavour determines configuration and behavior of Kibana. On premise users will almost always run the \"traditional\" flavour, while other flavours are reserved for Elastic-specific use cases.", "anyOf": [ { "enum": [ "serverless" ], "type": "string" }, { "enum": [ "traditional" ], "type": "string" } ] }, "build_date": { "description": "The date and time of this build.", "type": "string" } }, "additionalProperties": false, "required": [ "number", "build_hash", "build_number", "build_snapshot", "build_flavor", "build_date" ] }, "status": { "type": "object", "properties": { "overall": { "type": "object", "properties": { "level": { "description": "Service status levels as human and machine readable values.", "anyOf": [ { "enum": [ "available" ], "type": "string" }, { "enum": [ "degraded" ], "type": "string" }, { "enum": [ "unavailable" ], "type": "string" }, { "enum": [ "critical" ], "type": "string" } ] }, "summary": { "description": "A human readable summary of the service status.", "type": "string" }, "detail": { "description": "Human readable detail of the service status.", "type": "string" }, "documentationUrl": { "description": "A URL to further documentation regarding this service.", "type": "string" }, "meta": { "description": "An unstructured set of extra metadata about this service.", "type": "object", "additionalProperties": {} } }, "additionalProperties": false, "required": [ "level", "summary", "meta" ] }, "core": { "description": "Statuses of core Kibana services.", "type": "object", "properties": { "elasticsearch": { "type": "object", "properties": { "level": { "description": "Service status levels as human and machine readable values.", "anyOf": [ { "enum": [ "available" ], "type": "string" }, { "enum": [ "degraded" ], "type": "string" }, { "enum": [ "unavailable" ], "type": "string" }, { "enum": [ "critical" ], "type": "string" } ] }, "summary": { "description": "A human readable summary of the service status.", "type": "string" }, "detail": { "description": "Human readable detail of the service status.", "type": "string" }, "documentationUrl": { "description": "A URL to further documentation regarding this service.", "type": "string" }, "meta": { "description": "An unstructured set of extra metadata about this service.", "type": "object", "additionalProperties": {} } }, "additionalProperties": false, "required": [ "level", "summary", "meta" ] }, "savedObjects": { "type": "object", "properties": { "level": { "description": "Service status levels as human and machine readable values.", "anyOf": [ { "enum": [ "available" ], "type": "string" }, { "enum": [ "degraded" ], "type": "string" }, { "enum": [ "unavailable" ], "type": "string" }, { "enum": [ "critical" ], "type": "string" } ] }, "summary": { "description": "A human readable summary of the service status.", "type": "string" }, "detail": { "description": "Human readable detail of the service status.", "type": "string" }, "documentationUrl": { "description": "A URL to further documentation regarding this service.", "type": "string" }, "meta": { "description": "An unstructured set of extra metadata about this service.", "type": "object", "additionalProperties": {} } }, "additionalProperties": false, "required": [ "level", "summary", "meta" ] } }, "additionalProperties": false, "required": [ "elasticsearch", "savedObjects" ] }, "plugins": { "description": "A dynamic mapping of plugin ID to plugin status.", "type": "object", "additionalProperties": { "type": "object", "properties": { "level": { "description": "Service status levels as human and machine readable values.", "anyOf": [ { "enum": [ "available" ], "type": "string" }, { "enum": [ "degraded" ], "type": "string" }, { "enum": [ "unavailable" ], "type": "string" }, { "enum": [ "critical" ], "type": "string" } ] }, "summary": { "description": "A human readable summary of the service status.", "type": "string" }, "detail": { "description": "Human readable detail of the service status.", "type": "string" }, "documentationUrl": { "description": "A URL to further documentation regarding this service.", "type": "string" }, "meta": { "description": "An unstructured set of extra metadata about this service.", "type": "object", "additionalProperties": {} } }, "additionalProperties": false, "required": [ "level", "summary", "meta" ] } } }, "additionalProperties": false, "required": [ "overall", "core", "plugins" ] }, "metrics": { "description": "Metric groups collected by Kibana.", "type": "object", "properties": { "elasticsearch_client": { "description": "Current network metrics of Kibana's Elasticsearch client.", "type": "object", "properties": { "totalActiveSockets": { "description": "Count of network sockets currently in use.", "type": "number" }, "totalIdleSockets": { "description": "Count of network sockets currently idle.", "type": "number" }, "totalQueuedRequests": { "description": "Count of requests not yet assigned to sockets.", "type": "number" } }, "additionalProperties": false, "required": [ "totalActiveSockets", "totalIdleSockets", "totalQueuedRequests" ] }, "last_updated": { "description": "The time metrics were collected.", "type": "string" }, "collection_interval_in_millis": { "description": "The interval at which metrics should be collected.", "type": "number" } }, "additionalProperties": false, "required": [ "elasticsearch_client", "last_updated", "collection_interval_in_millis" ] } }, "additionalProperties": false, "required": [ "name", "uuid", "version", "status", "metrics" ] }, "core.status.redactedResponse": { "description": "A minimal representation of Kibana's operational status.", "type": "object", "properties": { "status": { "type": "object", "properties": { "overall": { "type": "object", "properties": { "level": { "description": "Service status levels as human and machine readable values.", "anyOf": [ { "enum": [ "available" ], "type": "string" }, { "enum": [ "degraded" ], "type": "string" }, { "enum": [ "unavailable" ], "type": "string" }, { "enum": [ "critical" ], "type": "string" } ] } }, "additionalProperties": false, "required": [ "level" ] } }, "additionalProperties": false, "required": [ "overall" ] } }, "additionalProperties": false, "required": [ "status" ] } }, "securitySchemes": { "basicAuth": { "type": "http", "scheme": "basic" }, "apiKeyAuth": { "type": "apiKey", "in": "header", "name": "Authorization" } } }, "security": [ { "basicAuth": [] } ] } ``` </details> Related to #181622 ## Notes * Tip from @lcawl : "If you want to see Bump previews of your files too, I’ve been doing it via the preview command per https://docs.bump.sh/help/continuous-integration/cli/#bump-preview-file"
- Loading branch information