Class GrantApiKeyRequest
- All Implemented Interfaces:
JsonpSerializable
Create an API key on behalf of another user. This API is similar to the create API keys API, however it creates the API key for a user that is different than the user that runs the API. The caller must have authentication credentials for the user on whose behalf the API key will be created. It is not possible to use this API to create an API key without that user's credentials. The supported user authentication credential types are:
- username and password
- Elasticsearch access tokens
- JWTs
The user, for whom the authentication credentials is provided, can optionally "run as" (impersonate) another user. In this case, the API key will be created on behalf of the impersonated user.
This API is intended be used by applications that need to create and manage API keys for end users, but cannot guarantee that those users have permission to create API keys on their own behalf. The API keys are created by the Elasticsearch API key service, which is automatically enabled.
A successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name. If applicable, it also returns expiration information for the API key in milliseconds.
By default, API keys never expire. You can specify expiration information when you create the API keys.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<GrantApiKeyRequest>Json deserializer forGrantApiKeyRequeststatic final Endpoint<GrantApiKeyRequest,GrantApiKeyResponse, ErrorResponse> Endpoint "security.grant_api_key". -
Method Summary
Modifier and TypeMethodDescriptionfinal StringThe user's access token.final GrantApiKeyapiKey()Required - The API key.final ApiKeyGrantTypeRequired - The type of grant.static GrantApiKeyRequestfinal Stringpassword()The user's password.final Refreshrefresh()If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search.final StringrunAs()The name of the user to be impersonated.voidserialize(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected voidserializeInternal(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static voidfinal Stringusername()The user name that identifies the user.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forGrantApiKeyRequest -
_ENDPOINT
Endpoint "security.grant_api_key".
-
-
Method Details
-
of
public static GrantApiKeyRequest of(Function<GrantApiKeyRequest.Builder, ObjectBuilder<GrantApiKeyRequest>> fn) -
accessToken
The user's access token. If you specify theaccess_tokengrant type, this parameter is required. It is not valid with other grant types.API name:
access_token -
apiKey
Required - The API key.API name:
api_key -
grantType
Required - The type of grant. Supported grant types are:access_token,password.API name:
grant_type -
password
The user's password. If you specify thepasswordgrant type, this parameter is required. It is not valid with other grant types.API name:
password -
refresh
If 'true', Elasticsearch refreshes the affected shards to make this operation visible to search. If 'wait_for', it waits for a refresh to make this operation visible to search. If 'false', nothing is done with refreshes.API name:
refresh -
runAs
The name of the user to be impersonated.API name:
run_as -
username
The user name that identifies the user. If you specify thepasswordgrant type, this parameter is required. It is not valid with other grant types.API name:
username -
serialize
Serialize this object to JSON.- Specified by:
serializein interfaceJsonpSerializable
-
serializeInternal
-
setupGrantApiKeyRequestDeserializer
protected static void setupGrantApiKeyRequestDeserializer(ObjectDeserializer<GrantApiKeyRequest.Builder> op)
-