From e2d1c2acf22ba92fa678eae19ecb42b17bdc97fb Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 18 Feb 2025 17:54:35 +0400 Subject: [PATCH] Switch back to properties body in put_data_lifecycle request (#3787) (cherry picked from commit 265cd5572fbfdce7c16dd5c151d57ac2010624d1) # Conflicts: # output/openapi/elasticsearch-serverless-openapi.json --- output/openapi/elasticsearch-openapi.json | 17 +++++-- .../elasticsearch-serverless-openapi.json | 17 +++++-- output/schema/schema-serverless.json | 51 +++++++++++++++---- output/schema/schema.json | 51 +++++++++++++++---- output/typescript/types.ts | 6 ++- .../IndicesPutDataLifecycleRequest.ts | 26 ++++++++-- 6 files changed, 137 insertions(+), 31 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 2cc582cbae..d20eaed277 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -12829,11 +12829,22 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/indices._types:DataStreamLifecycle" + "type": "object", + "properties": { + "data_retention": { + "$ref": "#/components/schemas/_types:Duration" + }, + "downsampling": { + "$ref": "#/components/schemas/indices._types:DataStreamLifecycleDownsampling" + }, + "enabled": { + "description": "If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle\nthat's disabled (enabled: `false`) will have no effect on the data stream.", + "type": "boolean" + } + } } } - }, - "required": true + } }, "responses": { "200": { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 3f63aa3e9d..d9a6af5cb2 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -7191,11 +7191,22 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/indices._types:DataStreamLifecycle" + "type": "object", + "properties": { + "data_retention": { + "$ref": "#/components/schemas/_types:Duration" + }, + "downsampling": { + "$ref": "#/components/schemas/indices._types:DataStreamLifecycleDownsampling" + }, + "enabled": { + "description": "If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle\nthat's disabled (enabled: `false`) will have no effect on the data stream.", + "type": "boolean" + } + } } } - }, - "required": true + } }, "responses": { "200": { diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 728d7346a1..76b7ce5876 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -3959,7 +3959,7 @@ "name": "Request", "namespace": "indices.put_data_lifecycle" }, - "requestBodyRequired": true, + "requestBodyRequired": false, "requestMediaType": [ "application/json" ], @@ -23491,15 +23491,46 @@ "CommonQueryParameters" ], "body": { - "codegenName": "lifecycle", - "kind": "value", - "value": { - "kind": "instance_of", - "type": { - "name": "DataStreamLifecycle", - "namespace": "indices._types" + "kind": "properties", + "properties": [ + { + "description": "If defined, every document added to this data stream will be stored at least for this time frame.\nAny time after this duration the document could be deleted.\nWhen empty, every document in this data stream will be stored indefinitely.", + "name": "data_retention", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The downsampling configuration to execute for the managed backing index after rollover.", + "name": "downsampling", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DataStreamLifecycleDownsampling", + "namespace": "indices._types" + } + } + }, + { + "description": "If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle\nthat's disabled (enabled: `false`) will have no effect on the data stream.", + "name": "enabled", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } - } + ] }, "description": "Update data stream lifecycles.\nUpdate the data stream lifecycle of the specified data streams.", "inherits": { @@ -23568,7 +23599,7 @@ } } ], - "specLocation": "indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L74" + "specLocation": "indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L92" }, { "body": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 7a677575cb..f9e5a64883 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8148,7 +8148,7 @@ "name": "Request", "namespace": "indices.put_data_lifecycle" }, - "requestBodyRequired": true, + "requestBodyRequired": false, "requestMediaType": [ "application/json" ], @@ -138714,15 +138714,46 @@ "CommonQueryParameters" ], "body": { - "kind": "value", - "codegenName": "lifecycle", - "value": { - "kind": "instance_of", - "type": { - "name": "DataStreamLifecycle", - "namespace": "indices._types" + "kind": "properties", + "properties": [ + { + "description": "If defined, every document added to this data stream will be stored at least for this time frame.\nAny time after this duration the document could be deleted.\nWhen empty, every document in this data stream will be stored indefinitely.", + "name": "data_retention", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, + { + "description": "The downsampling configuration to execute for the managed backing index after rollover.", + "name": "downsampling", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DataStreamLifecycleDownsampling", + "namespace": "indices._types" + } + } + }, + { + "description": "If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle\nthat's disabled (enabled: `false`) will have no effect on the data stream.", + "name": "enabled", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } - } + ] }, "description": "Update data stream lifecycles.\nUpdate the data stream lifecycle of the specified data streams.", "inherits": { @@ -138790,7 +138821,7 @@ } } ], - "specLocation": "indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L74" + "specLocation": "indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts#L25-L92" }, { "kind": "response", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 347ad9f3ce..770e87154c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12259,7 +12259,11 @@ export interface IndicesPutDataLifecycleRequest extends RequestBase { expand_wildcards?: ExpandWildcards master_timeout?: Duration timeout?: Duration - body?: IndicesDataStreamLifecycle + body?: { + data_retention?: Duration + downsampling?: IndicesDataStreamLifecycleDownsampling + enabled?: boolean + } } export type IndicesPutDataLifecycleResponse = AcknowledgedResponseBase diff --git a/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts b/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts index 36fa2602df..03e188b672 100644 --- a/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts +++ b/specification/indices/put_data_lifecycle/IndicesPutDataLifecycleRequest.ts @@ -17,7 +17,7 @@ * under the License. */ -import { DataStreamLifecycle } from '@indices/_types/DataStreamLifecycle' +import { DataStreamLifecycleDownsampling } from '@indices/_types/DataStreamLifecycleDownsampling' import { RequestBase } from '@_types/Base' import { DataStreamNames, ExpandWildcards } from '@_types/common' import { Duration } from '@_types/Time' @@ -67,8 +67,26 @@ export interface Request extends RequestBase { */ timeout?: Duration } - /** - * @codegen_name lifecycle + /* + * This is DataStreamLifecycle from @indices/_types/DataStreamLifecycle.ts, + * but kept as a properties body to avoid a breaking change */ - body: DataStreamLifecycle + body: { + /** + * If defined, every document added to this data stream will be stored at least for this time frame. + * Any time after this duration the document could be deleted. + * When empty, every document in this data stream will be stored indefinitely. + */ + data_retention?: Duration + /** + * The downsampling configuration to execute for the managed backing index after rollover. + */ + downsampling?: DataStreamLifecycleDownsampling + /** + * If defined, it turns data stream lifecycle on/off (`true`/`false`) for this data stream. A data stream lifecycle + * that's disabled (enabled: `false`) will have no effect on the data stream. + * @server_default true + */ + enabled?: boolean + } }