[8.5] [DOCS] Automate output for 4 case APIs (#142173) (#143798)

This commit is contained in:
Lisa Cawley 2022-10-20 14:16:26 -07:00 committed by GitHub
parent cd13abf07d
commit f6b2b4aacc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 2704 additions and 353 deletions

View file

@ -22,8 +22,13 @@ command in the `x-pack/plugins/cases/docs/openapi/` folder:
Then you can generate the `bundled` files by running the following commands:
```
npx @redocly/openapi-cli bundle --ext yaml --output bundled.yaml entrypoint.yaml
npx @redocly/openapi-cli bundle --ext json --output bundled.json entrypoint.yaml
```
```
npx @redocly/cli bundle entrypoint.yaml --output bundled.yaml --ext yaml
npx @redocly/cli bundle entrypoint.yaml --output bundled.json --ext json
```
You can run additional linting with the following command:
```
npx @redocly/cli lint bundled.json
```

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,923 @@
openapi: 3.0.1
info:
title: Cases
description: OpenAPI schema for Cases endpoints
version: '0.2'
contact:
name: Cases Team
license:
name: Elastic License 2.0
url: https://www.elastic.co/licensing/elastic-license
tags:
- name: cases
description: Case APIs enable you to open and track issues.
servers:
- url: http://localhost:5601
description: local
paths:
/s/{spaceId}/api/cases/{caseId}/comments:
post:
summary: Adds a comment or alert to a case.
operationId: addCaseComment
description: |
You must have `all` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the case you're creating.
tags:
- cases
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- $ref: '#/components/parameters/case_id'
- $ref: '#/components/parameters/space_id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/add_case_comment_request'
examples:
createCaseCommentRequest:
$ref: '#/components/examples/add_comment_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '#/components/schemas/case_response_properties'
examples:
createCaseCommentResponse:
$ref: '#/components/examples/add_comment_response'
servers:
- url: https://localhost:5601
delete:
summary: Deletes all comments and alerts from a case.
operationId: deleteCaseComments
description: |
You must have `all` 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 deleting.
tags:
- cases
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- $ref: '#/components/parameters/case_id'
- $ref: '#/components/parameters/space_id'
responses:
'204':
description: Indicates a successful call.
servers:
- url: https://localhost:5601
patch:
summary: Updates a comment or alert in a case.
operationId: updateCaseComment
description: |
You must have `all` privileges for the **Cases** feature in the **Management**, **Observability**, or **Security** section of the Kibana feature privileges, depending on the owner of the case you're updating. NOTE: You cannot change the comment type or the owner of a comment.
tags:
- cases
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- $ref: '#/components/parameters/case_id'
- $ref: '#/components/parameters/space_id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/update_case_comment_request'
examples:
updateCaseCommentRequest:
$ref: '#/components/examples/update_comment_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '#/components/schemas/case_response_properties'
examples:
updateCaseCommentResponse:
$ref: '#/components/examples/update_comment_response'
servers:
- url: https://localhost:5601
get:
summary: Retrieves all the comments from a case.
operationId: getAllCaseComments
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 with the comments you're seeking.
deprecated: true
tags:
- cases
parameters:
- $ref: '#/components/parameters/case_id'
- $ref: '#/components/parameters/space_id'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '#/components/schemas/case_response_properties'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
components:
securitySchemes:
basicAuth:
type: http
scheme: basic
apiKeyAuth:
type: apiKey
in: header
name: ApiKey
parameters:
case_id:
in: path
name: caseId
description: The identifier for the case. To retrieve case IDs, use the find cases API. All non-ASCII characters must be URL encoded.
required: true
schema:
type: string
example: 9c235210-6834-11ea-a78c-6ffb38a34414
space_id:
in: path
name: spaceId
description: An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used.
required: true
schema:
type: string
example: default
kbn_xsrf:
schema:
type: string
in: header
name: kbn-xsrf
required: true
schemas:
case_response_closed_by_properties:
title: Case response properties for closed_by
type: object
nullable: true
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
required:
- email
- full_name
- username
owners:
type: string
description: |
The application that owns the cases: Stack Management, Observability, or Elastic Security.
enum:
- cases
- observability
- securitySolution
example: cases
alert_comment_response_properties:
title: Add case comment response properties for alerts
type: object
required:
- type
properties:
alertId:
type: string
example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42
created_at:
type: string
format: date-time
example: '2022-03-24T02:31:03.210Z'
created_by:
type: object
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
id:
type: string
example: 73362370-ab1a-11ec-985f-97e55adae8b9
index:
type: string
example: .internal.alerts-security.alerts-default-000001
owner:
$ref: '#/components/schemas/owners'
pushed_at:
type: string
format: date-time
example: null
nullable: true
pushed_by:
type: object
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
nullable: true
rule:
type: object
properties:
id:
description: The rule identifier.
type: string
example: 94d80550-aaf4-11ec-985f-97e55adae8b9
name:
description: The rule name.
type: string
example: security_rule
type:
type: string
example: alert
enum:
- alert
updated_at:
type: string
format: date-time
example: null
updated_by:
type: object
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
version:
type: string
example: WzMwNDgsMV0=
case_response_created_by_properties:
title: Case response properties for created_by
type: object
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
required:
- email
- full_name
- username
case_response_pushed_by_properties:
title: Case response properties for pushed_by
type: object
nullable: true
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
required:
- email
- full_name
- username
case_response_updated_by_properties:
title: Case response properties for updated_by
type: object
nullable: true
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
required:
- email
- full_name
- username
user_comment_response_properties:
title: Case response properties for user comments
type: object
required:
- type
properties:
comment:
type: string
example: A new comment.
created_at:
type: string
format: date-time
example: '2022-05-13T09:16:17.416Z'
created_by:
$ref: '#/components/schemas/case_response_created_by_properties'
id:
type: string
example: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
owner:
$ref: '#/components/schemas/owners'
pushed_at:
type: string
format: date-time
nullable: true
example: null
pushed_by:
$ref: '#/components/schemas/case_response_pushed_by_properties'
type:
type: string
example: user
enum:
- user
updated_at:
type: string
format: date-time
nullable: true
example: null
updated_by:
$ref: '#/components/schemas/case_response_updated_by_properties'
version:
type: string
example: WzIwNDMxLDFd
case_response_connector_field_properties:
title: Case response properties for connector fields
type: object
description: An object containing the connector fields. To create a case without a connector, specify null. If you want to omit any individual field, specify null as its value.
nullable: true
properties:
caseId:
description: The case identifier for Swimlane connectors.
type: string
category:
description: The category of the incident for ServiceNow ITSM and ServiceNow SecOps connectors.
type: string
destIp:
description: A comma-separated list of destination IPs for ServiceNow SecOps connectors.
type: string
impact:
description: The effect an incident had on business for ServiceNow ITSM connectors.
type: string
issueType:
description: The type of issue for Jira connectors.
type: string
issueTypes:
description: The type of incident for IBM Resilient connectors.
type: array
items:
type: number
malwareHash:
description: A comma-separated list of malware hashes for ServiceNow SecOps connectors.
type: string
malwareUrl:
description: A comma-separated list of malware URLs for ServiceNow SecOps connectors.
type: string
parent:
description: The key of the parent issue, when the issue type is sub-task for Jira connectors.
type: string
priority:
description: The priority of the issue for Jira and ServiceNow SecOps connectors.
type: string
severity:
description: The severity of the incident for ServiceNow ITSM connectors.
type: string
severityCode:
description: The severity code of the incident for IBM Resilient connectors.
type: number
sourceIp:
description: A comma-separated list of source IPs for ServiceNow SecOps connectors.
type: string
subcategory:
description: The subcategory of the incident for ServiceNow ITSM connectors.
type: string
urgency:
description: The extent to which the incident resolution can be delayed for ServiceNow ITSM connectors.
type: string
connector_types:
type: string
description: The type of connector.
enum:
- .cases-webhook
- .jira
- .none
- .resilient
- .servicenow
- .servicenow-sir
- .swimlane
example: .none
external_service:
type: object
nullable: true
properties:
connector_id:
type: string
connector_name:
type: string
external_id:
type: string
external_title:
type: string
external_url:
type: string
pushed_at:
type: string
format: date-time
pushed_by:
type: object
properties:
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0
nullable: true
settings:
type: object
description: An object that contains the case settings.
properties:
syncAlerts:
description: Turns alert syncing on or off.
type: boolean
example: true
severity_property:
type: string
description: The severity of the case.
enum:
- critical
- high
- low
- medium
default: low
status:
type: string
description: The status of the case.
enum:
- closed
- in-progress
- open
case_response_properties:
title: Case response properties
type: object
required:
- closed_at
- closed_by
- comments
- connector
- created_at
- created_by
- description
- duration
- external_service
- id
- owner
- settings
- severity
- status
- tags
- title
- totalAlerts
- totalComment
- updated_at
- updated_by
- version
properties:
closed_at:
type: string
format: date-time
nullable: true
closed_by:
$ref: '#/components/schemas/case_response_closed_by_properties'
comments:
title: Case response properties for comments
description: An array of comment objects for the case.
type: array
items:
discriminator:
propertyName: type
oneOf:
- $ref: '#/components/schemas/alert_comment_response_properties'
- $ref: '#/components/schemas/user_comment_response_properties'
connector:
title: Case response properties for connectors
type: object
properties:
fields:
$ref: '#/components/schemas/case_response_connector_field_properties'
id:
description: The identifier for the connector. To create a case without a connector, use `none`.
type: string
example: none
name:
description: The name of the connector. To create a case without a connector, use `none`.
type: string
example: none
type:
$ref: '#/components/schemas/connector_types'
created_at:
type: string
format: date-time
example: '2022-05-13T09:16:17.416Z'
created_by:
$ref: '#/components/schemas/case_response_created_by_properties'
description:
type: string
example: A case description.
duration:
type: integer
description: |
The elapsed time from the creation of the case to its closure (in seconds). If the case has not been closed, the duration is set to null. If the case was closed after less than half a second, the duration is rounded down to zero.
nullable: true
example: 120
external_service:
$ref: '#/components/schemas/external_service'
id:
type: string
example: 66b9aa00-94fa-11ea-9f74-e7e108796192
owner:
$ref: '#/components/schemas/owners'
settings:
$ref: '#/components/schemas/settings'
severity:
$ref: '#/components/schemas/severity_property'
status:
$ref: '#/components/schemas/status'
tags:
type: array
items:
type: string
example:
- tag-1
title:
type: string
example: Case title 1
totalAlerts:
type: integer
example: 0
totalComment:
type: integer
example: 0
updated_at:
type: string
format: date-time
nullable: true
updated_by:
$ref: '#/components/schemas/case_response_updated_by_properties'
version:
type: string
example: WzUzMiwxXQ==
alert_identifiers:
title: Alert identifiers
description: |
The alert identifier. It is required only when `type` is `alert`. If it is an array, `index` must also be an array with the same length or number of elements. This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42
alert_indices:
title: Alert indices
description: |
The alert index. It is required only when `type` is `alert`. If it is an array, `alertId` must also be an array with the same length or number of elements. This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
rule:
title: Alerting rule
description: |
The rule that is associated with the alert. It is required only when `type` is `alert`. This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
type: object
x-technical-preview: true
properties:
id:
description: The rule identifier.
type: string
example: 94d80550-aaf4-11ec-985f-97e55adae8b9
name:
description: The rule name.
type: string
example: security_rule
add_alert_comment_request_properties:
title: Add case comment request properties for alerts
required:
- alertId
- index
- owner
- rule
- type
description: Defines properties for case comment requests when type is alert.
type: object
properties:
alertId:
$ref: '#/components/schemas/alert_identifiers'
index:
$ref: '#/components/schemas/alert_indices'
owner:
$ref: '#/components/schemas/owners'
rule:
$ref: '#/components/schemas/rule'
type:
description: The type of comment.
type: string
example: alert
enum:
- alert
add_user_comment_request_properties:
title: Add case comment request properties for user comments
description: Defines properties for case comment requests when type is user.
type: object
properties:
comment:
description: The new comment. It is required only when `type` is `user`.
type: string
example: A new comment.
owner:
$ref: '#/components/schemas/owners'
type:
type: string
description: The type of comment.
example: user
enum:
- user
required:
- comment
- owner
- type
add_case_comment_request:
title: Add case comment request
description: The add comment to case API request body varies depending on whether you are adding an alert or a comment.
discriminator:
propertyName: type
oneOf:
- $ref: '#/components/schemas/add_alert_comment_request_properties'
- $ref: '#/components/schemas/add_user_comment_request_properties'
update_alert_comment_request_properties:
title: Update case comment request properties for alerts
description: Defines properties for case comment requests when type is alert.
required:
- alertId
- id
- index
- owner
- rule
- type
- version
type: object
properties:
alertId:
$ref: '#/components/schemas/alert_identifiers'
id:
type: string
description: |
The identifier for the comment. To retrieve comment IDs, use the get comments API.
example: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
index:
$ref: '#/components/schemas/alert_indices'
owner:
$ref: '#/components/schemas/owners'
rule:
$ref: '#/components/schemas/rule'
type:
description: The type of comment.
type: string
enum:
- alert
example: alert
version:
description: |
The current comment version. To retrieve version values, use the get comments API.
type: string
example: Wzk1LDFd
update_user_comment_request_properties:
title: Update case comment request properties for user comments
description: Defines properties for case comment requests when type is user.
type: object
properties:
comment:
description: The new comment. It is required only when `type` is `user`.
type: string
example: A new comment.
id:
type: string
description: |
The identifier for the comment. To retrieve comment IDs, use the get comments API.
example: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
owner:
$ref: '#/components/schemas/owners'
type:
type: string
description: The type of comment.
enum:
- user
example: user
version:
description: |
The current comment version. To retrieve version values, use the get comments API.
type: string
example: Wzk1LDFd
required:
- comment
- id
- owner
- type
- version
update_case_comment_request:
title: Update case comment request
description: The update case comment API request body varies depending on whether you are updating an alert or a comment.
discriminator:
propertyName: type
oneOf:
- $ref: '#/components/schemas/update_alert_comment_request_properties'
- $ref: '#/components/schemas/update_user_comment_request_properties'
examples:
add_comment_request:
summary: Adds a comment to a case.
value:
type: user
comment: A new comment.
owner: cases
add_comment_response:
summary: The add comment to case API returns a JSON object that contains details about the case and its comments.
value:
comments:
- id: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
version: WzIwNDMxLDFd
type: user
owner: cases
comment: A new comment.
created_at: '2022-06-02T00:49:47.716Z'
created_by:
username: elastic
email: null
full_name: null
totalAlerts: 0
id: 293f1bc0-74f6-11ea-b83a-553aecdb28b6
version: WzIzMzgsMV0=
totalComment: 1
title: Case title 1
tags:
- tag 1
description: A case description.
settings:
syncAlerts: false
owner: cases
duration: null
severity: low
closed_at: null
closed_by: null
created_at: '2022-03-24T00:37:03.906Z'
created_by:
username: elastic
full_name: null
email: null
status: open
updated_at: '2022-06-03T00:49:47.716Z'
updated_by:
username: elastic
email: null
full_name: null
connector:
id: none
name: none
type: .none
fields: null
external_service: null
update_comment_request:
summary: Updates a comment of a case.
value:
id: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
version: Wzk1LDFd
type: user
comment: An updated comment.
owner: cases
update_comment_response:
summary: The add comment to case API returns a JSON object that contains details about the case and its comments.
value:
comments:
- id: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
version: WzIwNjM3LDFd
comment: An updated comment.
type: user
owner: cases
created_at: '2022-03-24T00:37:10.832Z'
created_by:
username: elastic
full_name: null
email: null
pushed_at: null
pushed_by: null
updated_at: '2022-03-24T01:27:06.210Z'
updated_by:
username: elastic
full_name: null
email: null
totalAlerts: 0
id: 293f1bc0-74f6-11ea-b83a-553aecdb28b6
version: WzIwNjM2LDFd
totalComment: 1
title: Case title 1
tags:
- tag 1
description: A case description.
settings:
syncAlerts: false
owner: cases
duration: null
severity: low
closed_at: null
closed_by: null
created_at: '2022-03-24T00:37:03.906Z'
created_by:
username: elastic
full_name: null
email: null
status: open
updated_at: '2022-03-24T01:27:06.210Z'
updated_by:
username: elastic
full_name: null
email: null
connector:
id: none
name: none
type: .none
fields: null
external_service: null
security:
- basicAuth: []
- apiKeyAuth: []

View file

@ -1,58 +1,46 @@
summary: The add comment to case API returns a JSON object that contains details about the case and its comments.
value:
{
"comments":[
{
"id": "8af6ac20-74f6-11ea-b83a-553aecdb28b6",
"version": "WzIwNDMxLDFd",
"type":"user",
"owner":"cases",
"comment":"A new comment.",
"created_at":"2022-06-02T00:49:47.716Z",
"created_by": {
"username": "elastic",
"email": null,
"full_name": null
},
"pushed_at":null,
"pushed_by":null,
"updated_at":null,
"updated_by":null
}
],
"totalAlerts":0,
"id":"293f1bc0-74f6-11ea-b83a-553aecdb28b6",
"version":"WzIzMzgsMV0=",
"totalComment":1,
"title": "Case title 1",
"tags": ["tag 1"],
"description": "A case description.",
"settings": {
"syncAlerts":false
},
"owner": "cases",
"duration": null,
"severity": "low",
"closed_at": null,
"closed_by": null,
"created_at": "2022-03-24T00:37:03.906Z",
"created_by": {
"email": null,
"full_name": null,
"username": "elastic"
},
"status": "open",
"updated_at": "2022-06-03T00:49:47.716Z",
"updated_by": {
"username": "elastic",
"email": null,
"full_name": null
},
"connector": {
"id": "none",
"name": "none",
"type": ".none",
"fields": null
},
"external_service": null
}
comments:
- id: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
version: WzIwNDMxLDFd
type: user
owner: cases
comment: A new comment.
created_at: '2022-06-02T00:49:47.716Z'
created_by:
username: elastic
email: null
full_name: null
totalAlerts: 0
id: 293f1bc0-74f6-11ea-b83a-553aecdb28b6
version: WzIzMzgsMV0=
totalComment: 1
title: Case title 1
tags:
- tag 1
description: A case description.
settings:
syncAlerts: false
owner: cases
duration: null
severity: low
closed_at: null
closed_by: null
created_at: '2022-03-24T00:37:03.906Z'
created_by:
username: elastic
full_name: null
email: null
status: open
updated_at: '2022-06-03T00:49:47.716Z'
updated_by:
username: elastic
email: null
full_name: null
connector:
id: none
name: none
type: .none
fields: null
external_service: null

View file

@ -4,5 +4,6 @@ value:
"id": "8af6ac20-74f6-11ea-b83a-553aecdb28b6",
"version": "Wzk1LDFd",
"type": "user",
"comment": "An updated comment."
"comment": "An updated comment.",
"owner": "cases"
}

View file

@ -1,59 +1,52 @@
summary: The add comment to case API returns a JSON object that contains details about the case and its comments.
value:
{
"comments":[{
"id": "8af6ac20-74f6-11ea-b83a-553aecdb28b6",
"version": "WzIwNjM3LDFd",
"comment": "An updated comment.",
"type": "user",
"owner": "cases",
"created_at": "2022-03-24T00:37:10.832Z",
"created_by": {
"username": "elastic",
"full_name": null,
"email": null
},
"pushed_at": null,
"pushed_by": null,
"updated_at": "2022-03-24T01:27:06.210Z",
"updated_by": {
"username": "elastic",
"full_name": null,
"email": null
}
}
],
"totalAlerts": 0,
"id": "293f1bc0-74f6-11ea-b83a-553aecdb28b6",
"version": "WzIwNjM2LDFd",
"totalComment": 1,
"title": "Case title 1",
"tags": ["tag 1"],
"description": "A case description.",
"settings": {"syncAlerts":false},
"owner": "cases",
"duration": null,
"severity": "low",
"closed_at": null,
"closed_by": null,
"created_at": "2022-03-24T00:37:03.906Z",
"created_by": {
"username": "elastic",
"full_name": null,
"email": null
},
"status": "open",
"updated_at": "2022-03-24T01:27:06.210Z",
"updated_by": {
"username": "elastic",
"full_name": null,
"email": null
},
"connector": {
"id": "none",
"name": "none",
"type": ".none",
"fields": null
},
"external_service": null
}
comments:
- id: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
version: WzIwNjM3LDFd
comment: An updated comment.
type: user
owner: cases
created_at: '2022-03-24T00:37:10.832Z'
created_by:
username: elastic
full_name: null
email: null
pushed_at: null
pushed_by: null
updated_at: '2022-03-24T01:27:06.210Z'
updated_by:
username: elastic
full_name: null
email: null
totalAlerts: 0
id: 293f1bc0-74f6-11ea-b83a-553aecdb28b6
version: WzIwNjM2LDFd
totalComment: 1
title: Case title 1
tags:
- tag 1
description: A case description.
settings:
syncAlerts: false
owner: cases
duration: null
severity: low
closed_at: null
closed_by: null
created_at: '2022-03-24T00:37:03.906Z'
created_by:
username: elastic
full_name: null
email: null
status: open
updated_at: '2022-03-24T01:27:06.210Z'
updated_by:
username: elastic
full_name: null
email: null
connector:
id: none
name: none
type: .none
fields: null
external_service: null

View file

@ -4,4 +4,4 @@ description: The identifier for the case. To retrieve case IDs, use the find cas
required: true
schema:
type: string
example: '9c235210-6834-11ea-a78c-6ffb38a34414'
example: 9c235210-6834-11ea-a78c-6ffb38a34414

View file

@ -1,55 +1,24 @@
type: object
properties:
alertId:
description: >
The alert identifier. It is required only when `type` is `alert`. If it is
an array, `index` must also be an array. This functionality is in
technical preview and may be changed or removed in a future release.
Elastic will apply best effort to fix any issues, but features in
technical preview are not subject to the support SLA of official GA
features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42
index:
description: >
The alert index. It is required only when `type` is `alert`. If it is an
array, `alertId` must also be an array. This functionality is in technical
preview and may be changed or removed in a future release. Elastic will
apply best effort to fix any issues, but features in technical preview are
not subject to the support SLA of official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
owner:
$ref: 'owners.yaml'
rule:
description: >
The rule that is associated with the alert. It is required only when
`type` is `alert`. This functionality is in technical preview and may be
changed or removed in a future release. Elastic will apply best effort to
fix any issues, but features in technical preview are not subject to the
support SLA of official GA features.
type: object
x-technical-preview: true
properties:
$ref: 'rule_properties.yaml'
type:
description: The type of comment.
type: string
enum:
- alert
example: alert
title: Add case comment request properties for alerts
required:
- alertId
- index
- owner
- rule
- type
- type
description: Defines properties for case comment requests when type is alert.
type: object
properties:
alertId:
$ref: 'alert_identifiers.yaml'
index:
$ref: 'alert_indices.yaml'
owner:
$ref: 'owners.yaml'
rule:
$ref: 'rule.yaml'
type:
description: The type of comment.
type: string
example: alert
enum:
- alert

View file

@ -0,0 +1,9 @@
title: Add case comment request
description: >-
The add comment to case API request body varies depending on whether you are
adding an alert or a comment.
discriminator:
propertyName: type
oneOf:
- $ref: 'add_alert_comment_request_properties.yaml'
- $ref: 'add_user_comment_request_properties.yaml'

View file

@ -1,3 +1,5 @@
title: Add case comment request properties for user comments
description: Defines properties for case comment requests when type is user.
type: object
properties:
comment:
@ -9,9 +11,9 @@ properties:
type:
type: string
description: The type of comment.
example: user
enum:
- user
example: user
required:
- comment
- owner

View file

@ -1,5 +1,7 @@
title: Add case comment response properties for alerts
type: object
required:
- type
properties:
alertId:
type: string
@ -37,6 +39,8 @@ properties:
type:
type: string
example: alert
enum:
- alert
updated_at:
type: string
format: date-time

View file

@ -0,0 +1,15 @@
title: Alert identifiers
description: >
The alert identifier. It is required only when `type` is `alert`. If it is
an array, `index` must also be an array with the same length or number of
elements. This functionality is in technical preview and may be changed or
removed in a future release. Elastic will apply best effort to fix any issues,
but features in technical preview are not subject to the support SLA of
official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42

View file

@ -0,0 +1,14 @@
title: Alert indices
description: >
The alert index. It is required only when `type` is `alert`. If it is an
array, `alertId` must also be an array with the same length or number of
elements. This functionality is in technical preview and may be changed or
removed in a future release. Elastic will apply best effort to fix any issues,
but features in technical preview are not subject to the support SLA of
official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true

View file

@ -0,0 +1,9 @@
title: Case response properties for closed_by
type: object
nullable: true
properties:
$ref: 'user_properties.yaml'
required:
- email
- full_name
- username

View file

@ -0,0 +1,52 @@
title: Case response properties for connector fields
type: object
description: An object containing the connector fields. To create a case without a connector, specify null. If you want to omit any individual field, specify null as its value.
nullable: true
properties:
caseId:
description: The case identifier for Swimlane connectors.
type: string
category:
description: The category of the incident for ServiceNow ITSM and ServiceNow SecOps connectors.
type: string
destIp:
description: A comma-separated list of destination IPs for ServiceNow SecOps connectors.
type: string
impact:
description: The effect an incident had on business for ServiceNow ITSM connectors.
type: string
issueType:
description: The type of issue for Jira connectors.
type: string
issueTypes:
description: The type of incident for IBM Resilient connectors.
type: array
items:
type: number
malwareHash:
description: A comma-separated list of malware hashes for ServiceNow SecOps connectors.
type: string
malwareUrl:
description: A comma-separated list of malware URLs for ServiceNow SecOps connectors.
type: string
parent:
description: The key of the parent issue, when the issue type is sub-task for Jira connectors.
type: string
priority:
description: The priority of the issue for Jira and ServiceNow SecOps connectors.
type: string
severity:
description: The severity of the incident for ServiceNow ITSM connectors.
type: string
severityCode:
description: The severity code of the incident for IBM Resilient connectors.
type: number
sourceIp:
description: A comma-separated list of source IPs for ServiceNow SecOps connectors.
type: string
subcategory:
description: The subcategory of the incident for ServiceNow ITSM connectors.
type: string
urgency:
description: The extent to which the incident resolution can be delayed for ServiceNow ITSM connectors.
type: string

View file

@ -0,0 +1,8 @@
title: Case response properties for created_by
type: object
properties:
$ref: 'user_properties.yaml'
required:
- email
- full_name
- username

View file

@ -1,82 +1,112 @@
closed_at:
type: string
format: date-time
nullable: true
example: null
closed_by:
type: object
properties:
$ref: 'user_properties.yaml'
nullable: true
example: null
comments:
type: array
items:
oneOf:
- $ref: 'alert_comment_response_properties.yaml'
- $ref: 'user_comment_response_properties.yaml'
example: []
connector:
type: object
properties:
$ref: 'connector_properties.yaml'
created_at:
type: string
format: date-time
example: 2022-05-13T09:16:17.416Z
created_by:
type: object
properties:
$ref: 'user_properties.yaml'
description:
type: string
example: "A case description."
duration:
type: integer
description: >
The elapsed time from the creation of the case to its closure (in seconds).
If the case has not been closed, the duration is set to null. If the case
was closed after less than half a second, the duration is rounded down to
zero.
example: 120
external_service:
$ref: 'external_service.yaml'
id:
type: string
example: 66b9aa00-94fa-11ea-9f74-e7e108796192
owner:
$ref: 'owners.yaml'
settings:
$ref: 'settings.yaml'
severity:
$ref: 'severity_property.yaml'
status:
$ref: 'status.yaml'
tags:
type: array
items:
title: Case response properties
type: object
required:
- closed_at
- closed_by
- comments
- connector
- created_at
- created_by
- description
- duration
- external_service
- id
- owner
- settings
- severity
- status
- tags
- title
- totalAlerts
- totalComment
- updated_at
- updated_by
- version
properties:
closed_at:
type: string
example: ["tag-1"]
title:
type: string
example: Case title 1
totalAlerts:
type: integer
example: 0
totalComment:
type: integer
example: 0
updated_at:
type: string
format: date-time
nullable: true
example: null
updated_by:
type: object
properties:
$ref: 'user_properties.yaml'
nullable: true
example: null
version:
type: string
example: WzUzMiwxXQ==
format: date-time
nullable: true
closed_by:
$ref: 'case_response_closed_by_properties.yaml'
comments:
title: Case response properties for comments
description: An array of comment objects for the case.
type: array
items:
discriminator:
propertyName: type
oneOf:
- $ref: 'alert_comment_response_properties.yaml'
- $ref: 'user_comment_response_properties.yaml'
connector:
title: Case response properties for connectors
type: object
properties:
fields:
$ref: 'case_response_connector_field_properties.yaml'
id:
description: The identifier for the connector. To create a case without a connector, use `none`.
type: string
example: none
name:
description: The name of the connector. To create a case without a connector, use `none`.
type: string
example: none
type:
$ref: 'connector_types.yaml'
created_at:
type: string
format: date-time
example: '2022-05-13T09:16:17.416Z'
created_by:
$ref: 'case_response_created_by_properties.yaml'
description:
type: string
example: A case description.
duration:
type: integer
description: >
The elapsed time from the creation of the case to its closure (in seconds).
If the case has not been closed, the duration is set to null. If the case
was closed after less than half a second, the duration is rounded down to
zero.
nullable: true
example: 120
external_service:
$ref: 'external_service.yaml'
id:
type: string
example: 66b9aa00-94fa-11ea-9f74-e7e108796192
owner:
$ref: 'owners.yaml'
settings:
$ref: 'settings.yaml'
severity:
$ref: 'severity_property.yaml'
status:
$ref: 'status.yaml'
tags:
type: array
items:
type: string
example:
- tag-1
title:
type: string
example: Case title 1
totalAlerts:
type: integer
example: 0
totalComment:
type: integer
example: 0
updated_at:
type: string
format: date-time
nullable: true
updated_by:
$ref: 'case_response_updated_by_properties.yaml'
version:
type: string
example: WzUzMiwxXQ==

View file

@ -0,0 +1,9 @@
title: Case response properties for pushed_by
type: object
nullable: true
properties:
$ref: 'user_properties.yaml'
required:
- email
- full_name
- username

View file

@ -0,0 +1,9 @@
title: Case response properties for updated_by
type: object
nullable: true
properties:
$ref: 'user_properties.yaml'
required:
- email
- full_name
- username

View file

@ -1,4 +1,5 @@
type: object
nullable: true
properties:
connector_id:
type: string

View file

@ -0,0 +1,18 @@
title: Alerting rule
description: >
The rule that is associated with the alert. It is required only when
`type` is `alert`. This functionality is in technical preview and may be
changed or removed in a future release. Elastic will apply best effort to
fix any issues, but features in technical preview are not subject to the
support SLA of official GA features.
type: object
x-technical-preview: true
properties:
id:
description: The rule identifier.
type: string
example: 94d80550-aaf4-11ec-985f-97e55adae8b9
name:
description: The rule name.
type: string
example: security_rule

View file

@ -1,20 +1,17 @@
title: Update case comment request properties for alerts
description: Defines properties for case comment requests when type is alert.
required:
- alertId
- id
- index
- owner
- rule
- type
- version
type: object
properties:
alertId:
description: >
The alert identifier. It is required only when `type` is `alert`. If it is
an array, `index` must also be an array. This functionality is in
technical preview and may be changed or removed in a future release.
Elastic will apply best effort to fix any issues, but features in
technical preview are not subject to the support SLA of official GA
features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
example: 6b24c4dc44bc720cfc92797f3d61fff952f2b2627db1fb4f8cc49f4530c4ff42
alertId:
$ref: 'alert_identifiers.yaml'
id:
type: string
description: >
@ -22,31 +19,11 @@ properties:
get comments API.
example: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
index:
description: >
The alert index. It is required only when `type` is `alert`. If it is an
array, `alertId` must also be an array. This functionality is in technical
preview and may be changed or removed in a future release. Elastic will
apply best effort to fix any issues, but features in technical preview are
not subject to the support SLA of official GA features.
oneOf:
- type: string
- type: array
items:
type: string
x-technical-preview: true
$ref: 'alert_indices.yaml'
owner:
$ref: 'owners.yaml'
rule:
description: >
The rule that is associated with the alert. It is required only when
`type` is `alert`. This functionality is in technical preview and may be
changed or removed in a future release. Elastic will apply best effort to
fix any issues, but features in technical preview are not subject to the
support SLA of official GA features.
type: object
x-technical-preview: true
properties:
$ref: 'rule_properties.yaml'
$ref: 'rule.yaml'
type:
description: The type of comment.
type: string
@ -58,12 +35,4 @@ properties:
The current comment version. To retrieve version values, use the get
comments API.
type: string
example: Wzk1LDFd
required:
- alertId
- id
- index
- owner
- rule
- type
- version
example: Wzk1LDFd

View file

@ -0,0 +1,9 @@
title: Update case comment request
description: >-
The update case comment API request body varies depending on whether you are
updating an alert or a comment.
discriminator:
propertyName: type
oneOf:
- $ref: 'update_alert_comment_request_properties.yaml'
- $ref: 'update_user_comment_request_properties.yaml'

View file

@ -1,3 +1,5 @@
title: Update case comment request properties for user comments
description: Defines properties for case comment requests when type is user.
type: object
properties:
comment:

View file

@ -1,4 +1,7 @@
title: Case response properties for user comments
type: object
required:
- type
properties:
comment:
type: string
@ -8,9 +11,7 @@ properties:
format: date-time
example: 2022-05-13T09:16:17.416Z
created_by:
type: object
properties:
$ref: 'user_properties.yaml'
$ref: 'case_response_created_by_properties.yaml'
id:
type: string
example: 8af6ac20-74f6-11ea-b83a-553aecdb28b6
@ -22,25 +23,19 @@ properties:
nullable: true
example: null
pushed_by:
type: object
properties:
$ref: 'user_properties.yaml'
nullable: true
example: null
$ref: 'case_response_pushed_by_properties.yaml'
type:
type: string
example: user
enum:
- user
updated_at:
type: string
format: date-time
nullable: true
example: null
updated_by:
type: object
properties:
$ref: 'user_properties.yaml'
nullable: true
example: null
$ref: 'case_response_updated_by_properties.yaml'
version:
type: string
example: WzIwNDMxLDFd

View file

@ -1,12 +1,15 @@
email:
type: string
example: null
nullable: true
full_name:
type: string
example: null
nullable: true
username:
type: string
example: elastic
nullable: true
profile_uid:
type: string
example: u_J41Oh6L9ki-Vo2tOogS8WRTENzhHurGtRc87NgEAlkc_0

View file

@ -0,0 +1,59 @@
openapi: 3.0.1
info:
title: Cases
description: OpenAPI schema for Cases endpoints
version: '0.2'
contact:
name: Cases Team
license:
name: Elastic License 2.0
url: https://www.elastic.co/licensing/elastic-license
tags:
- name: cases
description: Case APIs enable you to open and track issues.
servers:
- url: 'http://localhost:5601'
description: local
paths:
# '/s/{spaceId}/api/cases':
# $ref: 'paths/s@{spaceid}@api@cases.yaml'
# '/s/{spaceId}/api/cases/_find':
# $ref: 'paths/s@{spaceid}@api@cases@_find.yaml'
# '/s/{spaceId}/api/cases/alerts/{alertId}':
# $ref: 'paths/s@{spaceid}@api@cases@alerts@{alertid}.yaml'
# '/s/{spaceId}/api/cases/configure':
# $ref: paths/s@{spaceid}@api@cases@configure.yaml
# '/s/{spaceId}/api/cases/configure/{configurationId}':
# $ref: paths/s@{spaceid}@api@cases@configure@{configurationid}.yaml
# '/s/{spaceId}/api/cases/configure/connectors/_find':
# $ref: paths/s@{spaceid}@api@cases@configure@connectors@_find.yaml
# '/s/{spaceId}/api/cases/reporters':
# $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/{caseId}':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}.yaml'
# '/s/{spaceId}/api/cases/{caseId}/alerts':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}@alerts.yaml'
'/s/{spaceId}/api/cases/{caseId}/comments':
$ref: 'paths/s@{spaceid}@api@cases@{caseid}@comments.yaml'
# '/s/{spaceId}/api/cases/{caseId}/comments/{commentId}':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}@comments@{commentid}.yaml'
# '/s/{spaceId}/api/cases/{caseId}/connector/{connectorId}/_push':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}@connector@{connectorid}@_push.yaml'
# '/s/{spaceId}/api/cases/{caseId}/user_actions':
# $ref: 'paths/s@{spaceid}@api@cases@{caseid}@user_actions.yaml'
components:
securitySchemes:
basicAuth:
type: http
scheme: basic
apiKeyAuth:
type: apiKey
in: header
name: ApiKey
security:
- basicAuth: []
- apiKeyAuth: []

View file

@ -11,8 +11,6 @@ info:
tags:
- name: cases
description: Case APIs enable you to open and track issues.
- name: kibana
description: Kibana APIs enable you to interact with Kibana features.
servers:
- url: 'http://localhost:5601'
description: local

View file

@ -57,11 +57,9 @@ post:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
createCaseResponse:
$ref: '../components/examples/create_case_response.yaml'
@ -160,11 +158,9 @@ patch:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
updateCaseResponse:
$ref: '../components/examples/update_case_response.yaml'

View file

@ -138,9 +138,7 @@ get:
cases:
type: array
items:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
count_closed_cases:
type: integer
count_in_progress_cases:

View file

@ -21,11 +21,9 @@ get:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
getCaseResponse:
$ref: '../components/examples/get_case_response.yaml'

View file

@ -12,12 +12,11 @@ post:
- $ref: '../components/parameters/case_id.yaml'
- $ref: '../components/parameters/space_id.yaml'
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '../components/schemas/add_alert_comment_request_properties.yaml'
- $ref: '../components/schemas/add_user_comment_request_properties.yaml'
$ref: '../components/schemas/add_case_comment_request.yaml'
examples:
createCaseCommentRequest:
$ref: '../components/examples/add_comment_request.yaml'
@ -25,11 +24,9 @@ post:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
createCaseCommentResponse:
$ref: '../components/examples/add_comment_response.yaml'
@ -70,12 +67,11 @@ patch:
- $ref: '../components/parameters/case_id.yaml'
- $ref: '../components/parameters/space_id.yaml'
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '../components/schemas/update_alert_comment_request_properties.yaml'
- $ref: '../components/schemas/update_user_comment_request_properties.yaml'
$ref: '../components/schemas/update_case_comment_request.yaml'
examples:
updateCaseCommentRequest:
$ref: '../components/examples/update_comment_request.yaml'
@ -83,11 +79,9 @@ patch:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
updateCaseCommentResponse:
$ref: '../components/examples/update_comment_response.yaml'
@ -111,14 +105,10 @@ get:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '../components/schemas/alert_comment_response_properties.yaml'
- $ref: '../components/schemas/user_comment_response_properties.yaml'
examples: {}
$ref: '../components/schemas/case_response_properties.yaml'
servers:
- url: https://localhost:5601

View file

@ -21,11 +21,9 @@ post:
'200':
description: Indicates a successful call.
content:
application/json; charset=utf-8:
application/json:
schema:
type: object
properties:
$ref: '../components/schemas/case_response_properties.yaml'
$ref: '../components/schemas/case_response_properties.yaml'
examples:
pushCaseResponse:
$ref: '../components/examples/push_case_response.yaml'