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

Add docs for QueryApiKey API #76521

Merged
merged 15 commits into from
Aug 19, 2021
Merged

Conversation

ywangd
Copy link
Member

@ywangd ywangd commented Aug 14, 2021

@ywangd ywangd added >docs General docs changes :Security/Security Security issues without another label v7.15.0 v8.0.0-alpha1 labels Aug 14, 2021
@ywangd ywangd force-pushed the api-key-search-api-docs branch from f6277df to 559a8a5 Compare August 14, 2021 11:33
@sethmlarson sethmlarson added the Team:Clients Meta label for clients team label Aug 16, 2021
@ywangd ywangd force-pushed the api-key-search-api-docs branch from 559a8a5 to 576fcde Compare August 17, 2021 01:01
@ywangd ywangd marked this pull request as ready for review August 17, 2021 01:29
@elasticmachine elasticmachine added the Team:Docs Meta label for docs team label Aug 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/clients-team (Team:Clients)

@elasticmachine elasticmachine added the Team:Security Meta label for security team label Aug 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

"id": "api-key-id-2",
"id": "6wHJmcQpReKBa42EHV5SBw",
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is not really related to the purpose of this PR. It's more of a bug fix of existing doc because this ID format is misleading.

"id": "dGhpcyBpcyBub3QgYSByZWFsIHRva2VuIGJ1dCBpdCBpcyBvbmx5IHRlc3QgZGF0YS4gZG8gbm90IHRyeSB0byByZWFkIHRva2VuIQ==", <2>
"id": "0GF5GXsBCXxz2eDxWwFN", <2>
Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above.

@ywangd ywangd mentioned this pull request Aug 17, 2021
5 tasks
Note it only support a subset of the query types including
<<query-dsl-match-all-query>>, <<query-dsl-bool-query>>,
<<query-dsl-term-query>>, <<query-dsl-terms-query>>, <<query-dsl-ids-query>>,
<<query-dsl-prefix-query>>, <<query-dsl-wildcard-query>>, <<query-dsl-range-query>>.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have some comments about the fields that can be queried? Maybe a list, or at least an explanation of how people would work out what the fields are.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I added a list to explain the available fields.

x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
+
By default, you cannot page through more than 10,000 hits using the `from` and
`size` parameters. To page through more hits, use the
<<search-after,`search_after`>> parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is repeated from above. Is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it is indeed intentional. The same is repeated on the Search API doc page. The difference is that the two parameters, from and size, are further apart on the Search API page which makes the repitition more justifiable. I can consolidate them if you prefer.

(Optional, array) <<search-after,Search after>> definition.

NOTE: If the user only has `manage_own_api_key` privilege, this API returns
only those API keys that are owned by the user.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to state the reverse as well.

If the user has manage_api_key or higher (including manage_security),
this API returns API keys that are owned by any user

(any user? all users?)

Copy link
Member Author

@ywangd ywangd Aug 17, 2021

Choose a reason for hiding this comment

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

Good point. I added

On the other hand, if the user
has manage_api_key or greater privilege (including manage_security), this
API returns API keys regardless of their owners.

?

Copy link
Contributor

@lockewritesdocs lockewritesdocs left a comment

Choose a reason for hiding this comment

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

Suggested some changes -- will push some changes to this branch for a definition list under the query parameter.

x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
x-pack/docs/en/rest-api/security/query-api-key.asciidoc Outdated Show resolved Hide resolved
Comment on lines 76 to 79
NOTE: If the user only has `manage_own_api_key` privilege, this API returns
only those API keys that are owned by the user. On the other hand, if the user
has `manage_api_key` or greater privilege (including `manage_security`), this
API returns API keys regardless of their owners.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this note belongs in the Prerequisites section where we mention which privileges are required to use the API.

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved it under the prerequisites as a separate bullet point.

Comment on lines 142 to 151
<1> The list of API keys that were retrieved for this request.
<2> Id for the API key
<3> Name of the API key
<4> Creation time for the API key in milliseconds
<5> Optional expiration time for the API key in milliseconds
<6> Invalidation status for the API key. If the key has been invalidated, it has
a value of `true`. Otherwise, it is `false`.
<7> Principal for which this API key was created
<8> Realm name of the principal for which this API key was created
<9> Metadata of the API key
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that these callouts should be removed in favor of a proper definition list under the query parameter starting on line 44. I'll push changes to this branch with the formatted and updated definition list.

@ywangd
Copy link
Member Author

ywangd commented Aug 18, 2021

@elasticmachine update branch

@ywangd ywangd requested a review from tvernum August 18, 2021 05:08
@lockewritesdocs lockewritesdocs self-requested a review August 18, 2021 19:10
Copy link
Contributor

@lockewritesdocs lockewritesdocs left a comment

Choose a reason for hiding this comment

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

👍 with the latest changes included

@lockewritesdocs
Copy link
Contributor

@elasticmachine update branch

@ywangd
Copy link
Member Author

ywangd commented Aug 18, 2021

@tvernum Because I merged the rest spec PR (#76238) too soon, our docs build is currently broken because the rest spec file points to an URL yet to be added by this PR. To fix the issue, I am going to merge this PR once the CI passes. Both @lockewritesdocs and I are OK with where it is now. But I am happy to raise a follow-up PR if you spot any issues (commenting and review are still allowed by the UI after merging). Sorry for the inconvenience. I'll manage it better next time.

@ywangd ywangd added the auto-backport Automatically create backport pull requests when merged label Aug 18, 2021
@ywangd
Copy link
Member Author

ywangd commented Aug 18, 2021

@elasticmachine run elasticsearch-ci/part-2-fips

The CI failure is irrelevant but seems legit, I raised #76689

@ywangd ywangd merged commit ccc9c35 into elastic:master Aug 19, 2021
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
7.15 Commit could not be cherrypicked due to conflicts

To backport manually run backport --upstream elastic/elasticsearch --pr 76521

ywangd added a commit to ywangd/elasticsearch that referenced this pull request Aug 19, 2021
This PR adds documentation for the new QueryApiKey API added in elastic#75335 and elastic#76144

Relates: elastic#71023
ywangd added a commit to ywangd/elasticsearch that referenced this pull request Aug 19, 2021
This PR adds documentation for the new QueryApiKey API added in elastic#75335 and elastic#76144

Relates: elastic#71023
elasticsearchmachine pushed a commit that referenced this pull request Aug 19, 2021
This PR adds documentation for the new QueryApiKey API added in #75335 and #76144

Relates: #71023
elasticsearchmachine pushed a commit that referenced this pull request Aug 19, 2021
This PR adds documentation for the new QueryApiKey API added in #75335 and #76144

Relates: #71023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >docs General docs changes :Security/Security Security issues without another label Team:Clients Meta label for clients team Team:Docs Meta label for docs team Team:Security Meta label for security team v7.15.0 v8.0.0-alpha2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants