-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] OpenAPI - add missing routes and clean up names, types, etc (#…
…106464) (#106540) ### Add specs for several missing routes See additions in `openapi/entrypoint.yaml` - `/agents/{agentId}/reassign` - `/agents/bulk_reassign` - `/agents/bulk_unenroll` - `/package_policies/delete` ### Add enum of string values for delete package response See 5c04dfc ### Fixed inaccurate operation spec spec for `delete-agent-policy` operation currently shows it accepting an array of ids`agentPolicyIds: string[]` and returning an array of results, but it actually accepts a single `agentPolicyId: string` id an returns a single object ### Internal changes #### Better / more consistent operation names e.g. ```diff - operationId: post-agent-policy + operationId: create-agent-policy ``` and ```diff - operationId: put-agent-policy-agentPolicyId + operationId: update-agent-policy ``` #### Better schema titles e.g. ```diff - title: UpdatePackagePolicy + title: Update package policy ``` Co-authored-by: John Schulz <[email protected]>
- Loading branch information
1 parent
78b3b3b
commit d28b7a4
Showing
41 changed files
with
1,016 additions
and
312 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
x-pack/plugins/fleet/common/openapi/components/schemas/access_api_key.yaml
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/agent_metadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
title: AgentMetadata | ||
title: Agent metadata | ||
type: object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/agent_status.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
type: string | ||
title: AgentStatus | ||
title: Agent status | ||
enum: | ||
- offline | ||
- error | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/agent_type.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
type: string | ||
title: AgentType | ||
title: Agent type | ||
enum: | ||
- PERMANENT | ||
- EPHEMERAL | ||
|
49 changes: 14 additions & 35 deletions
49
x-pack/plugins/fleet/common/openapi/components/schemas/bulk_upgrade_agents.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,16 @@ | ||
title: BulkUpgradeAgents | ||
oneOf: | ||
- type: object | ||
properties: | ||
version: | ||
type: string | ||
agents: | ||
type: array | ||
title: Bulk upgrade agents | ||
type: object | ||
properties: | ||
version: | ||
type: string | ||
source_uri: | ||
type: string | ||
agents: | ||
oneOf: | ||
- type: array | ||
items: | ||
type: string | ||
required: | ||
- version | ||
- agents | ||
- type: object | ||
properties: | ||
version: | ||
type: string | ||
source_uri: | ||
type: string | ||
agents: | ||
type: array | ||
items: | ||
type: string | ||
required: | ||
- version | ||
- agents | ||
- type: object | ||
properties: | ||
version: | ||
type: string | ||
source_uri: | ||
type: string | ||
agents: | ||
type: string | ||
required: | ||
- version | ||
- agents | ||
- type: string | ||
required: | ||
- agents | ||
- version |
9 changes: 9 additions & 0 deletions
9
x-pack/plugins/fleet/common/openapi/components/schemas/elasticsearch_asset_type.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
title: Elasticsearch asset type | ||
type: string | ||
enum: | ||
- component_template | ||
- ingest_pipeline | ||
- index_template | ||
- ilm_policy | ||
- transform | ||
- data_stream_ilm_policy |
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/enrollment_api_key.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: EnrollmentApiKey | ||
title: Enrollment API key | ||
type: object | ||
properties: | ||
id: | ||
|
11 changes: 11 additions & 0 deletions
11
x-pack/plugins/fleet/common/openapi/components/schemas/kibana_saved_object_type.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
title: Kibana saved object asset type | ||
type: string | ||
enum: | ||
- dashboard | ||
- visualization | ||
- search | ||
- index-pattern | ||
- map | ||
- lens | ||
- ml-module | ||
- security-rule |
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/new_agent_policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: NewAgentPolicy | ||
title: New agent policy | ||
type: object | ||
properties: | ||
name: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/new_package_policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: NewPackagePolicy | ||
title: New package policy | ||
type: object | ||
description: '' | ||
properties: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/package_info.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: PackageInfo | ||
title: Package information | ||
type: object | ||
properties: | ||
name: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/package_policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: PackagePolicy | ||
title: Package policy | ||
allOf: | ||
- type: object | ||
properties: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/search_result.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: SearchResult | ||
title: Search result | ||
type: object | ||
properties: | ||
description: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/update_package_policy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: UpdatePackagePolicy | ||
title: Update package policy | ||
allOf: | ||
- type: object | ||
properties: | ||
|
2 changes: 1 addition & 1 deletion
2
x-pack/plugins/fleet/common/openapi/components/schemas/upgrade_agent.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
title: UpgradeAgent | ||
title: Upgrade agent | ||
oneOf: | ||
- type: object | ||
properties: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,10 +34,16 @@ paths: | |
$ref: paths/agents@bulk_upgrade.yaml | ||
'/agents/{agentId}': | ||
$ref: 'paths/agents@{agent_id}.yaml' | ||
'/agents/{agentId}/reassign': | ||
$ref: 'paths/agents@{agent_id}@reassign.yaml' | ||
'/agents/{agentId}/unenroll': | ||
$ref: 'paths/agents@{agent_id}@unenroll.yaml' | ||
'/agents/{agentId}/upgrade': | ||
$ref: 'paths/agents@{agent_id}@upgrade.yaml' | ||
'/agents/bulk_reassign': | ||
$ref: 'paths/agents@bulk_reassign.yaml' | ||
'/agents/bulk_unenroll': | ||
$ref: 'paths/agents@bulk_unenroll.yaml' | ||
/agent_policies: | ||
$ref: paths/agent_policies.yaml | ||
'/agent_policies/{agentPolicyId}': | ||
|
@@ -52,6 +58,8 @@ paths: | |
$ref: 'paths/enrollment_api_keys@{key_id}.yaml' | ||
/package_policies: | ||
$ref: paths/package_policies.yaml | ||
/package_policies/delete: | ||
$ref: paths/[email protected] | ||
'/package_policies/{packagePolicyId}': | ||
$ref: 'paths/package_policies@{package_policy_id}.yaml' | ||
components: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 14 additions & 16 deletions
30
x-pack/plugins/fleet/common/openapi/paths/[email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,31 @@ | ||
post: | ||
summary: Agent policy - Delete | ||
operationId: post-agent-policy-delete | ||
operationId: delete-agent-policy | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
success: | ||
type: boolean | ||
required: | ||
- id | ||
- success | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
success: | ||
type: boolean | ||
required: | ||
- id | ||
- success | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
agentPolicyIds: | ||
type: array | ||
items: | ||
type: string | ||
agentPolicyId: | ||
type: string | ||
required: | ||
- agentPolicyId | ||
parameters: | ||
- $ref: ../components/headers/kbn_xsrf.yaml | ||
parameters: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,6 @@ get: | |
- total | ||
- page | ||
- perPage | ||
operationId: get-fleet-agents | ||
operationId: get-agents | ||
security: | ||
- basicAuth: [] |
39 changes: 39 additions & 0 deletions
39
x-pack/plugins/fleet/common/openapi/paths/agents@bulk_reassign.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
post: | ||
summary: Agents - Bulk reassign | ||
tags: [] | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
additionalProperties: | ||
type: object | ||
properties: | ||
success: | ||
type: boolean | ||
error: | ||
type: string | ||
required: | ||
- success | ||
operationId: bulk-reassign-agents | ||
parameters: | ||
- $ref: ../components/headers/kbn_xsrf.yaml | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
policy_id: | ||
type: string | ||
agents: | ||
oneOf: | ||
- type: string | ||
- type: array | ||
items: | ||
type: string | ||
required: | ||
- policy_id | ||
- agents |
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/fleet/common/openapi/paths/agents@bulk_unenroll.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
post: | ||
summary: Agents - Bulk unenroll | ||
tags: [] | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
additionalProperties: | ||
type: object | ||
properties: | ||
success: | ||
type: boolean | ||
error: | ||
type: string | ||
required: | ||
- success | ||
operationId: bulk-unenroll-agents | ||
parameters: | ||
- $ref: ../components/headers/kbn_xsrf.yaml | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
revoke: | ||
type: boolean | ||
force: | ||
type: boolean | ||
agents: | ||
oneOf: | ||
- type: string | ||
- type: array | ||
items: | ||
type: string | ||
required: | ||
- agents |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.