From 76fe2e31feb5fd2c34da79f6c032e5443cc6299e Mon Sep 17 00:00:00 2001 From: Julia Bardi <90178898+juliaElastic@users.noreply.github.com> Date: Fri, 23 Sep 2022 11:10:38 +0200 Subject: [PATCH] updated openapi for bulk action responses (#141566) --- .../plugins/fleet/common/openapi/bundled.json | 25 +++++++++++++++- .../plugins/fleet/common/openapi/bundled.yaml | 19 ++++++++++-- .../openapi/paths/agents@bulk_reassign.yaml | 4 +++ .../openapi/paths/agents@bulk_unenroll.yaml | 4 +++ .../paths/agents@bulk_update_tags.yaml | 4 +++ .../openapi/paths/agents@bulk_upgrade.yaml | 4 +++ .../fleet/common/types/rest_spec/agent.ts | 30 +++++-------------- 7 files changed, 64 insertions(+), 26 deletions(-) diff --git a/x-pack/plugins/fleet/common/openapi/bundled.json b/x-pack/plugins/fleet/common/openapi/bundled.json index b7bbc22d5f1eb..88f091ad98310 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.json +++ b/x-pack/plugins/fleet/common/openapi/bundled.json @@ -616,7 +616,6 @@ "in": "query" } ], - "required": true, "post": { "summary": "Packages - Install", "tags": [], @@ -1253,6 +1252,12 @@ "application/json": { "schema": { "type": "object", + "properties": { + "actionId": { + "type": "string", + "description": "action id when running in async mode (>10k agents)" + } + }, "additionalProperties": { "type": "object", "properties": { @@ -1842,6 +1847,12 @@ "application/json": { "schema": { "type": "object", + "properties": { + "actionId": { + "type": "string", + "description": "action id when running in async mode (>10k agents)" + } + }, "additionalProperties": { "type": "object", "properties": { @@ -1918,6 +1929,12 @@ "application/json": { "schema": { "type": "object", + "properties": { + "actionId": { + "type": "string", + "description": "action id when running in async mode (>10k agents)" + } + }, "additionalProperties": { "type": "object", "properties": { @@ -2001,6 +2018,12 @@ "application/json": { "schema": { "type": "object", + "properties": { + "actionId": { + "type": "string", + "description": "action id when running in async mode (>10k agents)" + } + }, "additionalProperties": { "type": "object", "properties": { diff --git a/x-pack/plugins/fleet/common/openapi/bundled.yaml b/x-pack/plugins/fleet/common/openapi/bundled.yaml index fab23c6596a8f..86928fca0b2f4 100644 --- a/x-pack/plugins/fleet/common/openapi/bundled.yaml +++ b/x-pack/plugins/fleet/common/openapi/bundled.yaml @@ -381,7 +381,6 @@ paths: name: ignoreUnverified description: Ignore if the package is fails signature verification in: query - required: true post: summary: Packages - Install tags: [] @@ -772,6 +771,10 @@ paths: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: @@ -1139,6 +1142,10 @@ paths: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: @@ -1185,6 +1192,10 @@ paths: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: @@ -1236,6 +1247,10 @@ paths: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: @@ -1332,7 +1347,7 @@ paths: name: full description: >- When set to true, retrieve the related package policies for each - agent policy/ + agent policy. description: '' post: summary: Agent policy - Create diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml index df2f8c0c4c2f2..cd333e94e4750 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml @@ -8,6 +8,10 @@ post: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml index c77adc8571973..ff04eda0be8a8 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml @@ -8,6 +8,10 @@ post: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml index d2a5f8a3f3e69..80643ebd3625e 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_update_tags.yaml @@ -8,6 +8,10 @@ post: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: diff --git a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml index dca02df27e7b3..1d9136353f01b 100644 --- a/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml +++ b/x-pack/plugins/fleet/common/openapi/paths/agents@bulk_upgrade.yaml @@ -8,6 +8,10 @@ post: application/json: schema: type: object + properties: + actionId: + type: string + description: action id when running in async mode (>10k agents) additionalProperties: type: object properties: diff --git a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts index fddba4e172a01..f1fbe4469de44 100644 --- a/x-pack/plugins/fleet/common/types/rest_spec/agent.ts +++ b/x-pack/plugins/fleet/common/types/rest_spec/agent.ts @@ -72,13 +72,15 @@ export interface PostBulkAgentUnenrollRequest { }; } -export type PostBulkAgentUnenrollResponse = Record< +export type BulkAgentAction = Record< Agent['id'], { success: boolean; error?: string; } ->; +> & { actionId?: string }; + +export type PostBulkAgentUnenrollResponse = BulkAgentAction; export interface PostAgentUpgradeRequest { params: { @@ -100,13 +102,7 @@ export interface PostBulkAgentUpgradeRequest { }; } -export type PostBulkAgentUpgradeResponse = Record< - Agent['id'], - { - success: boolean; - error?: string; - } ->; +export type PostBulkAgentUpgradeResponse = BulkAgentAction; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface PostAgentUpgradeResponse {} @@ -129,21 +125,9 @@ export interface PostBulkAgentReassignRequest { }; } -export type PostBulkAgentReassignResponse = Record< - Agent['id'], - { - success: boolean; - error?: string; - } ->; +export type PostBulkAgentReassignResponse = BulkAgentAction; -export type PostBulkUpdateAgentTagsResponse = Record< - Agent['id'], - { - success: boolean; - error?: string; - } ->; +export type PostBulkUpdateAgentTagsResponse = BulkAgentAction; export interface DeleteAgentRequest { params: {