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] Make API responses consistent #119494

Merged
merged 34 commits into from
Dec 8, 2021

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Nov 23, 2021

Summary

Fixes #119182

  • Making Fleet API GET responses consistent, so that they all return items:

    • /api/fleet/enrollment-api-keys
    • /api/fleet/agents
  • Updated openapi spec.

EDIT: as discussed it is a kibana convention to use underscore. Updated following APIs to underscore and deprecated old ones:
enrollment-api-keys to enrollment_api_keys
agent-status to agent_status
service-tokens to service_tokens
Note: check-permissions will be removed anyway, so not worth changing that.

EDIT:
further changes for consistency:
changing /epm/packages/{pkgkey} endpoint to /epm/packages/{packageName}/{version}
changing response[] to items[] or item here:

/epm/packages/
/epm/packages/{pkgkey}
/epm/categories
/epm/packages/_bulk
/epm/packages/limited
  • Update documentation with changed API paths (epm pkgkey mentioned in many places)

For maintainers

@juliaElastic juliaElastic requested a review from a team as a code owner November 23, 2021 15:52
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Nov 23, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic juliaElastic self-assigned this Nov 23, 2021
@juliaElastic juliaElastic added auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes v8.0.0 v8.1.0 labels Nov 23, 2021
page: number;
perPage: number;
kuery?: string;
query: ListWithKuery & {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a slight difference here as page and perPage are optional in ListWithKuery, hopefully not a problem. I feel it's still better to use the common interface.

@nchaulet
Copy link
Member

I do not think we can make that change without breaking the agent setup on cloud. Elastic agent on cloud is calling the setup API and this API to get enrollemtn tokens https://github.com/elastic/beats/blob/15366ffee58fe2012daf524a7845026011faf4a1/x-pack/elastic-agent/pkg/agent/cmd/container.go#L453

@juliaElastic
Copy link
Contributor Author

@nchaulet thanks for pointing this out! should I updated in beats repo?

@nchaulet
Copy link
Member

@nchaulet thanks for pointing this out! should I updated in beats repo?

I think it will make sense to create an issue in the beats repo to see how the migration could work, I am not sure what retro compatibility we should keep here

@juliaElastic
Copy link
Contributor Author

@nchaulet raised this: elastic/elastic-agent#111

@criamico
Copy link
Contributor

I think that this should be labeled as release_note:breaking

@juliaElastic juliaElastic added release_note:breaking and removed release_note:skip Skip the PR/issue when compiling release notes labels Nov 24, 2021
@juliaElastic
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

expected head sha didn’t match current head ref.

Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM for the fleet changes 👍

@juliaElastic
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@patrykkopycinski patrykkopycinski left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Test Failures

  • [job] [logs] Security Solution Tests / Detection rules, machine learning Creates and activates a new ml rule

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 547 549 +2

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 1144 1143 -1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 643.4KB 643.5KB +50.0B
securitySolution 4.6MB 4.6MB -9.0B
total +41.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 108.0KB 109.1KB +1.1KB
Unknown metric groups

API count

id before after diff
fleet 1251 1255 +4

History

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

cc @juliaElastic

@juliaElastic juliaElastic merged commit b1a038d into elastic:main Dec 8, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Dec 8, 2021
* make apis consistent

* UI and test fixes

* test fixes

* fixed test

* fix tests

* fix test

* removed deprecated shared_id from openapi spec

* added back list prop as deprecated

* renamed apis with hyphens

* openapi update

* fix checks

* fix test

* renamed epm api path and response

* fix tests

* fix ml

* moved splitPkgKey

* fixed edit package policy page

* fixed storybook

* fix prettier after conflict

* fix tests

* fix tests

* fix tests

* fix test

* fix test

* added back semver validation

* fix test

* pkgVersion optional

* fix tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
8.0

This backport PR will be merged automatically after passing CI.

@juliaElastic juliaElastic deleted the make-api-consistent branch December 8, 2021 12:12
kibanamachine added a commit that referenced this pull request Dec 8, 2021
* [Fleet] Make API responses consistent (#119494)

* make apis consistent

* UI and test fixes

* test fixes

* fixed test

* fix tests

* fix test

* removed deprecated shared_id from openapi spec

* added back list prop as deprecated

* renamed apis with hyphens

* openapi update

* fix checks

* fix test

* renamed epm api path and response

* fix tests

* fix ml

* moved splitPkgKey

* fixed edit package policy page

* fixed storybook

* fix prettier after conflict

* fix tests

* fix tests

* fix tests

* fix test

* fix test

* added back semver validation

* fix test

* pkgVersion optional

* fix tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* fixed tests

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Co-authored-by: Julia Bardi <julia.bardi@elastic.co>
TinLe pushed a commit to TinLe/kibana that referenced this pull request Dec 22, 2021
* make apis consistent

* UI and test fixes

* test fixes

* fixed test

* fix tests

* fix test

* removed deprecated shared_id from openapi spec

* added back list prop as deprecated

* renamed apis with hyphens

* openapi update

* fix checks

* fix test

* renamed epm api path and response

* fix tests

* fix ml

* moved splitPkgKey

* fixed edit package policy page

* fixed storybook

* fix prettier after conflict

* fix tests

* fix tests

* fix tests

* fix test

* fix test

* added back semver validation

* fix test

* pkgVersion optional

* fix tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gbamparop pushed a commit to gbamparop/kibana that referenced this pull request Jan 12, 2022
* make apis consistent

* UI and test fixes

* test fixes

* fixed test

* fix tests

* fix test

* removed deprecated shared_id from openapi spec

* added back list prop as deprecated

* renamed apis with hyphens

* openapi update

* fix checks

* fix test

* renamed epm api path and response

* fix tests

* fix ml

* moved splitPkgKey

* fixed edit package policy page

* fixed storybook

* fix prettier after conflict

* fix tests

* fix tests

* fix tests

* fix test

* fix test

* added back semver validation

* fix test

* pkgVersion optional

* fix tests

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:deprecation Team:Fleet Team label for Observability Data Collection Fleet team v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Make responses in fleet endpoints consistent