mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.4`: - [[DOCS] Lint ML sync API specification (#148841)](https://github.com/elastic/kibana/pull/148841) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Lisa Cawley","email":"lcawley@elastic.co"},"sourceCommit":{"committedDate":"2023-01-13T16:44:07Z","message":"[DOCS] Lint ML sync API specification (#148841)","sha":"b174b1908fae1d79ed1904a365be69cfec96edd6","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","docs","backport:prev-minor","v8.7.0"],"number":148841,"url":"https://github.com/elastic/kibana/pull/148841","mergeCommit":{"message":"[DOCS] Lint ML sync API specification (#148841)","sha":"b174b1908fae1d79ed1904a365be69cfec96edd6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/148841","number":148841,"mergeCommit":{"message":"[DOCS] Lint ML sync API specification (#148841)","sha":"b174b1908fae1d79ed1904a365be69cfec96edd6"}},{"url":"https://github.com/elastic/kibana/pull/148904","number":148904,"branch":"8.6","state":"OPEN"}]}] BACKPORT-->
This commit is contained in:
parent
6966c0f72a
commit
dea5649573
3 changed files with 30 additions and 198 deletions
|
@ -4,14 +4,14 @@ The current self-contained spec file can be used for online tools like those fou
|
|||
|
||||
A guide about the openApi specification can be found at [https://swagger.io/docs/specification/about/](https://swagger.io/docs/specification/about/).
|
||||
|
||||
The `ml_apis_v2.json` file uses OpenAPI Specification Version 2.0.
|
||||
The `ml_apis_v3.yaml` file uses OpenAPI Specification Version 3.0.1.
|
||||
|
||||
## 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:
|
||||
It is possible to validate the docs before bundling them by running these
|
||||
commands in the `x-pack/plugins/ml/common/openapi/` folder:
|
||||
|
||||
```
|
||||
npx swagger-cli validate ml_apis_v2.json
|
||||
npx swagger-cli validate ml_apis_v3.yaml
|
||||
npx @redocly/cli lint ml_apis_v3.yaml
|
||||
```
|
||||
|
|
|
@ -1,185 +0,0 @@
|
|||
{
|
||||
"swagger" : "2.0",
|
||||
"info" : {
|
||||
"version" : "1",
|
||||
"title" : "Machine learning APIs",
|
||||
"description": "Kibana APIs for the machine learning feature",
|
||||
"termsOfService" : "",
|
||||
"license": {
|
||||
"name": "Elastic License 2.0",
|
||||
"url": "https://www.elastic.co/licensing/elastic-license"
|
||||
}
|
||||
},
|
||||
"host" : "localhost:5601",
|
||||
"basePath" : "/",
|
||||
"tags" : [ {
|
||||
"name" : "ml",
|
||||
"description": "Machine learning"
|
||||
} ],
|
||||
"schemes" : [ "https" ],
|
||||
"security" : [
|
||||
{
|
||||
"basicAuth": [ ]
|
||||
},
|
||||
{
|
||||
"apiKey" : [ ]
|
||||
}
|
||||
],
|
||||
"paths" : {
|
||||
"/s/{spaceId}/api/ml/saved_objects/sync" : {
|
||||
"get" : {
|
||||
"tags" : [ "ml" ],
|
||||
"summary" : "Sync machine learning objects",
|
||||
"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.",
|
||||
"operationId" : "ml-sync",
|
||||
"parameters" : [ {
|
||||
"name" : "spaceId",
|
||||
"in" : "path",
|
||||
"description" : "An identifier for the space. If you omit `/s/` and this identifier from the path, the default space is used.",
|
||||
"required" : true,
|
||||
"type" : "string"
|
||||
}, {
|
||||
"name" : "simulate",
|
||||
"in" : "query",
|
||||
"description" : "When true, simulates the synchronization by returning only the list actions that would be performed.",
|
||||
"required" : false,
|
||||
"type" : "boolean",
|
||||
"default" : false
|
||||
} ],
|
||||
"responses" : {
|
||||
"200" : {
|
||||
"description" : "Indicates a successful call.",
|
||||
"schema" : {
|
||||
"$ref" : "#/definitions/MLSyncResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-doc" : {
|
||||
"tag" : "Machine learning APIs"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions" : {
|
||||
"apiKey" : {
|
||||
"type" : "apiKey",
|
||||
"name" : "Authorization",
|
||||
"in" : "header"
|
||||
},
|
||||
"basicAuth": {
|
||||
"type": "basic"
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"MLSyncResponse-Datafeeds": {
|
||||
"type": "object",
|
||||
"description": "The sync machine learning saved objects API response contains this object when there are datafeeds affected by the synchronization. There is an object for each relevant datafeed, which contains the synchronization status.",
|
||||
"properties" : {
|
||||
"success": {
|
||||
"type" : "boolean",
|
||||
"description": "The success or failure of the synchronization."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MLSyncResponse-Jobs": {
|
||||
"type": "object",
|
||||
"description": "The sync machine learning saved objects API response contains this object when there are machine learning jobs affected by the synchronization. There is an object for each relevant job, which contains the synchronization status.",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type" : "boolean",
|
||||
"description": "The success or failure of the synchronization."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MLSyncResponse-Models": {
|
||||
"type": "object",
|
||||
"description": "The sync machine learning saved objects API response contains this object when there are trained models affected by the synchronization. There is an object for each relevant trained model, which contains the synchronization status.",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type" : "boolean",
|
||||
"description": "The success or failure of the synchronization."
|
||||
}
|
||||
}
|
||||
},
|
||||
"MLSyncResponse-SavedObjectsCreated":{
|
||||
"type": "object",
|
||||
"description": "If saved objects are missing for machine learning jobs or trained models, they are created when you run the sync machine learning saved objects API.",
|
||||
"properties": {
|
||||
"anomaly-detector": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are anomaly detection jobs affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Jobs"
|
||||
}
|
||||
},
|
||||
"data-frame-analytics": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are data frame analytics jobs affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Jobs"
|
||||
}
|
||||
},
|
||||
"trained-model": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are trained models affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Models"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"MLSyncResponse-SavedObjectsDeleted":{
|
||||
"type": "object",
|
||||
"description": "If saved objects exist for machine learning jobs or trained models that no longer exist, they are deleted when you run the sync machine learning saved objects API.",
|
||||
"properties": {
|
||||
"anomaly-detector": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are anomaly detection jobs affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Jobs"
|
||||
}
|
||||
},
|
||||
"data-frame-analytics": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are data frame analytics jobs affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Jobs"
|
||||
}
|
||||
},
|
||||
"trained-model": {
|
||||
"type": "object",
|
||||
"description": "This object is present if there are trained models affected by the synchronization.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Models"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"MLSyncResponse": {
|
||||
"type": "object",
|
||||
"description": "The sync machine learning saved objects API returns this list of machine learning saved objects that required synchronization.",
|
||||
"properties": {
|
||||
"savedObjectsCreated": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-SavedObjectsCreated"
|
||||
},
|
||||
"savedObjectsDeleted": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-SavedObjectsDeleted"
|
||||
},
|
||||
"datafeedsAdded": {
|
||||
"type": "object",
|
||||
"description": "If a saved object for an anomaly detection job is missing a datafeed identifier, it is added when you run the sync machine learning saved objects API.",
|
||||
"additionalProperties":{
|
||||
"$ref" : "#/definitions/MLSyncResponse-Datafeeds"
|
||||
}
|
||||
},
|
||||
"datafeedsRemoved": {
|
||||
"type": "object",
|
||||
"description": "If a saved object for an anomaly detection job references a datafeed that no longer exists, it is deleted when you run the sync machine learning saved objects API.",
|
||||
"additionalProperties": {
|
||||
"$ref" : "#/definitions/MLSyncResponse-Datafeeds"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ tags:
|
|||
- name: ml
|
||||
description: Machine learning
|
||||
servers:
|
||||
- url: https://localhost:5601/
|
||||
- url: https://localhost:5601
|
||||
paths:
|
||||
/s/{spaceId}/api/ml/saved_objects/sync:
|
||||
get:
|
||||
|
@ -30,10 +30,16 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/mlSyncResponse'
|
||||
$ref: '#/components/schemas/mlSync200Response'
|
||||
examples:
|
||||
syncExample:
|
||||
$ref: '#/components/examples/mlSyncExample'
|
||||
'401':
|
||||
description: Authorization information is missing or invalid.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/mlSync4xxResponse'
|
||||
components:
|
||||
parameters:
|
||||
spaceParam:
|
||||
|
@ -131,9 +137,9 @@ components:
|
|||
properties:
|
||||
success:
|
||||
$ref: '#/components/schemas/mlSyncResponseSuccess'
|
||||
mlSyncResponse:
|
||||
mlSync200Response:
|
||||
type: object
|
||||
title: Sync API response
|
||||
title: Successful sync API response
|
||||
properties:
|
||||
datafeedsAdded:
|
||||
type: object
|
||||
|
@ -149,21 +155,32 @@ components:
|
|||
$ref: '#/components/schemas/mlSyncResponseSavedObjectsCreated'
|
||||
savedObjectsDeleted:
|
||||
$ref: '#/components/schemas/mlSyncResponseSavedObjectsDeleted'
|
||||
mlSync4xxResponse:
|
||||
type: object
|
||||
title: Unsuccessful sync API response
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
example: Unauthorized
|
||||
message:
|
||||
type: string
|
||||
statusCode:
|
||||
type: integer
|
||||
example: 401
|
||||
examples:
|
||||
mlSyncExample:
|
||||
summary: Two anomaly detection jobs required synchronization in this example.
|
||||
value:
|
||||
{
|
||||
"savedObjectsCreated": {
|
||||
"anomaly_detector": {
|
||||
"anomaly-detector": {
|
||||
"myjob1": { "success":true },
|
||||
"myjob2":{ "success":true }
|
||||
"myjob2": { "success":true }
|
||||
}
|
||||
},
|
||||
"savedObjectsDeleted": {},
|
||||
"datafeedsAdded":{},
|
||||
"datafeedsRemoved":{}
|
||||
"datafeedsAdded": {},
|
||||
"datafeedsRemoved": {}
|
||||
}
|
||||
security:
|
||||
- basicAuth: [ ]
|
||||
- ApiKeyAuth: [ ]
|
||||
- basicAuth: [ ]
|
Loading…
Add table
Add a link
Reference in a new issue