-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Fleet] Simplified package policy create API, enriching default values #119739
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
); | ||
if (newPP) { | ||
const inputs = newPolicy.inputs.map((input) => { | ||
const defaultInput = newPP.inputs.find((i) => i.type === input.type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we map on policy_template
too here for granular integration like AWS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchaulet In request only input.type
and enabled
is mandatory, so this code is mapping the rest of properties from the base package (streams
, vars
, etc.).
Could you give an example what you mean by the AWS use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure for example when you try to add the AWS billing integration this we are sending the following payload
as there is multiple input with the same type, so I think in the case where there is a policy_template on the payload input we should probably use it to find the default input.
It is clearer? I can rephrase otherwise :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it is clear now, so the enrich should consider policy_template
too if set
I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nchaulet done, please check again when you get a chance
I tested locally and I'm having an issue when trying to update an integration policy for the |
@criamico good catch! I've fixed in latest commit, thanks |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
elastic#119739) * simplified api, enriching default values * removed comment * reverted changes in common models * fixed handlers test * separated create schema * fixed test * removed throwing error * getting package info from registry only * fix type * fix test and new tests * simplified update api * updated open api spec * fixed compiled_input * added policy_template enrich Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
#119739) (#120576) * simplified api, enriching default values * removed comment * reverted changes in common models * fixed handlers test * separated create schema * fixed test * removed throwing error * getting package info from registry only * fix type * fix test and new tests * simplified update api * updated open api spec * fixed compiled_input * added policy_template enrich Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
…-chromium-before-compiling-pdf * 'main' of github.com:elastic/kibana: (121 commits) FTR should use the new kibana_system user (elastic#120436) [Lens] Temporarily exclude Mosaic/Waffle from the suggestions list (elastic#120488) [Reporting] Fix slow CSV with large max size bytes (elastic#120365) [CTI] Threat Intel Card on Overview page needs to accommodate Fleet TI integrations - (elastic#120459) [Dashboard] Added KibanaThemeProvider. (elastic#120122) add more rule_registry unit tests (elastic#120323) [Lens] update xpack.lens.pie.smallValuesWarningMessage text (elastic#120478) [Fleet] Simplified package policy create API, enriching default values (elastic#119739) mock `elastic-apm-node` in `@kbn/test` jest preset (elastic#120324) [RAC] Rename occurrences of alert_type to rule_type in Infra (elastic#120455) [Security Solutions] Removes tech debt of exporting all from linter rule for timeline plugin (elastic#120437) [Workplace Search] Add API Keys view to replace Access tokens (elastic#120147) [Security Solutions] Removes tech debt of exporting all from linter rule for cases plugin in the server section (elastic#120411) Add support for threat.feed.name (elastic#120250) [Rule Registry] Rewrite APM registry rules for Observability (elastic#117740) [docs] Fix artifact layout formatting (elastic#119386) [Workplace Search] Add a technical preview of connecting GitHub via GitHub apps (elastic#119764) add osquery notes for 7.16 (elastic#120407) chore(NA): splits types from code on @kbn/docs-utils (elastic#120533) [Reporting] Decouple screenshotting plugin from the reporting (elastic#120110) ... # Conflicts: # x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.test.ts # x-pack/plugins/reporting/server/browsers/chromium/driver_factory/index.ts # x-pack/plugins/reporting/server/lib/screenshots/observable.test.ts # x-pack/plugins/reporting/server/lib/screenshots/observable.ts # x-pack/plugins/reporting/server/test_helpers/create_mock_browserdriverfactory.ts
elastic#119739) * simplified api, enriching default values * removed comment * reverted changes in common models * fixed handlers test * separated create schema * fixed test * removed throwing error * getting package info from registry only * fix type * fix test and new tests * simplified update api * updated open api spec * fixed compiled_input * added policy_template enrich Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Closes #113750
Made most properties optional in
POST /api/fleet/package_policies
, loading default values from base package.This is not a breaking change.
Remaining tasks:
To verify:
enabled: false
, it is propagated down to allinputs.streams
package.version
does not match the installed base package version, there is an error cominge.g.
Update on Nov 30, simplified update API. To verify:
description: "", enabled: false
Verify updated open api spec here:
Checklist
For maintainers