From 3dfa8d9cabbbbd17897403c733c4724ad0c90ea3 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 11 Jul 2025 17:29:40 +0400 Subject: [PATCH] Add refresh to security.grant_api_key (#4872) (cherry picked from commit e847a834f2dd019e9d2281a401e8861cc78a153b) --- output/openapi/elasticsearch-openapi.json | 12 ++++++++++++ output/schema/schema.json | 18 ++++++++++++++++-- output/schema/validation-errors.json | 6 ------ output/typescript/types.ts | 1 + .../SecurityGrantApiKeyRequest.ts | 12 +++++++++++- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 0da3db9a55..eb721590af 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -40150,6 +40150,18 @@ "summary": "Grant an API key", "description": "Create an API key on behalf of another user.\nThis 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.\nThe caller must have authentication credentials for the user on whose behalf the API key will be created.\nIt is not possible to use this API to create an API key without that user's credentials.\nThe supported user authentication credential types are:\n\n* username and password\n* Elasticsearch access tokens\n* JWTs\n\nThe user, for whom the authentication credentials is provided, can optionally \"run as\" (impersonate) another user.\nIn this case, the API key will be created on behalf of the impersonated user.\n\nThis 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.\nThe API keys are created by the Elasticsearch API key service, which is automatically enabled.\n\nA successful grant API key API call returns a JSON structure that contains the API key, its unique id, and its name.\nIf applicable, it also returns expiration information for the API key in milliseconds.\n\nBy default, API keys never expire. You can specify expiration information when you create the API keys.\n\n## Required authorization\n\n* Cluster privileges: `grant_api_key`\n", "operationId": "security-grant-api-key", + "parameters": [ + { + "in": "query", + "name": "refresh", + "description": "If 'true', Elasticsearch refreshes the affected shards to make this operation\nvisible to search.\nIf 'wait_for', it waits for a refresh to make this operation visible to search.\nIf 'false', nothing is done with refreshes.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types.Refresh" + }, + "style": "form" + } + ], "requestBody": { "content": { "application/json": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 2156f5e580..b76cfb3529 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -233919,8 +233919,22 @@ "namespace": "security.grant_api_key" }, "path": [], - "query": [], - "specLocation": "security/grant_api_key/SecurityGrantApiKeyRequest.ts#L24-L92" + "query": [ + { + "description": "If 'true', Elasticsearch refreshes the affected shards to make this operation\nvisible to search.\nIf 'wait_for', it waits for a refresh to make this operation visible to search.\nIf 'false', nothing is done with refreshes.", + "name": "refresh", + "required": false, + "serverDefault": "false", + "type": { + "kind": "instance_of", + "type": { + "name": "Refresh", + "namespace": "_types" + } + } + } + ], + "specLocation": "security/grant_api_key/SecurityGrantApiKeyRequest.ts#L24-L102" }, { "kind": "response", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index f3e6a46144..3157d034e0 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -291,12 +291,6 @@ ], "response": [] }, - "security.grant_api_key": { - "request": [ - "Request: missing json spec query parameter 'refresh'" - ], - "response": [] - }, "snapshot.repository_analyze": { "request": [ "Request: query parameter 'register_operation_count' does not exist in the json spec" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index e68cb451e6..1c443d78d6 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -20068,6 +20068,7 @@ export interface SecurityGrantApiKeyGrantApiKey { } export interface SecurityGrantApiKeyRequest extends RequestBase { + refresh?: Refresh body?: { api_key: SecurityGrantApiKeyGrantApiKey grant_type: SecurityGrantApiKeyApiKeyGrantType diff --git a/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts b/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts index 5d1e227e80..259a522781 100644 --- a/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts +++ b/specification/security/grant_api_key/SecurityGrantApiKeyRequest.ts @@ -18,7 +18,7 @@ */ import { RequestBase } from '@_types/Base' -import { Password, Username } from '@_types/common' +import { Password, Refresh, Username } from '@_types/common' import { ApiKeyGrantType, GrantApiKey } from './types' /** @@ -57,6 +57,16 @@ export interface Request extends RequestBase { methods: ['POST'] } ] + query_parameters: { + /** + * 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. + * @server_default false + */ + refresh?: Refresh + } body: { /** * The API key.