Skip to content

Commit

Permalink
Merge branch 'main' into feature/shared_field_picker
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jul 6, 2022
2 parents bb72cc7 + 092c8e1 commit 9f028e0
Show file tree
Hide file tree
Showing 20 changed files with 750 additions and 239 deletions.
18 changes: 10 additions & 8 deletions docs/api/cases/cases-api-get-tags.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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"
]
--------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ export function normalizeTable(data: Datatable, xAccessor?: string | ExpressionV
const xColumn = xAccessor && getColumnByAccessor(xAccessor, data.columns);
if (xColumn && xColumn?.meta.type === 'date') {
const xColumnId = xColumn.id;
const rows = data.rows.reduce<Datatable['rows']>((normalizedRows, row) => {
return [
...normalizedRows,
{
...row,
[xColumnId]:
typeof row[xColumnId] === 'string' ? moment(row[xColumnId]).valueOf() : row[xColumnId],
},
];
}, []);
if (!data.rows.some((row) => typeof row[xColumnId] === 'string')) return data;
const rows = data.rows.map((row) => {
return typeof row[xColumnId] !== 'string'
? row
: {
...row,
[xColumnId]: moment(row[xColumnId]).valueOf(),
};
});
return { ...data, rows };
}

Expand Down
132 changes: 132 additions & 0 deletions x-pack/plugins/cases/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down Expand Up @@ -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": {
Expand Down
86 changes: 86 additions & 0 deletions x-pack/plugins/cases/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary: A list of tags that are used in cases
value:
[
"observability",
"security",
"tag 1",
"tag 2"
]
8 changes: 4 additions & 4 deletions x-pack/plugins/cases/docs/openapi/entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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':
Expand Down
35 changes: 35 additions & 0 deletions x-pack/plugins/cases/docs/openapi/paths/api@cases@tags.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 9f028e0

Please sign in to comment.