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

Refactor fleet policy APIs, fix JSON issues #129

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

fearful-symmetry
Copy link
Contributor

Fixes #127

What does this PR do?

This PR does a few things:

  • Update the JSON objects being sent to the fleet API to fix a few bugs as documented in CreatePolicy() sends incorrect JSON requests #127. Most of these bugs were due to small things like missing omitempty fields.
  • Change the structs used by the go APIs to reflect the fields actually accepted/returned by Kibana, in order to make the API usage clearer.
  • Reference the openAPI docs in Kibana where needed
  • Add some integration tests. These require a Kibana instance, but I don't think we have any built-in e2e tests ready-to-use in this repo.
  • Add a DeletePolicy() helper
  • Fix some of the error handling in client.go

Why is it important?

This is blocking integration test development.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

@fearful-symmetry fearful-symmetry added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Jun 2, 2023
@fearful-symmetry fearful-symmetry self-assigned this Jun 2, 2023
@fearful-symmetry fearful-symmetry requested a review from a team as a code owner June 2, 2023 17:16
@fearful-symmetry fearful-symmetry requested review from ycombinator and leehinman and removed request for a team June 2, 2023 17:16
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 2, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-06-06T21:06:00.597+0000

  • Duration: 10 min 0 sec

Test stats 🧪

Test Results
Failed 0
Passed 787
Skipped 11
Total 798

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

kibana/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for making these fixes and improvements.

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreatePolicy() sends incorrect JSON requests
3 participants