Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] [Fleet] Simplified package policy create API, enriching default values (#119739) #120576

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 74 additions & 11 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2673,8 +2673,7 @@
},
"required": [
"name",
"version",
"title"
"version"
]
},
"namespace": {
Expand Down Expand Up @@ -2713,8 +2712,7 @@
},
"required": [
"type",
"enabled",
"streams"
"enabled"
]
}
},
Expand All @@ -2729,9 +2727,7 @@
}
},
"required": [
"output_id",
"inputs",
"policy_id",
"name"
]
},
Expand Down Expand Up @@ -2858,19 +2854,86 @@
},
"update_package_policy": {
"title": "Update package policy",
"allOf": [
{
"type": "object",
"description": "",
"properties": {
"version": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"package": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"title": {
"type": "string"
}
},
"required": [
"name",
"title",
"version"
]
},
"namespace": {
"type": "string"
},
"output_id": {
"type": "string"
},
"inputs": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"processors": {
"type": "array",
"items": {
"type": "string"
}
},
"streams": {
"type": "array",
"items": {}
},
"config": {
"type": "object"
},
"vars": {
"type": "object"
}
},
"required": [
"type",
"enabled",
"streams"
]
}
},
{
"$ref": "#/components/schemas/new_package_policy"
"policy_id": {
"type": "string"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
}
]
},
"required": null
},
"output": {
"title": "Output",
Expand Down
59 changes: 52 additions & 7 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,6 @@ components:
required:
- name
- version
- title
namespace:
type: string
output_id:
Expand Down Expand Up @@ -1711,17 +1710,14 @@ components:
required:
- type
- enabled
- streams
policy_id:
type: string
name:
type: string
description:
type: string
required:
- output_id
- inputs
- policy_id
- name
package_policy:
title: Package policy
Expand Down Expand Up @@ -1801,12 +1797,61 @@ components:
items: {}
update_package_policy:
title: Update package policy
allOf:
- type: object
type: object
description: ''
properties:
version:
type: string
enabled:
type: boolean
package:
type: object
properties:
name:
type: string
version:
type: string
- $ref: '#/components/schemas/new_package_policy'
title:
type: string
required:
- name
- title
- version
namespace:
type: string
output_id:
type: string
inputs:
type: array
items:
type: object
properties:
type:
type: string
enabled:
type: boolean
processors:
type: array
items:
type: string
streams:
type: array
items: {}
config:
type: object
vars:
type: object
required:
- type
- enabled
- streams
policy_id:
type: string
name:
type: string
description:
type: string
required: null
output:
title: Output
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ properties:
required:
- name
- version
- title
namespace:
type: string
output_id:
Expand Down Expand Up @@ -44,15 +43,12 @@ properties:
required:
- type
- enabled
- streams
policy_id:
type: string
name:
type: string
description:
type: string
required:
- output_id
- inputs
- policy_id
- name
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
title: Update package policy
allOf:
- type: object
type: object
description: ''
properties:
version:
type: string
enabled:
type: boolean
package:
type: object
properties:
name:
type: string
version:
type: string
- $ref: ./new_package_policy.yaml
title:
type: string
required:
- name
- title
- version
namespace:
type: string
output_id:
type: string
inputs:
type: array
items:
type: object
properties:
type:
type: string
enabled:
type: boolean
processors:
type: array
items:
type: string
streams:
type: array
items: {}
config:
type: object
vars:
type: object
required:
- type
- enabled
- streams
policy_id:
type: string
name:
type: string
description:
type: string
required:
2 changes: 2 additions & 0 deletions x-pack/plugins/fleet/server/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const createPackagePolicyServiceMock = (): jest.Mocked<PackagePolicyServi
return {
_compilePackagePolicyInputs: jest.fn(),
buildPackagePolicyFromPackage: jest.fn(),
buildPackagePolicyFromPackageWithVersion: jest.fn(),
bulkCreate: jest.fn(),
create: jest.fn(),
delete: jest.fn(),
Expand All @@ -112,6 +113,7 @@ export const createPackagePolicyServiceMock = (): jest.Mocked<PackagePolicyServi
upgrade: jest.fn(),
getUpgradeDryRunDiff: jest.fn(),
getUpgradePackagePolicyInfo: jest.fn(),
enrichPolicyWithDefaultsFromPackage: jest.fn(),
};
};

Expand Down
Loading