mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Drafts an open API specification for Kibana ML APIs (#129548)
This commit is contained in:
parent
161e9a2742
commit
9e197819c2
5 changed files with 561 additions and 3 deletions
|
@ -47,9 +47,9 @@ it is added. This list contains the {dfeed} identifiers and indicates whether
|
|||
the synchronization was successful.
|
||||
|
||||
`datafeedsRemoved`::
|
||||
(array) If saved objects exist for {dfeeds} that no longer exist, they are
|
||||
deleted. This list contains the {dfeed} identifiers and indicates whether the
|
||||
synchronization was successful.
|
||||
(array) If a saved object for an anomaly detection job references a datafeed
|
||||
that no longer exists, it is deleted. This list contains the {dfeed} identifiers
|
||||
and indicates whether the synchronization was successful.
|
||||
|
||||
`savedObjectsCreated`::
|
||||
(array) If saved objects are missing for {ml} jobs or trained models, they are
|
||||
|
|
20
x-pack/plugins/ml/common/openapi/README.md
Normal file
20
x-pack/plugins/ml/common/openapi/README.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
# OpenAPI (Experimental)
|
||||
|
||||
The current self-contained spec file can be used for online tools like those found at https://openapi.tools/. This spec is experimental and may be incomplete or change later.
|
||||
|
||||
A guide about the openApi specification can be found at [https://swagger.io/docs/specification/about/](https://swagger.io/docs/specification/about/).
|
||||
|
||||
## Tools
|
||||
|
||||
It is possible to validate the docs before bundling them by running the following command in the `x-pack/plugins/ml/common/openapi/` folder:
|
||||
```
|
||||
npx swagger-cli validate ml_apis.yaml
|
||||
```
|
||||
|
||||
Then generate the `bundled` files with the following commands:
|
||||
|
||||
```
|
||||
npx @redocly/openapi-cli bundle --ext yaml --output bundled.yaml ml_apis.yaml
|
||||
npx @redocly/openapi-cli bundle --ext json --output bundled.json ml_apis.yaml
|
||||
```
|
||||
|
225
x-pack/plugins/ml/common/openapi/bundled.json
Normal file
225
x-pack/plugins/ml/common/openapi/bundled.json
Normal file
|
@ -0,0 +1,225 @@
|
|||
{
|
||||
"openapi": "3.0.1",
|
||||
"info": {
|
||||
"title": "Machine learning APIs",
|
||||
"description": "Kibana APIs for the machine learning feature",
|
||||
"version": "1.0.0",
|
||||
"license": {
|
||||
"name": "Elastic License 2.0",
|
||||
"url": "https://www.elastic.co/licensing/elastic-license"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "ml",
|
||||
"description": "Machine learning"
|
||||
}
|
||||
],
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://localhost:5601/"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/s/{spaceId}/api/ml/saved_objects/sync": {
|
||||
"get": {
|
||||
"description": "Synchronizes Kibana saved objects for machine learning jobs and trained models. You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges. This API runs automatically when you start Kibana and periodically thereafter.\n",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/spaceParam"
|
||||
},
|
||||
{
|
||||
"$ref": "#/components/parameters/simulateParam"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Indicates a successful call",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/syncResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ml/saved_objects/sync": {
|
||||
"get": {
|
||||
"description": "Synchronizes Kibana saved objects for machine learning jobs and trained models. You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges. This API runs automatically when you start Kibana and periodically thereafter.\n",
|
||||
"parameters": [
|
||||
{
|
||||
"$ref": "#/components/parameters/simulateParam"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Indicates a successful call",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/syncResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"parameters": {
|
||||
"spaceParam": {
|
||||
"in": "path",
|
||||
"name": "spaceId",
|
||||
"description": "An identifier for the space.",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"simulateParam": {
|
||||
"in": "query",
|
||||
"name": "simulate",
|
||||
"description": "When true, simulates the synchronization by returning only the list actions that would be performed.",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"example": "true"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
"basicAuth": {
|
||||
"type": "http",
|
||||
"scheme": "basic"
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"syncResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"datafeedsAdded": {
|
||||
"type": "object",
|
||||
"description": "If a saved object for an anomaly detection job is missing a datafeed identifier, it is added. This list contains the datafeed identifiers and indicates whether the synchronization was successful.",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"datafeedsRemoved": {
|
||||
"type": "object",
|
||||
"description": "If a saved object for an anomaly detection job references a datafeed that no longer exists, it is deleted. This list contains the datafeed identifiers and indicates whether the synchronization was successful.",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"savedObjectsCreated": {
|
||||
"type": "object",
|
||||
"description": "If saved objects are missing for machine learning jobs or trained models, they are created. This list contains the job and model identifiers and indicates whether the synchronization was successful.",
|
||||
"properties": {
|
||||
"anomaly-detector": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"data-frame-analytics": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"trained-model": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"savedObjectsDeleted": {
|
||||
"type": "object",
|
||||
"description": "If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted. This list contains the job and model identifiers and indicates whether the synchronization was successful.",
|
||||
"properties": {
|
||||
"anomaly-detector": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"data-frame-analytics": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"trained-model": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"basicAuth": []
|
||||
}
|
||||
]
|
||||
}
|
167
x-pack/plugins/ml/common/openapi/bundled.yaml
Normal file
167
x-pack/plugins/ml/common/openapi/bundled.yaml
Normal file
|
@ -0,0 +1,167 @@
|
|||
openapi: 3.0.1
|
||||
info:
|
||||
title: Machine learning APIs
|
||||
description: Kibana APIs for the machine learning feature
|
||||
version: 1.0.0
|
||||
license:
|
||||
name: Elastic License 2.0
|
||||
url: https://www.elastic.co/licensing/elastic-license
|
||||
tags:
|
||||
- name: ml
|
||||
description: Machine learning
|
||||
servers:
|
||||
- url: https://localhost:5601/
|
||||
paths:
|
||||
/s/{spaceId}/api/ml/saved_objects/sync:
|
||||
get:
|
||||
description: >
|
||||
Synchronizes Kibana saved objects for machine learning jobs and trained
|
||||
models. You must have `all` privileges for the **Machine Learning**
|
||||
feature in the **Analytics** section of the Kibana feature privileges.
|
||||
This API runs automatically when you start Kibana and periodically
|
||||
thereafter.
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/spaceParam'
|
||||
- $ref: '#/components/parameters/simulateParam'
|
||||
responses:
|
||||
'200':
|
||||
description: Indicates a successful call
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/syncResponse'
|
||||
/api/ml/saved_objects/sync:
|
||||
get:
|
||||
description: >
|
||||
Synchronizes Kibana saved objects for machine learning jobs and trained
|
||||
models. You must have `all` privileges for the **Machine Learning**
|
||||
feature in the **Analytics** section of the Kibana feature privileges.
|
||||
This API runs automatically when you start Kibana and periodically
|
||||
thereafter.
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/simulateParam'
|
||||
responses:
|
||||
'200':
|
||||
description: Indicates a successful call
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/syncResponse'
|
||||
components:
|
||||
parameters:
|
||||
spaceParam:
|
||||
in: path
|
||||
name: spaceId
|
||||
description: An identifier for the space.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
simulateParam:
|
||||
in: query
|
||||
name: simulate
|
||||
description: >-
|
||||
When true, simulates the synchronization by returning only the list
|
||||
actions that would be performed.
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
example: 'true'
|
||||
securitySchemes:
|
||||
basicAuth:
|
||||
type: http
|
||||
scheme: basic
|
||||
schemas:
|
||||
syncResponse:
|
||||
type: object
|
||||
properties:
|
||||
datafeedsAdded:
|
||||
type: object
|
||||
description: >-
|
||||
If a saved object for an anomaly detection job is missing a datafeed
|
||||
identifier, it is added. This list contains the datafeed identifiers
|
||||
and indicates whether the synchronization was successful.
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
datafeedsRemoved:
|
||||
type: object
|
||||
description: >-
|
||||
If a saved object for an anomaly detection job references a datafeed
|
||||
that no longer exists, it is deleted. This list contains the
|
||||
datafeed identifiers and indicates whether the synchronization was
|
||||
successful.
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
savedObjectsCreated:
|
||||
type: object
|
||||
description: >-
|
||||
If saved objects are missing for machine learning jobs or trained
|
||||
models, they are created. This list contains the job and model
|
||||
identifiers and indicates whether the synchronization was
|
||||
successful.
|
||||
properties:
|
||||
anomaly-detector:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
data-frame-analytics:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
trained-model:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
savedObjectsDeleted:
|
||||
type: object
|
||||
description: >-
|
||||
If saved objects exist for machine learning jobs or trained models
|
||||
that no longer exist, they are deleted. This list contains the job
|
||||
and model identifiers and indicates whether the synchronization was
|
||||
successful.
|
||||
properties:
|
||||
anomaly-detector:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
data-frame-analytics:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
trained-model:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
security:
|
||||
- basicAuth: []
|
146
x-pack/plugins/ml/common/openapi/ml_apis.yaml
Normal file
146
x-pack/plugins/ml/common/openapi/ml_apis.yaml
Normal file
|
@ -0,0 +1,146 @@
|
|||
openapi: 3.0.1
|
||||
info:
|
||||
title: Machine learning APIs
|
||||
description: Kibana APIs for the machine learning feature
|
||||
version: "1.0.0"
|
||||
license:
|
||||
name: Elastic License 2.0
|
||||
url: https://www.elastic.co/licensing/elastic-license
|
||||
tags:
|
||||
- name: ml
|
||||
description: Machine learning
|
||||
servers:
|
||||
- url: https://localhost:5601/
|
||||
paths:
|
||||
/s/{spaceId}/api/ml/saved_objects/sync:
|
||||
get:
|
||||
description: >
|
||||
Synchronizes Kibana saved objects for machine learning jobs and trained models.
|
||||
You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges.
|
||||
This API runs automatically when you start Kibana and periodically thereafter.
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/spaceParam'
|
||||
- $ref: '#/components/parameters/simulateParam'
|
||||
responses:
|
||||
'200':
|
||||
description: Indicates a successful call
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/syncResponse'
|
||||
/api/ml/saved_objects/sync:
|
||||
get:
|
||||
description: >
|
||||
Synchronizes Kibana saved objects for machine learning jobs and trained models.
|
||||
You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges.
|
||||
This API runs automatically when you start Kibana and periodically thereafter.
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/simulateParam'
|
||||
responses:
|
||||
'200':
|
||||
description: Indicates a successful call
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/components/schemas/syncResponse'
|
||||
components:
|
||||
parameters:
|
||||
spaceParam:
|
||||
in: path
|
||||
name: spaceId
|
||||
description: An identifier for the space.
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
simulateParam:
|
||||
in: query
|
||||
name: simulate
|
||||
description: When true, simulates the synchronization by returning only the list actions that would be performed.
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
example: 'true'
|
||||
securitySchemes:
|
||||
basicAuth:
|
||||
type: http
|
||||
scheme: basic
|
||||
schemas:
|
||||
syncResponse:
|
||||
type: object
|
||||
properties:
|
||||
datafeedsAdded:
|
||||
type: object
|
||||
description: If a saved object for an anomaly detection job is missing a datafeed identifier, it is added. This list contains the datafeed identifiers and indicates whether the synchronization was successful.
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
datafeedsRemoved:
|
||||
type: object
|
||||
description: If a saved object for an anomaly detection job references a datafeed that no longer exists, it is deleted. This list contains the datafeed identifiers and indicates whether the synchronization was successful.
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
savedObjectsCreated:
|
||||
type: object
|
||||
description: If saved objects are missing for machine learning jobs or trained models, they are created. This list contains the job and model identifiers and indicates whether the synchronization was successful.
|
||||
properties:
|
||||
anomaly-detector:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
data-frame-analytics:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
trained-model:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
savedObjectsDeleted:
|
||||
type: object
|
||||
description: If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted. This list contains the job and model identifiers and indicates whether the synchronization was successful.
|
||||
properties:
|
||||
anomaly-detector:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
data-frame-analytics:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
trained-model:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
security:
|
||||
- basicAuth: []
|
Loading…
Add table
Add a link
Reference in a new issue