From 7e38c81bea77266a3f65703ad7e7acf61702b299 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 18 Feb 2025 17:32:46 +0400 Subject: [PATCH] Switch back to properties body in put_data_lifecycle request --- 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 7344ad8a20..d589c24924 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -12847,11 +12847,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 233056621c..3ad1d08a6f 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -7486,11 +7486,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 ea0be1f2e0..0519a16cac 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -3839,7 +3839,7 @@ "name": "Request", "namespace": "indices.put_data_lifecycle" }, - "requestBodyRequired": true, + "requestBodyRequired": false, "requestMediaType": [ "application/json" ], @@ -23239,15 +23239,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": { @@ -23316,7 +23347,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 a4e24687f2..eef7456675 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -8149,7 +8149,7 @@ "name": "Request", "namespace": "indices.put_data_lifecycle" }, - "requestBodyRequired": true, + "requestBodyRequired": false, "requestMediaType": [ "application/json" ], @@ -138814,15 +138814,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": { @@ -138890,7 +138921,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 f431a37def..ef502c01bd 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -12272,7 +12272,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 + } }