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

[Fleet] support setting id in new agent policy API #124255

Merged
merged 3 commits into from
Feb 2, 2022

Conversation

juliaElastic
Copy link
Contributor

Summary

Support an optional id in create agent policy API

Came up during this discussion: #121628 (comment)

To verify:

  1. Send a new agent policy request with id, verify the response contains the sent id:
POST http://elastic:changeme@localhost:5620/api/fleet/agent_policies
kbn-xsrf: kibana

{"id": "my-agent-policy", "namespace":"default", "name":"My agent policy"}
  1. Send a new agent policy request without id, verify it succeeds (no regression)
POST http://elastic:changeme@localhost:5620/api/fleet/agent_policies
kbn-xsrf: kibana

{"namespace":"default", "name":"My agent policy 2"}
  1. Send a new agent policy request with id and has_fleet_server, verify that the response contains the sent id:
POST http://elastic:changeme@localhost:5620/api/fleet/agent_policies
kbn-xsrf: kibana

{"id": "my-fleet-server-policy", "namespace":"default", "name":"My fleet server policy", "has_fleet_server": true}

Checklist

@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes v8.1.0 labels Feb 1, 2022
@juliaElastic juliaElastic requested a review from a team as a code owner February 1, 2022 14:59
@juliaElastic juliaElastic self-assigned this Feb 1, 2022
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Feb 1, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works as expected 🚀

It would be nice to add an explicit integration test about this field here https://github.com/elastic/kibana/blob/main/x-pack/test/fleet_api_integration/apis/agent_policy/agent_policy.ts/#L22
also creating two time the policy with the same id is well handling 409 on the second all but It could be nice to add an integration test for that.

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Test Failures

  • [job] [logs] Default CI Group #10 / Uptime app with generated data certificates with certs page "before each" hook for "displays certificates"

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1142 1143 +1
Unknown metric groups

API count

id before after diff
fleet 1258 1259 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

@juliaElastic juliaElastic merged commit 22d87fc into elastic:main Feb 2, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Feb 2, 2022
@juliaElastic juliaElastic deleted the new-agent-policy-with-id branch February 2, 2022 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants