From 3ee58ef8f5a6477151f549ef2646ca831bff104d Mon Sep 17 00:00:00 2001 From: lcawl Date: Mon, 8 May 2023 09:31:43 -0700 Subject: [PATCH 1/2] Validate connector OAS --- .../components/schemas/connector_response_properties.yaml | 3 ++- .../docs/openapi/paths/s@{spaceid}@api@actions@connector.yaml | 3 ++- .../paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties.yaml index b73584568df6b..ef72d88e31480 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties.yaml @@ -12,7 +12,8 @@ oneOf: - $ref: 'connector_response_properties_servicenow.yaml' - $ref: 'connector_response_properties_servicenow_itom.yaml' - $ref: 'connector_response_properties_servicenow_sir.yaml' - - $ref: 'connector_response_properties_slack.yaml' + - $ref: 'connector_response_properties_slack_api.yaml' + - $ref: 'connector_response_properties_slack_webhook.yaml' - $ref: 'connector_response_properties_swimlane.yaml' - $ref: 'connector_response_properties_teams.yaml' - $ref: 'connector_response_properties_tines.yaml' diff --git a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector.yaml b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector.yaml index b3d42c3f47484..24fddf1a8b972 100644 --- a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector.yaml +++ b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector.yaml @@ -36,7 +36,8 @@ post: - $ref: '../components/schemas/create_connector_request_servicenow.yaml' - $ref: '../components/schemas/create_connector_request_servicenow_itom.yaml' - $ref: '../components/schemas/create_connector_request_servicenow_sir.yaml' - - $ref: '../components/schemas/create_connector_request_slack.yaml' + - $ref: '../components/schemas/create_connector_request_slack_api.yaml' + - $ref: '../components/schemas/create_connector_request_slack_webhook.yaml' - $ref: '../components/schemas/create_connector_request_swimlane.yaml' - $ref: '../components/schemas/create_connector_request_teams.yaml' - $ref: '../components/schemas/create_connector_request_tines.yaml' diff --git a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml index 3cee979ed3e91..a417a457a9448 100644 --- a/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml +++ b/x-pack/plugins/actions/docs/openapi/paths/s@{spaceid}@api@actions@connector@{connectorid}.yaml @@ -104,7 +104,8 @@ put: - $ref: '../components/schemas/update_connector_request_serverlog.yaml' - $ref: '../components/schemas/update_connector_request_servicenow.yaml' - $ref: '../components/schemas/update_connector_request_servicenow_itom.yaml' - - $ref: '../components/schemas/update_connector_request_slack.yaml' + - $ref: '../components/schemas/update_connector_request_slack_api.yaml' + - $ref: '../components/schemas/update_connector_request_slack_webhook.yaml' - $ref: '../components/schemas/update_connector_request_swimlane.yaml' # - $ref: '../components/schemas/update_connector_request_teams.yaml' # - $ref: '../components/schemas/update_connector_request_tines.yaml' From a441701c68710f24748b446ea4aefb9771b7bd29 Mon Sep 17 00:00:00 2001 From: lcawl Date: Mon, 8 May 2023 09:44:32 -0700 Subject: [PATCH 2/2] [DOCS] Regenerate API output --- .../connector-apis-passthru.asciidoc | 63 ++++--- .../plugins/actions/docs/openapi/bundled.json | 172 ++++++++++++++---- .../plugins/actions/docs/openapi/bundled.yaml | 109 +++++++---- 3 files changed, 248 insertions(+), 96 deletions(-) diff --git a/docs/api-generated/connectors/connector-apis-passthru.asciidoc b/docs/api-generated/connectors/connector-apis-passthru.asciidoc index 5bd4a4bc44f45..385807de6a7d4 100644 --- a/docs/api-generated/connectors/connector-apis-passthru.asciidoc +++ b/docs/api-generated/connectors/connector-apis-passthru.asciidoc @@ -46,7 +46,9 @@ Any modifications made to this file will be overwritten.
spaceId (required)
-
Path Parameter — An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used. default: null
+
Path Parameter — An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used. default: null
id (required)
+ +
Path Parameter — An UUID v1 or v4 identifier for the connector. If you omit this parameter, an identifier is randomly generated. default: null

Consumes

@@ -970,7 +972,8 @@ Any modifications made to this file will be overwritten.
  • create_connector_request_servicenow - Create ServiceNow ITSM connector request
  • create_connector_request_servicenow_itom - Create ServiceNow ITOM connector request
  • create_connector_request_servicenow_sir - Create ServiceNow SecOps connector request
  • -
  • create_connector_request_slack - Create Slack connector request
  • +
  • create_connector_request_slack_api - Create Slack connector request
  • +
  • create_connector_request_slack_webhook - Create Slack connector request
  • create_connector_request_swimlane - Create Swimlane connector request
  • create_connector_request_teams - Create Microsoft Teams connector request
  • create_connector_request_tines - Create Tines connector request
  • @@ -1016,9 +1019,8 @@ Any modifications made to this file will be overwritten.
  • secrets_properties_opsgenie - Connector secrets properties for an Opsgenie connector
  • secrets_properties_resilient - Connector secrets properties for IBM Resilient connector
  • secrets_properties_servicenow - Connector secrets properties for ServiceNow ITOM, ServiceNow ITSM, and ServiceNow SecOps connectors
  • -
  • secrets_properties_slack - Connector secrets properties for a Slack connector
  • -
  • secrets_properties_slack_oneOf -
  • -
  • secrets_properties_slack_oneOf_1 -
  • +
  • secrets_properties_slack_api - Connector secrets properties for a Web API Slack connector
  • +
  • secrets_properties_slack_webhook - Connector secrets properties for a Webhook Slack connector
  • secrets_properties_swimlane - Connector secrets properties for a Swimlane connector
  • updateConnector_400_response -
  • update_connector_request_cases_webhook - Update Webhook - Case Managment connector request
  • @@ -1029,7 +1031,8 @@ Any modifications made to this file will be overwritten.
  • update_connector_request_serverlog - Update server log connector request
  • update_connector_request_servicenow - Update ServiceNow ITSM connector or ServiceNow SecOps request
  • update_connector_request_servicenow_itom - Create ServiceNow ITOM connector request
  • -
  • update_connector_request_slack - Update Slack connector request
  • +
  • update_connector_request_slack_api - Update Slack connector request
  • +
  • update_connector_request_slack_webhook - Update Slack connector request
  • update_connector_request_swimlane - Update Swimlane connector request
  • @@ -1785,14 +1788,25 @@ Any modifications made to this file will be overwritten.
    -

    create_connector_request_slack - Create Slack connector request Up

    +

    create_connector_request_slack_api - Create Slack connector request Up

    +
    The Slack connector uses Slack Incoming Webhooks.
    +
    +
    connector_type_id
    String The type of connector.
    +
    Enum:
    +
    .slack_api
    +
    name
    String The display name for the connector.
    +
    secrets
    +
    +
    +
    +

    create_connector_request_slack_webhook - Create Slack connector request Up

    The Slack connector uses Slack Incoming Webhooks.
    connector_type_id
    String The type of connector.
    Enum:
    .slack
    name
    String The display name for the connector.
    -
    secrets
    +
    secrets
    @@ -2240,25 +2254,17 @@ Any modifications made to this file will be overwritten.
    -

    secrets_properties_slack - Connector secrets properties for a Slack connector Up

    +

    secrets_properties_slack_api - Connector secrets properties for a Web API Slack connector Up

    Defines secrets for connectors when type is .slack.
    -
    token
    String The Slack bot user OAuth token.
    -
    webhookUrl
    String The Slack webhook url.
    +
    token
    String Slack bot user OAuth token.
    -

    secrets_properties_slack_oneOf - Up

    -
    -
    -
    token
    String The Slack bot user OAuth token.
    -
    -
    -
    -

    secrets_properties_slack_oneOf_1 - Up

    -
    +

    secrets_properties_slack_webhook - Connector secrets properties for a Webhook Slack connector Up

    +
    Defines secrets for connectors when type is .slack.
    -
    webhookUrl
    String The Slack webhook url.
    +
    webhookUrl
    String Slack webhook url.
    @@ -2347,14 +2353,19 @@ Any modifications made to this file will be overwritten.
    +
    diff --git a/x-pack/plugins/actions/docs/openapi/bundled.json b/x-pack/plugins/actions/docs/openapi/bundled.json index 524b09c965130..53f48394d26bd 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.json +++ b/x-pack/plugins/actions/docs/openapi/bundled.json @@ -39,6 +39,16 @@ }, { "$ref": "#/components/parameters/space_id" + }, + { + "in": "path", + "name": "id", + "description": "An UUID v1 or v4 identifier for the connector. If you omit this parameter, an identifier is randomly generated.\n", + "required": true, + "schema": { + "type": "string", + "example": "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" + } } ], "requestBody": { @@ -83,7 +93,10 @@ "$ref": "#/components/schemas/create_connector_request_servicenow_sir" }, { - "$ref": "#/components/schemas/create_connector_request_slack" + "$ref": "#/components/schemas/create_connector_request_slack_api" + }, + { + "$ref": "#/components/schemas/create_connector_request_slack_webhook" }, { "$ref": "#/components/schemas/create_connector_request_swimlane" @@ -318,7 +331,10 @@ "$ref": "#/components/schemas/update_connector_request_servicenow_itom" }, { - "$ref": "#/components/schemas/update_connector_request_slack" + "$ref": "#/components/schemas/update_connector_request_slack_api" + }, + { + "$ref": "#/components/schemas/update_connector_request_slack_webhook" }, { "$ref": "#/components/schemas/update_connector_request_swimlane" @@ -1948,37 +1964,63 @@ } } }, - "secrets_properties_slack": { - "title": "Connector secrets properties for a Slack connector", + "secrets_properties_slack_api": { + "title": "Connector secrets properties for a Web API Slack connector", "description": "Defines secrets for connectors when type is `.slack`.", - "oneOf": [ - { - "type": "object", - "required": [ - "token" + "required": [ + "token" + ], + "type": "object", + "properties": { + "token": { + "type": "string", + "description": "Slack bot user OAuth token." + } + } + }, + "create_connector_request_slack_api": { + "title": "Create Slack connector request", + "description": "The Slack connector uses Slack Incoming Webhooks.", + "type": "object", + "required": [ + "connector_type_id", + "name", + "secrets" + ], + "properties": { + "connector_type_id": { + "type": "string", + "description": "The type of connector.", + "enum": [ + ".slack_api" ], - "properties": { - "token": { - "type": "string", - "description": "The Slack bot user OAuth token." - } - } + "example": ".slack_api" }, - { - "type": "object", - "required": [ - "webhookUrl" - ], - "properties": { - "webhookUrl": { - "type": "string", - "description": "The Slack webhook url." - } - } + "name": { + "type": "string", + "description": "The display name for the connector.", + "example": "my-connector" + }, + "secrets": { + "$ref": "#/components/schemas/secrets_properties_slack_api" } - ] + } }, - "create_connector_request_slack": { + "secrets_properties_slack_webhook": { + "title": "Connector secrets properties for a Webhook Slack connector", + "description": "Defines secrets for connectors when type is `.slack`.", + "required": [ + "webhookUrl" + ], + "type": "object", + "properties": { + "webhookUrl": { + "type": "string", + "description": "Slack webhook url." + } + } + }, + "create_connector_request_slack_webhook": { "title": "Create Slack connector request", "description": "The Slack connector uses Slack Incoming Webhooks.", "type": "object", @@ -2002,7 +2044,7 @@ "example": "my-connector" }, "secrets": { - "$ref": "#/components/schemas/secrets_properties_slack" + "$ref": "#/components/schemas/secrets_properties_slack_webhook" } } }, @@ -2921,7 +2963,44 @@ } } }, - "connector_response_properties_slack": { + "connector_response_properties_slack_api": { + "title": "Connector response properties for a Slack connector", + "type": "object", + "required": [ + "connector_type_id", + "id", + "is_deprecated", + "is_preconfigured", + "name" + ], + "properties": { + "connector_type_id": { + "type": "string", + "description": "The type of connector.", + "enum": [ + ".slack_api" + ] + }, + "id": { + "type": "string", + "description": "The identifier for the connector." + }, + "is_deprecated": { + "$ref": "#/components/schemas/is_deprecated" + }, + "is_missing_secrets": { + "$ref": "#/components/schemas/is_missing_secrets" + }, + "is_preconfigured": { + "$ref": "#/components/schemas/is_preconfigured" + }, + "name": { + "type": "string", + "description": "The display name for the connector." + } + } + }, + "connector_response_properties_slack_webhook": { "title": "Connector response properties for a Slack connector", "type": "object", "required": [ @@ -3197,7 +3276,10 @@ "$ref": "#/components/schemas/connector_response_properties_servicenow_sir" }, { - "$ref": "#/components/schemas/connector_response_properties_slack" + "$ref": "#/components/schemas/connector_response_properties_slack_api" + }, + { + "$ref": "#/components/schemas/connector_response_properties_slack_webhook" }, { "$ref": "#/components/schemas/connector_response_properties_swimlane" @@ -3375,7 +3457,7 @@ } } }, - "update_connector_request_slack": { + "update_connector_request_slack_api": { "title": "Update Slack connector request", "type": "object", "required": [ @@ -3387,15 +3469,29 @@ "type": "string", "description": "The display name for the connector." }, - "config": { + "secrets": { + "type": "object", + "description": "The secrets object containing the necessary fields for authentication.", + "$ref": "#/components/schemas/secrets_properties_slack_api" + } + } + }, + "update_connector_request_slack_webhook": { + "title": "Update Slack connector request", + "type": "object", + "required": [ + "name", + "secrets" + ], + "properties": { + "name": { "type": "string", - "enum": [ - "web_api", - "webhook" - ] + "description": "The display name for the connector." }, "secrets": { - "$ref": "#/components/schemas/secrets_properties_slack" + "type": "object", + "description": "The secrets object containing the necessary fields for authentication.", + "$ref": "#/components/schemas/secrets_properties_slack_webhook" } } }, diff --git a/x-pack/plugins/actions/docs/openapi/bundled.yaml b/x-pack/plugins/actions/docs/openapi/bundled.yaml index 2d02e0dd2b046..8cd264536b8e7 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.yaml +++ b/x-pack/plugins/actions/docs/openapi/bundled.yaml @@ -26,6 +26,14 @@ paths: parameters: - $ref: '#/components/parameters/kbn_xsrf' - $ref: '#/components/parameters/space_id' + - in: path + name: id + description: | + An UUID v1 or v4 identifier for the connector. If you omit this parameter, an identifier is randomly generated. + required: true + schema: + type: string + example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 requestBody: required: true content: @@ -45,7 +53,8 @@ paths: - $ref: '#/components/schemas/create_connector_request_servicenow' - $ref: '#/components/schemas/create_connector_request_servicenow_itom' - $ref: '#/components/schemas/create_connector_request_servicenow_sir' - - $ref: '#/components/schemas/create_connector_request_slack' + - $ref: '#/components/schemas/create_connector_request_slack_api' + - $ref: '#/components/schemas/create_connector_request_slack_webhook' - $ref: '#/components/schemas/create_connector_request_swimlane' - $ref: '#/components/schemas/create_connector_request_teams' - $ref: '#/components/schemas/create_connector_request_tines' @@ -174,7 +183,8 @@ paths: - $ref: '#/components/schemas/update_connector_request_serverlog' - $ref: '#/components/schemas/update_connector_request_servicenow' - $ref: '#/components/schemas/update_connector_request_servicenow_itom' - - $ref: '#/components/schemas/update_connector_request_slack' + - $ref: '#/components/schemas/update_connector_request_slack_api' + - $ref: '#/components/schemas/update_connector_request_slack_webhook' - $ref: '#/components/schemas/update_connector_request_swimlane' examples: updateIndexConnectorRequest: @@ -1298,25 +1308,48 @@ components: example: my-connector secrets: $ref: '#/components/schemas/secrets_properties_servicenow' - secrets_properties_slack: - title: Connector secrets properties for a Slack connector + secrets_properties_slack_api: + title: Connector secrets properties for a Web API Slack connector description: Defines secrets for connectors when type is `.slack`. - oneOf: - - type: object - required: - - token - properties: - token: - type: string - description: The Slack bot user OAuth token. - - type: object - required: - - webhookUrl - properties: - webhookUrl: - type: string - description: The Slack webhook url. - create_connector_request_slack: + required: + - token + type: object + properties: + token: + type: string + description: Slack bot user OAuth token. + create_connector_request_slack_api: + title: Create Slack connector request + description: The Slack connector uses Slack Incoming Webhooks. + type: object + required: + - connector_type_id + - name + - secrets + properties: + connector_type_id: + type: string + description: The type of connector. + enum: + - .slack_api + example: .slack_api + name: + type: string + description: The display name for the connector. + example: my-connector + secrets: + $ref: '#/components/schemas/secrets_properties_slack_api' + secrets_properties_slack_webhook: + title: Connector secrets properties for a Webhook Slack connector + description: Defines secrets for connectors when type is `.slack`. + required: + - webhookUrl + type: object + properties: + webhookUrl: + type: string + description: Slack webhook url. + create_connector_request_slack_webhook: title: Create Slack connector request description: The Slack connector uses Slack Incoming Webhooks. type: object @@ -1336,7 +1369,7 @@ components: description: The display name for the connector. example: my-connector secrets: - $ref: '#/components/schemas/secrets_properties_slack' + $ref: '#/components/schemas/secrets_properties_slack_webhook' config_properties_swimlane: title: Connector request properties for a Swimlane connector required: @@ -2024,7 +2057,7 @@ components: name: type: string description: The display name for the connector. - connector_response_properties_slack_webhook: + connector_response_properties_slack_api: title: Connector response properties for a Slack connector type: object required: @@ -2038,7 +2071,7 @@ components: type: string description: The type of connector. enum: - - .slack + - .slack_api id: type: string description: The identifier for the connector. @@ -2051,7 +2084,7 @@ components: name: type: string description: The display name for the connector. - connector_response_properties_slack_api: + connector_response_properties_slack_webhook: title: Connector response properties for a Slack connector type: object required: @@ -2065,7 +2098,7 @@ components: type: string description: The type of connector. enum: - - .slack_api + - .slack id: type: string description: The identifier for the connector. @@ -2240,7 +2273,8 @@ components: - $ref: '#/components/schemas/connector_response_properties_servicenow' - $ref: '#/components/schemas/connector_response_properties_servicenow_itom' - $ref: '#/components/schemas/connector_response_properties_servicenow_sir' - - $ref: '#/components/schemas/connector_response_properties_slack' + - $ref: '#/components/schemas/connector_response_properties_slack_api' + - $ref: '#/components/schemas/connector_response_properties_slack_webhook' - $ref: '#/components/schemas/connector_response_properties_swimlane' - $ref: '#/components/schemas/connector_response_properties_teams' - $ref: '#/components/schemas/connector_response_properties_tines' @@ -2359,7 +2393,7 @@ components: description: The display name for the connector. secrets: $ref: '#/components/schemas/secrets_properties_servicenow' - update_connector_request_slack: + update_connector_request_slack_api: title: Update Slack connector request type: object required: @@ -2369,13 +2403,24 @@ components: name: type: string description: The display name for the connector. - config: + secrets: + type: object + description: The secrets object containing the necessary fields for authentication. + $ref: '#/components/schemas/secrets_properties_slack_api' + update_connector_request_slack_webhook: + title: Update Slack connector request + type: object + required: + - name + - secrets + properties: + name: type: string - enum: - - web_api - - webhook + description: The display name for the connector. secrets: - $ref: '#/components/schemas/secrets_properties_slack' + type: object + description: The secrets object containing the necessary fields for authentication. + $ref: '#/components/schemas/secrets_properties_slack_webhook' update_connector_request_swimlane: title: Update Swimlane connector request type: object