Skip to content

Commit

Permalink
[Fleet] Split package policy Upgrade endpoint (elastic#118854) (elast…
Browse files Browse the repository at this point in the history
…ic#119140)

* [Fleet] Split package policy Upgrade endpoint

* Add openapi specs

Co-authored-by: Cristina Amico <[email protected]>
  • Loading branch information
kibanamachine and criamico authored Nov 19, 2021
1 parent 8ba5812 commit 2d6c10a
Show file tree
Hide file tree
Showing 14 changed files with 559 additions and 105 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/constants/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const PACKAGE_POLICY_API_ROUTES = {
UPDATE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/{packagePolicyId}`,
DELETE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/delete`,
UPGRADE_PATTERN: `${PACKAGE_POLICY_API_ROOT}/upgrade`,
DRYRUN_PATTERN: `${PACKAGE_POLICY_API_ROOT}/upgrade/dryrun`,
};

// Agent policy API routes
Expand Down
243 changes: 238 additions & 5 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,115 @@
]
}
},
"/package_policies/upgrade": {
"post": {
"summary": "Package policy - Upgrade",
"operationId": "upgrade-package-policy",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"packagePolicyIds": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"packagePolicyIds"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"success": {
"type": "boolean"
}
},
"required": [
"id",
"success"
]
}
}
}
}
}
}
}
},
"/package_policies/upgrade/dryrun": {
"post": {
"summary": "Package policy - Upgrade Dry run",
"operationId": "upgrade-package-policy",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"packagePolicyIds": {
"type": "array",
"items": {
"type": "string"
}
},
"packageVersion": {
"type": "string"
}
},
"required": [
"packagePolicyIds"
]
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"hasErrors": {
"type": "boolean"
},
"diff": {
"schema": null,
"$ref": "#/components/schemas/upgrade_diff"
},
"required": [
"hasErrors"
]
}
}
}
}
}
}
}
},
"/package_policies/{packagePolicyId}": {
"get": {
"summary": "Package policy - Info",
Expand Down Expand Up @@ -1716,6 +1825,74 @@
}
},
"operationId": "get-outputs"
},
"post": {
"summary": "Outputs",
"description": "Create a new output",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"item": {
"$ref": "#/components/schemas/output"
}
}
}
}
}
}
},
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"elasticsearch"
]
},
"is_default": {
"type": "boolean"
},
"is_default_monitoring": {
"type": "boolean"
},
"hosts": {
"type": "array",
"items": {
"type": "string"
}
},
"ca_sha256": {
"type": "string"
},
"config_yaml": {
"type": "string"
}
},
"required": [
"name",
"type"
]
}
}
}
},
"operationId": "post-outputs"
}
},
"/outputs/{outputId}": {
Expand Down Expand Up @@ -1754,6 +1931,35 @@
"required": true
}
],
"delete": {
"summary": "Output - Delete",
"operationId": "delete-output",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"required": [
"id"
]
}
}
}
}
},
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
]
},
"put": {
"summary": "Output - Update",
"operationId": "update-output",
Expand All @@ -1763,19 +1969,38 @@
"schema": {
"type": "object",
"properties": {
"hosts": {
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"elasticsearch"
]
},
"is_default": {
"type": "boolean"
},
"is_default_monitoring": {
"type": "boolean"
},
"hosts": {
"type": "array",
"items": {
"type": "string"
}
},
"ca_sha256": {
"type": "string"
},
"config": {
"type": "object"
},
"config_yaml": {
"type": "string"
}
}
},
"required": [
"name",
"type"
]
}
}
}
Expand Down Expand Up @@ -2626,6 +2851,11 @@
"created_at"
]
},
"upgrade_diff": {
"title": "Package policy Upgrade dryrun",
"type": "array",
"items": {}
},
"update_package_policy": {
"title": "Update package policy",
"allOf": [
Expand All @@ -2652,6 +2882,9 @@
"is_default": {
"type": "boolean"
},
"is_default_monitoring": {
"type": "boolean"
},
"name": {
"type": "string"
},
Expand Down
Loading

0 comments on commit 2d6c10a

Please sign in to comment.