From 93a14aa3ea89dd21e74eb0b6c159adce1bf94269 Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 31 Dec 2024 13:39:58 -0800 Subject: [PATCH 1/7] Add specification for security.update_settings --- specification/_doc_ids/table.csv | 1 + .../SecurityGetSettingsRequest.ts | 39 +++++++++++++++++++ .../SecurityGetSettingsResponse.ts | 26 +++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 specification/security/get_settings/SecurityGetSettingsRequest.ts create mode 100644 specification/security/get_settings/SecurityGetSettingsResponse.ts diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 3e61792f6b..5269e7845f 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -658,6 +658,7 @@ security-api-saml-prepare-authentication,https://www.elastic.co/guide/en/elastic security-api-saml-sp-metadata,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-saml-sp-metadata.html security-api-ssl,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-ssl.html security-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-privileges.html +security-api-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-settings.html service-accounts,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/service-accounts.html set-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-processor.html shape,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/shape.html diff --git a/specification/security/get_settings/SecurityGetSettingsRequest.ts b/specification/security/get_settings/SecurityGetSettingsRequest.ts new file mode 100644 index 0000000000..5259df096d --- /dev/null +++ b/specification/security/get_settings/SecurityGetSettingsRequest.ts @@ -0,0 +1,39 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { RequestBase } from '@_types/Base' +import { Duration } from '@_types/Time' + +/** + * Get security index settings. + * Get the user-configurable settings for the security internal index (`.security` and associated indices). + * @rest_spec_name security.get_settings + * @availability stack stability=stable visibility=public + * @doc_id security-api-get-settings + * @cluster_privileges read_security + */ +export interface Request extends RequestBase { + query_parameters: { + /** + * Period to wait for a connection to the master node. + * If no response is received before the timeout expires, the request fails and returns an error. + */ + master_timeout?: Duration + } +} diff --git a/specification/security/get_settings/SecurityGetSettingsResponse.ts b/specification/security/get_settings/SecurityGetSettingsResponse.ts new file mode 100644 index 0000000000..eb1370188b --- /dev/null +++ b/specification/security/get_settings/SecurityGetSettingsResponse.ts @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Actions } from '@security/put_privileges/types' +import { Dictionary } from '@spec_utils/Dictionary' + +export class Response { + /** @codegen_name privileges */ + body: Dictionary> +} From 12bba039d0c8cc02808cd3c3784725d382ad1d3b Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 31 Dec 2024 15:00:17 -0800 Subject: [PATCH 2/7] Add setting types --- output/openapi/elasticsearch-openapi.json | 145 +++++++++ output/schema/schema.json | 300 +++++++++++++++++- output/schema/validation-errors.json | 12 - output/typescript/types.ts | 28 ++ specification/_doc_ids/table.csv | 3 +- .../SecurityGetSettingsResponse.ts | 23 +- .../SecurityUpdateSettingsRequest.ts | 61 ++++ .../SecurityUpdateSettingsResponse.ts | 24 ++ 8 files changed, 571 insertions(+), 25 deletions(-) create mode 100644 specification/security/update_settings/SecurityUpdateSettingsRequest.ts create mode 100644 specification/security/update_settings/SecurityUpdateSettingsResponse.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index e4531811ba..d0e73e3046 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -30962,6 +30962,143 @@ "x-state": "Added in 7.13.0" } }, + "/_security/settings": { + "get": { + "tags": [ + "security" + ], + "summary": "Get security index settings", + "description": "Get the user-configurable settings for the security internal index (`.security` and associated indices).", + "operationId": "security-get-settings", + "parameters": [ + { + "in": "query", + "name": "master_timeout", + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "security": { + "$ref": "#/components/schemas/security.get_settings:SecuritySettings" + }, + "security-profile": { + "description": "Settings for the index used to store profile information.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "security-tokens": { + "$ref": "#/components/schemas/security.get_settings:SecuritySettings" + } + }, + "required": [ + "security", + "security-profile", + "security-tokens" + ] + } + } + } + } + } + }, + "put": { + "tags": [ + "security" + ], + "summary": "Update security index settings", + "description": "Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.\n\nIf a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use.", + "operationId": "security-update-settings", + "parameters": [ + { + "in": "query", + "name": "master_timeout", + "description": "The period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + }, + { + "in": "query", + "name": "timeout", + "description": "The period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "security": { + "description": "Settings for the index used for most security configuration, including native realm users and roles configured with the API.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "security-profile": { + "description": "Settings for the index used to store profile information.", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "security-tokens": { + "description": "Settings for the index used to store tokens.", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + } + }, + "required": [ + "acknowledged" + ] + } + } + } + } + } + } + }, "/_security/oauth2/token": { "post": { "tags": [ @@ -86184,6 +86321,14 @@ "nodes" ] }, + "security.get_settings:SecuritySettings": { + "type": "object", + "properties": { + "index": { + "$ref": "#/components/schemas/indices._types:IndexSettings" + } + } + }, "security.get_token:AccessTokenGrantType": { "type": "string", "enum": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 45495c7112..df47a973e2 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -17066,15 +17066,27 @@ "visibility": "public" } }, - "description": "Retrieve settings for the security system indices", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-settings.html", + "description": "Get security index settings.\nGet the user-configurable settings for the security internal index (`.security` and associated indices).", + "docId": "security-api-get-settings", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-settings.html", "name": "security.get_settings", - "request": null, + "privileges": { + "cluster": [ + "read_security" + ] + }, + "request": { + "name": "Request", + "namespace": "security.get_settings" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "security.get_settings" + }, "responseMediaType": [ "application/json" ], @@ -18206,15 +18218,27 @@ "visibility": "public" } }, - "description": "Update settings for the security system index", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-update-settings.html", + "description": "Update security index settings.\nUpdate the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.\n\nIf a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use.", + "docId": "security-api-update-settings", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-update-settings.html", "name": "security.update_settings", - "request": null, + "privileges": { + "cluster": [ + "manage_security" + ] + }, + "request": { + "name": "Request", + "namespace": "security.update_settings" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "security.update_settings" + }, "responseMediaType": [ "application/json" ], @@ -198012,6 +198036,123 @@ }, "specLocation": "security/get_service_credentials/GetServiceCredentialsResponse.ts#L25-L33" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get security index settings.\nGet the user-configurable settings for the security internal index (`.security` and associated indices).", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "security.get_settings" + }, + "path": [], + "query": [ + { + "description": "Period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "master_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "security/get_settings/SecurityGetSettingsRequest.ts#L23-L39" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "description": "Settings for the index used for most security configuration, including native realm users and roles configured with the API.", + "name": "security", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security.get_settings" + } + } + }, + { + "description": "Settings for the index used to store profile information.", + "name": "security-profile", + "required": true, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "description": "Settings for the index used to store tokens.", + "name": "security-tokens", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security.get_settings" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "security.get_settings" + }, + "specLocation": "security/get_settings/SecurityGetSettingsResponse.ts#L22-L37" + }, + { + "kind": "interface", + "name": { + "name": "SecuritySettings", + "namespace": "security.get_settings" + }, + "properties": [ + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexSettings", + "namespace": "indices._types" + } + } + } + ], + "specLocation": "security/get_settings/SecurityGetSettingsResponse.ts#L39-L41" + }, { "kind": "enum", "members": [ @@ -203642,6 +203783,149 @@ }, "specLocation": "security/update_cross_cluster_api_key/UpdateCrossClusterApiKeyResponse.ts#L20-L28" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "description": "Settings for the index used for most security configuration, including native realm users and roles configured with the API.", + "name": "security", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "description": "Settings for the index used to store profile information.", + "name": "security-profile", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + }, + { + "description": "Settings for the index used to store tokens.", + "name": "security-tokens", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + } + ] + }, + "description": "Update security index settings.\nUpdate the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.\n\nIf a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "security.update_settings" + }, + "path": [], + "query": [ + { + "description": "The period to wait for a connection to the master node.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "master_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The period to wait for a response.\nIf no response is received before the timeout expires, the request fails and returns an error.", + "name": "timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "security/update_settings/SecurityUpdateSettingsRequest.ts#L24-L61" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "acknowledged", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "security.update_settings" + }, + "specLocation": "security/update_settings/SecurityUpdateSettingsResponse.ts#L20-L24" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 94ec3dafb2..57542f9d1b 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -352,12 +352,6 @@ ], "response": [] }, - "security.get_settings": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "security.get_user_privileges": { "request": [ "Request: query parameter 'application' does not exist in the json spec", @@ -372,12 +366,6 @@ ], "response": [] }, - "security.update_settings": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "shutdown.delete_node": { "request": [ "Request: query parameter 'master_timeout' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4b2af8b930..57866b0f5e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -18572,6 +18572,20 @@ export interface SecurityGetServiceCredentialsResponse { nodes_credentials: SecurityGetServiceCredentialsNodesCredentials } +export interface SecurityGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface SecurityGetSettingsResponse { + security: SecurityGetSettingsSecuritySettings + 'security-profile': Record + 'security-tokens': SecurityGetSettingsSecuritySettings +} + +export interface SecurityGetSettingsSecuritySettings { + index?: IndicesIndexSettings +} + export type SecurityGetTokenAccessTokenGrantType = 'password' | 'client_credentials' | '_kerberos' | 'refresh_token' export interface SecurityGetTokenAuthenticatedUser extends SecurityUser { @@ -19140,6 +19154,20 @@ export interface SecurityUpdateCrossClusterApiKeyResponse { updated: boolean } +export interface SecurityUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + body?: { + security?: Record + 'security-profile'?: Record + 'security-tokens'?: Record + } +} + +export interface SecurityUpdateSettingsResponse { + acknowledged: boolean +} + export interface SecurityUpdateUserProfileDataRequest extends RequestBase { uid: SecurityUserProfileId if_seq_no?: SequenceNumber diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 5269e7845f..7b06d87c01 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -633,6 +633,7 @@ security-api-get-role-mapping,https://www.elastic.co/guide/en/elasticsearch/refe security-api-get-role,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-role.html security-api-get-service-accounts,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-service-accounts.html security-api-get-service-credentials,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-service-credentials.html +security-api-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-settings.html security-api-get-token,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-token.html security-api-get-user-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-user-privileges.html security-api-get-user,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-user.html @@ -658,7 +659,7 @@ security-api-saml-prepare-authentication,https://www.elastic.co/guide/en/elastic security-api-saml-sp-metadata,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-saml-sp-metadata.html security-api-ssl,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-ssl.html security-privileges,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-privileges.html -security-api-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-get-settings.html +security-api-update-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/security-api-update-settings.html service-accounts,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/service-accounts.html set-processor,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/set-processor.html shape,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/shape.html diff --git a/specification/security/get_settings/SecurityGetSettingsResponse.ts b/specification/security/get_settings/SecurityGetSettingsResponse.ts index eb1370188b..26a2edc4e6 100644 --- a/specification/security/get_settings/SecurityGetSettingsResponse.ts +++ b/specification/security/get_settings/SecurityGetSettingsResponse.ts @@ -16,11 +16,26 @@ * specific language governing permissions and limitations * under the License. */ - -import { Actions } from '@security/put_privileges/types' +import { IndexSettings } from '@indices/_types/IndexSettings' import { Dictionary } from '@spec_utils/Dictionary' export class Response { - /** @codegen_name privileges */ - body: Dictionary> + body: { + /** + * Settings for the index used for most security configuration, including native realm users and roles configured with the API. + */ + security: SecuritySettings + /** + * Settings for the index used to store profile information. + */ + 'security-profile': Dictionary + /** + * Settings for the index used to store tokens. + */ + 'security-tokens': SecuritySettings + } +} + +export class SecuritySettings { + index?: IndexSettings } diff --git a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts new file mode 100644 index 0000000000..2b72e72832 --- /dev/null +++ b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts @@ -0,0 +1,61 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { Dictionary } from '@spec_utils/Dictionary' +import { RequestBase } from '@_types/Base' +import { Duration } from '@_types/Time' + +/** + * Update security index settings. + * Update the user-configurable settings for the security internal index (`.security` and associated indices). Only a subset of settings are allowed to be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`. + * + * If a specific index is not in use on the system and settings are provided for it, the request will be rejected. This API does not yet support configuring the settings for indices before they are in use. + * @rest_spec_name security.update_settings + * @availability stack stability=stable visibility=public + * @cluster_privileges manage_security + * @doc_id security-api-update-settings + */ +export interface Request extends RequestBase { + query_parameters: { + /** + * The period to wait for a connection to the master node. + * If no response is received before the timeout expires, the request fails and returns an error. + */ + master_timeout?: Duration + /** + * The period to wait for a response. + * If no response is received before the timeout expires, the request fails and returns an error. + */ + timeout?: Duration + } + body: { + /** + * Settings for the index used for most security configuration, including native realm users and roles configured with the API. + */ + security?: Dictionary + /** + * Settings for the index used to store profile information. + */ + 'security-profile'?: Dictionary + /** + * Settings for the index used to store tokens. + */ + 'security-tokens'?: Dictionary + } +} diff --git a/specification/security/update_settings/SecurityUpdateSettingsResponse.ts b/specification/security/update_settings/SecurityUpdateSettingsResponse.ts new file mode 100644 index 0000000000..626e80c3d5 --- /dev/null +++ b/specification/security/update_settings/SecurityUpdateSettingsResponse.ts @@ -0,0 +1,24 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export class Response { + body: { + acknowledged: boolean + } +} From 8cef2d2b9c3cfdcadf06c442b8fb68269ff1a67b Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Wed, 8 Jan 2025 13:44:20 -0800 Subject: [PATCH 3/7] Update specification/security/get_settings/SecurityGetSettingsResponse.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../security/get_settings/SecurityGetSettingsResponse.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/security/get_settings/SecurityGetSettingsResponse.ts b/specification/security/get_settings/SecurityGetSettingsResponse.ts index 26a2edc4e6..3e52db1f72 100644 --- a/specification/security/get_settings/SecurityGetSettingsResponse.ts +++ b/specification/security/get_settings/SecurityGetSettingsResponse.ts @@ -28,7 +28,7 @@ export class Response { /** * Settings for the index used to store profile information. */ - 'security-profile': Dictionary + 'security-profile': SecuritySettings /** * Settings for the index used to store tokens. */ From 76140b8d8ff177a5234d0a675b47077a2c8b2d0e Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Wed, 8 Jan 2025 13:44:28 -0800 Subject: [PATCH 4/7] Update specification/security/update_settings/SecurityUpdateSettingsRequest.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../security/update_settings/SecurityUpdateSettingsRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts index 2b72e72832..46a7dd3959 100644 --- a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts +++ b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts @@ -48,7 +48,7 @@ export interface Request extends RequestBase { /** * Settings for the index used for most security configuration, including native realm users and roles configured with the API. */ - security?: Dictionary + security?: SecuritySettings /** * Settings for the index used to store profile information. */ From 127fb2ea6b9499c304571325b95256799c49a1c8 Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Wed, 8 Jan 2025 13:44:35 -0800 Subject: [PATCH 5/7] Update specification/security/update_settings/SecurityUpdateSettingsRequest.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../security/update_settings/SecurityUpdateSettingsRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts index 46a7dd3959..b29e281694 100644 --- a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts +++ b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts @@ -52,7 +52,7 @@ export interface Request extends RequestBase { /** * Settings for the index used to store profile information. */ - 'security-profile'?: Dictionary + 'security-profile'?: SecuritySettings /** * Settings for the index used to store tokens. */ From 184f17241e7cd8b16a7dccaf6ab5e2787b0203fa Mon Sep 17 00:00:00 2001 From: Lisa Cawley Date: Wed, 8 Jan 2025 13:44:43 -0800 Subject: [PATCH 6/7] Update specification/security/update_settings/SecurityUpdateSettingsRequest.ts Co-authored-by: Laura Trotta <153528055+l-trotta@users.noreply.github.com> --- .../security/update_settings/SecurityUpdateSettingsRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts index b29e281694..50a5d5e628 100644 --- a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts +++ b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts @@ -56,6 +56,6 @@ export interface Request extends RequestBase { /** * Settings for the index used to store tokens. */ - 'security-tokens'?: Dictionary + 'security-tokens'?: SecuritySettings } } From b8e53704051a8bc6132c97b03eaf871d81759b3f Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 8 Jan 2025 13:50:10 -0800 Subject: [PATCH 7/7] Import shared SecuritySettings --- output/openapi/elasticsearch-openapi.json | 30 +---- output/schema/schema.json | 124 ++++++------------ output/typescript/types.ts | 20 +-- .../security/_types/SecuritySettings.ts | 24 ++++ .../SecurityGetSettingsResponse.ts | 7 +- .../SecurityUpdateSettingsRequest.ts | 2 +- 6 files changed, 83 insertions(+), 124 deletions(-) create mode 100644 specification/security/_types/SecuritySettings.ts diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index d0e73e3046..019ad1386d 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -30991,17 +30991,13 @@ "type": "object", "properties": { "security": { - "$ref": "#/components/schemas/security.get_settings:SecuritySettings" + "$ref": "#/components/schemas/security._types:SecuritySettings" }, "security-profile": { - "description": "Settings for the index used to store profile information.", - "type": "object", - "additionalProperties": { - "type": "string" - } + "$ref": "#/components/schemas/security._types:SecuritySettings" }, "security-tokens": { - "$ref": "#/components/schemas/security.get_settings:SecuritySettings" + "$ref": "#/components/schemas/security._types:SecuritySettings" } }, "required": [ @@ -31051,25 +31047,13 @@ "type": "object", "properties": { "security": { - "description": "Settings for the index used for most security configuration, including native realm users and roles configured with the API.", - "type": "object", - "additionalProperties": { - "type": "string" - } + "$ref": "#/components/schemas/security._types:SecuritySettings" }, "security-profile": { - "description": "Settings for the index used to store profile information.", - "type": "object", - "additionalProperties": { - "type": "string" - } + "$ref": "#/components/schemas/security._types:SecuritySettings" }, "security-tokens": { - "description": "Settings for the index used to store tokens.", - "type": "object", - "additionalProperties": { - "type": "string" - } + "$ref": "#/components/schemas/security._types:SecuritySettings" } } } @@ -86321,7 +86305,7 @@ "nodes" ] }, - "security.get_settings:SecuritySettings": { + "security._types:SecuritySettings": { "type": "object", "properties": { "index": { diff --git a/output/schema/schema.json b/output/schema/schema.json index df47a973e2..52ebbe31f4 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -193562,6 +193562,27 @@ ], "specLocation": "security/_types/Privileges.ts#L429-L449" }, + { + "kind": "interface", + "name": { + "name": "SecuritySettings", + "namespace": "security._types" + }, + "properties": [ + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexSettings", + "namespace": "indices._types" + } + } + } + ], + "specLocation": "security/_types/SecuritySettings.ts#L22-L24" + }, { "kind": "enum", "members": [ @@ -198085,7 +198106,7 @@ "kind": "instance_of", "type": { "name": "SecuritySettings", - "namespace": "security.get_settings" + "namespace": "security._types" } } }, @@ -198094,21 +198115,10 @@ "name": "security-profile", "required": true, "type": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - "singleKey": false, - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security._types" } } }, @@ -198120,7 +198130,7 @@ "kind": "instance_of", "type": { "name": "SecuritySettings", - "namespace": "security.get_settings" + "namespace": "security._types" } } } @@ -198130,28 +198140,7 @@ "name": "Response", "namespace": "security.get_settings" }, - "specLocation": "security/get_settings/SecurityGetSettingsResponse.ts#L22-L37" - }, - { - "kind": "interface", - "name": { - "name": "SecuritySettings", - "namespace": "security.get_settings" - }, - "properties": [ - { - "name": "index", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "IndexSettings", - "namespace": "indices._types" - } - } - } - ], - "specLocation": "security/get_settings/SecurityGetSettingsResponse.ts#L39-L41" + "specLocation": "security/get_settings/SecurityGetSettingsResponse.ts#L21-L36" }, { "kind": "enum", @@ -203796,21 +203785,10 @@ "name": "security", "required": false, "type": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - "singleKey": false, - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security._types" } } }, @@ -203819,21 +203797,10 @@ "name": "security-profile", "required": false, "type": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - "singleKey": false, - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security._types" } } }, @@ -203842,21 +203809,10 @@ "name": "security-tokens", "required": false, "type": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - }, - "singleKey": false, - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } + "kind": "instance_of", + "type": { + "name": "SecuritySettings", + "namespace": "security._types" } } } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 57866b0f5e..c857087bb9 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -18100,6 +18100,10 @@ export interface SecuritySearchAccess { allow_restricted_indices?: boolean } +export interface SecuritySecuritySettings { + index?: IndicesIndexSettings +} + export type SecurityTemplateFormat = 'string' | 'json' export interface SecurityUser { @@ -18577,13 +18581,9 @@ export interface SecurityGetSettingsRequest extends RequestBase { } export interface SecurityGetSettingsResponse { - security: SecurityGetSettingsSecuritySettings - 'security-profile': Record - 'security-tokens': SecurityGetSettingsSecuritySettings -} - -export interface SecurityGetSettingsSecuritySettings { - index?: IndicesIndexSettings + security: SecuritySecuritySettings + 'security-profile': SecuritySecuritySettings + 'security-tokens': SecuritySecuritySettings } export type SecurityGetTokenAccessTokenGrantType = 'password' | 'client_credentials' | '_kerberos' | 'refresh_token' @@ -19158,9 +19158,9 @@ export interface SecurityUpdateSettingsRequest extends RequestBase { master_timeout?: Duration timeout?: Duration body?: { - security?: Record - 'security-profile'?: Record - 'security-tokens'?: Record + security?: SecuritySecuritySettings + 'security-profile'?: SecuritySecuritySettings + 'security-tokens'?: SecuritySecuritySettings } } diff --git a/specification/security/_types/SecuritySettings.ts b/specification/security/_types/SecuritySettings.ts new file mode 100644 index 0000000000..0a1f4f28d9 --- /dev/null +++ b/specification/security/_types/SecuritySettings.ts @@ -0,0 +1,24 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { IndexSettings } from '@indices/_types/IndexSettings' + +export class SecuritySettings { + index?: IndexSettings +} diff --git a/specification/security/get_settings/SecurityGetSettingsResponse.ts b/specification/security/get_settings/SecurityGetSettingsResponse.ts index 3e52db1f72..dfbed2ed54 100644 --- a/specification/security/get_settings/SecurityGetSettingsResponse.ts +++ b/specification/security/get_settings/SecurityGetSettingsResponse.ts @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { IndexSettings } from '@indices/_types/IndexSettings' -import { Dictionary } from '@spec_utils/Dictionary' +import { SecuritySettings } from '@security/_types/SecuritySettings' export class Response { body: { @@ -35,7 +34,3 @@ export class Response { 'security-tokens': SecuritySettings } } - -export class SecuritySettings { - index?: IndexSettings -} diff --git a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts index 50a5d5e628..828d49e065 100644 --- a/specification/security/update_settings/SecurityUpdateSettingsRequest.ts +++ b/specification/security/update_settings/SecurityUpdateSettingsRequest.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Dictionary } from '@spec_utils/Dictionary' +import { SecuritySettings } from '@security/_types/SecuritySettings' import { RequestBase } from '@_types/Base' import { Duration } from '@_types/Time'