From b07eae54ccdb18ddb6347448400e3c29f5f1a7a8 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 12 Dec 2024 08:40:14 +1300 Subject: [PATCH] Generate DataStream operations (#1351) * Generate DataStream operations Signed-off-by: Thomas Farr * Fix tests Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- .gitignore | 2 + UPGRADING.md | 11 +- .../opensearch/_types/HealthStatus.java | 23 +- .../indices/CreateDataStreamRequest.java | 191 +++ .../indices/CreateDataStreamResponse.java | 154 ++ .../client/opensearch/indices/DataStream.java | 721 +++++++++ .../opensearch/indices/DataStreamIndex.java | 320 ++++ .../opensearch/indices/DataStreamStats.java | 206 ++- .../indices/DataStreamsStatsRequest.java | 224 +++ .../indices/DataStreamsStatsResponse.java | 319 ++-- .../indices/DeleteDataStreamRequest.java | 204 +++ .../indices/DeleteDataStreamResponse.java | 154 ++ .../indices/GetDataStreamRequest.java | 221 +++ .../indices/GetDataStreamResponse.java | 220 +++ .../client/opensearch/indices/ManagedBy.java | 65 + .../OpenSearchIndicesAsyncClientBase.java | 97 ++ .../indices/OpenSearchIndicesClientBase.java | 93 ++ .../indices/CreateDataStreamRequest.java | 106 -- .../indices/CreateDataStreamResponse.java | 74 - .../indices/DataStreamIndexInfo.java | 141 -- .../opensearch/indices/DataStreamInfo.java | 279 ---- .../indices/DataStreamsStatsRequest.java | 170 --- .../indices/DeleteDataStreamRequest.java | 123 -- .../indices/DeleteDataStreamResponse.java | 74 - .../indices/GetDataStreamRequest.java | 134 -- .../indices/GetDataStreamResponse.java | 118 -- .../indices/OpenSearchIndicesAsyncClient.java | 157 -- .../indices/OpenSearchIndicesClient.java | 153 -- .../integTest/AbstractIndicesClientIT.java | 15 +- java-codegen/opensearch-openapi.yaml | 1287 ++++++++++++++--- .../client/codegen/CodeGenerator.java | 2 + .../client/codegen/model/SpecTransformer.java | 4 +- .../codegen/utils/matcher/StringMatcher.java | 4 + 33 files changed, 4204 insertions(+), 1862 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/HealthStatus.java (79%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStream.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamIndex.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/DataStreamStats.java (55%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java (51%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/indices/ManagedBy.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamIndexInfo.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamInfo.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java diff --git a/.gitignore b/.gitignore index 7ccebda403..baa2605e02 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ java-client/bin samples/bin .DS_Store + +.kotlin/ \ No newline at end of file diff --git a/UPGRADING.md b/UPGRADING.md index d756de966b..f98573bf9c 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -151,4 +151,13 @@ After: ### PutTemplateRequest - The `flatSettings` property has been removed as it is not supported by OpenSearch. -- The `timeout` property has been removed as it is not supported by OpenSearch. \ No newline at end of file +- The `timeout` property has been removed as it is not supported by OpenSearch. + +### DataStreamInfo renamed to DataStream +- The `DataStreamInfo` class has been renamed to `DataStream`, this affects: + - `GetDataStreamResponse`'s `dataStreams` field. +- The `generation` property is now of type `long` instead of `int`. + +### DataStreamIndexInfo renamed to DataStreamIndex +- The `DataStreamIndexInfo` class has been renamed to `DataStreamIndex`, this affects: + - `DataStream`'s (previously `DataStreamInfo`) `indices` field. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/HealthStatus.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/HealthStatus.java index 09a9914a63..e5be6d71c3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/HealthStatus.java @@ -30,12 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.HealthStatus + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum HealthStatus implements JsonEnum { /** * All shards are assigned. @@ -43,19 +51,16 @@ public enum HealthStatus implements JsonEnum { Green("green", "GREEN"), /** - * All primary shards are assigned, but one or more replica shards are - * unassigned. If a node in the cluster fails, some data could be unavailable - * until that node is repaired. + * One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary + * shards are assigned. */ - Yellow("yellow", "YELLOW"), + Red("red", "RED"), /** - * One or more primary shards are unassigned, so some data is unavailable. This - * can occur briefly during cluster startup as primary shards are assigned. + * All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be + * unavailable until that node is repaired. */ - Red("red", "RED"), - - ; + Yellow("yellow", "YELLOW"); private final String jsonValue; private final String[] aliases; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java new file mode 100644 index 0000000000..620b38124a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java @@ -0,0 +1,191 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.create_data_stream.Request + +/** + * Creates or updates a data stream. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateDataStreamRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final String name; + + // --------------------------------------------------------------------------------------------- + + private CreateDataStreamRequest(Builder builder) { + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + } + + public static CreateDataStreamRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include \, + * /, *, ?, ", <, >, |, + * ,, #, :, or a space character; Cannot start with -, _, + * +, or .ds-; Cannot be . or ..; Cannot be longer than 255 bytes. Multi-byte + * characters count towards this limit faster. + *

+ * API name: {@code name} + *

+ */ + @Nonnull + public final String name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateDataStreamRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String name; + + public Builder() {} + + private Builder(CreateDataStreamRequest o) { + this.name = o.name; + } + + private Builder(Builder o) { + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include \, + * /, *, ?, ", <, >, |, + * ,, #, :, or a space character; Cannot start with -, _, + * +, or .ds-; Cannot be . or ..; Cannot be longer than 255 bytes. Multi-byte + * characters count towards this limit faster. + *

+ * API name: {@code name} + *

+ */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link CreateDataStreamRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateDataStreamRequest build() { + _checkSingleUse(); + + return new CreateDataStreamRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.create_data_stream}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + CreateDataStreamResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.name.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateDataStreamRequest other = (CreateDataStreamRequest) o; + return this.name.equals(other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java new file mode 100644 index 0000000000..b8ff11b295 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java @@ -0,0 +1,154 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.create_data_stream.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateDataStreamResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private CreateDataStreamResponse(Builder builder) { + super(builder); + } + + public static CreateDataStreamResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateDataStreamResponse}. + */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(CreateDataStreamResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link CreateDataStreamResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateDataStreamResponse build() { + _checkSingleUse(); + + return new CreateDataStreamResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateDataStreamResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateDataStreamResponse::setupCreateDataStreamResponseDeserializer + ); + + protected static void setupCreateDataStreamResponseDeserializer(ObjectDeserializer op) { + setupAcknowledgedResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStream.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStream.java new file mode 100644 index 0000000000..41ae3e4d90 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStream.java @@ -0,0 +1,721 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.HealthStatus; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.DataStream + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DataStream implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Boolean allowCustomRouting; + + private final long generation; + + @Nullable + private final Boolean hidden; + + @Nullable + private final String ilmPolicy; + + @Nonnull + private final List indices; + + @Nonnull + private final Map meta; + + @Nonnull + private final String name; + + @Nullable + private final ManagedBy nextGenerationManagedBy; + + @Nullable + private final Boolean preferIlm; + + @Nullable + private final Boolean replicated; + + @Nonnull + private final HealthStatus status; + + @Nullable + private final Boolean system; + + @Nonnull + private final String template; + + @Nonnull + private final DataStreamTimestampField timestampField; + + // --------------------------------------------------------------------------------------------- + + private DataStream(Builder builder) { + this.allowCustomRouting = builder.allowCustomRouting; + this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); + this.hidden = builder.hidden; + this.ilmPolicy = builder.ilmPolicy; + this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); + this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.nextGenerationManagedBy = builder.nextGenerationManagedBy; + this.preferIlm = builder.preferIlm; + this.replicated = builder.replicated; + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.system = builder.system; + this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); + } + + public static DataStream of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If true, the data stream allows custom routing on write request. + *

+ * API name: {@code allow_custom_routing} + *

+ */ + @Nullable + public final Boolean allowCustomRouting() { + return this.allowCustomRouting; + } + + /** + * Required - Current generation for the data stream. This number acts as a cumulative count of the stream's rollovers, starting at 1. + *

+ * API name: {@code generation} + *

+ */ + public final long generation() { + return this.generation; + } + + /** + * If true, the data stream is hidden. + *

+ * API name: {@code hidden} + *

+ */ + @Nullable + public final Boolean hidden() { + return this.hidden; + } + + /** + * API name: {@code ilm_policy} + */ + @Nullable + public final String ilmPolicy() { + return this.ilmPolicy; + } + + /** + * Required - Array of objects containing information about the data stream's backing indexes. The last item in this array contains + * information about the stream's current write index. + *

+ * API name: {@code indices} + *

+ */ + @Nonnull + public final List indices() { + return this.indices; + } + + /** + * API name: {@code _meta} + */ + @Nonnull + public final Map meta() { + return this.meta; + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final String name() { + return this.name; + } + + /** + * API name: {@code next_generation_managed_by} + */ + @Nullable + public final ManagedBy nextGenerationManagedBy() { + return this.nextGenerationManagedBy; + } + + /** + * Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream. + *

+ * API name: {@code prefer_ilm} + *

+ */ + @Nullable + public final Boolean preferIlm() { + return this.preferIlm; + } + + /** + * If true, the data stream is created and managed by cross-cluster replication and the local cluster can not write into + * this data stream or change its mappings. + *

+ * API name: {@code replicated} + *

+ */ + @Nullable + public final Boolean replicated() { + return this.replicated; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final HealthStatus status() { + return this.status; + } + + /** + * If true, the data stream is created and managed by an OpenSearch stack component and cannot be modified through normal + * user interaction. + *

+ * API name: {@code system} + *

+ */ + @Nullable + public final Boolean system() { + return this.system; + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final String template() { + return this.template; + } + + /** + * Required - API name: {@code timestamp_field} + */ + @Nonnull + public final DataStreamTimestampField timestampField() { + return this.timestampField; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.allowCustomRouting != null) { + generator.writeKey("allow_custom_routing"); + generator.write(this.allowCustomRouting); + } + + generator.writeKey("generation"); + generator.write(this.generation); + + if (this.hidden != null) { + generator.writeKey("hidden"); + generator.write(this.hidden); + } + + if (this.ilmPolicy != null) { + generator.writeKey("ilm_policy"); + generator.write(this.ilmPolicy); + } + + generator.writeKey("indices"); + generator.writeStartArray(); + for (DataStreamIndex item0 : this.indices) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("name"); + generator.write(this.name); + + if (this.nextGenerationManagedBy != null) { + generator.writeKey("next_generation_managed_by"); + this.nextGenerationManagedBy.serialize(generator, mapper); + } + + if (this.preferIlm != null) { + generator.writeKey("prefer_ilm"); + generator.write(this.preferIlm); + } + + if (this.replicated != null) { + generator.writeKey("replicated"); + generator.write(this.replicated); + } + + generator.writeKey("status"); + this.status.serialize(generator, mapper); + + if (this.system != null) { + generator.writeKey("system"); + generator.write(this.system); + } + + generator.writeKey("template"); + generator.write(this.template); + + generator.writeKey("timestamp_field"); + this.timestampField.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DataStream}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean allowCustomRouting; + private Long generation; + @Nullable + private Boolean hidden; + @Nullable + private String ilmPolicy; + private List indices; + @Nullable + private Map meta; + private String name; + @Nullable + private ManagedBy nextGenerationManagedBy; + @Nullable + private Boolean preferIlm; + @Nullable + private Boolean replicated; + private HealthStatus status; + @Nullable + private Boolean system; + private String template; + private DataStreamTimestampField timestampField; + + public Builder() {} + + private Builder(DataStream o) { + this.allowCustomRouting = o.allowCustomRouting; + this.generation = o.generation; + this.hidden = o.hidden; + this.ilmPolicy = o.ilmPolicy; + this.indices = _listCopy(o.indices); + this.meta = _mapCopy(o.meta); + this.name = o.name; + this.nextGenerationManagedBy = o.nextGenerationManagedBy; + this.preferIlm = o.preferIlm; + this.replicated = o.replicated; + this.status = o.status; + this.system = o.system; + this.template = o.template; + this.timestampField = o.timestampField; + } + + private Builder(Builder o) { + this.allowCustomRouting = o.allowCustomRouting; + this.generation = o.generation; + this.hidden = o.hidden; + this.ilmPolicy = o.ilmPolicy; + this.indices = _listCopy(o.indices); + this.meta = _mapCopy(o.meta); + this.name = o.name; + this.nextGenerationManagedBy = o.nextGenerationManagedBy; + this.preferIlm = o.preferIlm; + this.replicated = o.replicated; + this.status = o.status; + this.system = o.system; + this.template = o.template; + this.timestampField = o.timestampField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * If true, the data stream allows custom routing on write request. + *

+ * API name: {@code allow_custom_routing} + *

+ */ + @Nonnull + public final Builder allowCustomRouting(@Nullable Boolean value) { + this.allowCustomRouting = value; + return this; + } + + /** + * Required - Current generation for the data stream. This number acts as a cumulative count of the stream's rollovers, starting at + * 1. + *

+ * API name: {@code generation} + *

+ */ + @Nonnull + public final Builder generation(long value) { + this.generation = value; + return this; + } + + /** + * If true, the data stream is hidden. + *

+ * API name: {@code hidden} + *

+ */ + @Nonnull + public final Builder hidden(@Nullable Boolean value) { + this.hidden = value; + return this; + } + + /** + * API name: {@code ilm_policy} + */ + @Nonnull + public final Builder ilmPolicy(@Nullable String value) { + this.ilmPolicy = value; + return this; + } + + /** + * Required - Array of objects containing information about the data stream's backing indexes. The last item in this array contains + * information about the stream's current write index. + *

+ * API name: {@code indices} + *

+ * + *

+ * Adds all elements of list to indices. + *

+ */ + @Nonnull + public final Builder indices(List list) { + this.indices = _listAddAll(this.indices, list); + return this; + } + + /** + * Required - Array of objects containing information about the data stream's backing indexes. The last item in this array contains + * information about the stream's current write index. + *

+ * API name: {@code indices} + *

+ * + *

+ * Adds one or more values to indices. + *

+ */ + @Nonnull + public final Builder indices(DataStreamIndex value, DataStreamIndex... values) { + this.indices = _listAdd(this.indices, value, values); + return this; + } + + /** + * Required - Array of objects containing information about the data stream's backing indexes. The last item in this array contains + * information about the stream's current write index. + *

+ * API name: {@code indices} + *

+ * + *

+ * Adds a value to indices using a builder lambda. + *

+ */ + @Nonnull + public final Builder indices(Function> fn) { + return indices(fn.apply(new DataStreamIndex.Builder()).build()); + } + + /** + * API name: {@code _meta} + * + *

+ * Adds all elements of map to meta. + *

+ */ + @Nonnull + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; + } + + /** + * API name: {@code _meta} + * + *

+ * Adds an entry to meta. + *

+ */ + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * API name: {@code next_generation_managed_by} + */ + @Nonnull + public final Builder nextGenerationManagedBy(@Nullable ManagedBy value) { + this.nextGenerationManagedBy = value; + return this; + } + + /** + * Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream. + *

+ * API name: {@code prefer_ilm} + *

+ */ + @Nonnull + public final Builder preferIlm(@Nullable Boolean value) { + this.preferIlm = value; + return this; + } + + /** + * If true, the data stream is created and managed by cross-cluster replication and the local cluster can not write + * into this data stream or change its mappings. + *

+ * API name: {@code replicated} + *

+ */ + @Nonnull + public final Builder replicated(@Nullable Boolean value) { + this.replicated = value; + return this; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final Builder status(HealthStatus value) { + this.status = value; + return this; + } + + /** + * If true, the data stream is created and managed by an OpenSearch stack component and cannot be modified through + * normal user interaction. + *

+ * API name: {@code system} + *

+ */ + @Nonnull + public final Builder system(@Nullable Boolean value) { + this.system = value; + return this; + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Builder template(String value) { + this.template = value; + return this; + } + + /** + * Required - API name: {@code timestamp_field} + */ + @Nonnull + public final Builder timestampField(DataStreamTimestampField value) { + this.timestampField = value; + return this; + } + + /** + * Required - API name: {@code timestamp_field} + */ + @Nonnull + public final Builder timestampField(Function> fn) { + return timestampField(fn.apply(new DataStreamTimestampField.Builder()).build()); + } + + /** + * Builds a {@link DataStream}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DataStream build() { + _checkSingleUse(); + + return new DataStream(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStream} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DataStream::setupDataStreamDeserializer + ); + + protected static void setupDataStreamDeserializer(ObjectDeserializer op) { + op.add(Builder::allowCustomRouting, JsonpDeserializer.booleanDeserializer(), "allow_custom_routing"); + op.add(Builder::generation, JsonpDeserializer.longDeserializer(), "generation"); + op.add(Builder::hidden, JsonpDeserializer.booleanDeserializer(), "hidden"); + op.add(Builder::ilmPolicy, JsonpDeserializer.stringDeserializer(), "ilm_policy"); + op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(DataStreamIndex._DESERIALIZER), "indices"); + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::nextGenerationManagedBy, ManagedBy._DESERIALIZER, "next_generation_managed_by"); + op.add(Builder::preferIlm, JsonpDeserializer.booleanDeserializer(), "prefer_ilm"); + op.add(Builder::replicated, JsonpDeserializer.booleanDeserializer(), "replicated"); + op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); + op.add(Builder::system, JsonpDeserializer.booleanDeserializer(), "system"); + op.add(Builder::template, JsonpDeserializer.stringDeserializer(), "template"); + op.add(Builder::timestampField, DataStreamTimestampField._DESERIALIZER, "timestamp_field"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowCustomRouting); + result = 31 * result + Long.hashCode(this.generation); + result = 31 * result + Objects.hashCode(this.hidden); + result = 31 * result + Objects.hashCode(this.ilmPolicy); + result = 31 * result + this.indices.hashCode(); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.nextGenerationManagedBy); + result = 31 * result + Objects.hashCode(this.preferIlm); + result = 31 * result + Objects.hashCode(this.replicated); + result = 31 * result + this.status.hashCode(); + result = 31 * result + Objects.hashCode(this.system); + result = 31 * result + this.template.hashCode(); + result = 31 * result + this.timestampField.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DataStream other = (DataStream) o; + return Objects.equals(this.allowCustomRouting, other.allowCustomRouting) + && this.generation == other.generation + && Objects.equals(this.hidden, other.hidden) + && Objects.equals(this.ilmPolicy, other.ilmPolicy) + && this.indices.equals(other.indices) + && Objects.equals(this.meta, other.meta) + && this.name.equals(other.name) + && Objects.equals(this.nextGenerationManagedBy, other.nextGenerationManagedBy) + && Objects.equals(this.preferIlm, other.preferIlm) + && Objects.equals(this.replicated, other.replicated) + && this.status.equals(other.status) + && Objects.equals(this.system, other.system) + && this.template.equals(other.template) + && this.timestampField.equals(other.timestampField); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamIndex.java new file mode 100644 index 0000000000..d614b69547 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamIndex.java @@ -0,0 +1,320 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.DataStreamIndex + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DataStreamIndex implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String ilmPolicy; + + @Nonnull + private final String indexName; + + @Nonnull + private final String indexUuid; + + @Nullable + private final ManagedBy managedBy; + + @Nullable + private final Boolean preferIlm; + + // --------------------------------------------------------------------------------------------- + + private DataStreamIndex(Builder builder) { + this.ilmPolicy = builder.ilmPolicy; + this.indexName = ApiTypeHelper.requireNonNull(builder.indexName, this, "indexName"); + this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); + this.managedBy = builder.managedBy; + this.preferIlm = builder.preferIlm; + } + + public static DataStreamIndex of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code ilm_policy} + */ + @Nullable + public final String ilmPolicy() { + return this.ilmPolicy; + } + + /** + * Required - API name: {@code index_name} + */ + @Nonnull + public final String indexName() { + return this.indexName; + } + + /** + * Required - API name: {@code index_uuid} + */ + @Nonnull + public final String indexUuid() { + return this.indexUuid; + } + + /** + * API name: {@code managed_by} + */ + @Nullable + public final ManagedBy managedBy() { + return this.managedBy; + } + + /** + * Indicates if ILM should take precedence over DSL in case both are configured to manage this index. + *

+ * API name: {@code prefer_ilm} + *

+ */ + @Nullable + public final Boolean preferIlm() { + return this.preferIlm; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.ilmPolicy != null) { + generator.writeKey("ilm_policy"); + generator.write(this.ilmPolicy); + } + + generator.writeKey("index_name"); + generator.write(this.indexName); + + generator.writeKey("index_uuid"); + generator.write(this.indexUuid); + + if (this.managedBy != null) { + generator.writeKey("managed_by"); + this.managedBy.serialize(generator, mapper); + } + + if (this.preferIlm != null) { + generator.writeKey("prefer_ilm"); + generator.write(this.preferIlm); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DataStreamIndex}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String ilmPolicy; + private String indexName; + private String indexUuid; + @Nullable + private ManagedBy managedBy; + @Nullable + private Boolean preferIlm; + + public Builder() {} + + private Builder(DataStreamIndex o) { + this.ilmPolicy = o.ilmPolicy; + this.indexName = o.indexName; + this.indexUuid = o.indexUuid; + this.managedBy = o.managedBy; + this.preferIlm = o.preferIlm; + } + + private Builder(Builder o) { + this.ilmPolicy = o.ilmPolicy; + this.indexName = o.indexName; + this.indexUuid = o.indexUuid; + this.managedBy = o.managedBy; + this.preferIlm = o.preferIlm; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code ilm_policy} + */ + @Nonnull + public final Builder ilmPolicy(@Nullable String value) { + this.ilmPolicy = value; + return this; + } + + /** + * Required - API name: {@code index_name} + */ + @Nonnull + public final Builder indexName(String value) { + this.indexName = value; + return this; + } + + /** + * Required - API name: {@code index_uuid} + */ + @Nonnull + public final Builder indexUuid(String value) { + this.indexUuid = value; + return this; + } + + /** + * API name: {@code managed_by} + */ + @Nonnull + public final Builder managedBy(@Nullable ManagedBy value) { + this.managedBy = value; + return this; + } + + /** + * Indicates if ILM should take precedence over DSL in case both are configured to manage this index. + *

+ * API name: {@code prefer_ilm} + *

+ */ + @Nonnull + public final Builder preferIlm(@Nullable Boolean value) { + this.preferIlm = value; + return this; + } + + /** + * Builds a {@link DataStreamIndex}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DataStreamIndex build() { + _checkSingleUse(); + + return new DataStreamIndex(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamIndex} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DataStreamIndex::setupDataStreamIndexDeserializer + ); + + protected static void setupDataStreamIndexDeserializer(ObjectDeserializer op) { + op.add(Builder::ilmPolicy, JsonpDeserializer.stringDeserializer(), "ilm_policy"); + op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); + op.add(Builder::indexUuid, JsonpDeserializer.stringDeserializer(), "index_uuid"); + op.add(Builder::managedBy, ManagedBy._DESERIALIZER, "managed_by"); + op.add(Builder::preferIlm, JsonpDeserializer.booleanDeserializer(), "prefer_ilm"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.ilmPolicy); + result = 31 * result + this.indexName.hashCode(); + result = 31 * result + this.indexUuid.hashCode(); + result = 31 * result + Objects.hashCode(this.managedBy); + result = 31 * result + Objects.hashCode(this.preferIlm); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DataStreamIndex other = (DataStreamIndex) o; + return Objects.equals(this.ilmPolicy, other.ilmPolicy) + && this.indexName.equals(other.indexName) + && this.indexUuid.equals(other.indexUuid) + && Objects.equals(this.managedBy, other.managedBy) + && Objects.equals(this.preferIlm, other.preferIlm); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamStats.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamStats.java index 8f04758b8d..62bf125a88 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamStats.java @@ -6,10 +6,41 @@ * compatible open source license. */ +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -18,64 +49,63 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: indices._types.DataStreamStats +// typedef: indices.DataStreamStats @JsonpDeserializable -public class DataStreamStats implements PlainJsonSerializable { - - private final String dataStream; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DataStreamStats implements PlainJsonSerializable, ToCopyableBuilder { private final int backingIndices; - private final long storeSizeBytes; + @Nonnull + private final String dataStream; private final long maximumTimestamp; @Nullable private final String storeSize; + private final long storeSizeBytes; + // --------------------------------------------------------------------------------------------- private DataStreamStats(Builder builder) { - - this.dataStream = ApiTypeHelper.requireNonNull(builder.dataStream, this, "dataStream"); this.backingIndices = ApiTypeHelper.requireNonNull(builder.backingIndices, this, "backingIndices"); - this.storeSizeBytes = ApiTypeHelper.requireNonNull(builder.storeSizeBytes, this, "storeSizeBytes"); + this.dataStream = ApiTypeHelper.requireNonNull(builder.dataStream, this, "dataStream"); this.maximumTimestamp = ApiTypeHelper.requireNonNull(builder.maximumTimestamp, this, "maximumTimestamp"); this.storeSize = builder.storeSize; - + this.storeSizeBytes = ApiTypeHelper.requireNonNull(builder.storeSizeBytes, this, "storeSizeBytes"); } - public static DataStreamStats of(Function> fn) { + public static DataStreamStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * API name: {@code data_stream} - */ - public final String dataStream() { - return this.dataStream; - } - - /** + * Required - Current number of backing indexes for the data stream. + *

* API name: {@code backing_indices} + *

*/ public final int backingIndices() { return this.backingIndices; } /** - * API name: {@code store_size_bytes} + * Required - API name: {@code data_stream} */ - public final long storeSizeBytes() { - return this.storeSizeBytes; + @Nonnull + public final String dataStream() { + return this.dataStream; } /** - * API name: {@code maximum_timestamp} + * Required - API name: {@code maximum_timestamp} */ public final long maximumTimestamp() { return this.maximumTimestamp; @@ -89,9 +119,20 @@ public final String storeSize() { return this.storeSize; } + /** + * Required - Total size, in bytes, of all shards for the data stream's backing indexes. + *

+ * API name: {@code store_size_bytes} + *

+ */ + public final long storeSizeBytes() { + return this.storeSizeBytes; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,15 +140,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("data_stream"); - generator.write(this.dataStream); - generator.writeKey("backing_indices"); generator.write(this.backingIndices); - generator.writeKey("store_size_bytes"); - generator.write(this.storeSizeBytes); + generator.writeKey("data_stream"); + generator.write(this.dataStream); generator.writeKey("maximum_timestamp"); generator.write(this.maximumTimestamp); @@ -115,57 +152,85 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.storeSize != null) { generator.writeKey("store_size"); generator.write(this.storeSize); - } + generator.writeKey("store_size_bytes"); + generator.write(this.storeSizeBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DataStreamStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Integer backingIndices; private String dataStream; + private Long maximumTimestamp; + @Nullable + private String storeSize; + private Long storeSizeBytes; - private int backingIndices; - - private long storeSizeBytes; + public Builder() {} - private long maximumTimestamp; + private Builder(DataStreamStats o) { + this.backingIndices = o.backingIndices; + this.dataStream = o.dataStream; + this.maximumTimestamp = o.maximumTimestamp; + this.storeSize = o.storeSize; + this.storeSizeBytes = o.storeSizeBytes; + } - @Nullable - private String storeSize; + private Builder(Builder o) { + this.backingIndices = o.backingIndices; + this.dataStream = o.dataStream; + this.maximumTimestamp = o.maximumTimestamp; + this.storeSize = o.storeSize; + this.storeSizeBytes = o.storeSizeBytes; + } - /** - * API name: {@code data_stream} - */ - public final Builder dataStream(String value) { - this.dataStream = value; - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** + * Required - Current number of backing indexes for the data stream. + *

* API name: {@code backing_indices} + *

*/ + @Nonnull public final Builder backingIndices(int value) { this.backingIndices = value; return this; } /** - * API name: {@code store_size_bytes} + * Required - API name: {@code data_stream} */ - public final Builder storeSizeBytes(long value) { - this.storeSizeBytes = value; + @Nonnull + public final Builder dataStream(String value) { + this.dataStream = value; return this; } /** - * API name: {@code maximum_timestamp} + * Required - API name: {@code maximum_timestamp} */ + @Nonnull public final Builder maximumTimestamp(long value) { this.maximumTimestamp = value; return this; @@ -174,17 +239,31 @@ public final Builder maximumTimestamp(long value) { /** * API name: {@code store_size} */ + @Nonnull public final Builder storeSize(@Nullable String value) { this.storeSize = value; return this; } + /** + * Required - Total size, in bytes, of all shards for the data stream's backing indexes. + *

+ * API name: {@code store_size_bytes} + *

+ */ + @Nonnull + public final Builder storeSizeBytes(long value) { + this.storeSizeBytes = value; + return this; + } + /** * Builds a {@link DataStreamStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DataStreamStats build() { _checkSingleUse(); @@ -202,13 +281,34 @@ public DataStreamStats build() { DataStreamStats::setupDataStreamStatsDeserializer ); - protected static void setupDataStreamStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); + protected static void setupDataStreamStatsDeserializer(ObjectDeserializer op) { op.add(Builder::backingIndices, JsonpDeserializer.integerDeserializer(), "backing_indices"); + op.add(Builder::dataStream, JsonpDeserializer.stringDeserializer(), "data_stream"); + op.add(Builder::maximumTimestamp, JsonpDeserializer.longDeserializer(), "maximum_timestamp"); op.add(Builder::storeSize, JsonpDeserializer.stringDeserializer(), "store_size"); op.add(Builder::storeSizeBytes, JsonpDeserializer.longDeserializer(), "store_size_bytes"); - op.add(Builder::maximumTimestamp, JsonpDeserializer.longDeserializer(), "maximum_timestamp"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.backingIndices); + result = 31 * result + this.dataStream.hashCode(); + result = 31 * result + Long.hashCode(this.maximumTimestamp); + result = 31 * result + Objects.hashCode(this.storeSize); + result = 31 * result + Long.hashCode(this.storeSizeBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DataStreamStats other = (DataStreamStats) o; + return this.backingIndices == other.backingIndices + && this.dataStream.equals(other.dataStream) + && this.maximumTimestamp == other.maximumTimestamp + && Objects.equals(this.storeSize, other.storeSize) + && this.storeSizeBytes == other.storeSizeBytes; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java new file mode 100644 index 0000000000..1705c606cc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java @@ -0,0 +1,224 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.data_streams_stats.Request + +/** + * Provides statistics on operations happening in a data stream. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DataStreamsStatsRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final List name; + + // --------------------------------------------------------------------------------------------- + + private DataStreamsStatsRequest(Builder builder) { + this.name = ApiTypeHelper.unmodifiable(builder.name); + } + + public static DataStreamsStatsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Comma-separated list of data streams used to limit the request. Wildcard expressions (*) are supported. To target all + * data streams in a cluster, omit this parameter or use *. + *

+ * API name: {@code name} + *

+ */ + @Nonnull + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DataStreamsStatsRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List name; + + public Builder() {} + + private Builder(DataStreamsStatsRequest o) { + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Comma-separated list of data streams used to limit the request. Wildcard expressions (*) are supported. To target + * all data streams in a cluster, omit this parameter or use *. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds all elements of list to name. + *

+ */ + @Nonnull + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Comma-separated list of data streams used to limit the request. Wildcard expressions (*) are supported. To target + * all data streams in a cluster, omit this parameter or use *. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds one or more values to name. + *

+ */ + @Nonnull + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); + return this; + } + + /** + * Builds a {@link DataStreamsStatsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DataStreamsStatsRequest build() { + _checkSingleUse(); + + return new DataStreamsStatsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.data_streams_stats}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; + + if (propsSet == 0) { + return "/_data_stream/_stats"; + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + buf.append("/_stats"); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DataStreamsStatsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DataStreamsStatsRequest other = (DataStreamsStatsRequest) o; + return Objects.equals(this.name, other.name); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java similarity index 51% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java index c646cc90de..f20f2579a3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DataStreamsStatsResponse.java @@ -6,11 +6,42 @@ * compatible open source license. */ +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.List; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -20,70 +51,87 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ShardStatistics; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.data_streams_stats.Response @JsonpDeserializable -public class DataStreamsStatsResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DataStreamsStatsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { - private final ShardStatistics shards; + private final int backingIndices; private final int dataStreamCount; - private final int backingIndices; + @Nonnull + private final List dataStreams; - private final long totalStoreSizeBytes; + @Nonnull + private final ShardStatistics shards; @Nullable private final String totalStoreSize; - private final List dataStreams; + private final long totalStoreSizeBytes; // --------------------------------------------------------------------------------------------- private DataStreamsStatsResponse(Builder builder) { - - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - this.dataStreamCount = ApiTypeHelper.requireNonNull(builder.dataStreamCount, this, "dataStreamCount"); this.backingIndices = ApiTypeHelper.requireNonNull(builder.backingIndices, this, "backingIndices"); - this.totalStoreSizeBytes = ApiTypeHelper.requireNonNull(builder.totalStoreSizeBytes, this, "totalStoreSizeBytes"); - this.totalStoreSize = builder.totalStoreSize; + this.dataStreamCount = ApiTypeHelper.requireNonNull(builder.dataStreamCount, this, "dataStreamCount"); this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - + this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); + this.totalStoreSize = builder.totalStoreSize; + this.totalStoreSizeBytes = ApiTypeHelper.requireNonNull(builder.totalStoreSizeBytes, this, "totalStoreSizeBytes"); } - public static DataStreamsStatsResponse of(Function> fn) { + public static DataStreamsStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code _shards} + * Required - Total number of backing indexes for the selected data streams. + *

+ * API name: {@code backing_indices} + *

*/ - public final ShardStatistics shards() { - return this.shards; + public final int backingIndices() { + return this.backingIndices; } /** - * Required - API name: {@code data_stream_count} + * Required - Total number of selected data streams. + *

+ * API name: {@code data_stream_count} + *

*/ public final int dataStreamCount() { return this.dataStreamCount; } /** - * Required - API name: {@code backing_indices} + * Required - Contains statistics for the selected data streams. + *

+ * API name: {@code data_streams} + *

*/ - public final int backingIndices() { - return this.backingIndices; + @Nonnull + public final List dataStreams() { + return this.dataStreams; } /** - * Required - API name: {@code total_store_size_bytes} + * Required - API name: {@code _shards} */ - public final long totalStoreSizeBytes() { - return this.totalStoreSizeBytes; + @Nonnull + public final ShardStatistics shards() { + return this.shards; } /** @@ -95,15 +143,19 @@ public final String totalStoreSize() { } /** - * API name: {@code data_streams} + * Required - Total size, in bytes, of all shards for the selected data streams. + *

+ * API name: {@code total_store_size_bytes} + *

*/ - public final List dataStreams() { - return this.dataStreams; + public final long totalStoreSizeBytes() { + return this.totalStoreSizeBytes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -111,133 +163,198 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); + generator.writeKey("backing_indices"); + generator.write(this.backingIndices); generator.writeKey("data_stream_count"); generator.write(this.dataStreamCount); - generator.writeKey("backing_indices"); - generator.write(this.backingIndices); + generator.writeKey("data_streams"); + generator.writeStartArray(); + for (DataStreamStats item0 : this.dataStreams) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); - generator.writeKey("total_store_size_bytes"); - generator.write(this.totalStoreSizeBytes); + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); if (this.totalStoreSize != null) { generator.writeKey("total_store_size"); generator.write(this.totalStoreSize); - - } - - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (DataStreamStats item : this.dataStreams) { - item.serialize(generator, mapper); - } - generator.writeEnd(); } + generator.writeKey("total_store_size_bytes"); + generator.write(this.totalStoreSizeBytes); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DataStreamsStatsResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Integer backingIndices; + private Integer dataStreamCount; + private List dataStreams; private ShardStatistics shards; + @Nullable + private String totalStoreSize; + private Long totalStoreSizeBytes; - private int dataStreamCount; - - private int backingIndices; + public Builder() {} - private long totalStoreSizeBytes; + private Builder(DataStreamsStatsResponse o) { + this.backingIndices = o.backingIndices; + this.dataStreamCount = o.dataStreamCount; + this.dataStreams = _listCopy(o.dataStreams); + this.shards = o.shards; + this.totalStoreSize = o.totalStoreSize; + this.totalStoreSizeBytes = o.totalStoreSizeBytes; + } - @Nullable - private String totalStoreSize; + private Builder(Builder o) { + this.backingIndices = o.backingIndices; + this.dataStreamCount = o.dataStreamCount; + this.dataStreams = _listCopy(o.dataStreams); + this.shards = o.shards; + this.totalStoreSize = o.totalStoreSize; + this.totalStoreSizeBytes = o.totalStoreSizeBytes; + } - private List dataStreams; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code _shards} + * Required - Total number of backing indexes for the selected data streams. + *

+ * API name: {@code backing_indices} + *

*/ - public final Builder shards(ShardStatistics value) { - this.shards = value; + @Nonnull + public final Builder backingIndices(int value) { + this.backingIndices = value; return this; } /** - * Required - API name: {@code _shards} + * Required - Total number of selected data streams. + *

+ * API name: {@code data_stream_count} + *

*/ - public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + @Nonnull + public final Builder dataStreamCount(int value) { + this.dataStreamCount = value; + return this; } /** - * Required - API name: {@code data_stream_count} + * Required - Contains statistics for the selected data streams. + *

+ * API name: {@code data_streams} + *

+ * + *

+ * Adds all elements of list to dataStreams. + *

*/ - public final Builder dataStreamCount(int value) { - this.dataStreamCount = value; + @Nonnull + public final Builder dataStreams(List list) { + this.dataStreams = _listAddAll(this.dataStreams, list); return this; } /** - * Required - API name: {@code backing_indices} + * Required - Contains statistics for the selected data streams. + *

+ * API name: {@code data_streams} + *

+ * + *

+ * Adds one or more values to dataStreams. + *

*/ - public final Builder backingIndices(int value) { - this.backingIndices = value; + @Nonnull + public final Builder dataStreams(DataStreamStats value, DataStreamStats... values) { + this.dataStreams = _listAdd(this.dataStreams, value, values); return this; } /** - * Required - API name: {@code total_store_size_bytes} + * Required - Contains statistics for the selected data streams. + *

+ * API name: {@code data_streams} + *

+ * + *

+ * Adds a value to dataStreams using a builder lambda. + *

*/ - public final Builder totalStoreSizeBytes(int value) { - this.totalStoreSizeBytes = value; - return this; + @Nonnull + public final Builder dataStreams(Function> fn) { + return dataStreams(fn.apply(new DataStreamStats.Builder()).build()); } /** - * API name: {@code total_store_size} + * Required - API name: {@code _shards} */ - public final Builder totalStoreSize(@Nullable String value) { - this.totalStoreSize = value; + @Nonnull + public final Builder shards(ShardStatistics value) { + this.shards = value; return this; } /** - * API name: {@code data_streams} + * Required - API name: {@code _shards} */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; + @Nonnull + public final Builder shards(Function> fn) { + return shards(fn.apply(new ShardStatistics.Builder()).build()); } /** - * API name: {@code data_streams} + * API name: {@code total_store_size} */ - public final Builder dataStreams(DataStreamStats value, DataStreamStats... values) { - this.dataStreams = _listAdd(this.dataStreams, value, values); + @Nonnull + public final Builder totalStoreSize(@Nullable String value) { + this.totalStoreSize = value; return this; } /** - * API name: {@code data_streams} + * Required - Total size, in bytes, of all shards for the selected data streams. + *

+ * API name: {@code total_store_size_bytes} + *

*/ - public final Builder dataStreams(Function> fn) { - return dataStreams(fn.apply(new DataStreamStats.Builder()).build()); + @Nonnull + public final Builder totalStoreSizeBytes(long value) { + this.totalStoreSizeBytes = value; + return this; } /** * Builds a {@link DataStreamsStatsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DataStreamsStatsResponse build() { _checkSingleUse(); @@ -252,18 +369,40 @@ public DataStreamsStatsResponse build() { */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - DataStreamsStatsResponse::setupDataStreamStatsResponseDeserializer + DataStreamsStatsResponse::setupDataStreamsStatsResponseDeserializer ); - protected static void setupDataStreamStatsResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); - op.add(Builder::dataStreamCount, JsonpDeserializer.integerDeserializer(), "data_stream_count"); + protected static void setupDataStreamsStatsResponseDeserializer(ObjectDeserializer op) { op.add(Builder::backingIndices, JsonpDeserializer.integerDeserializer(), "backing_indices"); - op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.integerDeserializer(), "total_store_size_bytes"); - op.add(Builder::totalStoreSize, JsonpDeserializer.stringDeserializer(), "total_store_size"); + op.add(Builder::dataStreamCount, JsonpDeserializer.integerDeserializer(), "data_stream_count"); op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamStats._DESERIALIZER), "data_streams"); + op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); + op.add(Builder::totalStoreSize, JsonpDeserializer.stringDeserializer(), "total_store_size"); + op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.longDeserializer(), "total_store_size_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.backingIndices); + result = 31 * result + Integer.hashCode(this.dataStreamCount); + result = 31 * result + this.dataStreams.hashCode(); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Objects.hashCode(this.totalStoreSize); + result = 31 * result + Long.hashCode(this.totalStoreSizeBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DataStreamsStatsResponse other = (DataStreamsStatsResponse) o; + return this.backingIndices == other.backingIndices + && this.dataStreamCount == other.dataStreamCount + && this.dataStreams.equals(other.dataStreams) + && this.shards.equals(other.shards) + && Objects.equals(this.totalStoreSize, other.totalStoreSize) + && this.totalStoreSizeBytes == other.totalStoreSizeBytes; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java new file mode 100644 index 0000000000..5e4008ead8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java @@ -0,0 +1,204 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.delete_data_stream.Request + +/** + * Deletes a data stream. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteDataStreamRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final List name; + + // --------------------------------------------------------------------------------------------- + + private DeleteDataStreamRequest(Builder builder) { + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + } + + public static DeleteDataStreamRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Comma-separated list of data streams to delete. Wildcard (*) expressions are supported. + *

+ * API name: {@code name} + *

+ */ + @Nonnull + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteDataStreamRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List name; + + public Builder() {} + + private Builder(DeleteDataStreamRequest o) { + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - Comma-separated list of data streams to delete. Wildcard (*) expressions are supported. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds all elements of list to name. + *

+ */ + @Nonnull + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Required - Comma-separated list of data streams to delete. Wildcard (*) expressions are supported. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds one or more values to name. + *

+ */ + @Nonnull + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); + return this; + } + + /** + * Builds a {@link DeleteDataStreamRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteDataStreamRequest build() { + _checkSingleUse(); + + return new DeleteDataStreamRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.delete_data_stream}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + return buf.toString(); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + DeleteDataStreamResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.name.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteDataStreamRequest other = (DeleteDataStreamRequest) o; + return this.name.equals(other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java new file mode 100644 index 0000000000..f31bd4584a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java @@ -0,0 +1,154 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.delete_data_stream.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteDataStreamResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private DeleteDataStreamResponse(Builder builder) { + super(builder); + } + + public static DeleteDataStreamResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteDataStreamResponse}. + */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteDataStreamResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteDataStreamResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteDataStreamResponse build() { + _checkSingleUse(); + + return new DeleteDataStreamResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteDataStreamResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteDataStreamResponse::setupDeleteDataStreamResponseDeserializer + ); + + protected static void setupDeleteDataStreamResponseDeserializer(ObjectDeserializer op) { + setupAcknowledgedResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java new file mode 100644 index 0000000000..e9e21e39a3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java @@ -0,0 +1,221 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.get_data_stream.Request + +/** + * Returns data streams. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetDataStreamRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final List name; + + // --------------------------------------------------------------------------------------------- + + private GetDataStreamRequest(Builder builder) { + this.name = ApiTypeHelper.unmodifiable(builder.name); + } + + public static GetDataStreamRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Comma-separated list of data stream names used to limit the request. Wildcard (*) expressions are supported. If omitted, + * all data streams are returned. + *

+ * API name: {@code name} + *

+ */ + @Nonnull + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetDataStreamRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List name; + + public Builder() {} + + private Builder(GetDataStreamRequest o) { + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Comma-separated list of data stream names used to limit the request. Wildcard (*) expressions are supported. If + * omitted, all data streams are returned. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds all elements of list to name. + *

+ */ + @Nonnull + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Comma-separated list of data stream names used to limit the request. Wildcard (*) expressions are supported. If + * omitted, all data streams are returned. + *

+ * API name: {@code name} + *

+ * + *

+ * Adds one or more values to name. + *

+ */ + @Nonnull + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); + return this; + } + + /** + * Builds a {@link GetDataStreamRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetDataStreamRequest build() { + _checkSingleUse(); + + return new GetDataStreamRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.get_data_stream}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; + + if (propsSet == 0) { + return "/_data_stream"; + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + SimpleEndpoint.emptyMap(), + SimpleEndpoint.emptyMap(), + false, + GetDataStreamResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetDataStreamRequest other = (GetDataStreamRequest) o; + return Objects.equals(this.name, other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java new file mode 100644 index 0000000000..074f14cb05 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java @@ -0,0 +1,220 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.get_data_stream.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetDataStreamResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List dataStreams; + + // --------------------------------------------------------------------------------------------- + + private GetDataStreamResponse(Builder builder) { + this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); + } + + public static GetDataStreamResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code data_streams} + */ + @Nonnull + public final List dataStreams() { + return this.dataStreams; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("data_streams"); + generator.writeStartArray(); + for (DataStream item0 : this.dataStreams) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetDataStreamResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List dataStreams; + + public Builder() {} + + private Builder(GetDataStreamResponse o) { + this.dataStreams = _listCopy(o.dataStreams); + } + + private Builder(Builder o) { + this.dataStreams = _listCopy(o.dataStreams); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds all elements of list to dataStreams. + *

+ */ + @Nonnull + public final Builder dataStreams(List list) { + this.dataStreams = _listAddAll(this.dataStreams, list); + return this; + } + + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds one or more values to dataStreams. + *

+ */ + @Nonnull + public final Builder dataStreams(DataStream value, DataStream... values) { + this.dataStreams = _listAdd(this.dataStreams, value, values); + return this; + } + + /** + * Required - API name: {@code data_streams} + * + *

+ * Adds a value to dataStreams using a builder lambda. + *

+ */ + @Nonnull + public final Builder dataStreams(Function> fn) { + return dataStreams(fn.apply(new DataStream.Builder()).build()); + } + + /** + * Builds a {@link GetDataStreamResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetDataStreamResponse build() { + _checkSingleUse(); + + return new GetDataStreamResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetDataStreamResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetDataStreamResponse::setupGetDataStreamResponseDeserializer + ); + + protected static void setupGetDataStreamResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStream._DESERIALIZER), "data_streams"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.dataStreams.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetDataStreamResponse other = (GetDataStreamResponse) o; + return this.dataStreams.equals(other.dataStreams); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ManagedBy.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ManagedBy.java new file mode 100644 index 0000000000..f6f9491074 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ManagedBy.java @@ -0,0 +1,65 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * 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. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: indices.ManagedBy + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ManagedBy implements JsonEnum { + DataStreamLifecycle("Data stream lifecycle"), + + IndexLifecycleManagement("Index Lifecycle Management"), + + Unmanaged("Unmanaged"); + + private final String jsonValue; + + ManagedBy(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ManagedBy.values()); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java index 2959a09154..4e752a7ee1 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java @@ -78,6 +78,55 @@ public final CompletableFuture create(Function createDataStream(CreateDataStreamRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CreateDataStreamRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates or updates a data stream. + * + * @param fn a function that initializes a builder to create the {@link CreateDataStreamRequest} + */ + public final CompletableFuture createDataStream( + Function> fn + ) throws IOException, OpenSearchException { + return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); + } + + // ----- Endpoint: indices.data_streams_stats + + /** + * Provides statistics on operations happening in a data stream. + */ + public CompletableFuture dataStreamsStats(DataStreamsStatsRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DataStreamsStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides statistics on operations happening in a data stream. + * + * @param fn a function that initializes a builder to create the {@link DataStreamsStatsRequest} + */ + public final CompletableFuture dataStreamsStats( + Function> fn + ) throws IOException, OpenSearchException { + return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); + } + + /** + * Provides statistics on operations happening in a data stream. + */ + public final CompletableFuture dataStreamsStats() throws IOException, OpenSearchException { + return dataStreamsStats(new DataStreamsStatsRequest.Builder().build()); + } + // ----- Endpoint: indices.delete /** @@ -97,6 +146,27 @@ public final CompletableFuture delete(Function deleteDataStream(DeleteDataStreamRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DeleteDataStreamRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a data stream. + * + * @param fn a function that initializes a builder to create the {@link DeleteDataStreamRequest} + */ + public final CompletableFuture deleteDataStream( + Function> fn + ) throws IOException, OpenSearchException { + return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); + } + // ----- Endpoint: indices.delete_index_template /** @@ -217,6 +287,33 @@ public final CompletableFuture get(Function getDataStream(GetDataStreamRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetDataStreamRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns data streams. + * + * @param fn a function that initializes a builder to create the {@link GetDataStreamRequest} + */ + public final CompletableFuture getDataStream( + Function> fn + ) throws IOException, OpenSearchException { + return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); + } + + /** + * Returns data streams. + */ + public final CompletableFuture getDataStream() throws IOException, OpenSearchException { + return getDataStream(new GetDataStreamRequest.Builder().build()); + } + // ----- Endpoint: indices.get_index_template /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java index c9c20e12d3..d0acea740b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java @@ -77,6 +77,53 @@ public final CreateIndexResponse create(Function> fn + ) throws IOException, OpenSearchException { + return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); + } + + // ----- Endpoint: indices.data_streams_stats + + /** + * Provides statistics on operations happening in a data stream. + */ + public DataStreamsStatsResponse dataStreamsStats(DataStreamsStatsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DataStreamsStatsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Provides statistics on operations happening in a data stream. + * + * @param fn a function that initializes a builder to create the {@link DataStreamsStatsRequest} + */ + public final DataStreamsStatsResponse dataStreamsStats( + Function> fn + ) throws IOException, OpenSearchException { + return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); + } + + /** + * Provides statistics on operations happening in a data stream. + */ + public final DataStreamsStatsResponse dataStreamsStats() throws IOException, OpenSearchException { + return dataStreamsStats(new DataStreamsStatsRequest.Builder().build()); + } + // ----- Endpoint: indices.delete /** @@ -96,6 +143,26 @@ public final DeleteIndexResponse delete(Function> fn + ) throws IOException, OpenSearchException { + return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); + } + // ----- Endpoint: indices.delete_index_template /** @@ -212,6 +279,32 @@ public final GetIndexResponse get(Function> fn) + throws IOException, OpenSearchException { + return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); + } + + /** + * Returns data streams. + */ + public final GetDataStreamResponse getDataStream() throws IOException, OpenSearchException { + return getDataStream(new GetDataStreamRequest.Builder().build()); + } + // ----- Endpoint: indices.get_index_template /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java deleted file mode 100644 index 04314828f7..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamRequest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.function.Function; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.create_data_stream.Request - -/** - * Creates a data stream - */ -public class CreateDataStreamRequest extends RequestBase { - - private final String name; - - // --------------------------------------------------------------------------------------------- - - private CreateDataStreamRequest(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - } - - public static CreateDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The name of the data stream - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateDataStreamRequest}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - - private String name; - - /** - * Required - The name of the data stream - *

- * API name: {@code name} - */ - public final Builder name(String name) { - this.name = name; - return this; - } - - public CreateDataStreamRequest build() { - _checkSingleUse(); - - return new CreateDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.create_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { return "PUT"; }, - - // Request path - request -> { - final int _name = 1 << 0; - int propsSet = 0; - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - sbd.append("/"); - SimpleEndpoint.pathEncode(request.name, sbd); - return sbd.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - }, - - // Request parameters - SimpleEndpoint.emptyMap(), - - SimpleEndpoint.emptyMap(), - false, - CreateDataStreamResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java deleted file mode 100644 index 7fc25ffe68..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CreateDataStreamResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: indices.create_data_stream.Response - -@JsonpDeserializable -public class CreateDataStreamResponse extends AcknowledgedResponseBase { - - // --------------------------------------------------------------------------------------------- - - private CreateDataStreamResponse(Builder builder) { - super(builder); - } - - public static CreateDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CreateDataStreamResponse} - */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link CreateDataStreamResponse}. - * - * @throws NullPointerException - * if any required field is null. - */ - public CreateDataStreamResponse build() { - _checkSingleUse(); - - return new CreateDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CreateDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - CreateDataStreamResponse::setupCreateDataStreamResponseDeserializer - ); - - protected static void setupCreateDataStreamResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamIndexInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamIndexInfo.java deleted file mode 100644 index 335a67d022..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamIndexInfo.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices._types.DataStreamIndexInfo -@JsonpDeserializable -public class DataStreamIndexInfo implements PlainJsonSerializable { - - private final String indexName; - - private final String indexUuid; - - // --------------------------------------------------------------------------------------------- - - private DataStreamIndexInfo(Builder builder) { - - this.indexName = ApiTypeHelper.requireNonNull(builder.indexName, this, "indexName"); - this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); - - } - - public static DataStreamIndexInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Index name - *

- * API name: {@code index_name} - */ - public final String indexName() { - return this.indexName; - } - - /** - * Required - Index uuid - *

- * API name: {@code index_uuid} - */ - public final String indexUuid() { - return this.indexUuid; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index_name"); - generator.write(this.indexName); - - generator.writeKey("index_uuid"); - generator.write(this.indexUuid); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamIndexInfo}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String indexName; - - private String indexUuid; - - /** - * Required - Index name - *

- * API name: {@code index_name} - */ - public final Builder indexName(String value) { - this.indexName = value; - return this; - } - - /** - * Required - Index uuid - *

- * API name: {@code index_uuid} - */ - public final Builder indexUuid(String value) { - this.indexUuid = value; - return this; - } - - /** - * Builds a {@link DataStreamIndexInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamIndexInfo build() { - _checkSingleUse(); - - return new DataStreamIndexInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamIndexInfo} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - DataStreamIndexInfo::setupDataStreamIndexInfoDeserializer - ); - - protected static void setupDataStreamIndexInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); - op.add(Builder::indexUuid, JsonpDeserializer.stringDeserializer(), "index_uuid"); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamInfo.java deleted file mode 100644 index fe359d54af..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamInfo.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.HealthStatus; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices._types.DataStreamInfo - -@JsonpDeserializable -public class DataStreamInfo implements PlainJsonSerializable { - private final String name; - - private final DataStreamTimestampField timestampField; - - private final List indices; - - private final int generation; - - private final HealthStatus status; - - private final String template; - - // --------------------------------------------------------------------------------------------- - - private DataStreamInfo(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.timestampField = ApiTypeHelper.requireNonNull(builder.timestampField, this, "timestampField"); - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.generation = ApiTypeHelper.requireNonNull(builder.generation, this, "generation"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - } - - public static DataStreamInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - data stream name - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - data stream timestamp field - *

- * API name: {@code timestamp_field} - */ - public final DataStreamTimestampField timestampField() { - return this.timestampField; - } - - /** - * Required - information about data stream's backing indices - *

- * API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Required - generation - *

- * API name: {@code generation} - */ - public final int generation() { - return this.generation; - } - - /** - * Required - health status of the data stream - *

- * API name: {@code status} - */ - public final HealthStatus status() { - return this.status; - } - - /** - * Required - index template name used to create the data stream's backing indices - *

- * API name: {@code template} - */ - public final String template() { - return this.template; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("timestamp_field"); - this.timestampField.serialize(generator, mapper); - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (DataStreamIndexInfo item : this.indices) { - item.serialize(generator, mapper); - } - generator.writeEnd(); - } - - generator.writeKey("generation"); - generator.write(this.generation); - - generator.writeKey("status"); - this.status.serialize(generator, mapper); - - generator.writeKey("template"); - generator.write(this.template); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamInfo}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - private DataStreamTimestampField timestampField; - - private List indices; - - private int generation; - - private HealthStatus status; - - private String template; - - /** - * Required - data stream name - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - data stream timestamp field - *

- * API name: {@code timestamp_field} - */ - public final Builder timestampField(DataStreamTimestampField value) { - this.timestampField = value; - return this; - } - - /** - * Required - data stream timestamp field - *

- * API name: {@code timestamp_field} - */ - public final Builder timestampField(Function> fn) { - return this.timestampField(fn.apply(new DataStreamTimestampField.Builder()).build()); - } - - /** - * Required - information about data stream's backing indices - *

- * API name: {@code indices} - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * Required - information about data stream's backing indices - *

- * API name: {@code indices} - */ - public final Builder indices(DataStreamIndexInfo value, DataStreamIndexInfo... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Required - generation - *

- * API name: {@code generation} - */ - public final Builder generation(int value) { - this.generation = value; - return this; - } - - /** - * Required - health status of the data stream - *

- * API name: {@code status} - */ - public final Builder status(HealthStatus value) { - this.status = value; - return this; - } - - /** - * Required - index template name used to create the data stream's backing indices - *

- * API name: {@code template} - */ - public final Builder template(String value) { - this.template = value; - return this; - } - - /** - * Builds a {@link DataStreamInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DataStreamInfo build() { - _checkSingleUse(); - - return new DataStreamInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DataStreamInfo} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - DataStreamInfo::setupDataStreamInfoDeserializer - ); - - protected static void setupDataStreamInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::timestampField, DataStreamTimestampField._DESERIALIZER, "timestamp_field"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(DataStreamIndexInfo._DESERIALIZER), "indices"); - op.add(Builder::generation, JsonpDeserializer.integerDeserializer(), "generation"); - op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); - op.add(Builder::template, JsonpDeserializer.stringDeserializer(), "template"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java deleted file mode 100644 index 170b134c32..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DataStreamsStatsRequest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.data_streams_stats.Request - -/** - * Returns statistics of data streams - */ -public class DataStreamsStatsRequest extends RequestBase { - - private final List name; - - @Nullable - private final Boolean human; - - // --------------------------------------------------------------------------------------------- - - private DataStreamsStatsRequest(Builder builder) { - this.name = ApiTypeHelper.unmodifiable(builder.name); - this.human = builder.human; - } - - public static DataStreamsStatsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - /** - * Specify this query parameter to include human readable fields in the response. - *

- * API name: {@code human} - */ - @Nullable - public final Boolean human() { - return this.human; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DataStreamsStatsRequest}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - - @Nullable - private List name; - - @Nullable - private Boolean human; - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - /** - * Specify this query parameter to include human readable fields in the response. - *

- * API name: {@code human} - */ - public final Builder human(@Nullable Boolean value) { - this.human = value; - return this; - } - - public DataStreamsStatsRequest build() { - _checkSingleUse(); - - return new DataStreamsStatsRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { return "GET"; }, - - // Request path - request -> { - final int _name = 1 << 0; - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) { - propsSet |= _name; - } - - if (propsSet == 0) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - sbd.append("/_stats"); - return sbd.toString(); - } - - if (propsSet == (_name)) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - sbd.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), sbd); - sbd.append("/_stats"); - return sbd.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.human != null) { - params.put("human", String.valueOf(request.human)); - } - return params; - }, - SimpleEndpoint.emptyMap(), - false, - DataStreamsStatsResponse._DESERIALIZER - ); - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java deleted file mode 100644 index 25420a23d2..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamRequest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.delete_data_stream.Request - -/** - * Deletes one or more data streams and their backing indices. - */ -public class DeleteDataStreamRequest extends RequestBase { - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private DeleteDataStreamRequest(Builder builder) { - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - } - - public static DeleteDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Comma-separated list of data streams to delete. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataStreamRequest}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - - private List name; - - /** - * Required - Comma-separated list of data streams to delete. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams to delete. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - public DeleteDataStreamRequest build() { - _checkSingleUse(); - - return new DeleteDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.delete_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { return "DELETE"; }, - - // Request path - request -> { - final int _name = 1 << 0; - int propsSet = 0; - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - sbd.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), sbd); - return sbd.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - }, - - // Request parameters - SimpleEndpoint.emptyMap(), - - SimpleEndpoint.emptyMap(), - false, - DeleteDataStreamResponse._DESERIALIZER - ); - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java deleted file mode 100644 index 2ed7e00422..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteDataStreamResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; -import org.opensearch.client.util.ObjectBuilder; - -// typedef: indices.delete_data_stream.Response - -@JsonpDeserializable -public class DeleteDataStreamResponse extends AcknowledgedResponseBase { - - // --------------------------------------------------------------------------------------------- - - private DeleteDataStreamResponse(Builder builder) { - super(builder); - } - - public static DeleteDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link DeleteDataStreamResponse} - */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder - implements - ObjectBuilder { - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link DeleteDataStreamResponse}. - * - * @throws NullPointerException - * if any required field is null. - */ - public DeleteDataStreamResponse build() { - _checkSingleUse(); - - return new DeleteDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link DeleteDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - DeleteDataStreamResponse::setupDeleteDataStreamResponseDeserializer - ); - - protected static void setupDeleteDataStreamResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java deleted file mode 100644 index 61293727ae..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamRequest.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.get_data_stream.Request - -/** - * Returns data streams - */ -public class GetDataStreamRequest extends RequestBase { - - private final List name; - - // --------------------------------------------------------------------------------------------- - - private GetDataStreamRequest(Builder builder) { - this.name = ApiTypeHelper.unmodifiable(builder.name); - } - - public static GetDataStreamRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - */ - public final List name() { - return this.name; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataStreamRequest}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - - @Nullable - private List name; - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - *

- * Adds all elements of list to name. - */ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; - } - - /** - * Required - Comma-separated list of data streams to get. - *

- * API name: {@code name} - *

- * Adds one or more values to name. - */ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); - return this; - } - - public GetDataStreamRequest build() { - _checkSingleUse(); - - return new GetDataStreamRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code indices.get_data_stream}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { return "GET"; }, - - // Request path - request -> { - final int _name = 1 << 0; - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.name())) { - propsSet |= _name; - } - - if (propsSet == 0) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - return sbd.toString(); - } - - if (propsSet == (_name)) { - StringBuilder sbd = new StringBuilder(); - sbd.append("/_data_stream"); - sbd.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), sbd); - return sbd.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - }, - - // Request parameters - SimpleEndpoint.emptyMap(), - - SimpleEndpoint.emptyMap(), - false, - GetDataStreamResponse._DESERIALIZER - ); - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java deleted file mode 100644 index cfd1fd9e58..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetDataStreamResponse.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -package org.opensearch.client.opensearch.indices; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: indices.get_data_stream.Response - -@JsonpDeserializable -public class GetDataStreamResponse implements PlainJsonSerializable { - - private final List dataStreams; - - // --------------------------------------------------------------------------------------------- - - private GetDataStreamResponse(Builder builder) { - - this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); - - } - - public static GetDataStreamResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code data_streams} - */ - public final List dataStreams() { - return this.dataStreams; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.dataStreams)) { - generator.writeKey("data_streams"); - generator.writeStartArray(); - for (DataStreamInfo item : this.dataStreams) { - item.serialize(generator, mapper); - } - generator.writeEnd(); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetDataStreamResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private List dataStreams; - - /** - * API name: {@code data_streams} - */ - public final Builder dataStreams(List list) { - this.dataStreams = _listAddAll(this.dataStreams, list); - return this; - } - - /** - * Builds a {@link GetDataStreamResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetDataStreamResponse build() { - _checkSingleUse(); - - return new GetDataStreamResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetDataStreamResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - GetDataStreamResponse::setupGetDataStreamResponseDeserializer - ); - - protected static void setupGetDataStreamResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamInfo._DESERIALIZER), "data_streams"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java index 3f4b646b5d..fcf4f5f2d2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java @@ -248,68 +248,6 @@ public final CompletableFuture close(Function createDataStream(CreateDataStreamRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CreateDataStreamRequest, - CreateDataStreamResponse, - ErrorResponse>) CreateDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates a data stream - * - * @param fn - * a function that initializes a builder to create the {@link CreateDataStreamRequest} - */ - - public CompletableFuture createDataStream( - Function> fn - ) throws IOException, OpenSearchException { - return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_stream - - /** - * Deletes one or more data streams and their backing indices. - */ - - public CompletableFuture deleteDataStream(DeleteDataStreamRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteDataStreamRequest, - DeleteDataStreamResponse, - ErrorResponse>) DeleteDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes one or more data streams and their backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataStreamRequest} - * - */ - - public final CompletableFuture deleteDataStream( - Function> fn - ) throws IOException, OpenSearchException { - return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); - } - // ----- Endpoint: indices.delete_alias /** @@ -495,53 +433,6 @@ public CompletableFuture forcemerge() throws IOException, Op ); } - // ----- Endpoint: indices.get_data_stream - - /** - * Returns information about one or more data streams. - * - * - */ - - public CompletableFuture getDataStream(GetDataStreamRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetDataStreamRequest, - GetDataStreamResponse, - ErrorResponse>) GetDataStreamRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataStreamRequest} - * - */ - - public final CompletableFuture getDataStream( - Function> fn - ) throws IOException, OpenSearchException { - return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); - } - - /** - * Returns information about one or more data streams. - * - * - */ - - public CompletableFuture getDataStream() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetDataStreamRequest.Builder().build(), - GetDataStreamRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.get_alias /** @@ -1080,54 +971,6 @@ public CompletableFuture stats() throws IOException, OpenS ); } - // ----- Endpoint: indices.data_streams_stats - - /** - * Returns statistics of data streams - * - * - */ - - public CompletableFuture dataStreamsStats(DataStreamsStatsRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DataStreamsStatsRequest, - DataStreamsStatsResponse, - ErrorResponse>) DataStreamsStatsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns statistics of data streams - * - * @param fn - * a function that initializes a builder to create the - * {@link DataStreamsStatsRequest} - * - */ - - public final CompletableFuture dataStreamsStats( - Function> fn - ) throws IOException, OpenSearchException { - return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); - } - - /** - * Returns statistics of data streams - * - * - */ - - public CompletableFuture dataStreamsStats() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new DataStreamsStatsRequest.Builder().build(), - DataStreamsStatsRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.update_aliases /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java index 8b566e65cc..ce118e402a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java @@ -235,66 +235,6 @@ public final CloseIndexResponse close(Function endpoint = (JsonEndpoint< - CreateDataStreamRequest, - CreateDataStreamResponse, - ErrorResponse>) CreateDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates a data stream - * - * @param fn - * a function that initializes a builder to create the {@link CreateDataStreamRequest} - */ - - public final CreateDataStreamResponse createDataStream( - Function> fn - ) throws IOException, OpenSearchException { - return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); - } - - // ----- Endpoint: indices.delete_data_stream - - /** - * Deletes one or more data streams and their backing indices. - */ - - public DeleteDataStreamResponse deleteDataStream(DeleteDataStreamRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteDataStreamRequest, - DeleteDataStreamResponse, - ErrorResponse>) DeleteDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes one or more data streams and their backing indices. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDataStreamRequest} - * - */ - - public final DeleteDataStreamResponse deleteDataStream( - Function> fn - ) throws IOException, OpenSearchException { - return deleteDataStream(fn.apply(new DeleteDataStreamRequest.Builder()).build()); - } - // ----- Endpoint: indices.delete_alias /** @@ -475,52 +415,6 @@ public ForcemergeResponse forcemerge() throws IOException, OpenSearchException { return this.transport.performRequest(new ForcemergeRequest.Builder().build(), ForcemergeRequest._ENDPOINT, this.transportOptions); } - // ----- Endpoint: indices.get_data_stream - - /** - * Returns information about one or more data streams. - * - * - */ - - public GetDataStreamResponse getDataStream(GetDataStreamRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetDataStreamRequest, - GetDataStreamResponse, - ErrorResponse>) GetDataStreamRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about one or more data streams. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetDataStreamRequest} - * - */ - - public final GetDataStreamResponse getDataStream(Function> fn) - throws IOException, OpenSearchException { - return getDataStream(fn.apply(new GetDataStreamRequest.Builder()).build()); - } - - /** - * Returns information about one or more data streams. - * - * - */ - - public GetDataStreamResponse getDataStream() throws IOException, OpenSearchException { - return this.transport.performRequest( - new GetDataStreamRequest.Builder().build(), - GetDataStreamRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.get_alias /** @@ -1046,53 +940,6 @@ public IndicesStatsResponse stats() throws IOException, OpenSearchException { ); } - // ----- Endpoint: indices.data_streams_stats - - /** - * Returns statistics of data streams - * - * - */ - - public DataStreamsStatsResponse dataStreamsStats(DataStreamsStatsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DataStreamsStatsRequest, - DataStreamsStatsResponse, - ErrorResponse>) DataStreamsStatsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns statistics of data streams - * - * @param fn - * a function that initializes a builder to create the - * {@link DataStreamsStatsRequest} - * - */ - - public final DataStreamsStatsResponse dataStreamsStats( - Function> fn - ) throws IOException, OpenSearchException { - return dataStreamsStats(fn.apply(new DataStreamsStatsRequest.Builder()).build()); - } - - /** - * Returns statistics of data streams - * - * - */ - - public DataStreamsStatsResponse dataStreamsStats() throws IOException, OpenSearchException { - return this.transport.performRequest( - new DataStreamsStatsRequest.Builder().build(), - DataStreamsStatsRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: indices.update_aliases /** diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java index 09747c666c..75d3a09119 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractIndicesClientIT.java @@ -148,30 +148,33 @@ public void testDataStream() throws IOException { assertEquals(1, getAllDataStreamsResponse.dataStreams().size()); // get one data stream stats - DataStreamsStatsResponse dataStreamStatsResponse = javaClient().indices().dataStreamsStats(b -> b.name(dataStreamName).human(true)); + // TODO: support the `human` global parameter on all requests + DataStreamsStatsResponse dataStreamStatsResponse = javaClient().indices() + .dataStreamsStats(b -> b.name(dataStreamName)/* .human(true) */); assertNotNull(dataStreamStatsResponse.shards()); assertEquals(1, dataStreamStatsResponse.dataStreamCount()); assertEquals(1, dataStreamStatsResponse.backingIndices()); assertTrue(dataStreamStatsResponse.totalStoreSizeBytes() > 0L); - assertNotNull(dataStreamStatsResponse.totalStoreSize()); + // assertNotNull(dataStreamStatsResponse.totalStoreSize()); assertEquals(1, dataStreamStatsResponse.dataStreams().size()); assertEquals(dataStreamName, dataStreamStatsResponse.dataStreams().get(0).dataStream()); assertEquals(1, dataStreamStatsResponse.dataStreams().get(0).backingIndices()); assertTrue(dataStreamStatsResponse.dataStreams().get(0).storeSizeBytes() > 0); - assertNotNull(dataStreamStatsResponse.dataStreams().get(0).storeSize()); + // assertNotNull(dataStreamStatsResponse.dataStreams().get(0).storeSize()); // get all data streams stats - DataStreamsStatsResponse allDataStreamsStatsResponse = javaClient().indices().dataStreamsStats(b -> b.human(true)); + // TODO: support the `human` global parameter on all requests + DataStreamsStatsResponse allDataStreamsStatsResponse = javaClient().indices().dataStreamsStats(b -> b/* .human(true) */); assertNotNull(allDataStreamsStatsResponse.shards()); assertEquals(1, allDataStreamsStatsResponse.dataStreamCount()); assertEquals(1, allDataStreamsStatsResponse.backingIndices()); assertTrue(allDataStreamsStatsResponse.totalStoreSizeBytes() > 0L); - assertNotNull(allDataStreamsStatsResponse.totalStoreSize()); + // assertNotNull(allDataStreamsStatsResponse.totalStoreSize()); assertEquals(1, allDataStreamsStatsResponse.dataStreams().size()); assertEquals(dataStreamName, allDataStreamsStatsResponse.dataStreams().get(0).dataStream()); assertEquals(1, allDataStreamsStatsResponse.dataStreams().get(0).backingIndices()); assertTrue(allDataStreamsStatsResponse.dataStreams().get(0).storeSizeBytes() > 0); - assertNotNull(allDataStreamsStatsResponse.dataStreams().get(0).storeSize()); + // assertNotNull(allDataStreamsStatsResponse.dataStreams().get(0).storeSize()); // delete data stream DeleteDataStreamResponse deleteDataStreamResponse = javaClient().indices().deleteDataStream(b -> b.name(namePattern)); diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 7e7f867ab4..f21d3aa555 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -5065,8 +5065,8 @@ paths: get: operationId: observability.get_localstats.0 x-operation-group: observability.get_localstats - x-version-added: '1.1' - description: Retrieves Local Stats of all observability objects. + x-version-added: '2.5' + description: Retrieves local stats of all observability objects. responses: '200': $ref: '#/components/responses/observability.get_localstats___200' @@ -5630,8 +5630,8 @@ paths: externalDocs: url: https://opensearch.org/docs/latest/im-plugin/index-rollups/rollup-api/#create-or-update-an-index-rollup-job responses: - '200': - $ref: '#/components/responses/rollups.put___200' + '201': + $ref: '#/components/responses/rollups.put___201' parameters: - $ref: '#/components/parameters/rollups.put___path.id' - $ref: '#/components/parameters/rollups.put___query.if_primary_term' @@ -7473,6 +7473,149 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_sm/policies: + get: + operationId: sm.get_policies.0 + x-operation-group: sm.get_policies + x-version-added: '2.1' + description: Retrieves all snapshot management policies with optional pagination and filtering. + parameters: + - $ref: '#/components/parameters/sm.get_policies___query.from' + - $ref: '#/components/parameters/sm.get_policies___query.queryString' + - $ref: '#/components/parameters/sm.get_policies___query.size' + - $ref: '#/components/parameters/sm.get_policies___query.sortField' + - $ref: '#/components/parameters/sm.get_policies___query.sortOrder' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.get_policies___200' + /_plugins/_sm/policies/{policy_name}: + delete: + operationId: sm.delete_policy.0 + x-operation-group: sm.delete_policy + x-version-added: '2.1' + description: Deletes a snapshot management policy. + parameters: + - $ref: '#/components/parameters/sm.delete_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.delete_policy___200' + '404': + $ref: '#/components/responses/sm.delete_policy___404' + get: + operationId: sm.get_policy.0 + x-operation-group: sm.get_policy + x-version-added: '2.1' + description: Retrieves a specific snapshot management policy by name. + parameters: + - $ref: '#/components/parameters/sm.get_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.get_policy___200' + '404': + $ref: '#/components/responses/sm.get_policy___404' + post: + operationId: sm.create_policy.0 + x-operation-group: sm.create_policy + x-version-added: '2.1' + description: Creates a snapshot management policy. + parameters: + - $ref: '#/components/parameters/sm.create_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sm.create_policy' + responses: + '201': + $ref: '#/components/responses/sm.create_policy___201' + '400': + $ref: '#/components/responses/sm.create_policy___400' + put: + operationId: sm.update_policy.0 + x-operation-group: sm.update_policy + x-version-added: '2.1' + description: Updates an existing snapshot management policy. Requires `if_seq_no` and `if_primary_term`. + parameters: + - $ref: '#/components/parameters/sm.update_policy___path.policy_name' + - $ref: '#/components/parameters/sm.update_policy___query.if_primary_term' + - $ref: '#/components/parameters/sm.update_policy___query.if_seq_no' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sm.update_policy' + responses: + '200': + $ref: '#/components/responses/sm.update_policy___200' + '404': + $ref: '#/components/responses/sm.update_policy___404' + /_plugins/_sm/policies/{policy_name}/_explain: + get: + operationId: sm.explain_policy.0 + x-operation-group: sm.explain_policy + x-version-added: '2.1' + description: Explains the state of the snapshot management policy. + parameters: + - $ref: '#/components/parameters/sm.explain_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.explain_policy___200' + /_plugins/_sm/policies/{policy_name}/_start: + post: + operationId: sm.start_policy.0 + x-operation-group: sm.start_policy + x-version-added: '2.1' + description: Starts a snapshot management policy. + parameters: + - $ref: '#/components/parameters/sm.start_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.start_policy___200' + /_plugins/_sm/policies/{policy_name}/_stop: + post: + operationId: sm.stop_policy.0 + x-operation-group: sm.stop_policy + x-version-added: '2.1' + description: Stops a snapshot management policy. + parameters: + - $ref: '#/components/parameters/sm.stop_policy___path.policy_name' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/sm.stop_policy___200' /_plugins/_sql: post: operationId: sql.query.0 @@ -7672,6 +7815,8 @@ paths: responses: '200': $ref: '#/components/responses/transforms.put___200' + '201': + $ref: '#/components/responses/transforms.put___201' /_plugins/_transform/{id}/_explain: get: operationId: transforms.explain.0 @@ -8374,6 +8519,8 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards___200' @@ -8396,6 +8543,8 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards___200' @@ -11538,6 +11687,8 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards___200' @@ -11561,6 +11712,8 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/search_shards' responses: '200': $ref: '#/components/responses/search_shards___200' @@ -12977,8 +13130,8 @@ paths: externalDocs: url: https://opensearch.org/docs/latest/im-plugin/index-rollups/rollup-api/#create-or-update-an-index-rollup-job responses: - '200': - $ref: '#/components/responses/rollups.put___200' + '201': + $ref: '#/components/responses/rollups.put___201' parameters: - $ref: '#/components/parameters/rollups.put___path.id' - $ref: '#/components/parameters/rollups.put___query.if_primary_term' @@ -22264,12 +22417,19 @@ components: - graph_memory_usage_percentage - graph_query_errors - graph_query_requests + - graph_stats - hit_count - indexing_from_model_degraded - indices_in_cache - knn_query_requests + - knn_query_with_filter_requests - load_exception_count - load_success_count + - lucene_initialized + - max_distance_query_requests + - max_distance_query_with_filter_requests + - min_score_query_requests + - min_score_query_with_filter_requests - miss_count - model_index_status - nmslib_initialized @@ -24820,6 +24980,103 @@ components: schema: type: boolean required: false + sm.create_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.delete_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.explain_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.get_policies___query.from: + name: from + in: query + description: 'The starting index (default: 0)' + schema: + type: integer + sm.get_policies___query.queryString: + name: queryString + in: query + description: A query string to filter policies. + schema: + type: string + sm.get_policies___query.size: + name: size + in: query + description: The number of policies to return. + schema: + type: integer + sm.get_policies___query.sortField: + name: sortField + in: query + description: The field to sort on. + schema: + type: string + sm.get_policies___query.sortOrder: + name: sortOrder + in: query + description: The order of sorting. + schema: + type: string + enum: + - asc + - desc + default: asc + sm.get_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.start_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.stop_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.update_policy___path.policy_name: + name: policy_name + in: path + description: The name of the snapshot management policy. + required: true + schema: + type: string + sm.update_policy___query.if_primary_term: + name: if_primary_term + in: query + description: The primary term of the policy to update. + required: true + schema: + type: integer + sm.update_policy___query.if_seq_no: + name: if_seq_no + in: query + description: The sequence number of the policy to update. + required: true + schema: + type: integer snapshot.cleanup_repository___path.repository: in: path name: repository @@ -26775,36 +27032,7 @@ components: content: application/json: schema: - type: object - properties: - training_index: - type: string - training_field: - type: string - dimension: - type: integer - format: int32 - max_training_vector_count: - type: integer - format: int32 - search_size: - type: integer - format: int32 - description: - type: string - mode: - type: string - compression_level: - type: string - method: - type: string - spaceType: - type: string - required: - - dimension - - training_field - - training_index - required: true + $ref: '#/components/schemas/knn._common___TrainedModel' mget: content: application/json: @@ -27385,6 +27613,46 @@ components: schema: $ref: '#/components/schemas/search_pipeline._common___SearchPipelineStructure' required: true + search_shards: + content: + application/json: + schema: + type: object + properties: + query: + description: Defines the search query to filter shards. Supports any query that is valid for the `_search` endpoint. + type: object + additionalProperties: + type: object + indices_boost: + description: Allows increasing the relevance of specific indexes in the search. + type: object + additionalProperties: + type: number + allow_partial_search_results: + description: Indicates whether partial search results are allowed if some shards are unavailable. + type: boolean + _source: + description: Specifies which fields to include in the `_source` response or excludes specific fields. + oneOf: + - type: boolean + - type: array + items: + type: string + from: + description: The starting offset (default 0) for paginated results. + type: integer + size: + description: The maximum number of results to return (default 10). + type: integer + sort: + description: A list of fields and directions for sorting the results. + type: array + items: + type: object + additionalProperties: + type: string + description: Defines the parameters that can be used in the `search_shards` endpoint request. See documentation for supported query syntax. search_template: content: application/json: @@ -27614,6 +27882,16 @@ components: application/json: schema: $ref: '#/components/schemas/security._common___DistinguishedNames' + sm.create_policy: + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___CreateUpdatePolicyRequest' + sm.update_policy: + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___CreateUpdatePolicyRequest' snapshot.clone: content: application/json: @@ -27784,17 +28062,12 @@ components: content: application/json: schema: - type: object - properties: - transform: - $ref: '#/components/schemas/transforms._common___Transform' - required: - - transform + $ref: '#/components/schemas/transforms._common___TransformRequest' transforms.put: content: application/json: schema: - $ref: '#/components/schemas/transforms._common___Transform' + $ref: '#/components/schemas/transforms._common___TransformRequest' update: content: application/json: @@ -29094,16 +29367,18 @@ components: $ref: '#/components/schemas/_common___ShardStatistics' backing_indices: description: Total number of backing indexes for the selected data streams. - type: number + type: integer + format: int32 data_stream_count: description: Total number of selected data streams. - type: number + type: integer + format: int32 data_streams: description: Contains statistics for the selected data streams. type: array items: - $ref: '#/components/schemas/indices.data_streams_stats___DataStreamsStatsItem' - total_store_sizes: + $ref: '#/components/schemas/indices._common___DataStreamStats' + total_store_size: $ref: '#/components/schemas/_common___HumanReadableByteCount' total_store_size_bytes: description: Total size, in bytes, of all shards for the selected data streams. @@ -29689,6 +29964,10 @@ components: $ref: '#/components/schemas/ism._common___RetryIndexResponse' description: '' knn.delete_model___200: + content: + application/json: + schema: + $ref: '#/components/schemas/knn._common___DeletedModel' description: '' knn.get_model___200: content: @@ -29697,8 +29976,16 @@ components: type: object description: '' knn.search_models___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_core.search___ResponseBody' description: '' knn.stats___200: + content: + application/json: + schema: + $ref: '#/components/schemas/knn._common___Stats' description: '' knn.train_model___200: content: @@ -29712,6 +29999,10 @@ components: - model_id description: '' knn.warmup___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___ShardsOperationResponseBase' description: '' list.help___200: content: @@ -30134,7 +30425,7 @@ components: observability.get_localstats___200: description: Retrieves content: - application/json: + text/plain: schema: type: string observability.get_object___200: @@ -30403,6 +30694,10 @@ components: $ref: '#/components/schemas/_common___AcknowledgedResponseBase' description: '' rollups.delete___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' description: '' rollups.explain___200: content: @@ -30416,15 +30711,23 @@ components: schema: $ref: '#/components/schemas/rollups._common___RollupEntity' description: '' - rollups.put___200: + rollups.put___201: content: application/json: schema: $ref: '#/components/schemas/rollups._common___RollupEntity' description: '' rollups.start___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___AcknowledgedResponseBase' description: '' rollups.stop___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___AcknowledgedResponseBase' description: '' scripts_painless_execute___200: content: @@ -31382,6 +31685,84 @@ components: schema: $ref: '#/components/schemas/security._common___InternalServerError' description: '' + sm.create_policy___201: + description: Successfully created the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___PolicyResponse' + sm.create_policy___400: + description: Bad request when creating the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___BadRequestResponse' + sm.delete_policy___200: + description: Successfully deleted the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___DeletePolicyResponse' + sm.delete_policy___404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___NotFoundResponse' + sm.explain_policy___200: + description: Successfully explained the state of the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___PolicyExplanation' + sm.get_policies___200: + description: Successfully retrieved the list of snapshot management policies. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___GetPoliciesResponse' + sm.get_policy___200: + description: Successfully retrieved the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___PolicyResponse' + sm.get_policy___404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___NotFoundResponse' + sm.start_policy___200: + description: Successfully started the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + sm.stop_policy___200: + description: Successfully stopped the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + sm.update_policy___200: + description: Successfully updated the snapshot management policy. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___PolicyResponse' + sm.update_policy___404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '#/components/schemas/sm._common___NotFoundResponse' snapshot.cleanup_repository___200: content: application/json: @@ -31583,6 +31964,10 @@ components: - took description: '' transforms.delete___200: + content: + application/json: + schema: + $ref: '#/components/schemas/transforms._common___DeleteTransformsResponse' description: '' transforms.explain___200: content: @@ -31594,7 +31979,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/transforms._common___TransformEntity' + $ref: '#/components/schemas/transforms._common___TransformResponse' description: '' transforms.preview___200: content: @@ -31606,7 +31991,13 @@ components: content: application/json: schema: - $ref: '#/components/schemas/transforms._common___TransformEntity' + $ref: '#/components/schemas/transforms._common___TransformResponse' + description: '' + transforms.put___201: + content: + application/json: + schema: + $ref: '#/components/schemas/transforms._common___TransformResponse' description: '' transforms.search___200: content: @@ -32379,17 +32770,27 @@ components: - time_in_millis - total _common___HealthStatus: - type: string - enum: - - green - - red - - yellow - _common___HealthStatusCapitalized: - type: string - enum: - - GREEN - - RED - - YELLOW + oneOf: + - description: All shards are assigned. + type: string + enum: + - green + - GREEN + - description: | + All primary shards are assigned, but one or more replica shards are + unassigned. If a node in the cluster fails, some data could be unavailable + until that node is repaired. + type: string + enum: + - yellow + - YELLOW + - description: | + One or more primary shards are unassigned, so some data is unavailable. This + can occur briefly during cluster startup as primary shards are assigned. + type: string + enum: + - red + - RED _common___Host: type: string _common___HourAndMinute: @@ -33681,9 +34082,9 @@ components: - not: type: string enum: - - _score - _doc - _geo_distance + - _score - _script additionalProperties: $ref: '#/components/schemas/_common___FieldSort' @@ -49177,7 +49578,8 @@ components: type: boolean generation: description: Current generation for the data stream. This number acts as a cumulative count of the stream's rollovers, starting at 1. - type: number + type: integer + format: int64 hidden: description: If `true`, the data stream is hidden. type: boolean @@ -49201,7 +49603,7 @@ components: description: If `true`, the data stream is created and managed by cross-cluster replication and the local cluster can not write into this data stream or change its mappings. type: boolean status: - $ref: '#/components/schemas/_common___HealthStatusCapitalized' + $ref: '#/components/schemas/_common___HealthStatus' system: description: If `true`, the data stream is created and managed by an OpenSearch stack component and cannot be modified through normal user interaction. type: boolean @@ -49233,6 +49635,27 @@ components: required: - index_name - index_uuid + indices._common___DataStreamStats: + type: object + properties: + backing_indices: + description: Current number of backing indexes for the data stream. + type: integer + format: int32 + data_stream: + $ref: '#/components/schemas/_common___Name' + maximum_timestamp: + $ref: '#/components/schemas/_common___EpochTimeUnitMillis' + store_size: + $ref: '#/components/schemas/_common___HumanReadableByteCount' + store_size_bytes: + description: Total size, in bytes, of all shards for the data stream's backing indexes. + $ref: '#/components/schemas/_common___ByteCount' + required: + - backing_indices + - data_stream + - maximum_timestamp + - store_size_bytes indices._common___DataStreamTimestampField: type: object properties: @@ -50496,26 +50919,6 @@ components: $ref: '#/components/schemas/_common___ShardFailure' required: - failures - indices.data_streams_stats___DataStreamsStatsItem: - type: object - properties: - backing_indices: - description: Current number of backing indexes for the data stream. - type: number - data_stream: - $ref: '#/components/schemas/_common___Name' - maximum_timestamp: - $ref: '#/components/schemas/_common___EpochTimeUnitMillis' - store_size: - $ref: '#/components/schemas/_common___HumanReadableByteCount' - store_size_bytes: - description: Total size, in bytes, of all shards for the data stream's backing indexes. - $ref: '#/components/schemas/_common___ByteCount' - required: - - backing_indices - - data_stream - - maximum_timestamp - - store_size_bytes indices.get_alias___IndexAliases: type: object properties: @@ -50974,6 +51377,8 @@ components: $ref: '#/components/schemas/_common___Id' store_exception: $ref: '#/components/schemas/indices.shard_stores___ShardStoreException' + additionalProperties: + $ref: '#/components/schemas/_common___NodeAttributes' required: - allocation indices.shard_stores___ShardStoreAllocation: @@ -52930,12 +53335,143 @@ components: enum: - AND - OR + knn._common___DeletedModel: + type: object + properties: + model_id: + type: string + result: + type: string + enum: + - deleted + - error + required: + - model_id + - result + knn._common___GraphMergeStats: + type: object + properties: + current: + type: number + total: + type: number + total_time_in_millis: + $ref: '#/components/schemas/_common___DurationValueUnitMillis' + current_docs: + type: number + total_docs: + type: number + total_size_in_bytes: + $ref: '#/components/schemas/_common___ByteCount' + current_size_in_bytes: + $ref: '#/components/schemas/_common___ByteCount' + knn._common___GraphRefreshStats: + type: object + properties: + total: + type: number + total_time_in_millis: + $ref: '#/components/schemas/_common___DurationValueUnitMillis' + knn._common___GraphStats: + type: object + properties: + merge: + $ref: '#/components/schemas/knn._common___GraphMergeStats' + refresh: + $ref: '#/components/schemas/knn._common___GraphRefreshStats' + knn._common___NodeStats: + type: object + properties: + max_distance_query_with_filter_requests: + type: number + graph_memory_usage_percentage: + $ref: '#/components/schemas/_common___PercentageNumber' + graph_query_requests: + type: number + graph_memory_usage: + type: number + cache_capacity_reached: + type: boolean + load_success_count: + type: number + training_memory_usage: + type: number + indices_in_cache: + type: object + additionalProperties: true + script_query_errors: + type: number + hit_count: + type: number + knn_query_requests: + type: number + total_load_time: + type: number + miss_count: + type: number + min_score_query_requests: + type: number + knn_query_with_filter_requests: + type: number + training_memory_usage_percentage: + $ref: '#/components/schemas/_common___PercentageNumber' + max_distance_query_requests: + type: number + lucene_initialized: + type: boolean + graph_index_requests: + type: number + faiss_initialized: + type: boolean + load_exception_count: + type: number + training_errors: + type: number + min_score_query_with_filter_requests: + type: number + eviction_count: + type: number + nmslib_initialized: + type: boolean + script_compilations: + type: number + script_query_requests: + type: number + graph_stats: + $ref: '#/components/schemas/knn._common___GraphStats' + graph_query_errors: + type: number + indexing_from_model_degraded: + type: boolean + graph_index_errors: + type: number + training_requests: + type: number + script_compilation_errors: + type: number knn._common___SearchType: type: string description: Search operation type. enum: - dfs_query_then_fetch - query_then_fetch + knn._common___Stats: + type: object + properties: + _nodes: + $ref: '#/components/schemas/_common___NodeStatistics' + cluster_name: + $ref: '#/components/schemas/_common___Name' + circuit_breaker_triggered: + type: boolean + model_index_status: + oneOf: + - $ref: '#/components/schemas/_common___HealthStatusCapitalized' + - type: 'null' + nodes: + type: object + additionalProperties: + $ref: '#/components/schemas/knn._common___NodeStats' knn._common___SuggestMode: type: string description: Specify suggest mode. @@ -52943,6 +53479,36 @@ components: - always - missing - popular + knn._common___TrainedModel: + type: object + properties: + training_index: + type: string + training_field: + type: string + dimension: + type: integer + format: int32 + max_training_vector_count: + type: integer + format: int32 + search_size: + type: integer + format: int32 + description: + type: string + mode: + type: string + compression_level: + type: string + method: + type: string + spaceType: + type: string + required: + - dimension + - training_field + - training_index ml._common___Action: type: object properties: @@ -55745,7 +56311,6 @@ components: $ref: '#/components/schemas/observability._common___SavedQuery' required: - objectId - - tenant observability._common___ObservabilityObjectList: type: object properties: @@ -56293,19 +56858,6 @@ components: type: string follower_cluster_role: type: string - rollups._common___Continuous: - type: object - properties: - next_window_start_time: - type: number - next_window_end_time: - type: number - status: - type: string - failure_reason: - type: string - stats: - $ref: '#/components/schemas/rollups._common___Stats' rollups._common___Cron: type: object properties: @@ -56326,6 +56878,10 @@ components: type: string target_field: type: string + format: + type: + - 'null' + - string rollups._common___DimensionsConfigItem: type: object properties: @@ -56340,17 +56896,18 @@ components: rollups._common___Explain: type: object properties: - rollup_id: - type: string - last_updated_time: - type: number - continuous: - $ref: '#/components/schemas/rollups._common___Continuous' + metadata_id: + type: + - 'null' + - string + rollup_metadata: + type: + - 'null' + - object rollups._common___ExplainEntities: type: object - properties: - item: - $ref: '#/components/schemas/rollups._common___Explain' + additionalProperties: + $ref: '#/components/schemas/rollups._common___Explain' rollups._common___HistogramDimension: type: object properties: @@ -56425,7 +56982,9 @@ components: target_index: type: string metadata_id: - type: string + type: + - 'null' + - string page_size: type: number delay: @@ -56447,11 +57006,14 @@ components: type: object properties: _id: - type: string - _seqNo: - type: number - _primaryTerm: - type: number + $ref: '#/components/schemas/_common___Id' + _seq_no: + $ref: '#/components/schemas/_common___SequenceNumber' + _primary_term: + type: integer + format: int64 + _version: + $ref: '#/components/schemas/_common___VersionNumber' rollup: $ref: '#/components/schemas/rollups._common___Rollup' rollups._common___Schedule: @@ -56459,19 +57021,6 @@ components: properties: interval: $ref: '#/components/schemas/rollups._common___Interval' - rollups._common___Stats: - type: object - properties: - pages_processed: - type: number - documents_processed: - type: number - rollups_indexed: - type: number - index_time_in_ms: - type: number - search_time_in_ms: - type: number rollups._common___TermsDimension: type: object properties: @@ -57694,6 +58243,355 @@ components: type: boolean is_node_certificate_request: type: boolean + sm._common___BadRequestResponse: + type: object + properties: + error: + type: string + status: + type: integer + sm._common___CreateUpdatePolicyRequest: + type: object + properties: + description: + type: string + creation: + $ref: '#/components/schemas/sm._common___CreationConfig' + deletion: + $ref: '#/components/schemas/sm._common___DeletionConfig' + snapshot_config: + $ref: '#/components/schemas/sm._common___SnapshotConfig' + notification: + $ref: '#/components/schemas/sm._common___NotificationConfig' + enabled: + type: boolean + description: 'Whether the policy should be enabled at creation. Default: true' + required: + - creation + - snapshot_config + sm._common___CreationConfig: + type: object + properties: + schedule: + $ref: '#/components/schemas/sm._common___CronSchedule' + time_limit: + type: string + description: Maximum time for snapshot creation. + required: + - schedule + sm._common___CronExpression: + type: object + properties: + expression: + type: string + timezone: + type: string + required: + - expression + - timezone + sm._common___CronSchedule: + type: object + properties: + cron: + $ref: '#/components/schemas/sm._common___CronExpression' + sm._common___DeletePolicyResponse: + type: object + properties: + _index: + type: string + _id: + type: string + _version: + type: integer + result: + type: string + forced_refresh: + type: boolean + _shards: + $ref: '#/components/schemas/sm._common___ShardsInfo' + _seq_no: + type: integer + _primary_term: + type: integer + required: + - _id + - _index + - _primary_term + - _seq_no + - _shards + - _version + - forced_refresh + - result + sm._common___DeletionCondition: + type: object + properties: + max_age: + type: string + max_count: + type: integer + min_count: + type: integer + sm._common___DeletionConfig: + type: object + properties: + schedule: + $ref: '#/components/schemas/sm._common___CronSchedule' + condition: + $ref: '#/components/schemas/sm._common___DeletionCondition' + time_limit: + type: string + sm._common___ExecutionInfo: + type: object + properties: + message: + type: string + cause: + type: string + sm._common___ExecutionMetadata: + type: object + properties: + info: + $ref: '#/components/schemas/sm._common___ExecutionInfo' + sm._common___ExplainedPolicy: + type: object + properties: + name: + type: string + creation: + $ref: '#/components/schemas/sm._common___StateMetadata' + deletion: + $ref: '#/components/schemas/sm._common___StateMetadata' + policy_seq_no: + type: integer + policy_primary_term: + type: integer + enabled: + type: boolean + sm._common___GetPoliciesResponse: + type: object + properties: + total_policies: + type: integer + policies: + type: array + items: + $ref: '#/components/schemas/sm._common___ListedPolicy' + required: + - policies + - total_policies + sm._common___IntervalConfig: + type: object + properties: + start_time: + type: integer + period: + type: integer + unit: + type: string + enum: + - Days + - Hours + - Minutes + required: + - period + - start_time + - unit + sm._common___IntervalSchedule: + type: object + properties: + interval: + $ref: '#/components/schemas/sm._common___IntervalConfig' + sm._common___ListedPolicy: + type: object + properties: + _id: + type: string + _seq_no: + type: integer + _primary_term: + type: integer + sm_policy: + $ref: '#/components/schemas/sm._common___SMPolicy' + required: + - _id + - sm_policy + sm._common___NotFoundError: + type: object + properties: + root_cause: + type: array + items: + $ref: '#/components/schemas/sm._common___RootCause' + type: + type: string + reason: + type: string + required: + - reason + - type + sm._common___NotFoundResponse: + type: object + properties: + error: + $ref: '#/components/schemas/sm._common___NotFoundError' + status: + type: integer + required: + - error + - status + sm._common___NotificationChannel: + type: object + properties: + id: + type: string + required: + - id + sm._common___NotificationConditions: + type: object + properties: + creation: + type: boolean + default: true + deletion: + type: boolean + default: false + failure: + type: boolean + default: false + time_limit_exceeded: + type: boolean + default: false + sm._common___NotificationConfig: + type: object + properties: + channel: + $ref: '#/components/schemas/sm._common___NotificationChannel' + conditions: + $ref: '#/components/schemas/sm._common___NotificationConditions' + sm._common___PolicyExplanation: + type: object + properties: + policies: + type: array + items: + $ref: '#/components/schemas/sm._common___ExplainedPolicy' + sm._common___PolicyResponse: + type: object + properties: + _id: + type: string + _version: + type: integer + _seq_no: + type: integer + _primary_term: + type: integer + sm_policy: + $ref: '#/components/schemas/sm._common___SMPolicy' + required: + - _id + - _primary_term + - _seq_no + - _version + - sm_policy + sm._common___RetryMetadata: + type: object + properties: + count: + type: integer + sm._common___RootCause: + type: object + properties: + type: + type: string + reason: + type: string + sm._common___ShardsInfo: + type: object + properties: + total: + type: integer + successful: + type: integer + failed: + type: integer + sm._common___SMPolicy: + type: object + properties: + name: + type: string + description: + type: string + schema_version: + type: integer + creation: + $ref: '#/components/schemas/sm._common___CreationConfig' + deletion: + $ref: '#/components/schemas/sm._common___DeletionConfig' + description: Configuration for snapshot deletion, optional. + snapshot_config: + $ref: '#/components/schemas/sm._common___SnapshotConfig' + notification: + $ref: '#/components/schemas/sm._common___NotificationConfig' + schedule: + $ref: '#/components/schemas/sm._common___IntervalSchedule' + description: System-generated schedule metadata returned by the API. + enabled: + type: boolean + last_updated_time: + type: integer + enabled_time: + type: integer + required: + - creation + - description + - name + - snapshot_config + sm._common___SnapshotConfig: + type: object + properties: + date_format: + type: string + description: Default "yyyy-MM-dd'T'HH:mm:ss" + timezone: + type: string + description: Default UTC + indices: + type: string + description: Default "*" + repository: + type: string + ignore_unavailable: + type: boolean + description: Default false + include_global_state: + type: boolean + description: Default true + partial: + type: boolean + description: Default false + metadata: + type: object + additionalProperties: + type: string + required: + - repository + sm._common___StateMetadata: + type: object + properties: + current_state: + type: string + trigger: + $ref: '#/components/schemas/sm._common___TriggerMetadata' + latest_execution: + $ref: '#/components/schemas/sm._common___ExecutionMetadata' + retry: + $ref: '#/components/schemas/sm._common___RetryMetadata' + sm._common___TriggerMetadata: + type: object + properties: + time: + type: integer snapshot._common___FileCountSnapshotStats: type: object properties: @@ -58289,13 +59187,68 @@ components: type: string target_field: type: string + transforms._common___DeletedTransformResponse: + type: object + properties: + _type: + $ref: '#/components/schemas/_common___Type' + _index: + type: string + _id: + $ref: '#/components/schemas/_common___Id' + _version: + $ref: '#/components/schemas/_common___VersionNumber' + result: + type: string + forced_refresh: + type: boolean + _shards: + $ref: '#/components/schemas/_common___ShardStatistics' + _primary_term: + type: integer + format: int64 + _seq_no: + $ref: '#/components/schemas/_common___SequenceNumber' + status: + type: number + required: + - _id + - _index + - _primary_term + - _seq_no + - _shards + - _version + - forced_refresh + - result + - status + transforms._common___DeleteTransformResponseItem: + type: object + properties: + delete: + $ref: '#/components/schemas/transforms._common___DeletedTransformResponse' + transforms._common___DeleteTransformsResponse: + type: object + properties: + took: + type: integer + format: int64 + errors: + type: boolean + items: + type: array + items: + $ref: '#/components/schemas/transforms._common___DeleteTransformResponseItem' transforms._common___Explain: type: object properties: metadata_id: - type: string + type: + - 'null' + - string transform_metadata: - $ref: '#/components/schemas/transforms._common___TransformMetadata' + oneOf: + - $ref: '#/components/schemas/transforms._common___TransformMetadata' + - type: 'null' transforms._common___ExplainResponse: type: object additionalProperties: @@ -58333,32 +59286,6 @@ components: type: string interval: type: string - transforms._common___MetricsConfigItem: - type: object - properties: - source_field: - type: string - target_field: - type: string - metrics: - type: array - items: - $ref: '#/components/schemas/transforms._common___MetricsConfigMetrics' - transforms._common___MetricsConfigMetrics: - type: object - properties: - avg: - type: object - sum: - type: object - max: - type: object - min: - type: object - value_count: - type: object - minProperties: 1 - maxProperties: 1 transforms._common___Preview: type: object properties: @@ -58401,13 +59328,17 @@ components: schedule: $ref: '#/components/schemas/transforms._common___Schedule' metadata_id: - type: string + type: + - 'null' + - string updated_at: - type: string + type: number enabled: type: boolean enabled_at: - type: number + type: + - 'null' + - number description: type: string source_index: @@ -58427,20 +59358,9 @@ components: items: $ref: '#/components/schemas/transforms._common___GroupsConfigItem' aggregations: - type: array - items: - $ref: '#/components/schemas/transforms._common___MetricsConfigItem' - transforms._common___TransformEntity: - type: object - properties: - _id: - type: string - _seqNo: - type: number - _primaryTerm: - type: number - transform: - $ref: '#/components/schemas/transforms._common___Transform' + type: object + additionalProperties: + $ref: '#/components/schemas/transforms._common___GroupsConfigItem' transforms._common___TransformMetadata: type: object properties: @@ -58456,6 +59376,27 @@ components: type: string stats: $ref: '#/components/schemas/transforms._common___ExplainStats' + transforms._common___TransformRequest: + type: object + properties: + transform: + $ref: '#/components/schemas/transforms._common___Transform' + required: + - transform + transforms._common___TransformResponse: + type: object + properties: + _id: + $ref: '#/components/schemas/_common___Id' + _primary_term: + type: integer + format: int64 + _seq_no: + $ref: '#/components/schemas/_common___SequenceNumber' + _version: + $ref: '#/components/schemas/_common___VersionNumber' + transform: + $ref: '#/components/schemas/transforms._common___Transform' transforms._common___TransformsResponse: type: object properties: @@ -58464,7 +59405,7 @@ components: transforms: type: array items: - $ref: '#/components/schemas/transforms._common___TransformEntity' + $ref: '#/components/schemas/transforms._common___TransformResponse' wlm._common___QueryGroupCreate: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 9cea817077..cfbd41466e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -16,6 +16,7 @@ import static org.opensearch.client.codegen.utils.matcher.Matcher.isNull; import static org.opensearch.client.codegen.utils.matcher.Matcher.isOneOf; import static org.opensearch.client.codegen.utils.matcher.Matcher.or; +import static org.opensearch.client.codegen.utils.matcher.StringMatcher.contains; import static org.opensearch.client.codegen.utils.matcher.StringMatcher.endsWith; import java.io.File; @@ -52,6 +53,7 @@ public class CodeGenerator { namespace(is("indices")), name( or( + contains("data_stream"), and(endsWith("mapping"), isNot("get_field_mapping")), endsWith("settings"), endsWith("template"), diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 66804fe4ae..d0116d6178 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -502,7 +502,9 @@ private void visitInto(OpenApiSchema schema, EnumShape shape) { schema.getOneOf().orElseThrow().forEach(s -> visitInto(s, shape)); } else if (schema.hasEnums()) { var enums = schema.getEnums().orElseThrow(); - var description = enums.size() == 1 ? schema.getDescription().orElse(null) : null; + var description = title.isPresent() || enums.stream().map(String::toLowerCase).distinct().count() == 1 + ? schema.getDescription().orElse(null) + : null; enums.forEach(v -> shape.addVariant(title.orElse(v), v, description, isDeprecated)); } else if (schema.hasConst()) { var value = (String) schema.getConst().orElseThrow(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/matcher/StringMatcher.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/matcher/StringMatcher.java index 445f09fdbf..19529dc786 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/matcher/StringMatcher.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/matcher/StringMatcher.java @@ -14,4 +14,8 @@ private StringMatcher() {} public static Matcher endsWith(String suffix) { return s -> s.endsWith(suffix); } + + public static Matcher contains(String substring) { + return s -> s.contains(substring); + } }