Add openAPI specifications for get tags API (#135671)

This commit is contained in:
Lisa Cawley 2022-07-06 09:07:44 -07:00 committed by GitHub
parent f15355a36f
commit 9162f7f2f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 312 additions and 12 deletions

View file

@ -28,9 +28,10 @@ default space is used.
=== {api-query-parms-title}
`owner`::
(Optional, string or array of strings) A filter to limit the retrieved tags to a specific set of applications.
Valid values are: `cases`, `observability`, and `securitySolution`. If this parameter is omitted, the response
contains tags from all cases that the user has access to read.
(Optional, string or array of strings) A filter to limit the retrieved tags to a
specific set of applications. Valid values are: `cases`, `observability`, and
`securitySolution`. If this parameter is omitted, the response contains tags
from all cases that the user has access to read.
=== {api-response-codes-title}
@ -45,14 +46,15 @@ GET api/cases/tags
--------------------------------------------------
// KIBANA
The API returns a JSON object with tags from all the cases that the user has access to read. For example:
The API returns a JSON object with tags from all the cases that the user has
access to read. For example:
[source,json]
--------------------------------------------------
[
"windows",
"phishing",
"social engineering",
"bubblegum"
"observability",
"security",
"tag 1",
"tag 2"
]
--------------------------------------------------

View file

@ -2574,6 +2574,66 @@
}
]
},
"/api/cases/tags": {
"get": {
"summary": "Aggregates and returns a list of case tags.",
"description": "You must have read privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the cases you're seeking.\n",
"tags": [
"cases",
"kibana"
],
"parameters": [
{
"in": "query",
"name": "owner",
"description": "A filter to limit the retrieved case statistics to a specific set of applications. If this parameter is omitted, the response contains tags from all cases that the user has access to read.",
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/owners"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/owners"
}
}
]
}
}
],
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"examples": {
"getTagsResponse": {
"$ref": "#/components/examples/get_tags_response"
}
}
}
}
}
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"/api/cases/{caseId}/comments": {
"post": {
"summary": "Adds a comment or alert to a case.",
@ -5834,6 +5894,69 @@
}
]
},
"/s/{spaceId}/api/cases/tags": {
"get": {
"summary": "Aggregates and returns a list of case tags.",
"description": "You must have read privileges for the **Cases*** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the cases you're seeking.\n",
"tags": [
"cases",
"kibana"
],
"parameters": [
{
"$ref": "#/components/parameters/space_id"
},
{
"in": "query",
"name": "owner",
"description": "A filter to limit the retrieved case statistics to a specific set of applications. If this parameter is omitted, the response contains tags from all cases that the user has access to read.",
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/owners"
},
{
"type": "array",
"items": {
"$ref": "#/components/schemas/owners"
}
}
]
}
}
],
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
},
"examples": {
"getTagsResponse": {
"$ref": "#/components/examples/get_tags_response"
}
}
}
}
}
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"/s/{spaceId}/api/cases/{caseId}/comments": {
"post": {
"summary": "Adds a comment or alert to a case.",
@ -7307,6 +7430,15 @@
}
]
},
"get_tags_response": {
"summary": "A list of tags that are used in cases",
"value": [
"observability",
"security",
"tag 1",
"tag 2"
]
},
"add_comment_request": {
"summary": "Adds a comment to a case.",
"value": {

View file

@ -2173,6 +2173,45 @@ paths:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/cases/tags:
get:
summary: Aggregates and returns a list of case tags.
description: >
You must have read privileges for the **Cases** feature in the
**Management**, **Observability**, or **Security** section of the Kibana
feature privileges, depending on the owner of the cases you're seeking.
tags:
- cases
- kibana
parameters:
- in: query
name: owner
description: >-
A filter to limit the retrieved case statistics to a specific set of
applications. If this parameter is omitted, the response contains
tags from all cases that the user has access to read.
schema:
oneOf:
- $ref: '#/components/schemas/owners'
- type: array
items:
$ref: '#/components/schemas/owners'
responses:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
schema:
type: array
items:
type: string
examples:
getTagsResponse:
$ref: '#/components/examples/get_tags_response'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/cases/{caseId}/comments:
post:
summary: Adds a comment or alert to a case.
@ -4886,6 +4925,46 @@ paths:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/s/{spaceId}/api/cases/tags:
get:
summary: Aggregates and returns a list of case tags.
description: >
You must have read privileges for the **Cases*** feature in the
**Management**, **Observability**, or **Security** section of the Kibana
feature privileges, depending on the owner of the cases you're seeking.
tags:
- cases
- kibana
parameters:
- $ref: '#/components/parameters/space_id'
- in: query
name: owner
description: >-
A filter to limit the retrieved case statistics to a specific set of
applications. If this parameter is omitted, the response contains
tags from all cases that the user has access to read.
schema:
oneOf:
- $ref: '#/components/schemas/owners'
- type: array
items:
$ref: '#/components/schemas/owners'
responses:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
schema:
type: array
items:
type: string
examples:
getTagsResponse:
$ref: '#/components/examples/get_tags_response'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/s/{spaceId}/api/cases/{caseId}/comments:
post:
summary: Adds a comment or alert to a case.
@ -6072,6 +6151,13 @@ components:
- username: user2
full_name: User 2
email: user2@elastic.co
get_tags_response:
summary: A list of tags that are used in cases
value:
- observability
- security
- tag 1
- tag 2
add_comment_request:
summary: Adds a comment to a case.
value:

View file

@ -0,0 +1,8 @@
summary: A list of tags that are used in cases
value:
[
"observability",
"security",
"tag 1",
"tag 2"
]

View file

@ -33,8 +33,8 @@ paths:
$ref: 'paths/api@cases@reporters.yaml'
# '/api/cases/status':
# $ref: 'paths/api@cases@status.yaml'
# '/api/cases/tags':
# $ref: 'paths/api@cases@tags.yaml'
'/api/cases/tags':
$ref: 'paths/api@cases@tags.yaml'
# '/api/cases/{caseId}':
# $ref: 'paths/api@cases@{caseid}.yaml'
# '/api/cases/{caseId}/alerts':
@ -64,8 +64,8 @@ paths:
$ref: 'paths/s@{spaceid}@api@cases@reporters.yaml'
# '/s/{spaceId}/api/cases/status':
# $ref: 'paths/s@{spaceid}@api@cases@status.yaml'
# '/s/{spaceId}/api/cases/tags':
# $ref: 'paths/s@{spaceid}@api@cases@tags.yaml'
'/s/{spaceId}/api/cases/tags':
$ref: 'paths/s@{spaceid}@api@cases@tags.yaml'
# '/s/{spaceId}/api/cases/{caseId}':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}.yaml'
# '/s/{spaceId}/api/cases/{caseId}/alerts':

View file

@ -0,0 +1,35 @@
get:
summary: Aggregates and returns a list of case tags.
description: >
You must have read privileges for the **Cases** feature in the
**Management**, **Observability**, or **Security** section of the Kibana
feature privileges, depending on the owner of the cases you're seeking.
tags:
- cases
- kibana
parameters:
- in: query
name: owner
description: A filter to limit the retrieved case statistics to a specific set of applications. If this parameter is omitted, the response contains tags from all cases that the user has access to read.
schema:
oneOf:
- $ref: '../components/schemas/owners.yaml'
- type: array
items:
$ref: '../components/schemas/owners.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
schema:
type: array
items:
type: string
examples:
getTagsResponse:
$ref: '../components/examples/get_tags_response.yaml'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601

View file

@ -0,0 +1,37 @@
get:
summary: Aggregates and returns a list of case tags.
description: >
You must have read privileges for the **Cases*** feature in the
**Management**, **Observability**, or **Security** section of the Kibana
feature privileges, depending on the owner of the cases you're seeking.
tags:
- cases
- kibana
parameters:
- $ref: '../components/parameters/space_id.yaml'
- in: query
name: owner
description: A filter to limit the retrieved case statistics to a specific set of applications. If this parameter is omitted, the response contains tags from all cases that the user has access to read.
schema:
oneOf:
- $ref: '../components/schemas/owners.yaml'
- type: array
items:
$ref: '../components/schemas/owners.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
schema:
type: array
items:
type: string
examples:
getTagsResponse:
$ref: '../components/examples/get_tags_response.yaml'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601