HLRC support for query API key API (#76520)

This PR adds HLRC for the new Query API key API added with #75335 and #76144

Relates: #71023
This commit is contained in:
Yang Wang 2021-08-17 16:00:55 +10:00 committed by GitHub
parent c1a32447a7
commit 7bb1185806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 774 additions and 5 deletions

View file

@ -0,0 +1,86 @@
--
:api: query-api-key
:request: QueryApiKeyRequest
:response: QueryApiKeyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Query API Key information API
API Key(s) information can be queried and retrieved in a paginated
fashion using this API.
[id="{upid}-{api}-request"]
==== Query API Key Request
The +{request}+ supports query and retrieving API key information using
Elasticsearch's {ref}/query-dsl.html[Query DSL] with
{ref}/paginate-search-results.html[pagination].
It supports only a subset of available query types, including:
. {ref}/query-dsl-bool-query.html[Boolean query]
. {ref}/query-dsl-match-all-query.html[Match all query]
. {ref}/query-dsl-term-query.html[Term query]
. {ref}/query-dsl-terms-query.html[Terms query]
. {ref}/query-dsl-ids-query.html[IDs Query]
. {ref}/query-dsl-prefix-query.html[Prefix query]
. {ref}/query-dsl-wildcard-query.html[Wildcard query]
. {ref}/query-dsl-range-query.html[Range query]
===== Query for all API keys
In its most basic form, the request selects all API keys that the user
has access to.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[query-api-key-default-request]
--------------------------------------------------
===== Query API keys with Query DSL
The following query selects API keys owned by the user and also satisfy following criteria:
* The API key name must begin with the word `key`
* The API key name must *not* be `key-20000`
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[query-api-key-query-request]
--------------------------------------------------
===== Retrieve API keys with explicitly configured sort and paging
The following request sort the API keys by their names in descending order.
It also retrieves the API keys from index 1 (zero-based) and in a page size of 100.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[query-api-key-from-size-sort-request]
--------------------------------------------------
===== Deep pagination can be achieved with search after
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[query-api-key-search-after-request]
--------------------------------------------------
include::../execution.asciidoc[]
[id="{upid}-{api}-response"]
==== Query API Key information API Response
The returned +{response}+ contains the information regarding the API keys that were
requested.
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[query-api-key-from-size-sort-response]
--------------------------------------------------
<1> Total number of API keys matched by the query
<2> Number of API keys returned in this response
<3> The list of API keys
<4> If sorting is requested, each API key in the response contains its sort values.

View file

@ -540,6 +540,7 @@ include::security/create-api-key.asciidoc[]
include::security/grant-api-key.asciidoc[]
include::security/get-api-key.asciidoc[]
include::security/invalidate-api-key.asciidoc[]
include::security/query-api-key.asciidoc[]
include::security/get-service-accounts.asciidoc[]
include::security/create-service-account-token.asciidoc[]
include::security/delete-service-account-token.asciidoc[]