From 562f25b68abd19902ad2c256d180c9a90cb55ec7 Mon Sep 17 00:00:00 2001 From: lcawl Date: Thu, 15 Oct 2020 16:59:34 -0700 Subject: [PATCH 1/3] [DOCS] Add grant API key to Java HLRC --- .../security/grant-api-key.asciidoc | 47 +++++++++++++++++++ .../high-level/supported-apis.asciidoc | 1 + 2 files changed, 48 insertions(+) create mode 100644 docs/java-rest/high-level/security/grant-api-key.asciidoc diff --git a/docs/java-rest/high-level/security/grant-api-key.asciidoc b/docs/java-rest/high-level/security/grant-api-key.asciidoc new file mode 100644 index 0000000000000..ae3e79b6f7ede --- /dev/null +++ b/docs/java-rest/high-level/security/grant-api-key.asciidoc @@ -0,0 +1,47 @@ +-- +:api: grant-api-key +:request: GrantApiKeyRequest +:response: GrantApiKeyResponse +-- +[role="xpack"] +[id="{upid}-{api}"] +=== Grant API key API + +Creates an API key on behalf of another user. + +[id="{upid}-{api}-request"] +==== Grant API key request + +This API is similar to <>, however it +creates the API key for a user that is different than the user that runs the API. + +A +{request}+ contains authentication credentials for the user on whose behalf +the API key will be created, a grant type (which indicates whether the +credentials are an access token or a user ID and password), and API key details. +The API key details include a name for the API key, an optional list of role +descriptors to define permissions, and an optional expiration for the +generated API key. If expiration is not provided, by default the API keys do not +expire. + +//// +["source","java",subs="attributes,callouts,macros"] +-------------------------------------------------- +include-tagged::{doc-tests-file}[{api}-request] +-------------------------------------------------- + +include::../execution.asciidoc[] +//// + +[id="{upid}-{api}-response"] +==== Grant API key response + +The returned +{response}+ contains an ID, API key, name for the API key, and +optional expiration. +//// +["source","java",subs="attributes,callouts,macros"] +-------------------------------------------------- +include-tagged::{doc-tests-file}[{api}-response] +-------------------------------------------------- +<1> The API key that can be used to authenticate to Elasticsearch. +<2> Expiration details, if the API keys expire. +//// diff --git a/docs/java-rest/high-level/supported-apis.asciidoc b/docs/java-rest/high-level/supported-apis.asciidoc index acdb3fe9a3eec..9f98b31d270fd 100644 --- a/docs/java-rest/high-level/supported-apis.asciidoc +++ b/docs/java-rest/high-level/supported-apis.asciidoc @@ -523,6 +523,7 @@ include::security/create-token.asciidoc[] include::security/invalidate-token.asciidoc[] include::security/put-privileges.asciidoc[] include::security/create-api-key.asciidoc[] +include::security/grant-api-key.asciidoc[] include::security/get-api-key.asciidoc[] include::security/invalidate-api-key.asciidoc[] From 9bc8ffb7dcce26036c08c59f3cd5d5f4af82e3a5 Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 9 Feb 2021 09:20:26 -0800 Subject: [PATCH 2/3] Uncomment examples --- docs/java-rest/high-level/security/grant-api-key.asciidoc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/java-rest/high-level/security/grant-api-key.asciidoc b/docs/java-rest/high-level/security/grant-api-key.asciidoc index ae3e79b6f7ede..30cf1cfb4f010 100644 --- a/docs/java-rest/high-level/security/grant-api-key.asciidoc +++ b/docs/java-rest/high-level/security/grant-api-key.asciidoc @@ -23,25 +23,22 @@ descriptors to define permissions, and an optional expiration for the generated API key. If expiration is not provided, by default the API keys do not expire. -//// ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-request] -------------------------------------------------- include::../execution.asciidoc[] -//// [id="{upid}-{api}-response"] ==== Grant API key response The returned +{response}+ contains an ID, API key, name for the API key, and optional expiration. -//// + ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-response] -------------------------------------------------- <1> The API key that can be used to authenticate to Elasticsearch. <2> Expiration details, if the API keys expire. -//// From cf81619a9260a3e2e3d37074a6bf88313cb25220 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Mon, 22 Feb 2021 09:56:39 -0800 Subject: [PATCH 3/3] Update docs/java-rest/high-level/security/grant-api-key.asciidoc Co-authored-by: Tim Vernum --- docs/java-rest/high-level/security/grant-api-key.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/java-rest/high-level/security/grant-api-key.asciidoc b/docs/java-rest/high-level/security/grant-api-key.asciidoc index 30cf1cfb4f010..bb65b27d4297c 100644 --- a/docs/java-rest/high-level/security/grant-api-key.asciidoc +++ b/docs/java-rest/high-level/security/grant-api-key.asciidoc @@ -1,7 +1,7 @@ -- :api: grant-api-key :request: GrantApiKeyRequest -:response: GrantApiKeyResponse +:response: CreateApiKeyResponse -- [role="xpack"] [id="{upid}-{api}"]