From 191622245dc2ec660d8f03a7909889bdd9141ab5 Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 31 Dec 2024 15:39:48 -0800 Subject: [PATCH 1/3] Add watcher.update_settings --- .../elasticsearch-openapi-overlays.yaml | 10 ++ output/openapi/elasticsearch-openapi.json | 65 ++++++++++ output/schema/schema.json | 111 +++++++++++++++++- output/schema/validation-errors.json | 6 - output/typescript/types.ts | 10 ++ specification/_doc_ids/table.csv | 1 + .../WatcherUpdateSettingsRequest.ts | 48 ++++++++ .../WatcherUpdateSettingsResponse.ts | 24 ++++ .../WatcherUpdateSettingsRequestExample1.yaml | 6 + 9 files changed, 271 insertions(+), 10 deletions(-) create mode 100644 specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts create mode 100644 specification/watcher/update_settings/WatcherUpdateSettingsResponse.ts create mode 100644 specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml diff --git a/docs/overlays/elasticsearch-openapi-overlays.yaml b/docs/overlays/elasticsearch-openapi-overlays.yaml index 6aa33a1af3..2dfd1a8453 100644 --- a/docs/overlays/elasticsearch-openapi-overlays.yaml +++ b/docs/overlays/elasticsearch-openapi-overlays.yaml @@ -546,3 +546,13 @@ actions: examples: delegatePkiResponseExample1: $ref: "../../specification/security/delegate_pki/examples/200_response/SecurityDelegatePkiResponseExample1.yaml" +## Examples for watcher + - target: "$.paths['/_watcher/settings']['put']" + description: "Add request example for update watcher settings" + update: + requestBody: + content: + application/json: + examples: + updateWatcherSettingsRequestExample1: + $ref: "../../specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml" diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index cf7870f39b..78fe266479 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -38476,6 +38476,71 @@ } } }, + "/_watcher/settings": { + "put": { + "tags": [ + "watcher" + ], + "summary": "Update Watcher index settings", + "description": "Update settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "operationId": "watcher-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", + "additionalProperties": { + "type": "string" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + } + }, + "required": [ + "acknowledged" + ] + } + } + } + } + } + } + }, "/_xpack": { "get": { "tags": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index a353999155..cbff3bfa1d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -21342,15 +21342,27 @@ "visibility": "public" } }, - "description": "Update settings for the watcher system index", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-update-settings.html", + "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "docId": "watcher-api-update-settings", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-update-settings.html", "name": "watcher.update_settings", - "request": null, + "privileges": { + "cluster": [ + "manage_watcher" + ] + }, + "request": { + "name": "Request", + "namespace": "watcher.update_settings" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "watcher.update_settings" + }, "responseMediaType": [ "application/json" ], @@ -222809,6 +222821,97 @@ }, "specLocation": "watcher/stop/WatcherStopResponse.ts#L22-L24" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "value", + "codegenName": "watcher_index_settings", + "value": { + "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 Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "watcher.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": "watcher/update_settings/WatcherUpdateSettingsRequest.ts#L24-L48" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "acknowledged", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "watcher.update_settings" + }, + "specLocation": "watcher/update_settings/WatcherUpdateSettingsResponse.ts#L20-L24" + }, { "kind": "interface", "name": { diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 2aa021caef..bc206a1c63 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -437,12 +437,6 @@ ], "response": [] }, - "watcher.update_settings": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "xpack.info": { "request": [ "Request: query parameter 'human' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index aa2f6454bd..6f1f71db61 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -21187,6 +21187,16 @@ export interface WatcherStopRequest extends RequestBase { export type WatcherStopResponse = AcknowledgedResponseBase +export interface WatcherUpdateSettingsRequest extends RequestBase { + master_timeout?: Duration + timeout?: Duration + body?: Record +} + +export interface WatcherUpdateSettingsResponse { + acknowledged: boolean +} + export interface XpackInfoBuildInformation { date: DateTime hash: string diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index 67196e7686..fec457b505 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -735,4 +735,5 @@ watcher-api-query-watches,https://www.elastic.co/guide/en/elasticsearch/referenc watcher-api-start,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-start.html watcher-api-stats,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-stats.html watcher-api-stop,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-stop.html +watcher-api-update-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-update-settings.html xpack-rollup,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/xpack-rollup.html diff --git a/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts b/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts new file mode 100644 index 0000000000..7ba90f3336 --- /dev/null +++ b/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts @@ -0,0 +1,48 @@ +/* + * 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 Watcher index settings. + * Update settings for the Watcher internal index (`.watches`). + * Only a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`. + * @rest_spec_name watcher.update_settings + * @availability stack stability=stable visibility=public + * @cluster_privileges manage_watcher + * @doc_id watcher-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 + } + /** @codegen_name watcher_index_settings */ + body: Dictionary +} diff --git a/specification/watcher/update_settings/WatcherUpdateSettingsResponse.ts b/specification/watcher/update_settings/WatcherUpdateSettingsResponse.ts new file mode 100644 index 0000000000..626e80c3d5 --- /dev/null +++ b/specification/watcher/update_settings/WatcherUpdateSettingsResponse.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 + } +} diff --git a/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml new file mode 100644 index 0000000000..fe11d57280 --- /dev/null +++ b/specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml @@ -0,0 +1,6 @@ +# summary: +# description: +# type: request +# method_request: PUT /_watcher/settings +value: + index.auto_expand_replicas: 0-4 From 7570ddf26d9fc0149be2259d310e80067ce387cd Mon Sep 17 00:00:00 2001 From: lcawl Date: Tue, 31 Dec 2024 15:53:38 -0800 Subject: [PATCH 2/3] Add watcher.get_settings --- .../elasticsearch-openapi-overlays.yaml | 11 ++ output/openapi/elasticsearch-openapi.json | 170 +++++++++++------- output/schema/schema.json | 75 +++++++- output/schema/validation-errors.json | 6 - output/typescript/types.ts | 8 + specification/_doc_ids/table.csv | 1 + .../get_settings/WatcherGetSettingsRequest.ts | 39 ++++ .../WatcherGetSettingsResponse.ts | 26 +++ .../WatcherGetSettingsResponseExample1.yaml | 8 + 9 files changed, 269 insertions(+), 75 deletions(-) create mode 100644 specification/watcher/get_settings/WatcherGetSettingsRequest.ts create mode 100644 specification/watcher/get_settings/WatcherGetSettingsResponse.ts create mode 100644 specification/watcher/get_settings/examples/200_response/WatcherGetSettingsResponseExample1.yaml diff --git a/docs/overlays/elasticsearch-openapi-overlays.yaml b/docs/overlays/elasticsearch-openapi-overlays.yaml index 2dfd1a8453..4be0ef8ad7 100644 --- a/docs/overlays/elasticsearch-openapi-overlays.yaml +++ b/docs/overlays/elasticsearch-openapi-overlays.yaml @@ -556,3 +556,14 @@ actions: examples: updateWatcherSettingsRequestExample1: $ref: "../../specification/watcher/update_settings/examples/request/WatcherUpdateSettingsRequestExample1.yaml" + - target: "$.paths['/_watcher/settings']['get']" + description: "Add response example for get watcher settings" + update: + responses: + 200: + content: + application/json: + examples: + updateWatcherSettingsRequestExample1: + $ref: "../../specification/watcher/get_settings/examples/200_response/WatcherGetSettingsResponseExample1.yaml" + diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 78fe266479..af37802826 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -38323,6 +38323,111 @@ } } }, + "/_watcher/settings": { + "get": { + "tags": [ + "watcher" + ], + "summary": "Get Watcher index settings", + "description": "Get settings for the Watcher internal index (`.watches`).\nOnly a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "operationId": "watcher-get-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" + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "index": { + "$ref": "#/components/schemas/indices._types:IndexSettings" + } + }, + "required": [ + "index" + ] + } + } + } + } + } + }, + "put": { + "tags": [ + "watcher" + ], + "summary": "Update Watcher index settings", + "description": "Update settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "operationId": "watcher-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", + "additionalProperties": { + "type": "string" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "acknowledged": { + "type": "boolean" + } + }, + "required": [ + "acknowledged" + ] + } + } + } + } + } + } + }, "/_watcher/_query/watches": { "get": { "tags": [ @@ -38476,71 +38581,6 @@ } } }, - "/_watcher/settings": { - "put": { - "tags": [ - "watcher" - ], - "summary": "Update Watcher index settings", - "description": "Update settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", - "operationId": "watcher-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", - "additionalProperties": { - "type": "string" - } - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "acknowledged": { - "type": "boolean" - } - }, - "required": [ - "acknowledged" - ] - } - } - } - } - } - } - }, "/_xpack": { "get": { "tags": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index cbff3bfa1d..294bb1b26a 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -21087,15 +21087,22 @@ "visibility": "public" } }, - "description": "Retrieve settings for the watcher system index", - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-settings.html", + "description": "Get Watcher index settings.\nGet settings for the Watcher internal index (`.watches`).\nOnly a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "docId": "watcher-api-get-settings", + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-get-settings.html", "name": "watcher.get_settings", - "request": null, + "request": { + "name": "Request", + "namespace": "watcher.get_settings" + }, "requestBodyRequired": false, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "watcher.get_settings" + }, "responseMediaType": [ "application/json" ], @@ -221840,6 +221847,66 @@ ], "specLocation": "watcher/execute_watch/types.ts#L27-L39" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "no_body" + }, + "description": "Get Watcher index settings.\nGet settings for the Watcher internal index (`.watches`).\nOnly a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "watcher.get_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" + } + } + } + ], + "specLocation": "watcher/get_settings/WatcherGetSettingsRequest.ts#L23-L39" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "index", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "IndexSettings", + "namespace": "indices._types" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "watcher.get_settings" + }, + "specLocation": "watcher/get_settings/WatcherGetSettingsResponse.ts#L22-L26" + }, { "kind": "request", "attachedBehaviors": [ diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index bc206a1c63..94ec3dafb2 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -431,12 +431,6 @@ "interface definition watcher._types:TriggerEventContainer - Property schedule is a single-variant and must be required" ] }, - "watcher.get_settings": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "xpack.info": { "request": [ "Request: query parameter 'human' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 6f1f71db61..486be0b59c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -21084,6 +21084,14 @@ export interface WatcherExecuteWatchWatchRecord { status?: WatcherWatchStatus } +export interface WatcherGetSettingsRequest extends RequestBase { + master_timeout?: Duration +} + +export interface WatcherGetSettingsResponse { + index: IndicesIndexSettings +} + export interface WatcherGetWatchRequest extends RequestBase { id: Name } diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index fec457b505..c2f0798ed7 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -729,6 +729,7 @@ watcher-api-activate-watch,https://www.elastic.co/guide/en/elasticsearch/referen watcher-api-deactivate-watch,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-deactivate-watch.html watcher-api-delete-watch,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-delete-watch.html watcher-api-execute-watch,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-execute-watch.html +watcher-api-get-settings,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-get-settings.html watcher-api-get-watch,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-get-watch.html watcher-api-put-watch,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-put-watch.html watcher-api-query-watches,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-query-watches.html diff --git a/specification/watcher/get_settings/WatcherGetSettingsRequest.ts b/specification/watcher/get_settings/WatcherGetSettingsRequest.ts new file mode 100644 index 0000000000..c4903cdc47 --- /dev/null +++ b/specification/watcher/get_settings/WatcherGetSettingsRequest.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 Watcher index settings. + * Get settings for the Watcher internal index (`.watches`). + * Only a subset of settings are shown, for example `index.auto_expand_replicas` and `index.number_of_replicas`. + * @rest_spec_name watcher.get_settings + * @availability stack stability=stable visibility=public + * @doc_id watcher-api-get-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 + } +} diff --git a/specification/watcher/get_settings/WatcherGetSettingsResponse.ts b/specification/watcher/get_settings/WatcherGetSettingsResponse.ts new file mode 100644 index 0000000000..a0e7aa5e1d --- /dev/null +++ b/specification/watcher/get_settings/WatcherGetSettingsResponse.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 { IndexSettings } from '@indices/_types/IndexSettings' + +export class Response { + body: { + index: IndexSettings + } +} diff --git a/specification/watcher/get_settings/examples/200_response/WatcherGetSettingsResponseExample1.yaml b/specification/watcher/get_settings/examples/200_response/WatcherGetSettingsResponseExample1.yaml new file mode 100644 index 0000000000..e913927cee --- /dev/null +++ b/specification/watcher/get_settings/examples/200_response/WatcherGetSettingsResponseExample1.yaml @@ -0,0 +1,8 @@ +# summary: +description: A successful response with two index settings. +# type: response +# response_code: 200 +value: + index: + auto_expand_replicas: 0-4 + number_of_replicas: 0 From f44db9fb9fc8070b01fbdfed0ee79c75b1ad9a62 Mon Sep 17 00:00:00 2001 From: lcawl Date: Wed, 8 Jan 2025 14:13:54 -0800 Subject: [PATCH 3/3] Update only two watcher settings --- output/openapi/elasticsearch-openapi.json | 11 ++++-- output/schema/schema.json | 39 +++++++++++-------- output/typescript/types.ts | 5 ++- .../WatcherUpdateSettingsRequest.ts | 10 +++-- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index af37802826..1aa8dd9ada 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -38369,7 +38369,7 @@ "watcher" ], "summary": "Update Watcher index settings", - "description": "Update settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "description": "Update settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified.\nThis includes `index.auto_expand_replicas` and `index.number_of_replicas`.", "operationId": "watcher-update-settings", "parameters": [ { @@ -38398,8 +38398,13 @@ "application/json": { "schema": { "type": "object", - "additionalProperties": { - "type": "string" + "properties": { + "index.auto_expand_replicas": { + "type": "string" + }, + "index.number_of_replicas": { + "type": "number" + } } } } diff --git a/output/schema/schema.json b/output/schema/schema.json index 294bb1b26a..bfd79a1a93 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -21349,7 +21349,7 @@ "visibility": "public" } }, - "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified.\nThis includes `index.auto_expand_replicas` and `index.number_of_replicas`.", "docId": "watcher-api-update-settings", "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/watcher-api-update-settings.html", "name": "watcher.update_settings", @@ -222894,28 +222894,33 @@ "CommonQueryParameters" ], "body": { - "kind": "value", - "codegenName": "watcher_index_settings", - "value": { - "kind": "dictionary_of", - "key": { - "kind": "instance_of", + "kind": "properties", + "properties": [ + { + "name": "index.auto_expand_replicas", + "required": false, "type": { - "name": "string", - "namespace": "_builtins" + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } } }, - "singleKey": false, - "value": { - "kind": "instance_of", + { + "name": "index.number_of_replicas", + "required": false, "type": { - "name": "string", - "namespace": "_builtins" + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } } } - } + ] }, - "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`.", + "description": "Update Watcher index settings.\nUpdate settings for the Watcher internal index (`.watches`).\nOnly a subset of settings can be modified.\nThis includes `index.auto_expand_replicas` and `index.number_of_replicas`.", "inherits": { "type": { "name": "RequestBase", @@ -222953,7 +222958,7 @@ } } ], - "specLocation": "watcher/update_settings/WatcherUpdateSettingsRequest.ts#L24-L48" + "specLocation": "watcher/update_settings/WatcherUpdateSettingsRequest.ts#L24-L52" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 486be0b59c..a0f936887c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -21198,7 +21198,10 @@ export type WatcherStopResponse = AcknowledgedResponseBase export interface WatcherUpdateSettingsRequest extends RequestBase { master_timeout?: Duration timeout?: Duration - body?: Record + body?: { + 'index.auto_expand_replicas'?: string + 'index.number_of_replicas'?: integer + } } export interface WatcherUpdateSettingsResponse { diff --git a/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts b/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts index 7ba90f3336..7375d12066 100644 --- a/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts +++ b/specification/watcher/update_settings/WatcherUpdateSettingsRequest.ts @@ -17,14 +17,15 @@ * under the License. */ -import { Dictionary } from '@spec_utils/Dictionary' import { RequestBase } from '@_types/Base' +import { integer } from '@_types/Numeric' import { Duration } from '@_types/Time' /** * Update Watcher index settings. * Update settings for the Watcher internal index (`.watches`). - * Only a subset of settings can be modified, for example `index.auto_expand_replicas` and `index.number_of_replicas`. + * Only a subset of settings can be modified. + * This includes `index.auto_expand_replicas` and `index.number_of_replicas`. * @rest_spec_name watcher.update_settings * @availability stack stability=stable visibility=public * @cluster_privileges manage_watcher @@ -44,5 +45,8 @@ export interface Request extends RequestBase { timeout?: Duration } /** @codegen_name watcher_index_settings */ - body: Dictionary + body: { + 'index.auto_expand_replicas'?: string + 'index.number_of_replicas'?: integer + } }