diff --git a/CHANGELOG.md b/CHANGELOG.md index ef44f05fe..367ba6aa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Added - Added `toBuilder()` and `Builder.copy()` methods to all generated classes ([#1300](https://github.com/opensearch-project/opensearch-java/pull/1300)) - Added support for additional ML APIs ([#1443](https://github.com/opensearch-project/opensearch-java/pull/1443)) +- Added support for the Search Pipeline APIs ([#1442](https://github.com/opensearch-project/opensearch-java/pull/1442)) ### Dependencies diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/CollapseResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/CollapseResponseProcessor.java new file mode 100644 index 000000000..4b4af5699 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/CollapseResponseProcessor.java @@ -0,0 +1,329 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.CollapseResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CollapseResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String contextPrefix; + + @Nullable + private final String description; + + @Nonnull + private final String field; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private CollapseResponseProcessor(Builder builder) { + this.contextPrefix = builder.contextPrefix; + this.description = builder.description; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreFailure = builder.ignoreFailure; + this.tag = builder.tag; + } + + public static CollapseResponseProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.Collapse; + } + + /** + * API name: {@code context_prefix} + */ + @Nullable + public final String contextPrefix() { + return this.contextPrefix; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.contextPrefix != null) { + generator.writeKey("context_prefix"); + generator.write(this.contextPrefix); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CollapseResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String contextPrefix; + @Nullable + private String description; + private String field; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String tag; + + public Builder() {} + + private Builder(CollapseResponseProcessor o) { + this.contextPrefix = o.contextPrefix; + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.contextPrefix = o.contextPrefix; + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code context_prefix} + */ + @Nonnull + public final Builder contextPrefix(@Nullable String value) { + this.contextPrefix = value; + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link CollapseResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CollapseResponseProcessor build() { + _checkSingleUse(); + + return new CollapseResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CollapseResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CollapseResponseProcessor::setupCollapseResponseProcessorDeserializer + ); + + protected static void setupCollapseResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::contextPrefix, JsonpDeserializer.stringDeserializer(), "context_prefix"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.contextPrefix); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CollapseResponseProcessor other = (CollapseResponseProcessor) o; + return Objects.equals(this.contextPrefix, other.contextPrefix) + && Objects.equals(this.description, other.description) + && this.field.equals(other.field) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineRequest.java new file mode 100644 index 000000000..9ac92c36c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineRequest.java @@ -0,0 +1,303 @@ +/* + * 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.search_pipeline; + +import java.util.HashMap; +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.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +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.ToCopyableBuilder; + +// typedef: search_pipeline.delete.Request + +/** + * Deletes the specified search pipeline. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class DeleteSearchPipelineRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull + private final String id; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private DeleteSearchPipelineRequest(Builder builder) { + super(builder); + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.timeout = builder.timeout; + } + + public static DeleteSearchPipelineRequest of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Required - Pipeline ID. + *

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

+ */ + @Nonnull + public final String id() { + return this.id; + } + + /** + * Operation timeout. + *

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

+ */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteSearchPipelineRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder + implements + CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; + private String id; + @Nullable + private Time timeout; + + public Builder() {} + + private Builder(DeleteSearchPipelineRequest o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - Pipeline ID. + *

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

+ */ + @Nonnull + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Operation timeout. + *

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

+ */ + @Nonnull + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Operation timeout. + *

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

+ */ + @Nonnull + public final Builder timeout(Function> fn) { + return timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Builds a {@link DeleteSearchPipelineRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteSearchPipelineRequest build() { + _checkSingleUse(); + + return new DeleteSearchPipelineRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", this.clusterManagerTimeout._toJsonString()); + } + if (this.timeout != null) { + params.put("timeout", this.timeout._toJsonString()); + } + } + + /** + * Endpoint "{@code search_pipeline.delete}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_search/pipeline/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + DeleteSearchPipelineResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.id.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteSearchPipelineRequest other = (DeleteSearchPipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && this.id.equals(other.id) + && Objects.equals(this.timeout, other.timeout); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineResponse.java new file mode 100644 index 000000000..5d20203db --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/DeleteSearchPipelineResponse.java @@ -0,0 +1,192 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.delete.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteSearchPipelineResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Boolean acknowledged; + + // --------------------------------------------------------------------------------------------- + + private DeleteSearchPipelineResponse(Builder builder) { + this.acknowledged = builder.acknowledged; + } + + public static DeleteSearchPipelineResponse of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code acknowledged} + */ + @Nullable + public final Boolean acknowledged() { + return this.acknowledged; + } + + /** + * 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.acknowledged != null) { + generator.writeKey("acknowledged"); + generator.write(this.acknowledged); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteSearchPipelineResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean acknowledged; + + public Builder() {} + + private Builder(DeleteSearchPipelineResponse o) { + this.acknowledged = o.acknowledged; + } + + private Builder(Builder o) { + this.acknowledged = o.acknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code acknowledged} + */ + @Nonnull + public final Builder acknowledged(@Nullable Boolean value) { + this.acknowledged = value; + return this; + } + + /** + * Builds a {@link DeleteSearchPipelineResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteSearchPipelineResponse build() { + _checkSingleUse(); + + return new DeleteSearchPipelineResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteSearchPipelineResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteSearchPipelineResponse::setupDeleteSearchPipelineResponseDeserializer + ); + + protected static void setupDeleteSearchPipelineResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.acknowledged); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteSearchPipelineResponse other = (DeleteSearchPipelineResponse) o; + return Objects.equals(this.acknowledged, other.acknowledged); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/FilterQueryRequestProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/FilterQueryRequestProcessor.java new file mode 100644 index 000000000..9f3111374 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/FilterQueryRequestProcessor.java @@ -0,0 +1,309 @@ +/* + * 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.search_pipeline; + +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.opensearch._types.query_dsl.Query; +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: search_pipeline.FilterQueryRequestProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FilterQueryRequestProcessor + implements + RequestProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final Query query; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private FilterQueryRequestProcessor(Builder builder) { + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.query = builder.query; + this.tag = builder.tag; + } + + public static FilterQueryRequestProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link RequestProcessor} variant kind. + */ + @Override + public RequestProcessor.Kind _requestProcessorKind() { + return RequestProcessor.Kind.FilterQuery; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code query} + */ + @Nullable + public final Query query() { + return this.query; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.query != null) { + generator.writeKey("query"); + this.query.serialize(generator, mapper); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link FilterQueryRequestProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + @Nullable + private Query query; + @Nullable + private String tag; + + public Builder() {} + + private Builder(FilterQueryRequestProcessor o) { + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.query = o.query; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.query = o.query; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code query} + */ + @Nonnull + public final Builder query(@Nullable Query value) { + this.query = value; + return this; + } + + /** + * API name: {@code query} + */ + @Nonnull + public final Builder query(Function> fn) { + return query(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link FilterQueryRequestProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public FilterQueryRequestProcessor build() { + _checkSingleUse(); + + return new FilterQueryRequestProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FilterQueryRequestProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FilterQueryRequestProcessor::setupFilterQueryRequestProcessorDeserializer + ); + + protected static void setupFilterQueryRequestProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::query, Query._DESERIALIZER, "query"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.query); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FilterQueryRequestProcessor other = (FilterQueryRequestProcessor) o; + return Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.query, other.query) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineRequest.java new file mode 100644 index 000000000..770323985 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineRequest.java @@ -0,0 +1,264 @@ +/* + * 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.search_pipeline; + +import java.util.HashMap; +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.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.get.Request + +/** + * Retrieves information about a specified search pipeline. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetSearchPipelineRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + + @Nullable + private final String id; + + // --------------------------------------------------------------------------------------------- + + private GetSearchPipelineRequest(Builder builder) { + super(builder); + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.id = builder.id; + } + + public static GetSearchPipelineRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Comma-separated list of search pipeline ids. Wildcards supported. + *

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

+ */ + @Nullable + public final String id() { + return this.id; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetSearchPipelineRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; + @Nullable + private String id; + + public Builder() {} + + private Builder(GetSearchPipelineRequest o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + } + + private Builder(Builder o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Comma-separated list of search pipeline ids. Wildcards supported. + *

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

+ */ + @Nonnull + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * Builds a {@link GetSearchPipelineRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetSearchPipelineRequest build() { + _checkSingleUse(); + + return new GetSearchPipelineRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", this.clusterManagerTimeout._toJsonString()); + } + } + + /** + * Endpoint "{@code search_pipeline.get}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _id = 1 << 0; + + int propsSet = 0; + + if (request.id() != null) propsSet |= _id; + + if (propsSet == 0) { + return "/_search/pipeline"; + } + if (propsSet == (_id)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_search/pipeline/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetSearchPipelineResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.id); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetSearchPipelineRequest other = (GetSearchPipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) && Objects.equals(this.id, other.id); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineResponse.java new file mode 100644 index 000000000..ed7b48441 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/GetSearchPipelineResponse.java @@ -0,0 +1,105 @@ +/* + * 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.search_pipeline; + +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.transport.endpoints.DictionaryResponse; +import org.opensearch.client.util.ObjectBuilder; + +// typedef: search_pipeline.get.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetSearchPipelineResponse extends DictionaryResponse { + // --------------------------------------------------------------------------------------------- + + private GetSearchPipelineResponse(Builder builder) { + super(builder); + } + + public static GetSearchPipelineResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetSearchPipelineResponse}. + */ + public static class Builder extends DictionaryResponse.AbstractBuilder + implements + ObjectBuilder { + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetSearchPipelineResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public GetSearchPipelineResponse build() { + _checkSingleUse(); + super.tKeySerializer(null); + super.tValueSerializer(null); + + return new GetSearchPipelineResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetSearchPipelineResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetSearchPipelineResponse::setupGetSearchPipelineResponseDeserializer + ); + + protected static void setupGetSearchPipelineResponseDeserializer(ObjectDeserializer op) { + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), SearchPipelineStructure._DESERIALIZER); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/MLOpenSearchReranker.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/MLOpenSearchReranker.java new file mode 100644 index 000000000..c38a8618b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/MLOpenSearchReranker.java @@ -0,0 +1,183 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +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: search_pipeline.MLOpenSearchReranker + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class MLOpenSearchReranker implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private MLOpenSearchReranker(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static MLOpenSearchReranker of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * 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("model_id"); + generator.write(this.modelId); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link MLOpenSearchReranker}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String modelId; + + public Builder() {} + + private Builder(MLOpenSearchReranker o) { + this.modelId = o.modelId; + } + + private Builder(Builder o) { + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link MLOpenSearchReranker}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public MLOpenSearchReranker build() { + _checkSingleUse(); + + return new MLOpenSearchReranker(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MLOpenSearchReranker} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + MLOpenSearchReranker::setupMLOpenSearchRerankerDeserializer + ); + + protected static void setupMLOpenSearchRerankerDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + MLOpenSearchReranker other = (MLOpenSearchReranker) o; + return this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NeuralQueryEnricherRequestProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NeuralQueryEnricherRequestProcessor.java new file mode 100644 index 000000000..821b5b34f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NeuralQueryEnricherRequestProcessor.java @@ -0,0 +1,330 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +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.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: search_pipeline.NeuralQueryEnricherRequestProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NeuralQueryEnricherRequestProcessor + implements + RequestProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String defaultModelId; + + @Nullable + private final String description; + + @Nonnull + private final Map neuralFieldDefaultId; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private NeuralQueryEnricherRequestProcessor(Builder builder) { + this.defaultModelId = builder.defaultModelId; + this.description = builder.description; + this.neuralFieldDefaultId = ApiTypeHelper.unmodifiable(builder.neuralFieldDefaultId); + this.tag = builder.tag; + } + + public static NeuralQueryEnricherRequestProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link RequestProcessor} variant kind. + */ + @Override + public RequestProcessor.Kind _requestProcessorKind() { + return RequestProcessor.Kind.NeuralQueryEnricher; + } + + /** + * API name: {@code default_model_id} + */ + @Nullable + public final String defaultModelId() { + return this.defaultModelId; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code neural_field_default_id} + */ + @Nonnull + public final Map neuralFieldDefaultId() { + return this.neuralFieldDefaultId; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.defaultModelId != null) { + generator.writeKey("default_model_id"); + generator.write(this.defaultModelId); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (ApiTypeHelper.isDefined(this.neuralFieldDefaultId)) { + generator.writeKey("neural_field_default_id"); + generator.writeStartObject(); + for (Map.Entry item0 : this.neuralFieldDefaultId.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + } + generator.writeEnd(); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link NeuralQueryEnricherRequestProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String defaultModelId; + @Nullable + private String description; + @Nullable + private Map neuralFieldDefaultId; + @Nullable + private String tag; + + public Builder() {} + + private Builder(NeuralQueryEnricherRequestProcessor o) { + this.defaultModelId = o.defaultModelId; + this.description = o.description; + this.neuralFieldDefaultId = _mapCopy(o.neuralFieldDefaultId); + this.tag = o.tag; + } + + private Builder(Builder o) { + this.defaultModelId = o.defaultModelId; + this.description = o.description; + this.neuralFieldDefaultId = _mapCopy(o.neuralFieldDefaultId); + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code default_model_id} + */ + @Nonnull + public final Builder defaultModelId(@Nullable String value) { + this.defaultModelId = value; + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code neural_field_default_id} + * + *

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

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

+ * Adds an entry to neuralFieldDefaultId. + *

+ */ + @Nonnull + public final Builder neuralFieldDefaultId(String key, String value) { + this.neuralFieldDefaultId = _mapPut(this.neuralFieldDefaultId, key, value); + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link NeuralQueryEnricherRequestProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public NeuralQueryEnricherRequestProcessor build() { + _checkSingleUse(); + + return new NeuralQueryEnricherRequestProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NeuralQueryEnricherRequestProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NeuralQueryEnricherRequestProcessor::setupNeuralQueryEnricherRequestProcessorDeserializer + ); + + protected static void setupNeuralQueryEnricherRequestProcessorDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::defaultModelId, JsonpDeserializer.stringDeserializer(), "default_model_id"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add( + Builder::neuralFieldDefaultId, + JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), + "neural_field_default_id" + ); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.defaultModelId); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.neuralFieldDefaultId); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NeuralQueryEnricherRequestProcessor other = (NeuralQueryEnricherRequestProcessor) o; + return Objects.equals(this.defaultModelId, other.defaultModelId) + && Objects.equals(this.description, other.description) + && Objects.equals(this.neuralFieldDefaultId, other.neuralFieldDefaultId) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NormalizationPhaseResultsProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NormalizationPhaseResultsProcessor.java new file mode 100644 index 000000000..486f133f9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/NormalizationPhaseResultsProcessor.java @@ -0,0 +1,351 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.NormalizationPhaseResultsProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NormalizationPhaseResultsProcessor + implements + PhaseResultsProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final ScoreCombination combination; + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final ScoreNormalization normalization; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private NormalizationPhaseResultsProcessor(Builder builder) { + this.combination = builder.combination; + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.normalization = builder.normalization; + this.tag = builder.tag; + } + + public static NormalizationPhaseResultsProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link PhaseResultsProcessor} variant kind. + */ + @Override + public PhaseResultsProcessor.Kind _phaseResultsProcessorKind() { + return PhaseResultsProcessor.Kind.NormalizationProcessor; + } + + /** + * API name: {@code combination} + */ + @Nullable + public final ScoreCombination combination() { + return this.combination; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code normalization} + */ + @Nullable + public final ScoreNormalization normalization() { + return this.normalization; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.combination != null) { + generator.writeKey("combination"); + this.combination.serialize(generator, mapper); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.normalization != null) { + generator.writeKey("normalization"); + this.normalization.serialize(generator, mapper); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link NormalizationPhaseResultsProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private ScoreCombination combination; + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + @Nullable + private ScoreNormalization normalization; + @Nullable + private String tag; + + public Builder() {} + + private Builder(NormalizationPhaseResultsProcessor o) { + this.combination = o.combination; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.normalization = o.normalization; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.combination = o.combination; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.normalization = o.normalization; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code combination} + */ + @Nonnull + public final Builder combination(@Nullable ScoreCombination value) { + this.combination = value; + return this; + } + + /** + * API name: {@code combination} + */ + @Nonnull + public final Builder combination(Function> fn) { + return combination(fn.apply(new ScoreCombination.Builder()).build()); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code normalization} + */ + @Nonnull + public final Builder normalization(@Nullable ScoreNormalization value) { + this.normalization = value; + return this; + } + + /** + * API name: {@code normalization} + */ + @Nonnull + public final Builder normalization(Function> fn) { + return normalization(fn.apply(new ScoreNormalization.Builder()).build()); + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link NormalizationPhaseResultsProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public NormalizationPhaseResultsProcessor build() { + _checkSingleUse(); + + return new NormalizationPhaseResultsProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NormalizationPhaseResultsProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NormalizationPhaseResultsProcessor::setupNormalizationPhaseResultsProcessorDeserializer + ); + + protected static void setupNormalizationPhaseResultsProcessorDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::combination, ScoreCombination._DESERIALIZER, "combination"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::normalization, ScoreNormalization._DESERIALIZER, "normalization"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.combination); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.normalization); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NormalizationPhaseResultsProcessor other = (NormalizationPhaseResultsProcessor) o; + return Objects.equals(this.combination, other.combination) + && Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.normalization, other.normalization) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineAsyncClient.java new file mode 100644 index 000000000..0601384cd --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineAsyncClient.java @@ -0,0 +1,135 @@ +/* + * 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.search_pipeline; + +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the search_pipeline namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenSearchSearchPipelineAsyncClient extends ApiClient { + public OpenSearchSearchPipelineAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchSearchPipelineAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchSearchPipelineAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchSearchPipelineAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: search_pipeline.delete + + /** + * Deletes the specified search pipeline. + */ + public CompletableFuture delete(DeleteSearchPipelineRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DeleteSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes the specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link DeleteSearchPipelineRequest} + */ + public final CompletableFuture delete( + Function> fn + ) throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteSearchPipelineRequest.Builder()).build()); + } + + // ----- Endpoint: search_pipeline.get + + /** + * Retrieves information about a specified search pipeline. + */ + public CompletableFuture get(GetSearchPipelineRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves information about a specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link GetSearchPipelineRequest} + */ + public final CompletableFuture get( + Function> fn + ) throws IOException, OpenSearchException { + return get(fn.apply(new GetSearchPipelineRequest.Builder()).build()); + } + + /** + * Retrieves information about a specified search pipeline. + */ + public final CompletableFuture get() throws IOException, OpenSearchException { + return get(new GetSearchPipelineRequest.Builder().build()); + } + + // ----- Endpoint: search_pipeline.put + + /** + * Creates or replaces the specified search pipeline. + */ + public CompletableFuture put(PutSearchPipelineRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, PutSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates or replaces the specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link PutSearchPipelineRequest} + */ + public final CompletableFuture put( + Function> fn + ) throws IOException, OpenSearchException { + return put(fn.apply(new PutSearchPipelineRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineClient.java new file mode 100644 index 000000000..71d293d4e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OpenSearchSearchPipelineClient.java @@ -0,0 +1,131 @@ +/* + * 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.search_pipeline; + +import java.io.IOException; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the search_pipeline namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OpenSearchSearchPipelineClient extends ApiClient { + public OpenSearchSearchPipelineClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchSearchPipelineClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public OpenSearchSearchPipelineClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchSearchPipelineClient(this.transport, transportOptions); + } + + // ----- Endpoint: search_pipeline.delete + + /** + * Deletes the specified search pipeline. + */ + public DeleteSearchPipelineResponse delete(DeleteSearchPipelineRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes the specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link DeleteSearchPipelineRequest} + */ + public final DeleteSearchPipelineResponse delete( + Function> fn + ) throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteSearchPipelineRequest.Builder()).build()); + } + + // ----- Endpoint: search_pipeline.get + + /** + * Retrieves information about a specified search pipeline. + */ + public GetSearchPipelineResponse get(GetSearchPipelineRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves information about a specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link GetSearchPipelineRequest} + */ + public final GetSearchPipelineResponse get(Function> fn) + throws IOException, OpenSearchException { + return get(fn.apply(new GetSearchPipelineRequest.Builder()).build()); + } + + /** + * Retrieves information about a specified search pipeline. + */ + public final GetSearchPipelineResponse get() throws IOException, OpenSearchException { + return get(new GetSearchPipelineRequest.Builder().build()); + } + + // ----- Endpoint: search_pipeline.put + + /** + * Creates or replaces the specified search pipeline. + */ + public PutSearchPipelineResponse put(PutSearchPipelineRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, PutSearchPipelineRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates or replaces the specified search pipeline. + * + * @param fn a function that initializes a builder to create the {@link PutSearchPipelineRequest} + */ + public final PutSearchPipelineResponse put(Function> fn) + throws IOException, OpenSearchException { + return put(fn.apply(new PutSearchPipelineRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OversampleRequestProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OversampleRequestProcessor.java new file mode 100644 index 000000000..635940518 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/OversampleRequestProcessor.java @@ -0,0 +1,329 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.OversampleRequestProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OversampleRequestProcessor + implements + RequestProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String contentPrefix; + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + private final float sampleFactor; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private OversampleRequestProcessor(Builder builder) { + this.contentPrefix = builder.contentPrefix; + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.sampleFactor = ApiTypeHelper.requireNonNull(builder.sampleFactor, this, "sampleFactor"); + this.tag = builder.tag; + } + + public static OversampleRequestProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link RequestProcessor} variant kind. + */ + @Override + public RequestProcessor.Kind _requestProcessorKind() { + return RequestProcessor.Kind.Oversample; + } + + /** + * API name: {@code content_prefix} + */ + @Nullable + public final String contentPrefix() { + return this.contentPrefix; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * Required - API name: {@code sample_factor} + */ + public final float sampleFactor() { + return this.sampleFactor; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.contentPrefix != null) { + generator.writeKey("content_prefix"); + generator.write(this.contentPrefix); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + generator.writeKey("sample_factor"); + generator.write(this.sampleFactor); + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link OversampleRequestProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String contentPrefix; + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + private Float sampleFactor; + @Nullable + private String tag; + + public Builder() {} + + private Builder(OversampleRequestProcessor o) { + this.contentPrefix = o.contentPrefix; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.sampleFactor = o.sampleFactor; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.contentPrefix = o.contentPrefix; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.sampleFactor = o.sampleFactor; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code content_prefix} + */ + @Nonnull + public final Builder contentPrefix(@Nullable String value) { + this.contentPrefix = value; + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * Required - API name: {@code sample_factor} + */ + @Nonnull + public final Builder sampleFactor(float value) { + this.sampleFactor = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link OversampleRequestProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public OversampleRequestProcessor build() { + _checkSingleUse(); + + return new OversampleRequestProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link OversampleRequestProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + OversampleRequestProcessor::setupOversampleRequestProcessorDeserializer + ); + + protected static void setupOversampleRequestProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::contentPrefix, JsonpDeserializer.stringDeserializer(), "content_prefix"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::sampleFactor, JsonpDeserializer.floatDeserializer(), "sample_factor"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.contentPrefix); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Float.hashCode(this.sampleFactor); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + OversampleRequestProcessor other = (OversampleRequestProcessor) o; + return Objects.equals(this.contentPrefix, other.contentPrefix) + && Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && this.sampleFactor == other.sampleFactor + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PersonalizeSearchRankingResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PersonalizeSearchRankingResponseProcessor.java new file mode 100644 index 000000000..7e44eabbf --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PersonalizeSearchRankingResponseProcessor.java @@ -0,0 +1,424 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.PersonalizeSearchRankingResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PersonalizeSearchRankingResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String campaignArn; + + @Nullable + private final String description; + + @Nullable + private final String iamRoleArn; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String itemIdField; + + @Nonnull + private final String recipe; + + @Nullable + private final String tag; + + private final float weight; + + // --------------------------------------------------------------------------------------------- + + private PersonalizeSearchRankingResponseProcessor(Builder builder) { + this.campaignArn = ApiTypeHelper.requireNonNull(builder.campaignArn, this, "campaignArn"); + this.description = builder.description; + this.iamRoleArn = builder.iamRoleArn; + this.ignoreFailure = builder.ignoreFailure; + this.itemIdField = builder.itemIdField; + this.recipe = ApiTypeHelper.requireNonNull(builder.recipe, this, "recipe"); + this.tag = builder.tag; + this.weight = ApiTypeHelper.requireNonNull(builder.weight, this, "weight"); + } + + public static PersonalizeSearchRankingResponseProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.PersonalizeSearchRanking; + } + + /** + * Required - API name: {@code campaign_arn} + */ + @Nonnull + public final String campaignArn() { + return this.campaignArn; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code iam_role_arn} + */ + @Nullable + public final String iamRoleArn() { + return this.iamRoleArn; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code item_id_field} + */ + @Nullable + public final String itemIdField() { + return this.itemIdField; + } + + /** + * Required - API name: {@code recipe} + */ + @Nonnull + public final String recipe() { + return this.recipe; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * Required - API name: {@code weight} + */ + public final float weight() { + return this.weight; + } + + /** + * 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("campaign_arn"); + generator.write(this.campaignArn); + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.iamRoleArn != null) { + generator.writeKey("iam_role_arn"); + generator.write(this.iamRoleArn); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.itemIdField != null) { + generator.writeKey("item_id_field"); + generator.write(this.itemIdField); + } + + generator.writeKey("recipe"); + generator.write(this.recipe); + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + generator.writeKey("weight"); + generator.write(this.weight); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PersonalizeSearchRankingResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String campaignArn; + @Nullable + private String description; + @Nullable + private String iamRoleArn; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String itemIdField; + private String recipe; + @Nullable + private String tag; + private Float weight; + + public Builder() {} + + private Builder(PersonalizeSearchRankingResponseProcessor o) { + this.campaignArn = o.campaignArn; + this.description = o.description; + this.iamRoleArn = o.iamRoleArn; + this.ignoreFailure = o.ignoreFailure; + this.itemIdField = o.itemIdField; + this.recipe = o.recipe; + this.tag = o.tag; + this.weight = o.weight; + } + + private Builder(Builder o) { + this.campaignArn = o.campaignArn; + this.description = o.description; + this.iamRoleArn = o.iamRoleArn; + this.ignoreFailure = o.ignoreFailure; + this.itemIdField = o.itemIdField; + this.recipe = o.recipe; + this.tag = o.tag; + this.weight = o.weight; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code campaign_arn} + */ + @Nonnull + public final Builder campaignArn(String value) { + this.campaignArn = value; + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code iam_role_arn} + */ + @Nonnull + public final Builder iamRoleArn(@Nullable String value) { + this.iamRoleArn = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code item_id_field} + */ + @Nonnull + public final Builder itemIdField(@Nullable String value) { + this.itemIdField = value; + return this; + } + + /** + * Required - API name: {@code recipe} + */ + @Nonnull + public final Builder recipe(String value) { + this.recipe = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Required - API name: {@code weight} + */ + @Nonnull + public final Builder weight(float value) { + this.weight = value; + return this; + } + + /** + * Builds a {@link PersonalizeSearchRankingResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PersonalizeSearchRankingResponseProcessor build() { + _checkSingleUse(); + + return new PersonalizeSearchRankingResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PersonalizeSearchRankingResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PersonalizeSearchRankingResponseProcessor::setupPersonalizeSearchRankingResponseProcessorDeserializer + ); + + protected static void setupPersonalizeSearchRankingResponseProcessorDeserializer( + ObjectDeserializer op + ) { + op.add(Builder::campaignArn, JsonpDeserializer.stringDeserializer(), "campaign_arn"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::iamRoleArn, JsonpDeserializer.stringDeserializer(), "iam_role_arn"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::itemIdField, JsonpDeserializer.stringDeserializer(), "item_id_field"); + op.add(Builder::recipe, JsonpDeserializer.stringDeserializer(), "recipe"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::weight, JsonpDeserializer.floatDeserializer(), "weight"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.campaignArn.hashCode(); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.iamRoleArn); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.itemIdField); + result = 31 * result + this.recipe.hashCode(); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + Float.hashCode(this.weight); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PersonalizeSearchRankingResponseProcessor other = (PersonalizeSearchRankingResponseProcessor) o; + return this.campaignArn.equals(other.campaignArn) + && Objects.equals(this.description, other.description) + && Objects.equals(this.iamRoleArn, other.iamRoleArn) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.itemIdField, other.itemIdField) + && this.recipe.equals(other.recipe) + && Objects.equals(this.tag, other.tag) + && this.weight == other.weight; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessor.java new file mode 100644 index 000000000..1b571e06a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessor.java @@ -0,0 +1,199 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +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; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: search_pipeline.PhaseResultsProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PhaseResultsProcessor implements TaggedUnion, PlainJsonSerializable { + /** + * {@link PhaseResultsProcessor} variant kinds. + */ + public enum Kind implements JsonEnum { + NormalizationProcessor("normalization-processor"); + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + @Override + public String jsonValue() { + return jsonValue; + } + } + + private final Kind _kind; + private final PhaseResultsProcessorVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final PhaseResultsProcessorVariant _get() { + return _value; + } + + public PhaseResultsProcessor(PhaseResultsProcessorVariant value) { + this._kind = ApiTypeHelper.requireNonNull(value._phaseResultsProcessorKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + } + + private PhaseResultsProcessor(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static PhaseResultsProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code normalization-processor}? + */ + public boolean isNormalizationProcessor() { + return _kind == Kind.NormalizationProcessor; + } + + /** + * Get the {@code normalization-processor} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code normalization-processor} kind. + */ + public NormalizationPhaseResultsProcessor normalizationProcessor() { + return TaggedUnionUtils.get(this, Kind.NormalizationProcessor); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + generator.writeEnd(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private PhaseResultsProcessorVariant _value; + + public Builder() {} + + private Builder(PhaseResultsProcessor o) { + this._kind = o._kind; + this._value = o._value; + } + + public ObjectBuilder normalizationProcessor(NormalizationPhaseResultsProcessor v) { + this._kind = Kind.NormalizationProcessor; + this._value = v; + return this; + } + + public ObjectBuilder normalizationProcessor( + Function> fn + ) { + return this.normalizationProcessor(fn.apply(new NormalizationPhaseResultsProcessor.Builder()).build()); + } + + @Override + public PhaseResultsProcessor build() { + _checkSingleUse(); + return new PhaseResultsProcessor(this); + } + } + + protected static void setupPhaseResultsProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::normalizationProcessor, NormalizationPhaseResultsProcessor._DESERIALIZER, "normalization-processor"); + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PhaseResultsProcessor::setupPhaseResultsProcessorDeserializer, + Builder::build + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PhaseResultsProcessor other = (PhaseResultsProcessor) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorBuilders.java new file mode 100644 index 000000000..baaa3c70b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorBuilders.java @@ -0,0 +1,54 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Builders for {@link PhaseResultsProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PhaseResultsProcessorBuilders { + private PhaseResultsProcessorBuilders() {} + + /** + * Creates a builder for the {@link NormalizationPhaseResultsProcessor normalization-processor} {@code PhaseResultsProcessor} variant. + */ + public static NormalizationPhaseResultsProcessor.Builder normalizationProcessor() { + return new NormalizationPhaseResultsProcessor.Builder(); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorVariant.java new file mode 100644 index 000000000..0932cbed7 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PhaseResultsProcessorVariant.java @@ -0,0 +1,51 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Base interface for {@link PhaseResultsProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public interface PhaseResultsProcessorVariant { + PhaseResultsProcessor.Kind _phaseResultsProcessorKind(); + + default PhaseResultsProcessor _toPhaseResultsProcessor() { + return new PhaseResultsProcessor(this); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineRequest.java new file mode 100644 index 000000000..44be25e62 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineRequest.java @@ -0,0 +1,569 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +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.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.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +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.ToCopyableBuilder; + +// typedef: search_pipeline.put.Request + +/** + * Creates or replaces the specified search pipeline. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class PutSearchPipelineRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull + private final String id; + + @Nonnull + private final List phaseResultsProcessors; + + @Nonnull + private final List requestProcessors; + + @Nonnull + private final List responseProcessors; + + @Nullable + private final Time timeout; + + @Nullable + private final Integer version; + + // --------------------------------------------------------------------------------------------- + + private PutSearchPipelineRequest(Builder builder) { + super(builder); + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.phaseResultsProcessors = ApiTypeHelper.unmodifiable(builder.phaseResultsProcessors); + this.requestProcessors = ApiTypeHelper.unmodifiable(builder.requestProcessors); + this.responseProcessors = ApiTypeHelper.unmodifiable(builder.responseProcessors); + this.timeout = builder.timeout; + this.version = builder.version; + } + + public static PutSearchPipelineRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Required - Pipeline ID. + *

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

+ */ + @Nonnull + public final String id() { + return this.id; + } + + /** + * API name: {@code phase_results_processors} + */ + @Nonnull + public final List phaseResultsProcessors() { + return this.phaseResultsProcessors; + } + + /** + * API name: {@code request_processors} + */ + @Nonnull + public final List requestProcessors() { + return this.requestProcessors; + } + + /** + * API name: {@code response_processors} + */ + @Nonnull + public final List responseProcessors() { + return this.responseProcessors; + } + + /** + * Operation timeout. + *

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

+ */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * API name: {@code version} + */ + @Nullable + public final Integer version() { + return this.version; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.phaseResultsProcessors)) { + generator.writeKey("phase_results_processors"); + generator.writeStartArray(); + for (PhaseResultsProcessor item0 : this.phaseResultsProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.requestProcessors)) { + generator.writeKey("request_processors"); + generator.writeStartArray(); + for (RequestProcessor item0 : this.requestProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.responseProcessors)) { + generator.writeKey("response_processors"); + generator.writeStartArray(); + for (ResponseProcessor item0 : this.responseProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PutSearchPipelineRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; + private String id; + @Nullable + private List phaseResultsProcessors; + @Nullable + private List requestProcessors; + @Nullable + private List responseProcessors; + @Nullable + private Time timeout; + @Nullable + private Integer version; + + public Builder() {} + + private Builder(PutSearchPipelineRequest o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.phaseResultsProcessors = _listCopy(o.phaseResultsProcessors); + this.requestProcessors = _listCopy(o.requestProcessors); + this.responseProcessors = _listCopy(o.responseProcessors); + this.timeout = o.timeout; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.id = o.id; + this.phaseResultsProcessors = _listCopy(o.phaseResultsProcessors); + this.requestProcessors = _listCopy(o.requestProcessors); + this.responseProcessors = _listCopy(o.responseProcessors); + this.timeout = o.timeout; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - Pipeline ID. + *

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

+ */ + @Nonnull + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * API name: {@code phase_results_processors} + * + *

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

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

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

+ */ + @Nonnull + public final Builder phaseResultsProcessors(PhaseResultsProcessor value, PhaseResultsProcessor... values) { + this.phaseResultsProcessors = _listAdd(this.phaseResultsProcessors, value, values); + return this; + } + + /** + * API name: {@code phase_results_processors} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder requestProcessors(RequestProcessor value, RequestProcessor... values) { + this.requestProcessors = _listAdd(this.requestProcessors, value, values); + return this; + } + + /** + * API name: {@code request_processors} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder responseProcessors(ResponseProcessor value, ResponseProcessor... values) { + this.responseProcessors = _listAdd(this.responseProcessors, value, values); + return this; + } + + /** + * API name: {@code response_processors} + * + *

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

+ */ + @Nonnull + public final Builder responseProcessors(Function> fn) { + return responseProcessors(fn.apply(new ResponseProcessor.Builder()).build()); + } + + /** + * Operation timeout. + *

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

+ */ + @Nonnull + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Operation timeout. + *

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

+ */ + @Nonnull + public final Builder timeout(Function> fn) { + return timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable Integer value) { + this.version = value; + return this; + } + + /** + * Builds a {@link PutSearchPipelineRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PutSearchPipelineRequest build() { + _checkSingleUse(); + + return new PutSearchPipelineRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutSearchPipelineRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PutSearchPipelineRequest::setupPutSearchPipelineRequestDeserializer + ); + + protected static void setupPutSearchPipelineRequestDeserializer(ObjectDeserializer op) { + op.add( + Builder::phaseResultsProcessors, + JsonpDeserializer.arrayDeserializer(PhaseResultsProcessor._DESERIALIZER), + "phase_results_processors" + ); + op.add(Builder::requestProcessors, JsonpDeserializer.arrayDeserializer(RequestProcessor._DESERIALIZER), "request_processors"); + op.add(Builder::responseProcessors, JsonpDeserializer.arrayDeserializer(ResponseProcessor._DESERIALIZER), "response_processors"); + op.add(Builder::version, JsonpDeserializer.integerDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", this.clusterManagerTimeout._toJsonString()); + } + if (this.timeout != null) { + params.put("timeout", this.timeout._toJsonString()); + } + } + + /** + * Endpoint "{@code search_pipeline.put}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_search/pipeline/"); + SimpleEndpoint.pathEncode(request.id, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + PutSearchPipelineResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + this.id.hashCode(); + result = 31 * result + Objects.hashCode(this.phaseResultsProcessors); + result = 31 * result + Objects.hashCode(this.requestProcessors); + result = 31 * result + Objects.hashCode(this.responseProcessors); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutSearchPipelineRequest other = (PutSearchPipelineRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && this.id.equals(other.id) + && Objects.equals(this.phaseResultsProcessors, other.phaseResultsProcessors) + && Objects.equals(this.requestProcessors, other.requestProcessors) + && Objects.equals(this.responseProcessors, other.responseProcessors) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.version, other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineResponse.java new file mode 100644 index 000000000..c4efadbc8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/PutSearchPipelineResponse.java @@ -0,0 +1,190 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.put.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutSearchPipelineResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Boolean acknowledged; + + // --------------------------------------------------------------------------------------------- + + private PutSearchPipelineResponse(Builder builder) { + this.acknowledged = builder.acknowledged; + } + + public static PutSearchPipelineResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code acknowledged} + */ + @Nullable + public final Boolean acknowledged() { + return this.acknowledged; + } + + /** + * 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.acknowledged != null) { + generator.writeKey("acknowledged"); + generator.write(this.acknowledged); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PutSearchPipelineResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean acknowledged; + + public Builder() {} + + private Builder(PutSearchPipelineResponse o) { + this.acknowledged = o.acknowledged; + } + + private Builder(Builder o) { + this.acknowledged = o.acknowledged; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code acknowledged} + */ + @Nonnull + public final Builder acknowledged(@Nullable Boolean value) { + this.acknowledged = value; + return this; + } + + /** + * Builds a {@link PutSearchPipelineResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PutSearchPipelineResponse build() { + _checkSingleUse(); + + return new PutSearchPipelineResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutSearchPipelineResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PutSearchPipelineResponse::setupPutSearchPipelineResponseDeserializer + ); + + protected static void setupPutSearchPipelineResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.acknowledged); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutSearchPipelineResponse other = (PutSearchPipelineResponse) o; + return Objects.equals(this.acknowledged, other.acknowledged); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RenameFieldResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RenameFieldResponseProcessor.java new file mode 100644 index 000000000..cd20dfcd9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RenameFieldResponseProcessor.java @@ -0,0 +1,328 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.RenameFieldResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RenameFieldResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nonnull + private final String field; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String tag; + + @Nonnull + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private RenameFieldResponseProcessor(Builder builder) { + this.description = builder.description; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreFailure = builder.ignoreFailure; + this.tag = builder.tag; + this.targetField = ApiTypeHelper.requireNonNull(builder.targetField, this, "targetField"); + } + + public static RenameFieldResponseProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.RenameField; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * Required - API name: {@code target_field} + */ + @Nonnull + public final String targetField() { + return this.targetField; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + generator.writeKey("target_field"); + generator.write(this.targetField); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RenameFieldResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String description; + private String field; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String tag; + private String targetField; + + public Builder() {} + + private Builder(RenameFieldResponseProcessor o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Required - API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(String value) { + this.targetField = value; + return this; + } + + /** + * Builds a {@link RenameFieldResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RenameFieldResponseProcessor build() { + _checkSingleUse(); + + return new RenameFieldResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RenameFieldResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RenameFieldResponseProcessor::setupRenameFieldResponseProcessorDeserializer + ); + + protected static void setupRenameFieldResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + this.targetField.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RenameFieldResponseProcessor other = (RenameFieldResponseProcessor) o; + return Objects.equals(this.description, other.description) + && this.field.equals(other.field) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.tag, other.tag) + && this.targetField.equals(other.targetField); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessor.java new file mode 100644 index 000000000..f2bca8e29 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessor.java @@ -0,0 +1,289 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +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; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: search_pipeline.RequestProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RequestProcessor implements TaggedUnion, PlainJsonSerializable { + /** + * {@link RequestProcessor} variant kinds. + */ + public enum Kind implements JsonEnum { + FilterQuery("filter_query"), + NeuralQueryEnricher("neural_query_enricher"), + Oversample("oversample"), + Script("script"); + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + @Override + public String jsonValue() { + return jsonValue; + } + } + + private final Kind _kind; + private final RequestProcessorVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final RequestProcessorVariant _get() { + return _value; + } + + public RequestProcessor(RequestProcessorVariant value) { + this._kind = ApiTypeHelper.requireNonNull(value._requestProcessorKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + } + + private RequestProcessor(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static RequestProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code filter_query}? + */ + public boolean isFilterQuery() { + return _kind == Kind.FilterQuery; + } + + /** + * Get the {@code filter_query} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code filter_query} kind. + */ + public FilterQueryRequestProcessor filterQuery() { + return TaggedUnionUtils.get(this, Kind.FilterQuery); + } + + /** + * Is this variant instance of kind {@code neural_query_enricher}? + */ + public boolean isNeuralQueryEnricher() { + return _kind == Kind.NeuralQueryEnricher; + } + + /** + * Get the {@code neural_query_enricher} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code neural_query_enricher} kind. + */ + public NeuralQueryEnricherRequestProcessor neuralQueryEnricher() { + return TaggedUnionUtils.get(this, Kind.NeuralQueryEnricher); + } + + /** + * Is this variant instance of kind {@code oversample}? + */ + public boolean isOversample() { + return _kind == Kind.Oversample; + } + + /** + * Get the {@code oversample} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code oversample} kind. + */ + public OversampleRequestProcessor oversample() { + return TaggedUnionUtils.get(this, Kind.Oversample); + } + + /** + * Is this variant instance of kind {@code script}? + */ + public boolean isScript() { + return _kind == Kind.Script; + } + + /** + * Get the {@code script} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code script} kind. + */ + public SearchScriptRequestProcessor script() { + return TaggedUnionUtils.get(this, Kind.Script); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + generator.writeEnd(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private RequestProcessorVariant _value; + + public Builder() {} + + private Builder(RequestProcessor o) { + this._kind = o._kind; + this._value = o._value; + } + + public ObjectBuilder filterQuery(FilterQueryRequestProcessor v) { + this._kind = Kind.FilterQuery; + this._value = v; + return this; + } + + public ObjectBuilder filterQuery( + Function> fn + ) { + return this.filterQuery(fn.apply(new FilterQueryRequestProcessor.Builder()).build()); + } + + public ObjectBuilder neuralQueryEnricher(NeuralQueryEnricherRequestProcessor v) { + this._kind = Kind.NeuralQueryEnricher; + this._value = v; + return this; + } + + public ObjectBuilder neuralQueryEnricher( + Function> fn + ) { + return this.neuralQueryEnricher(fn.apply(new NeuralQueryEnricherRequestProcessor.Builder()).build()); + } + + public ObjectBuilder oversample(OversampleRequestProcessor v) { + this._kind = Kind.Oversample; + this._value = v; + return this; + } + + public ObjectBuilder oversample( + Function> fn + ) { + return this.oversample(fn.apply(new OversampleRequestProcessor.Builder()).build()); + } + + public ObjectBuilder script(SearchScriptRequestProcessor v) { + this._kind = Kind.Script; + this._value = v; + return this; + } + + public ObjectBuilder script( + Function> fn + ) { + return this.script(fn.apply(new SearchScriptRequestProcessor.Builder()).build()); + } + + @Override + public RequestProcessor build() { + _checkSingleUse(); + return new RequestProcessor(this); + } + } + + protected static void setupRequestProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::filterQuery, FilterQueryRequestProcessor._DESERIALIZER, "filter_query"); + op.add(Builder::neuralQueryEnricher, NeuralQueryEnricherRequestProcessor._DESERIALIZER, "neural_query_enricher"); + op.add(Builder::oversample, OversampleRequestProcessor._DESERIALIZER, "oversample"); + op.add(Builder::script, SearchScriptRequestProcessor._DESERIALIZER, "script"); + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RequestProcessor::setupRequestProcessorDeserializer, + Builder::build + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RequestProcessor other = (RequestProcessor) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorBuilders.java new file mode 100644 index 000000000..81d157b04 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorBuilders.java @@ -0,0 +1,75 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Builders for {@link RequestProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RequestProcessorBuilders { + private RequestProcessorBuilders() {} + + /** + * Creates a builder for the {@link FilterQueryRequestProcessor filter_query} {@code RequestProcessor} variant. + */ + public static FilterQueryRequestProcessor.Builder filterQuery() { + return new FilterQueryRequestProcessor.Builder(); + } + + /** + * Creates a builder for the {@link NeuralQueryEnricherRequestProcessor neural_query_enricher} {@code RequestProcessor} variant. + */ + public static NeuralQueryEnricherRequestProcessor.Builder neuralQueryEnricher() { + return new NeuralQueryEnricherRequestProcessor.Builder(); + } + + /** + * Creates a builder for the {@link OversampleRequestProcessor oversample} {@code RequestProcessor} variant. + */ + public static OversampleRequestProcessor.Builder oversample() { + return new OversampleRequestProcessor.Builder(); + } + + /** + * Creates a builder for the {@link SearchScriptRequestProcessor script} {@code RequestProcessor} variant. + */ + public static SearchScriptRequestProcessor.Builder script() { + return new SearchScriptRequestProcessor.Builder(); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorVariant.java new file mode 100644 index 000000000..5256e9ebc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RequestProcessorVariant.java @@ -0,0 +1,51 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Base interface for {@link RequestProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public interface RequestProcessorVariant { + RequestProcessor.Kind _requestProcessorKind(); + + default RequestProcessor _toRequestProcessor() { + return new RequestProcessor(this); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankContext.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankContext.java new file mode 100644 index 000000000..34906246d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankContext.java @@ -0,0 +1,205 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.RerankContext + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerankContext implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final List documentFields; + + // --------------------------------------------------------------------------------------------- + + private RerankContext(Builder builder) { + this.documentFields = ApiTypeHelper.unmodifiableRequired(builder.documentFields, this, "documentFields"); + } + + public static RerankContext of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code document_fields} + */ + @Nonnull + public final List documentFields() { + return this.documentFields; + } + + /** + * 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("document_fields"); + generator.writeStartArray(); + for (String item0 : this.documentFields) { + generator.write(item0); + } + generator.writeEnd(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RerankContext}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List documentFields; + + public Builder() {} + + private Builder(RerankContext o) { + this.documentFields = _listCopy(o.documentFields); + } + + private Builder(Builder o) { + this.documentFields = _listCopy(o.documentFields); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code document_fields} + * + *

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

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

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

+ */ + @Nonnull + public final Builder documentFields(String value, String... values) { + this.documentFields = _listAdd(this.documentFields, value, values); + return this; + } + + /** + * Builds a {@link RerankContext}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RerankContext build() { + _checkSingleUse(); + + return new RerankContext(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RerankContext} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RerankContext::setupRerankContextDeserializer + ); + + protected static void setupRerankContextDeserializer(ObjectDeserializer op) { + op.add(Builder::documentFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "document_fields"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.documentFields.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerankContext other = (RerankContext) o; + return this.documentFields.equals(other.documentFields); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankResponseProcessor.java new file mode 100644 index 000000000..e4673413d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RerankResponseProcessor.java @@ -0,0 +1,347 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.RerankResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerankResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final RerankContext context; + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final MLOpenSearchReranker mlOpensearch; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private RerankResponseProcessor(Builder builder) { + this.context = builder.context; + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.mlOpensearch = builder.mlOpensearch; + this.tag = builder.tag; + } + + public static RerankResponseProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.Rerank; + } + + /** + * API name: {@code context} + */ + @Nullable + public final RerankContext context() { + return this.context; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code ml_opensearch} + */ + @Nullable + public final MLOpenSearchReranker mlOpensearch() { + return this.mlOpensearch; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.context != null) { + generator.writeKey("context"); + this.context.serialize(generator, mapper); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.mlOpensearch != null) { + generator.writeKey("ml_opensearch"); + this.mlOpensearch.serialize(generator, mapper); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RerankResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private RerankContext context; + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + @Nullable + private MLOpenSearchReranker mlOpensearch; + @Nullable + private String tag; + + public Builder() {} + + private Builder(RerankResponseProcessor o) { + this.context = o.context; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.mlOpensearch = o.mlOpensearch; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.context = o.context; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.mlOpensearch = o.mlOpensearch; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code context} + */ + @Nonnull + public final Builder context(@Nullable RerankContext value) { + this.context = value; + return this; + } + + /** + * API name: {@code context} + */ + @Nonnull + public final Builder context(Function> fn) { + return context(fn.apply(new RerankContext.Builder()).build()); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code ml_opensearch} + */ + @Nonnull + public final Builder mlOpensearch(@Nullable MLOpenSearchReranker value) { + this.mlOpensearch = value; + return this; + } + + /** + * API name: {@code ml_opensearch} + */ + @Nonnull + public final Builder mlOpensearch(Function> fn) { + return mlOpensearch(fn.apply(new MLOpenSearchReranker.Builder()).build()); + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link RerankResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RerankResponseProcessor build() { + _checkSingleUse(); + + return new RerankResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RerankResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RerankResponseProcessor::setupRerankResponseProcessorDeserializer + ); + + protected static void setupRerankResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::context, RerankContext._DESERIALIZER, "context"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::mlOpensearch, MLOpenSearchReranker._DESERIALIZER, "ml_opensearch"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.context); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.mlOpensearch); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerankResponseProcessor other = (RerankResponseProcessor) o; + return Objects.equals(this.context, other.context) + && Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.mlOpensearch, other.mlOpensearch) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessor.java new file mode 100644 index 000000000..b780af702 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessor.java @@ -0,0 +1,409 @@ +/* + * 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.search_pipeline; + +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +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; +import org.opensearch.client.util.TaggedUnion; +import org.opensearch.client.util.TaggedUnionUtils; + +// typedef: search_pipeline.ResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResponseProcessor implements TaggedUnion, PlainJsonSerializable { + /** + * {@link ResponseProcessor} variant kinds. + */ + public enum Kind implements JsonEnum { + Collapse("collapse"), + PersonalizeSearchRanking("personalize_search_ranking"), + RenameField("rename_field"), + Rerank("rerank"), + RetrievalAugmentedGeneration("retrieval_augmented_generation"), + Sort("sort"), + Split("split"), + TruncateHits("truncate_hits"); + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + @Override + public String jsonValue() { + return jsonValue; + } + } + + private final Kind _kind; + private final ResponseProcessorVariant _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final ResponseProcessorVariant _get() { + return _value; + } + + public ResponseProcessor(ResponseProcessorVariant value) { + this._kind = ApiTypeHelper.requireNonNull(value._responseProcessorKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + } + + private ResponseProcessor(Builder builder) { + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + } + + public static ResponseProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code collapse}? + */ + public boolean isCollapse() { + return _kind == Kind.Collapse; + } + + /** + * Get the {@code collapse} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code collapse} kind. + */ + public CollapseResponseProcessor collapse() { + return TaggedUnionUtils.get(this, Kind.Collapse); + } + + /** + * Is this variant instance of kind {@code personalize_search_ranking}? + */ + public boolean isPersonalizeSearchRanking() { + return _kind == Kind.PersonalizeSearchRanking; + } + + /** + * Get the {@code personalize_search_ranking} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code personalize_search_ranking} kind. + */ + public PersonalizeSearchRankingResponseProcessor personalizeSearchRanking() { + return TaggedUnionUtils.get(this, Kind.PersonalizeSearchRanking); + } + + /** + * Is this variant instance of kind {@code rename_field}? + */ + public boolean isRenameField() { + return _kind == Kind.RenameField; + } + + /** + * Get the {@code rename_field} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code rename_field} kind. + */ + public RenameFieldResponseProcessor renameField() { + return TaggedUnionUtils.get(this, Kind.RenameField); + } + + /** + * Is this variant instance of kind {@code rerank}? + */ + public boolean isRerank() { + return _kind == Kind.Rerank; + } + + /** + * Get the {@code rerank} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code rerank} kind. + */ + public RerankResponseProcessor rerank() { + return TaggedUnionUtils.get(this, Kind.Rerank); + } + + /** + * Is this variant instance of kind {@code retrieval_augmented_generation}? + */ + public boolean isRetrievalAugmentedGeneration() { + return _kind == Kind.RetrievalAugmentedGeneration; + } + + /** + * Get the {@code retrieval_augmented_generation} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code retrieval_augmented_generation} kind. + */ + public RetrievalAugmentedGenerationResponseProcessor retrievalAugmentedGeneration() { + return TaggedUnionUtils.get(this, Kind.RetrievalAugmentedGeneration); + } + + /** + * Is this variant instance of kind {@code sort}? + */ + public boolean isSort() { + return _kind == Kind.Sort; + } + + /** + * Get the {@code sort} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code sort} kind. + */ + public SortResponseProcessor sort() { + return TaggedUnionUtils.get(this, Kind.Sort); + } + + /** + * Is this variant instance of kind {@code split}? + */ + public boolean isSplit() { + return _kind == Kind.Split; + } + + /** + * Get the {@code split} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code split} kind. + */ + public SplitResponseProcessor split() { + return TaggedUnionUtils.get(this, Kind.Split); + } + + /** + * Is this variant instance of kind {@code truncate_hits}? + */ + public boolean isTruncateHits() { + return _kind == Kind.TruncateHits; + } + + /** + * Get the {@code truncate_hits} variant value. + * + * @throws IllegalStateException if the current variant is not the {@code truncate_hits} kind. + */ + public TruncateHitsResponseProcessor truncateHits() { + return TaggedUnionUtils.get(this, Kind.TruncateHits); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + generator.writeEnd(); + } + + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private ResponseProcessorVariant _value; + + public Builder() {} + + private Builder(ResponseProcessor o) { + this._kind = o._kind; + this._value = o._value; + } + + public ObjectBuilder collapse(CollapseResponseProcessor v) { + this._kind = Kind.Collapse; + this._value = v; + return this; + } + + public ObjectBuilder collapse( + Function> fn + ) { + return this.collapse(fn.apply(new CollapseResponseProcessor.Builder()).build()); + } + + public ObjectBuilder personalizeSearchRanking(PersonalizeSearchRankingResponseProcessor v) { + this._kind = Kind.PersonalizeSearchRanking; + this._value = v; + return this; + } + + public ObjectBuilder personalizeSearchRanking( + Function> fn + ) { + return this.personalizeSearchRanking(fn.apply(new PersonalizeSearchRankingResponseProcessor.Builder()).build()); + } + + public ObjectBuilder renameField(RenameFieldResponseProcessor v) { + this._kind = Kind.RenameField; + this._value = v; + return this; + } + + public ObjectBuilder renameField( + Function> fn + ) { + return this.renameField(fn.apply(new RenameFieldResponseProcessor.Builder()).build()); + } + + public ObjectBuilder rerank(RerankResponseProcessor v) { + this._kind = Kind.Rerank; + this._value = v; + return this; + } + + public ObjectBuilder rerank( + Function> fn + ) { + return this.rerank(fn.apply(new RerankResponseProcessor.Builder()).build()); + } + + public ObjectBuilder retrievalAugmentedGeneration(RetrievalAugmentedGenerationResponseProcessor v) { + this._kind = Kind.RetrievalAugmentedGeneration; + this._value = v; + return this; + } + + public ObjectBuilder retrievalAugmentedGeneration( + Function> fn + ) { + return this.retrievalAugmentedGeneration(fn.apply(new RetrievalAugmentedGenerationResponseProcessor.Builder()).build()); + } + + public ObjectBuilder sort(SortResponseProcessor v) { + this._kind = Kind.Sort; + this._value = v; + return this; + } + + public ObjectBuilder sort(Function> fn) { + return this.sort(fn.apply(new SortResponseProcessor.Builder()).build()); + } + + public ObjectBuilder split(SplitResponseProcessor v) { + this._kind = Kind.Split; + this._value = v; + return this; + } + + public ObjectBuilder split(Function> fn) { + return this.split(fn.apply(new SplitResponseProcessor.Builder()).build()); + } + + public ObjectBuilder truncateHits(TruncateHitsResponseProcessor v) { + this._kind = Kind.TruncateHits; + this._value = v; + return this; + } + + public ObjectBuilder truncateHits( + Function> fn + ) { + return this.truncateHits(fn.apply(new TruncateHitsResponseProcessor.Builder()).build()); + } + + @Override + public ResponseProcessor build() { + _checkSingleUse(); + return new ResponseProcessor(this); + } + } + + protected static void setupResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::collapse, CollapseResponseProcessor._DESERIALIZER, "collapse"); + op.add(Builder::personalizeSearchRanking, PersonalizeSearchRankingResponseProcessor._DESERIALIZER, "personalize_search_ranking"); + op.add(Builder::renameField, RenameFieldResponseProcessor._DESERIALIZER, "rename_field"); + op.add(Builder::rerank, RerankResponseProcessor._DESERIALIZER, "rerank"); + op.add( + Builder::retrievalAugmentedGeneration, + RetrievalAugmentedGenerationResponseProcessor._DESERIALIZER, + "retrieval_augmented_generation" + ); + op.add(Builder::sort, SortResponseProcessor._DESERIALIZER, "sort"); + op.add(Builder::split, SplitResponseProcessor._DESERIALIZER, "split"); + op.add(Builder::truncateHits, TruncateHitsResponseProcessor._DESERIALIZER, "truncate_hits"); + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ResponseProcessor::setupResponseProcessorDeserializer, + Builder::build + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this._kind); + result = 31 * result + Objects.hashCode(this._value); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ResponseProcessor other = (ResponseProcessor) o; + return Objects.equals(this._kind, other._kind) && Objects.equals(this._value, other._value); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorBuilders.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorBuilders.java new file mode 100644 index 000000000..4ce4ed3a6 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorBuilders.java @@ -0,0 +1,105 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Builders for {@link ResponseProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ResponseProcessorBuilders { + private ResponseProcessorBuilders() {} + + /** + * Creates a builder for the {@link CollapseResponseProcessor collapse} {@code ResponseProcessor} variant. + */ + public static CollapseResponseProcessor.Builder collapse() { + return new CollapseResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link PersonalizeSearchRankingResponseProcessor personalize_search_ranking} {@code ResponseProcessor} + * variant. + */ + public static PersonalizeSearchRankingResponseProcessor.Builder personalizeSearchRanking() { + return new PersonalizeSearchRankingResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link RenameFieldResponseProcessor rename_field} {@code ResponseProcessor} variant. + */ + public static RenameFieldResponseProcessor.Builder renameField() { + return new RenameFieldResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link RerankResponseProcessor rerank} {@code ResponseProcessor} variant. + */ + public static RerankResponseProcessor.Builder rerank() { + return new RerankResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link RetrievalAugmentedGenerationResponseProcessor retrieval_augmented_generation} + * {@code ResponseProcessor} variant. + */ + public static RetrievalAugmentedGenerationResponseProcessor.Builder retrievalAugmentedGeneration() { + return new RetrievalAugmentedGenerationResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link SortResponseProcessor sort} {@code ResponseProcessor} variant. + */ + public static SortResponseProcessor.Builder sort() { + return new SortResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link SplitResponseProcessor split} {@code ResponseProcessor} variant. + */ + public static SplitResponseProcessor.Builder split() { + return new SplitResponseProcessor.Builder(); + } + + /** + * Creates a builder for the {@link TruncateHitsResponseProcessor truncate_hits} {@code ResponseProcessor} variant. + */ + public static TruncateHitsResponseProcessor.Builder truncateHits() { + return new TruncateHitsResponseProcessor.Builder(); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorVariant.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorVariant.java new file mode 100644 index 000000000..ef084fb78 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ResponseProcessorVariant.java @@ -0,0 +1,51 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; + +/** + * Base interface for {@link ResponseProcessor} variants. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public interface ResponseProcessorVariant { + ResponseProcessor.Kind _responseProcessorKind(); + + default ResponseProcessor _toResponseProcessor() { + return new ResponseProcessor(this); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RetrievalAugmentedGenerationResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RetrievalAugmentedGenerationResponseProcessor.java new file mode 100644 index 000000000..14af3a03b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/RetrievalAugmentedGenerationResponseProcessor.java @@ -0,0 +1,391 @@ +/* + * 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.search_pipeline; + +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; +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: search_pipeline.RetrievalAugmentedGenerationResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RetrievalAugmentedGenerationResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List contextFieldList; + + @Nullable + private final String description; + + @Nonnull + private final String modelId; + + @Nullable + private final String systemPrompt; + + @Nullable + private final String tag; + + @Nullable + private final String userInstructions; + + // --------------------------------------------------------------------------------------------- + + private RetrievalAugmentedGenerationResponseProcessor(Builder builder) { + this.contextFieldList = ApiTypeHelper.unmodifiableRequired(builder.contextFieldList, this, "contextFieldList"); + this.description = builder.description; + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.systemPrompt = builder.systemPrompt; + this.tag = builder.tag; + this.userInstructions = builder.userInstructions; + } + + public static RetrievalAugmentedGenerationResponseProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.RetrievalAugmentedGeneration; + } + + /** + * Required - API name: {@code context_field_list} + */ + @Nonnull + public final List contextFieldList() { + return this.contextFieldList; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code system_prompt} + */ + @Nullable + public final String systemPrompt() { + return this.systemPrompt; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * API name: {@code user_instructions} + */ + @Nullable + public final String userInstructions() { + return this.userInstructions; + } + + /** + * 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("context_field_list"); + generator.writeStartArray(); + for (String item0 : this.contextFieldList) { + generator.write(item0); + } + generator.writeEnd(); + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("model_id"); + generator.write(this.modelId); + + if (this.systemPrompt != null) { + generator.writeKey("system_prompt"); + generator.write(this.systemPrompt); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + if (this.userInstructions != null) { + generator.writeKey("user_instructions"); + generator.write(this.userInstructions); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RetrievalAugmentedGenerationResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase + implements + CopyableBuilder { + private List contextFieldList; + @Nullable + private String description; + private String modelId; + @Nullable + private String systemPrompt; + @Nullable + private String tag; + @Nullable + private String userInstructions; + + public Builder() {} + + private Builder(RetrievalAugmentedGenerationResponseProcessor o) { + this.contextFieldList = _listCopy(o.contextFieldList); + this.description = o.description; + this.modelId = o.modelId; + this.systemPrompt = o.systemPrompt; + this.tag = o.tag; + this.userInstructions = o.userInstructions; + } + + private Builder(Builder o) { + this.contextFieldList = _listCopy(o.contextFieldList); + this.description = o.description; + this.modelId = o.modelId; + this.systemPrompt = o.systemPrompt; + this.tag = o.tag; + this.userInstructions = o.userInstructions; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code context_field_list} + * + *

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

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

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

+ */ + @Nonnull + public final Builder contextFieldList(String value, String... values) { + this.contextFieldList = _listAdd(this.contextFieldList, value, values); + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code system_prompt} + */ + @Nonnull + public final Builder systemPrompt(@Nullable String value) { + this.systemPrompt = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * API name: {@code user_instructions} + */ + @Nonnull + public final Builder userInstructions(@Nullable String value) { + this.userInstructions = value; + return this; + } + + /** + * Builds a {@link RetrievalAugmentedGenerationResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RetrievalAugmentedGenerationResponseProcessor build() { + _checkSingleUse(); + + return new RetrievalAugmentedGenerationResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RetrievalAugmentedGenerationResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RetrievalAugmentedGenerationResponseProcessor::setupRetrievalAugmentedGenerationResponseProcessorDeserializer + ); + + protected static void setupRetrievalAugmentedGenerationResponseProcessorDeserializer( + ObjectDeserializer op + ) { + op.add( + Builder::contextFieldList, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "context_field_list" + ); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::systemPrompt, JsonpDeserializer.stringDeserializer(), "system_prompt"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::userInstructions, JsonpDeserializer.stringDeserializer(), "user_instructions"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.contextFieldList.hashCode(); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + Objects.hashCode(this.systemPrompt); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + Objects.hashCode(this.userInstructions); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RetrievalAugmentedGenerationResponseProcessor other = (RetrievalAugmentedGenerationResponseProcessor) o; + return this.contextFieldList.equals(other.contextFieldList) + && Objects.equals(this.description, other.description) + && this.modelId.equals(other.modelId) + && Objects.equals(this.systemPrompt, other.systemPrompt) + && Objects.equals(this.tag, other.tag) + && Objects.equals(this.userInstructions, other.userInstructions); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombination.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombination.java new file mode 100644 index 000000000..c1eba0c63 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombination.java @@ -0,0 +1,242 @@ +/* + * 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.search_pipeline; + +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; +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: search_pipeline.ScoreCombination + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ScoreCombination implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final List parameters; + + @Nullable + private final ScoreCombinationTechnique technique; + + // --------------------------------------------------------------------------------------------- + + private ScoreCombination(Builder builder) { + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + this.technique = builder.technique; + } + + public static ScoreCombination of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code parameters} + */ + @Nonnull + public final List parameters() { + return this.parameters; + } + + /** + * API name: {@code technique} + */ + @Nullable + public final ScoreCombinationTechnique technique() { + return this.technique; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartArray(); + for (Float item0 : this.parameters) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.technique != null) { + generator.writeKey("technique"); + this.technique.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ScoreCombination}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List parameters; + @Nullable + private ScoreCombinationTechnique technique; + + public Builder() {} + + private Builder(ScoreCombination o) { + this.parameters = _listCopy(o.parameters); + this.technique = o.technique; + } + + private Builder(Builder o) { + this.parameters = _listCopy(o.parameters); + this.technique = o.technique; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code parameters} + * + *

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

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

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

+ */ + @Nonnull + public final Builder parameters(Float value, Float... values) { + this.parameters = _listAdd(this.parameters, value, values); + return this; + } + + /** + * API name: {@code technique} + */ + @Nonnull + public final Builder technique(@Nullable ScoreCombinationTechnique value) { + this.technique = value; + return this; + } + + /** + * Builds a {@link ScoreCombination}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ScoreCombination build() { + _checkSingleUse(); + + return new ScoreCombination(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ScoreCombination} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ScoreCombination::setupScoreCombinationDeserializer + ); + + protected static void setupScoreCombinationDeserializer(ObjectDeserializer op) { + op.add(Builder::parameters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.floatDeserializer()), "parameters"); + op.add(Builder::technique, ScoreCombinationTechnique._DESERIALIZER, "technique"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.parameters); + result = 31 * result + Objects.hashCode(this.technique); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ScoreCombination other = (ScoreCombination) o; + return Objects.equals(this.parameters, other.parameters) && Objects.equals(this.technique, other.technique); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombinationTechnique.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombinationTechnique.java new file mode 100644 index 000000000..6abd1e3ef --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreCombinationTechnique.java @@ -0,0 +1,67 @@ +/* + * 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.search_pipeline; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: search_pipeline.ScoreCombinationTechnique + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ScoreCombinationTechnique implements JsonEnum { + ArithmeticMean("arithmetic_mean"), + + GeometricMean("geometric_mean"), + + HarmonicMean("harmonic_mean"); + + private final String jsonValue; + + ScoreCombinationTechnique(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ScoreCombinationTechnique.values() + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalization.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalization.java new file mode 100644 index 000000000..93a947006 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalization.java @@ -0,0 +1,187 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.ScoreNormalization + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ScoreNormalization implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final ScoreNormalizationTechnique technique; + + // --------------------------------------------------------------------------------------------- + + private ScoreNormalization(Builder builder) { + this.technique = builder.technique; + } + + public static ScoreNormalization of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code technique} + */ + @Nullable + public final ScoreNormalizationTechnique technique() { + return this.technique; + } + + /** + * 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.technique != null) { + generator.writeKey("technique"); + this.technique.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ScoreNormalization}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private ScoreNormalizationTechnique technique; + + public Builder() {} + + private Builder(ScoreNormalization o) { + this.technique = o.technique; + } + + private Builder(Builder o) { + this.technique = o.technique; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code technique} + */ + @Nonnull + public final Builder technique(@Nullable ScoreNormalizationTechnique value) { + this.technique = value; + return this; + } + + /** + * Builds a {@link ScoreNormalization}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ScoreNormalization build() { + _checkSingleUse(); + + return new ScoreNormalization(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ScoreNormalization} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ScoreNormalization::setupScoreNormalizationDeserializer + ); + + protected static void setupScoreNormalizationDeserializer(ObjectDeserializer op) { + op.add(Builder::technique, ScoreNormalizationTechnique._DESERIALIZER, "technique"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.technique); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ScoreNormalization other = (ScoreNormalization) o; + return Objects.equals(this.technique, other.technique); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalizationTechnique.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalizationTechnique.java new file mode 100644 index 000000000..1cdc8004e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/ScoreNormalizationTechnique.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.search_pipeline; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: search_pipeline.ScoreNormalizationTechnique + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ScoreNormalizationTechnique implements JsonEnum { + L2("l2"), + + MinMax("min_max"); + + private final String jsonValue; + + ScoreNormalizationTechnique(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ScoreNormalizationTechnique.values() + ); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchPipelineStructure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchPipelineStructure.java new file mode 100644 index 000000000..e612d2bdf --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchPipelineStructure.java @@ -0,0 +1,394 @@ +/* + * 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.search_pipeline; + +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; +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: search_pipeline.SearchPipelineStructure + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SearchPipelineStructure + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List phaseResultsProcessors; + + @Nonnull + private final List requestProcessors; + + @Nonnull + private final List responseProcessors; + + @Nullable + private final Integer version; + + // --------------------------------------------------------------------------------------------- + + private SearchPipelineStructure(Builder builder) { + this.phaseResultsProcessors = ApiTypeHelper.unmodifiable(builder.phaseResultsProcessors); + this.requestProcessors = ApiTypeHelper.unmodifiable(builder.requestProcessors); + this.responseProcessors = ApiTypeHelper.unmodifiable(builder.responseProcessors); + this.version = builder.version; + } + + public static SearchPipelineStructure of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code phase_results_processors} + */ + @Nonnull + public final List phaseResultsProcessors() { + return this.phaseResultsProcessors; + } + + /** + * API name: {@code request_processors} + */ + @Nonnull + public final List requestProcessors() { + return this.requestProcessors; + } + + /** + * API name: {@code response_processors} + */ + @Nonnull + public final List responseProcessors() { + return this.responseProcessors; + } + + /** + * API name: {@code version} + */ + @Nullable + public final Integer version() { + return this.version; + } + + /** + * 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 (ApiTypeHelper.isDefined(this.phaseResultsProcessors)) { + generator.writeKey("phase_results_processors"); + generator.writeStartArray(); + for (PhaseResultsProcessor item0 : this.phaseResultsProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.requestProcessors)) { + generator.writeKey("request_processors"); + generator.writeStartArray(); + for (RequestProcessor item0 : this.requestProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.responseProcessors)) { + generator.writeKey("response_processors"); + generator.writeStartArray(); + for (ResponseProcessor item0 : this.responseProcessors) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SearchPipelineStructure}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List phaseResultsProcessors; + @Nullable + private List requestProcessors; + @Nullable + private List responseProcessors; + @Nullable + private Integer version; + + public Builder() {} + + private Builder(SearchPipelineStructure o) { + this.phaseResultsProcessors = _listCopy(o.phaseResultsProcessors); + this.requestProcessors = _listCopy(o.requestProcessors); + this.responseProcessors = _listCopy(o.responseProcessors); + this.version = o.version; + } + + private Builder(Builder o) { + this.phaseResultsProcessors = _listCopy(o.phaseResultsProcessors); + this.requestProcessors = _listCopy(o.requestProcessors); + this.responseProcessors = _listCopy(o.responseProcessors); + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code phase_results_processors} + * + *

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

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

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

+ */ + @Nonnull + public final Builder phaseResultsProcessors(PhaseResultsProcessor value, PhaseResultsProcessor... values) { + this.phaseResultsProcessors = _listAdd(this.phaseResultsProcessors, value, values); + return this; + } + + /** + * API name: {@code phase_results_processors} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder requestProcessors(RequestProcessor value, RequestProcessor... values) { + this.requestProcessors = _listAdd(this.requestProcessors, value, values); + return this; + } + + /** + * API name: {@code request_processors} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder responseProcessors(ResponseProcessor value, ResponseProcessor... values) { + this.responseProcessors = _listAdd(this.responseProcessors, value, values); + return this; + } + + /** + * API name: {@code response_processors} + * + *

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

+ */ + @Nonnull + public final Builder responseProcessors(Function> fn) { + return responseProcessors(fn.apply(new ResponseProcessor.Builder()).build()); + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable Integer value) { + this.version = value; + return this; + } + + /** + * Builds a {@link SearchPipelineStructure}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SearchPipelineStructure build() { + _checkSingleUse(); + + return new SearchPipelineStructure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SearchPipelineStructure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SearchPipelineStructure::setupSearchPipelineStructureDeserializer + ); + + protected static void setupSearchPipelineStructureDeserializer(ObjectDeserializer op) { + op.add( + Builder::phaseResultsProcessors, + JsonpDeserializer.arrayDeserializer(PhaseResultsProcessor._DESERIALIZER), + "phase_results_processors" + ); + op.add(Builder::requestProcessors, JsonpDeserializer.arrayDeserializer(RequestProcessor._DESERIALIZER), "request_processors"); + op.add(Builder::responseProcessors, JsonpDeserializer.arrayDeserializer(ResponseProcessor._DESERIALIZER), "response_processors"); + op.add(Builder::version, JsonpDeserializer.integerDeserializer(), "version"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.phaseResultsProcessors); + result = 31 * result + Objects.hashCode(this.requestProcessors); + result = 31 * result + Objects.hashCode(this.responseProcessors); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SearchPipelineStructure other = (SearchPipelineStructure) o; + return Objects.equals(this.phaseResultsProcessors, other.phaseResultsProcessors) + && Objects.equals(this.requestProcessors, other.requestProcessors) + && Objects.equals(this.responseProcessors, other.responseProcessors) + && Objects.equals(this.version, other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchScriptRequestProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchScriptRequestProcessor.java new file mode 100644 index 000000000..96c619ec9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SearchScriptRequestProcessor.java @@ -0,0 +1,331 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.SearchScriptRequestProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SearchScriptRequestProcessor + implements + RequestProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String lang; + + @Nonnull + private final String source; + + @Nullable + private final String tag; + + // --------------------------------------------------------------------------------------------- + + private SearchScriptRequestProcessor(Builder builder) { + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.lang = builder.lang; + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.tag = builder.tag; + } + + public static SearchScriptRequestProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link RequestProcessor} variant kind. + */ + @Override + public RequestProcessor.Kind _requestProcessorKind() { + return RequestProcessor.Kind.Script; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code lang} + */ + @Nullable + public final String lang() { + return this.lang; + } + + /** + * Required - API name: {@code source} + */ + @Nonnull + public final String source() { + return this.source; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + } + + generator.writeKey("source"); + generator.write(this.source); + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SearchScriptRequestProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String lang; + private String source; + @Nullable + private String tag; + + public Builder() {} + + private Builder(SearchScriptRequestProcessor o) { + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.lang = o.lang; + this.source = o.source; + this.tag = o.tag; + } + + private Builder(Builder o) { + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.lang = o.lang; + this.source = o.source; + this.tag = o.tag; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code lang} + */ + @Nonnull + public final Builder lang(@Nullable String value) { + this.lang = value; + return this; + } + + /** + * Required - API name: {@code source} + */ + @Nonnull + public final Builder source(String value) { + this.source = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * Builds a {@link SearchScriptRequestProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SearchScriptRequestProcessor build() { + _checkSingleUse(); + + return new SearchScriptRequestProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SearchScriptRequestProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SearchScriptRequestProcessor::setupSearchScriptRequestProcessorDeserializer + ); + + protected static void setupSearchScriptRequestProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); + op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.lang); + result = 31 * result + this.source.hashCode(); + result = 31 * result + Objects.hashCode(this.tag); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SearchScriptRequestProcessor other = (SearchScriptRequestProcessor) o; + return Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.lang, other.lang) + && this.source.equals(other.source) + && Objects.equals(this.tag, other.tag); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SortResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SortResponseProcessor.java new file mode 100644 index 000000000..1dd9de65d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SortResponseProcessor.java @@ -0,0 +1,362 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.SortResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SortResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nonnull + private final String field; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String order; + + @Nullable + private final String tag; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private SortResponseProcessor(Builder builder) { + this.description = builder.description; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreFailure = builder.ignoreFailure; + this.order = builder.order; + this.tag = builder.tag; + this.targetField = builder.targetField; + } + + public static SortResponseProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.Sort; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code order} + */ + @Nullable + public final String order() { + return this.order; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.order != null) { + generator.writeKey("order"); + generator.write(this.order); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SortResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String description; + private String field; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String order; + @Nullable + private String tag; + @Nullable + private String targetField; + + public Builder() {} + + private Builder(SortResponseProcessor o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.order = o.order; + this.tag = o.tag; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.order = o.order; + this.tag = o.tag; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code order} + */ + @Nonnull + public final Builder order(@Nullable String value) { + this.order = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + /** + * Builds a {@link SortResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SortResponseProcessor build() { + _checkSingleUse(); + + return new SortResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SortResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SortResponseProcessor::setupSortResponseProcessorDeserializer + ); + + protected static void setupSortResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::order, JsonpDeserializer.stringDeserializer(), "order"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.order); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + Objects.hashCode(this.targetField); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SortResponseProcessor other = (SortResponseProcessor) o; + return Objects.equals(this.description, other.description) + && this.field.equals(other.field) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.order, other.order) + && Objects.equals(this.tag, other.tag) + && Objects.equals(this.targetField, other.targetField); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SplitResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SplitResponseProcessor.java new file mode 100644 index 000000000..d517a5cf1 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/SplitResponseProcessor.java @@ -0,0 +1,392 @@ +/* + * 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.search_pipeline; + +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: search_pipeline.SplitResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SplitResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nonnull + private final String field; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final Boolean preserveTrailing; + + @Nonnull + private final String separator; + + @Nullable + private final String tag; + + @Nullable + private final String targetField; + + // --------------------------------------------------------------------------------------------- + + private SplitResponseProcessor(Builder builder) { + this.description = builder.description; + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.ignoreFailure = builder.ignoreFailure; + this.preserveTrailing = builder.preserveTrailing; + this.separator = ApiTypeHelper.requireNonNull(builder.separator, this, "separator"); + this.tag = builder.tag; + this.targetField = builder.targetField; + } + + public static SplitResponseProcessor of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.Split; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final String field() { + return this.field; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code preserve_trailing} + */ + @Nullable + public final Boolean preserveTrailing() { + return this.preserveTrailing; + } + + /** + * Required - API name: {@code separator} + */ + @Nonnull + public final String separator() { + return this.separator; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * API name: {@code target_field} + */ + @Nullable + public final String targetField() { + return this.targetField; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("field"); + generator.write(this.field); + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.preserveTrailing != null) { + generator.writeKey("preserve_trailing"); + generator.write(this.preserveTrailing); + } + + generator.writeKey("separator"); + generator.write(this.separator); + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + if (this.targetField != null) { + generator.writeKey("target_field"); + generator.write(this.targetField); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SplitResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String description; + private String field; + @Nullable + private Boolean ignoreFailure; + @Nullable + private Boolean preserveTrailing; + private String separator; + @Nullable + private String tag; + @Nullable + private String targetField; + + public Builder() {} + + private Builder(SplitResponseProcessor o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.preserveTrailing = o.preserveTrailing; + this.separator = o.separator; + this.tag = o.tag; + this.targetField = o.targetField; + } + + private Builder(Builder o) { + this.description = o.description; + this.field = o.field; + this.ignoreFailure = o.ignoreFailure; + this.preserveTrailing = o.preserveTrailing; + this.separator = o.separator; + this.tag = o.tag; + this.targetField = o.targetField; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code field} + */ + @Nonnull + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code preserve_trailing} + */ + @Nonnull + public final Builder preserveTrailing(@Nullable Boolean value) { + this.preserveTrailing = value; + return this; + } + + /** + * Required - API name: {@code separator} + */ + @Nonnull + public final Builder separator(String value) { + this.separator = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * API name: {@code target_field} + */ + @Nonnull + public final Builder targetField(@Nullable String value) { + this.targetField = value; + return this; + } + + /** + * Builds a {@link SplitResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SplitResponseProcessor build() { + _checkSingleUse(); + + return new SplitResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SplitResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SplitResponseProcessor::setupSplitResponseProcessorDeserializer + ); + + protected static void setupSplitResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::preserveTrailing, JsonpDeserializer.booleanDeserializer(), "preserve_trailing"); + op.add(Builder::separator, JsonpDeserializer.stringDeserializer(), "separator"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::targetField, JsonpDeserializer.stringDeserializer(), "target_field"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.field.hashCode(); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.preserveTrailing); + result = 31 * result + this.separator.hashCode(); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + Objects.hashCode(this.targetField); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SplitResponseProcessor other = (SplitResponseProcessor) o; + return Objects.equals(this.description, other.description) + && this.field.equals(other.field) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.preserveTrailing, other.preserveTrailing) + && this.separator.equals(other.separator) + && Objects.equals(this.tag, other.tag) + && Objects.equals(this.targetField, other.targetField); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/TruncateHitsResponseProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/TruncateHitsResponseProcessor.java new file mode 100644 index 000000000..d4aae5d11 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/search_pipeline/TruncateHitsResponseProcessor.java @@ -0,0 +1,333 @@ +/* + * 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.search_pipeline; + +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.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: search_pipeline.TruncateHitsResponseProcessor + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TruncateHitsResponseProcessor + implements + ResponseProcessorVariant, + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String contextPrefix; + + @Nullable + private final String description; + + @Nullable + private final Boolean ignoreFailure; + + @Nullable + private final String tag; + + @Nullable + private final Integer targetSize; + + // --------------------------------------------------------------------------------------------- + + private TruncateHitsResponseProcessor(Builder builder) { + this.contextPrefix = builder.contextPrefix; + this.description = builder.description; + this.ignoreFailure = builder.ignoreFailure; + this.tag = builder.tag; + this.targetSize = builder.targetSize; + } + + public static TruncateHitsResponseProcessor of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * {@link ResponseProcessor} variant kind. + */ + @Override + public ResponseProcessor.Kind _responseProcessorKind() { + return ResponseProcessor.Kind.TruncateHits; + } + + /** + * API name: {@code context_prefix} + */ + @Nullable + public final String contextPrefix() { + return this.contextPrefix; + } + + /** + * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code ignore_failure} + */ + @Nullable + public final Boolean ignoreFailure() { + return this.ignoreFailure; + } + + /** + * API name: {@code tag} + */ + @Nullable + public final String tag() { + return this.tag; + } + + /** + * API name: {@code target_size} + */ + @Nullable + public final Integer targetSize() { + return this.targetSize; + } + + /** + * 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.contextPrefix != null) { + generator.writeKey("context_prefix"); + generator.write(this.contextPrefix); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.ignoreFailure != null) { + generator.writeKey("ignore_failure"); + generator.write(this.ignoreFailure); + } + + if (this.tag != null) { + generator.writeKey("tag"); + generator.write(this.tag); + } + + if (this.targetSize != null) { + generator.writeKey("target_size"); + generator.write(this.targetSize); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link TruncateHitsResponseProcessor}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String contextPrefix; + @Nullable + private String description; + @Nullable + private Boolean ignoreFailure; + @Nullable + private String tag; + @Nullable + private Integer targetSize; + + public Builder() {} + + private Builder(TruncateHitsResponseProcessor o) { + this.contextPrefix = o.contextPrefix; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + this.targetSize = o.targetSize; + } + + private Builder(Builder o) { + this.contextPrefix = o.contextPrefix; + this.description = o.description; + this.ignoreFailure = o.ignoreFailure; + this.tag = o.tag; + this.targetSize = o.targetSize; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code context_prefix} + */ + @Nonnull + public final Builder contextPrefix(@Nullable String value) { + this.contextPrefix = value; + return this; + } + + /** + * API name: {@code description} + */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code ignore_failure} + */ + @Nonnull + public final Builder ignoreFailure(@Nullable Boolean value) { + this.ignoreFailure = value; + return this; + } + + /** + * API name: {@code tag} + */ + @Nonnull + public final Builder tag(@Nullable String value) { + this.tag = value; + return this; + } + + /** + * API name: {@code target_size} + */ + @Nonnull + public final Builder targetSize(@Nullable Integer value) { + this.targetSize = value; + return this; + } + + /** + * Builds a {@link TruncateHitsResponseProcessor}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public TruncateHitsResponseProcessor build() { + _checkSingleUse(); + + return new TruncateHitsResponseProcessor(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TruncateHitsResponseProcessor} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + TruncateHitsResponseProcessor::setupTruncateHitsResponseProcessorDeserializer + ); + + protected static void setupTruncateHitsResponseProcessorDeserializer(ObjectDeserializer op) { + op.add(Builder::contextPrefix, JsonpDeserializer.stringDeserializer(), "context_prefix"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::ignoreFailure, JsonpDeserializer.booleanDeserializer(), "ignore_failure"); + op.add(Builder::tag, JsonpDeserializer.stringDeserializer(), "tag"); + op.add(Builder::targetSize, JsonpDeserializer.integerDeserializer(), "target_size"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.contextPrefix); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.ignoreFailure); + result = 31 * result + Objects.hashCode(this.tag); + result = 31 * result + Objects.hashCode(this.targetSize); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TruncateHitsResponseProcessor other = (TruncateHitsResponseProcessor) o; + return Objects.equals(this.contextPrefix, other.contextPrefix) + && Objects.equals(this.description, other.description) + && Objects.equals(this.ignoreFailure, other.ignoreFailure) + && Objects.equals(this.tag, other.tag) + && Objects.equals(this.targetSize, other.targetSize); + } +} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index feeca6248..25b6276af 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -3628,7 +3628,7 @@ paths: operationId: security.get_sslinfo.0 x-operation-group: security.get_sslinfo x-version-added: '1.0' - description: Retrieves the SSL configuration information. + description: Retrieves information about the SSL configuration. parameters: - $ref: '#/components/parameters/security.get_sslinfo___query.show_dn' - $ref: '#/components/parameters/_global___query.pretty' @@ -6726,7 +6726,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Check whether or not an upgrade can be performed and what resources can be updated. + description: Checks whether or not an upgrade can be performed and which security resources can be updated. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#configuration-upgrade-check responses: @@ -6746,7 +6746,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Helps cluster operator upgrade missing defaults and stale default definitions. + description: Assists the cluster operator with upgrading missing default values and stale default definitions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#configuration-upgrade requestBody: @@ -6770,7 +6770,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns account details for the current user. + description: Returns account information for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-account-details responses: @@ -6832,7 +6832,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates, updates, or deletes multiple action groups in a single call. + description: Creates, updates, or deletes multiple action groups in a single request. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-groups requestBody: @@ -6854,7 +6854,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete a specified action group. + description: Deletes the specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group parameters: @@ -6894,7 +6894,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of an action group. + description: Updates the individual attributes of an action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-group parameters: @@ -6941,7 +6941,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the current list of allowed API accessible to normal user. + description: Retrieves the current list of allowed APIs accessible to a normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api responses: @@ -6962,7 +6962,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates the current list of allowed API accessible to normal user. + description: Updates the current list of APIs accessible for users on the allow list. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api requestBody: @@ -6985,7 +6985,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates or replaces the permitted APIs. Accessible using Super Admin certificate or REST API permission. + description: Creates or replaces APIs permitted for users on the allow list. Requires a super admin certificate or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api requestBody: @@ -7028,7 +7028,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: A PATCH call is used to update specified fields in the audit configuration. + description: Updates the specified fields in the audit configuration. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#audit-logs requestBody: @@ -7072,7 +7072,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authorization token. + description: Returns the authorization token for the current user. responses: '200': $ref: '#/components/responses/security.authtoken___200' @@ -7090,7 +7090,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Flushes the Security plugin user, authentication, and authorization cache. + description: Flushes the Security plugin's user, authentication, and authorization cache. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#flush-cache responses: @@ -7110,7 +7110,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -7128,7 +7128,7 @@ paths: - amazon-managed - amazon-serverless x-ignorable: true - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -7146,7 +7146,7 @@ paths: - amazon-managed - amazon-serverless x-ignorable: true - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -7188,7 +7188,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the given node's security certificates. + description: Retrieves the specified node's security certificates. parameters: - $ref: '#/components/parameters/security.get_node_certificates___path.node_id' - $ref: '#/components/parameters/security.get_node_certificates___query.cert_type' @@ -7213,7 +7213,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Generates On-Behalf-Of token for the current user. + description: Generates a `On-Behalf-Of` token for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/authentication-tokens/#api-endpoint requestBody: @@ -7256,7 +7256,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates, updates, or deletes multiple internal users in a single call. + description: Creates, updates, or deletes multiple internal users in a single request. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-users requestBody: @@ -7278,7 +7278,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified user. + description: Deletes the specified internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-user parameters: @@ -7298,7 +7298,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieve one internal user. + description: Retrieve information about the specified internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-user parameters: @@ -7318,7 +7318,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of an internal user. + description: Updates individual attributes for an internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-user parameters: @@ -7365,7 +7365,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Generates authorization token for the given user. + description: Generates an authorization token for the specified user. parameters: - $ref: '#/components/parameters/security.generate_user_token___path.username' - $ref: '#/components/parameters/_global___query.pretty' @@ -7386,7 +7386,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Migrates security configuration from v6 to v7. + description: Migrates the security configuration from v6 to v7. responses: '200': $ref: '#/components/responses/security.migrate___200' @@ -7406,7 +7406,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + description: Retrieves all node distinguished names. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names parameters: @@ -7430,7 +7430,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Bulk update of distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + description: Bulk updates specified node distinguished names. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-all-distinguished-names requestBody: @@ -7456,7 +7456,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + description: Deletes all distinguished names in the specified cluster or node allowlist. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-distinguished-names parameters: @@ -7480,7 +7480,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + description: Retrieves all node distinguished names. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names parameters: @@ -7505,7 +7505,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. + description: Updates the distinguished cluster name for the specified cluster. Requires super admin or REST API permissions. parameters: - $ref: '#/components/parameters/security.patch_distinguished_name___path.cluster_name' - $ref: '#/components/parameters/_global___query.pretty' @@ -7529,7 +7529,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + description: Adds or updates the specified distinguished names in the cluster or node allowlist. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-distinguished-names parameters: @@ -7558,7 +7558,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Gets the evaluated REST API permissions for the currently logged in user. + description: Retrieves the evaluated REST API permissions for the currently logged in user. responses: '200': $ref: '#/components/responses/security.get_permissions_info___200' @@ -7621,7 +7621,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified role. + description: Deletes the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role parameters: @@ -7661,7 +7661,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of a role. + description: Updates the individual attributes of a role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role parameters: @@ -7729,7 +7729,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates or updates multiple role mappings in a single call. + description: Creates or updates multiple role mappings in a single request. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mappings requestBody: @@ -7773,7 +7773,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves one role mapping. + description: Retrieves the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role-mapping parameters: @@ -7793,7 +7793,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of a role mapping. + description: Updates the individual attributes of a role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mapping parameters: @@ -7842,7 +7842,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the current Security plugin configuration in JSON format. + description: Returns the current Security plugin configuration in a JSON format. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-configuration responses: @@ -7861,7 +7861,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: A `PATCH` call is used to update the existing configuration using the REST API. Only accessible by admins and users with REST API access and only when put or patch is enabled. + description: Updates the existing security configuration using the REST API. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-configuration requestBody: @@ -7885,7 +7885,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Adds or updates the existing configuration using the REST API. Only accessible by admins and users with REST API access and only when put or patch is enabled. + description: Updates the settings for an existing security configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-configuration requestBody: @@ -7933,7 +7933,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Reload HTTP layer communication certificates. + description: Reloads the HTTP communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-http-certificates responses: @@ -7957,7 +7957,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Reload Transport layer communication certificates. + description: Reloads the transport communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-transport-certificates responses: @@ -7981,7 +7981,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + description: Retrieves the multi-tenancy configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api responses: @@ -8002,7 +8002,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + description: Creates or replaces the multi-tenancy configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api requestBody: @@ -8047,7 +8047,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Add, delete, or modify multiple tenants in a single call. + description: Adds, deletes, or modifies multiple tenants in a single request. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenants requestBody: @@ -8071,7 +8071,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified tenant. + description: Deletes the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group parameters: @@ -8093,7 +8093,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves one tenant. + description: Retrieves the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenant parameters: @@ -8113,7 +8113,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Add, delete, or modify a single tenant. + description: Adds, deletes, or modifies a single tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenant parameters: @@ -8281,7 +8281,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authentication information. + description: Returns or updates authentication information for the currently authenticated user. parameters: - $ref: '#/components/parameters/security.authinfo___query.auth_type' - $ref: '#/components/parameters/security.authinfo___query.verbose' @@ -8302,7 +8302,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authentication information. + description: Returns or updates authentication information for the currently authenticated user. parameters: - $ref: '#/components/parameters/security.authinfo___query.auth_type' - $ref: '#/components/parameters/security.authinfo___query.verbose' @@ -8324,7 +8324,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the current security-dashboards plugin configuration. + description: Retrieves the current values for dynamic security settings for OpenSearch Dashboards. responses: '200': $ref: '#/components/responses/security.get_dashboards_info___200' @@ -8343,7 +8343,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates the current security-dashboards plugin configuration. + description: Retrieves the current values for dynamic security settings for OpenSearch Dashboards. responses: '200': $ref: '#/components/responses/security.post_dashboards_info___200' @@ -8363,7 +8363,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Checks to see if the Security plugin is up and running. + description: Checks to see if the Security plugin is running. parameters: - $ref: '#/components/parameters/security.health___query.mode' - $ref: '#/components/parameters/_global___query.pretty' @@ -8383,7 +8383,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Checks to see if the Security plugin is up and running. + description: Checks to see if the Security plugin is running. parameters: - $ref: '#/components/parameters/security.health___query.mode' - $ref: '#/components/parameters/_global___query.pretty' @@ -8404,7 +8404,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. + description: Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. responses: '200': $ref: '#/components/responses/security.tenant_info___200' @@ -8425,7 +8425,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. + description: Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. responses: '200': $ref: '#/components/responses/security.tenant_info___200' @@ -8447,7 +8447,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Gets the user identity related information for currently logged in user. + description: Gets the identity information for the user currently logged in. responses: '200': $ref: '#/components/responses/security.who_am_i___200' @@ -8466,7 +8466,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Gets the user identity related information for currently logged in user. + description: Gets the identity information for the user currently logged in. responses: '200': $ref: '#/components/responses/security.who_am_i___200' @@ -8486,7 +8486,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Gets the user identity related information for currently logged in user. User needs to have access to this endpoint when authorization at REST layer is enabled. + description: Gets the identity information for the user currently logged in. To use this operation, you must have access to this endpoint when authorization at REST layer is enabled. responses: '200': $ref: '#/components/responses/security.who_am_i_protected___200' @@ -14250,7 +14250,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns account details for the current user. + description: Returns account information for the current user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-account-details responses: @@ -14345,7 +14345,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of an action group. + description: Updates the individual attributes of an action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-action-group parameters: @@ -14369,7 +14369,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete a specified action group. + description: Deletes the specified action group. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group parameters: @@ -14416,7 +14416,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authorization token. + description: Returns the authorization token for the current user. responses: '200': $ref: '#/components/responses/security.authtoken___200' @@ -14437,7 +14437,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -14456,7 +14456,7 @@ paths: - amazon-managed - amazon-serverless x-ignorable: true - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -14475,7 +14475,7 @@ paths: - amazon-managed - amazon-serverless x-ignorable: true - description: Not supported for cache API. + description: Not supported for the Cache API. responses: '501': $ref: '#/components/responses/security.cache___501' @@ -14493,7 +14493,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Flushes the Security plugin user, authentication, and authorization cache. + description: Flushes the Security plugin's user, authentication, and authorization cache. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#flush-cache responses: @@ -14515,7 +14515,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieve one internal user. + description: Retrieve information about the specified internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-user parameters: @@ -14563,7 +14563,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of an internal user. + description: Updates individual attributes for an internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-user parameters: @@ -14587,7 +14587,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified user. + description: Deletes the specified internal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-user parameters: @@ -14610,7 +14610,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Generates authorization token for the given user. + description: Generates an authorization token for the specified user. parameters: - $ref: '#/components/parameters/security.generate_user_token___path.username' - $ref: '#/components/parameters/_global___query.pretty' @@ -14633,7 +14633,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Migrates security configuration from v6 to v7. + description: Migrates the security configuration from v6 to v7. responses: '200': $ref: '#/components/responses/security.migrate___200' @@ -14655,7 +14655,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Gets the evaluated REST API permissions for the currently logged in user. + description: Retrieves the evaluated REST API permissions for the currently logged in user. responses: '200': $ref: '#/components/responses/security.get_permissions_info___200' @@ -14725,7 +14725,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of a role. + description: Updates the individual attributes of a role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role parameters: @@ -14751,7 +14751,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified role. + description: Deletes the specified role. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-role parameters: @@ -14774,7 +14774,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves one role mapping. + description: Retrieves the specified role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-role-mapping parameters: @@ -14822,7 +14822,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates individual attributes of a role mapping. + description: Updates the individual attributes of a role mapping. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-role-mapping parameters: @@ -14871,7 +14871,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the current Security plugin configuration in JSON format. + description: Returns the current Security plugin configuration in a JSON format. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-configuration responses: @@ -14892,7 +14892,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: A `PATCH` call is used to update the existing configuration using the REST API. Only accessible by admins and users with REST API access and only when put or patch is enabled. + description: Updates the existing security configuration using the REST API. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-configuration requestBody: @@ -14918,7 +14918,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Adds or updates the existing configuration using the REST API. Only accessible by admins and users with REST API access and only when put or patch is enabled. + description: Updates the settings for an existing security configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-configuration requestBody: @@ -14970,7 +14970,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Reload Transport layer communication certificates. + description: Reloads the transport communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-transport-certificates responses: @@ -14996,7 +14996,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Reload HTTP layer communication certificates. + description: Reloads the HTTP communication certificates. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#reload-http-certificates responses: @@ -15022,7 +15022,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + description: Retrieves all node distinguished names. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-distinguished-names parameters: @@ -15049,7 +15049,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + description: Adds or updates the specified distinguished names in the cluster or node allowlist. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#update-distinguished-names parameters: @@ -15079,7 +15079,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. + description: Updates the distinguished cluster name for the specified cluster. Requires super admin or REST API permissions. parameters: - $ref: '#/components/parameters/security.patch_distinguished_name___path.cluster_name' - $ref: '#/components/parameters/_global___query.pretty' @@ -15105,7 +15105,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + description: Deletes all distinguished names in the specified cluster or node allowlist. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-distinguished-names parameters: @@ -15132,7 +15132,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + description: Retrieves the multi-tenancy configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api responses: @@ -15155,7 +15155,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + description: Creates or replaces the multi-tenancy configuration. Requires super admin or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/multi-tenancy/dynamic-config/#configuring-multi-tenancy-with-the-rest-api requestBody: @@ -15204,7 +15204,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Add, delete, or modify multiple tenants in a single call. + description: Adds, deletes, or modifies multiple tenants in a single request. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenants requestBody: @@ -15230,7 +15230,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves one tenant. + description: Retrieves the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#get-tenant parameters: @@ -15280,7 +15280,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Add, delete, or modify a single tenant. + description: Adds, deletes, or modifies a single tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#patch-tenant parameters: @@ -15306,7 +15306,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Delete the specified tenant. + description: Deletes the specified tenant. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#delete-action-group parameters: @@ -15460,7 +15460,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the current list of allowed API accessible to normal user. + description: Retrieves the current list of allowed APIs accessible to a normal user. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api responses: @@ -15483,7 +15483,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Creates or replaces the permitted APIs. Accessible using Super Admin certificate or REST API permission. + description: Creates or replaces APIs permitted for users on the allow list. Requires a super admin certificate or REST API permissions. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api requestBody: @@ -15508,7 +15508,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates the current list of allowed API accessible to normal user. + description: Updates the current list of APIs accessible for users on the allow list. externalDocs: url: https://opensearch.org/docs/latest/security/access-control/api/#access-control-for-the-api requestBody: @@ -15534,7 +15534,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authentication information. + description: Returns or updates authentication information for the currently authenticated user. parameters: - $ref: '#/components/parameters/security.authinfo___query.auth_type' - $ref: '#/components/parameters/security.authinfo___query.verbose' @@ -15557,7 +15557,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Returns the authentication information. + description: Returns or updates authentication information for the currently authenticated user. parameters: - $ref: '#/components/parameters/security.authinfo___query.auth_type' - $ref: '#/components/parameters/security.authinfo___query.verbose' @@ -15581,7 +15581,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Checks to see if the Security plugin is up and running. + description: Checks to see if the Security plugin is running. parameters: - $ref: '#/components/parameters/security.health___query.mode' - $ref: '#/components/parameters/_global___query.pretty' @@ -15603,7 +15603,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Checks to see if the Security plugin is up and running. + description: Checks to see if the Security plugin is running. parameters: - $ref: '#/components/parameters/security.health___query.mode' - $ref: '#/components/parameters/_global___query.pretty' @@ -15626,7 +15626,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the current security-dashboards plugin configuration. + description: Retrieves the current values for dynamic security settings for OpenSearch Dashboards. responses: '200': $ref: '#/components/responses/security.get_dashboards_info___200' @@ -15647,7 +15647,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Updates the current security-dashboards plugin configuration. + description: Retrieves the current values for dynamic security settings for OpenSearch Dashboards. responses: '200': $ref: '#/components/responses/security.post_dashboards_info___200' @@ -15669,7 +15669,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. + description: Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. responses: '200': $ref: '#/components/responses/security.tenant_info___200' @@ -15692,7 +15692,7 @@ paths: x-distributions-excluded: - amazon-managed - amazon-serverless - description: Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. + description: Retrieves the names of current tenants. Requires super admin or `kibanaserver` permissions. responses: '200': $ref: '#/components/responses/security.tenant_info___200' @@ -18421,7 +18421,7 @@ components: name: name description: |- The name of the component template to create. - OpenSearch includes the following built-in component templates: `logs-mappings`; 'logs-settings`; `metrics-mappings`; `metrics-settings`;`synthetics-mapping`; `synthetics-settings`. + OpenSearch includes the following built-in component templates: `logs-mappings`; `logs-settings`; `metrics-mappings`; `metrics-settings`; `synthetics-mapping`; `synthetics-settings`. OpenSearch uses these templates to configure backing indexes for its data streams. If you want to overwrite one of these templates, set the replacement template `version` to a higher value than the current version. If you want to disable all built-in component and index templates, set `stack.templates.enabled` to `false` using the Cluster Update Settings API. @@ -25969,14 +25969,14 @@ components: security.authinfo___query.auth_type: name: auth_type in: query - description: The type of current authentication request. + description: The type of the current authentication request. schema: type: string required: false security.authinfo___query.verbose: name: verbose in: query - description: Indicates whether a verbose response should be returned. + description: Whether to return a verbose response. schema: type: boolean required: false @@ -25990,35 +25990,35 @@ components: security.create_role_mapping___path.role: name: role in: path - description: The name of the role to create a role mapping for. + description: The name of the role for which to create a role mapping. schema: type: string required: true security.create_role___path.role: name: role in: path - description: The name of the role to be created. + description: The name of the role to create. schema: type: string required: true security.create_tenant___path.tenant: name: tenant in: path - description: The name of the tenant to be created. + description: The name of the tenant to create. schema: type: string required: true security.create_user_legacy___path.username: name: username in: path - description: The name of the user to be created. + description: The name of the user to create. schema: type: string required: true security.create_user___path.username: name: username in: path - description: The name of the user to be created. + description: The name of the user to create. schema: type: string required: true @@ -26032,14 +26032,14 @@ components: security.delete_distinguished_name___path.cluster_name: name: cluster_name in: path - description: The cluster-name to delete from list of distinguished names. + description: The cluster name to delete from list of distinguished names. schema: type: string required: true security.delete_role_mapping___path.role: name: role in: path - description: The name of the role whose mapping needs to delete. + description: The name of the role for which to delete the role's mappings. schema: type: string required: true @@ -26074,14 +26074,14 @@ components: security.generate_user_token_legacy___path.username: name: username in: path - description: The name of the user for whom an auth token is to be vended. + description: The name of the user for whom to issue an authorization token. schema: type: string required: true security.generate_user_token___path.username: name: username in: path - description: The name of the user for whom an auth token is to be vended. + description: The name of the user for whom to issue an authorization token. schema: type: string required: true @@ -26095,75 +26095,77 @@ components: security.get_all_certificates___query.cert_type: name: cert_type in: query - description: The type of certificates (HTTP, TRANSPORT, ALL) to retrieve from all nodes. + description: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from all nodes. schema: type: string required: false security.get_all_certificates___query.timeout: name: timeout in: query - description: The maximum duration, in seconds, to be spent to retrieve certificates from all nodes. + description: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. schema: $ref: '#/components/schemas/_common___Duration' required: false security.get_distinguished_name___path.cluster_name: name: cluster_name in: path - description: The cluster-name to retrieve nodes DN setting for. + description: The name of the cluster to retrieve that cluster's nodes DN settings. schema: type: string required: true security.get_distinguished_name___query.show_all: name: show_all in: query - description: A Boolean flag to include/exclude static nodes DN from final result. + description: Whether to include or exclude any static node's DN settings from the final result. schema: type: boolean required: false security.get_distinguished_names___query.show_all: name: show_all in: query - description: A Boolean flag to include/exclude static nodes DN from final result. + description: Whether to include or exclude any static node's DN settings from the final result. schema: type: boolean required: false security.get_node_certificates___path.node_id: name: node_id in: path - description: The full-id of the node to retrieve certificates. + description: The node ID to retrieve certificates for. schema: type: string required: true security.get_node_certificates___query.cert_type: name: cert_type in: query - description: The type of certificates (HTTP, TRANSPORT, ALL) to retrieve for a node. + description: The type of certificates (`HTTP`, `TRANSPORT`, or `ALL`) to retrieve from a node. schema: type: string required: false security.get_node_certificates___query.timeout: name: timeout in: query - description: The maximum duration, in seconds, to be spent to retrieve a node's certificates. + description: The maximum duration, in seconds, to spend retrieving certificates from all nodes before a timeout. schema: $ref: '#/components/schemas/_common___Duration' required: false security.get_role_mapping___path.role: name: role in: path + description: The name of the role mapping to retrieve. schema: type: string required: true security.get_role___path.role: name: role in: path + description: The name of the role to retrieve. schema: type: string required: true security.get_sslinfo___query.show_dn: name: show_dn in: query - description: A Boolean flag to indicate whether all domain names should be returned. + description: Whether to include all domain names in the response. schema: type: - boolean @@ -26193,7 +26195,7 @@ components: security.health___query.mode: name: mode in: query - description: A flag to indicate whether service should consider security-plugin's status before returning health response. `strict` mode indicates service should check Security plugin status. + description: A flag that determines whether to consider the security status before returning a response for a health query response. For example, `strict` mode indicates service should check the Security plugin status. schema: type: string required: false @@ -26207,14 +26209,14 @@ components: security.patch_distinguished_name___path.cluster_name: name: cluster_name in: path - description: The cluster name to update `nodesDn` value. + description: The cluster name to update the `nodesDn` value. schema: type: string required: true security.patch_role_mapping___path.role: name: role in: path - description: The name of the role to update role-mapping for. + description: The name of the role to update a role mapping for schema: type: string required: true @@ -26242,14 +26244,14 @@ components: security.update_distinguished_name___path.cluster_name: name: cluster_name in: path - description: The cluster-name to create/update `nodesDn` value for. + description: The name of the cluster containing the `nodesDn` value to create or update. schema: type: string required: true security.validate___query.accept_invalid: name: accept_invalid in: query - description: A Boolean flag to indicate whether invalid v6 configuration should be allowed. + description: Whether an invalid v6 configuration should be allowed. schema: type: boolean required: false @@ -41530,6 +41532,32 @@ components: $ref: '#/components/schemas/_common___VersionString' required: - type + _common.analysis___SimplePatternSplitTokenizer: + allOf: + - $ref: '#/components/schemas/_common.analysis___TokenizerBase' + - type: object + properties: + type: + type: string + enum: + - simple_pattern_split + pattern: + type: string + required: + - type + _common.analysis___SimplePatternTokenizer: + allOf: + - $ref: '#/components/schemas/_common.analysis___TokenizerBase' + - type: object + properties: + type: + type: string + enum: + - simple_pattern + pattern: + type: string + required: + - type _common.analysis___SmartcnAnalyzer: type: object properties: @@ -41873,6 +41901,8 @@ components: - $ref: '#/components/schemas/_common.analysis___WhitespaceTokenizer' - $ref: '#/components/schemas/_common.analysis___KuromojiTokenizer' - $ref: '#/components/schemas/_common.analysis___PatternTokenizer' + - $ref: '#/components/schemas/_common.analysis___SimplePatternTokenizer' + - $ref: '#/components/schemas/_common.analysis___SimplePatternSplitTokenizer' - $ref: '#/components/schemas/_common.analysis___IcuTokenizer' - $ref: '#/components/schemas/_common.analysis___SmartcnTokenizer' _common.analysis___TrimTokenFilter: @@ -47570,10 +47600,10 @@ components: _core.search___StringDistance: type: string enum: - - internal - damerau_levenshtein - - levenshtein + - internal - jaro_winkler + - levenshtein - ngram _core.search___StupidBackoffSmoothingModel: type: object @@ -47652,8 +47682,8 @@ components: _core.search___SuggestSort: type: string enum: - - score - frequency + - score _core.search___TermSuggest: allOf: - $ref: '#/components/schemas/_core.search___SuggestBase' @@ -50557,6 +50587,7 @@ components: - status - unassigned_shards cluster.health___Level: + description: Controls the amount of detail included in the cluster health response. type: string enum: - awareness_attributes @@ -61037,7 +61068,7 @@ components: ignore_failure: type: boolean query: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedObjectStructure' + $ref: '#/components/schemas/_common.query_dsl___QueryContainer' search_pipeline._common___MLOpenSearchReranker: type: object properties: @@ -61382,78 +61413,6 @@ components: format: int32 context_prefix: type: string - search_pipeline._common___UserDefinedObjectStructure: - type: object - properties: - bool: {} - boosting: {} - combined_fields: {} - constant_score: {} - dis_max: {} - distance_feature: {} - exists: {} - function_score: {} - fuzzy: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - geo_bounding_box: {} - geo_distance: {} - geo_polygon: {} - geo_shape: {} - has_child: {} - has_parent: {} - ids: {} - intervals: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - knn: {} - match: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - match_all: {} - match_bool_prefix: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - match_none: {} - match_phrase: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - match_phrase_prefix: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - more_like_this: {} - multi_match: {} - nested: {} - parent_id: {} - percolate: {} - pinned: {} - prefix: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - query_string: {} - range: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - rank_feature: {} - regexp: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - script: {} - script_score: {} - shape: {} - simple_query_string: {} - span_containing: {} - field_masking_span: {} - span_first: {} - span_multi: {} - span_near: {} - span_not: {} - span_or: {} - span_term: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - span_within: {} - term: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - terms: {} - terms_set: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - wildcard: - $ref: '#/components/schemas/search_pipeline._common___UserDefinedValueMap' - wrapper: {} - search_pipeline._common___UserDefinedValueMap: - type: object - additionalProperties: {} security._common___AccountDetails: type: object properties: @@ -61574,15 +61533,15 @@ components: properties: user: type: string - description: A User object as a string. + description: A user object as a string. user_name: type: string - description: User's name. + description: The username. user_requested_tenant: type: - 'null' - string - description: Name of the tenant the user wants to switch to. + description: The name of the tenant the user would like to switch to. remote_address: type: - 'null' @@ -61590,58 +61549,58 @@ components: description: The IP address of remote user. backend_roles: type: array - description: Backend roles associated with the user. + description: The backend roles associated with the user. items: type: string custom_attribute_names: type: array - description: Name of the attributes associated with the user. + description: The name of the attributes associated with the user. items: type: string roles: type: array - description: Roles associated with the user. + description: The roles associated with the user. items: type: string tenants: type: object - description: Tenants the user has access to with read-write or read-only access indicator. + description: The tenants the user has access to with `read-write` or `read-only` access indicators. principal: type: - 'null' - string - description: User principal. + description: The user's principal. peer_certificates: type: - number - string - description: Number of peer certificates. + description: The number of peer certificates related to the user. sso_logout_url: type: - 'null' - string - description: Logout URL. + description: The logout URL. size_of_user: type: string - description: Size of user in memory. + description: The size of user contained in memory. size_of_custom_attributes: type: string - description: Size of user's custom attributes in bytes. + description: The size of the user's custom attributes in bytes. size_of_backendroles: type: string - description: Size of backend roles in bytes. + description: The size of the user's backend roles in bytes. security._common___CertificateCountPerNode: type: object properties: total: type: number - description: Total number of nodes. + description: The total number of nodes. successful: type: number - description: Number of nodes for which certificates could be fetched. + description: The number of nodes for which certificates can be fetched. failed: type: number - description: Number of nodes for which certificates could not be fetched. + description: The number of nodes for which certificates could not be fetched. security._common___CertificatesDetail: type: object properties: @@ -61660,7 +61619,7 @@ components: properties: name: type: string - description: Name of the node. + description: The name of the node. certificates: type: object additionalProperties: @@ -61725,7 +61684,7 @@ components: properties: config: type: array - description: List of configs to be upgraded. + description: A list of configurations to upgrade. items: type: string security._common___Created: @@ -61737,7 +61696,7 @@ components: - string message: type: string - description: Message returned as part of CREATED response. + description: The message returned as part of a `CREATED` response. security._common___CreateTenantParams: type: object properties: @@ -61751,36 +61710,36 @@ components: description: User's name not_fail_on_forbidden_enabled: type: boolean - description: Indicates whether DNFOF is enabled. + description: Indicates whether `DNFOF` is enabled. opensearch_dashboards_mt_enabled: type: boolean description: Indicates whether multi-tenancy is enabled. opensearch_dashboards_index: type: string - description: Name of the dashboards index. + description: The name of the dashboard's index. opensearch_dashboards_server_user: type: string - description: Name of the user used to connect dashboards to the server. + description: The name of the user used to connect dashboard's to the server. multitenancy_enabled: type: boolean description: Indicates whether multi-tenancy is enabled. private_tenant_enabled: type: boolean - description: Indicates whether private tenant is enabled for all users. + description: Indicates whether a private tenant is enabled for all users. default_tenant: type: string description: The default tenant setting for the dashboard. sign_in_options: type: array - description: List of available sign-in options available. + description: A list of available sign-in options. items: type: string password_validation_error_message: type: string - description: Error message when password validation fails. + description: The error message when a password validation fails. password_validation_regex: type: string - description: Reg-ex to be used to perform password validation. + description: The regular expression used perform password validation. security._common___DistinguishedNames: type: object properties: @@ -61856,7 +61815,8 @@ components: description: The generated OBO token. durationSeconds: type: string - description: The duration of the token. Default is `300s`. + default: 300s + description: The duration of the token. security._common___GetCertificates: type: object properties: @@ -61938,13 +61898,13 @@ components: properties: description: type: string - description: Contains the description supplied by the user to describe the token. + description: The description supplied by the user to describe the token. service: type: string - description: A name of the service if generating a token for that service. + description: The name of the service when generating a token for that service. duration: type: string - description: Value in seconds. + description: A duration in seconds. required: - description security._common___Ok: @@ -61956,13 +61916,13 @@ components: - string message: type: string - description: Message returned as part of OK response. + description: The nessage returned as part of an `OK` response. security._common___PatchOperation: type: object properties: op: type: string - description: 'The operation to perform. Possible values: remove, add, replace, move, copy, test.' + description: The operation to perform, such as `remove`, `add`, `replace`, `move`, `copy`, or `test`. path: type: string description: The path to the resource. @@ -61986,7 +61946,7 @@ components: type: boolean disabled_endpoints: type: object - description: An object with disabled APIs as key and array of HTTP methods as values. + description: An object with disabled APIs as keys and an array of HTTP methods as values. security._common___Role: type: object properties: @@ -62055,37 +62015,37 @@ components: type: - 'null' - string - description: User principal. + description: The user's principal. peer_certificates: type: - number - string - description: Number of certificates. + description: The number of certificates. peer_certificates_list: type: - array - 'null' - description: List of domain names from peer certificates. + description: A list of domain names from peer certificates. items: type: string local_certificates_list: type: array - description: List of domain names from local certificates. + description: A list of domain names from local certificates. items: type: string ssl_protocol: type: - 'null' - string - description: Protocol for this SSL setup. + description: The protocol for this SSL setup. ssl_cipher: type: - 'null' - string - description: Cipher for this SSL setup. + description: The cipher for this SSL setup. ssl_openssl_available: type: boolean - description: A Boolean to indicate if OpenSSL is available. + description: Whether OpenSSL is available. ssl_openssl_version: type: - number @@ -62095,29 +62055,29 @@ components: type: - 'null' - string - description: Full version string for OpenSSL version. + description: The full version string for the OpenSSL version. ssl_openssl_non_available_cause: type: - 'null' - string - description: Reason for OpenSSL unavailability. + description: The reason OpenSSL is unavailable. ssl_openssl_supports_key_manager_factory: type: boolean - description: Indicates where KMF is supported. + description: Whether `KMF` is supported. ssl_openssl_supports_hostname_validation: type: boolean - description: Indicates whether hostname validation is supported. + description: Whether the hostname validation is supported. ssl_provider_http: type: - 'null' - string - description: Returns HTTP provider's name. + description: Returns the HTTP provider's name. ssl_provider_transport_server: type: string - description: Returns transport server's name. + description: Returns the transport server's name. ssl_provider_transport_client: type: string - description: Returns transport client's name. + description: Returns the transport client's name. required: - peer_certificates - principal 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 f39d3700f..3152602da 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 @@ -51,7 +51,8 @@ public class CodeGenerator { // TODO: search_models is complex and ideally should re-use the search structures not(or(contains("predict"), contains("search"), contains("train"), isOneOf("chunk_model", "execute_algorithm"))) ) - ) + ), + namespace(is("search_pipeline")) ); public static void main(String[] args) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 26d7557dc..539109273 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -259,6 +259,7 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { case "create": case "delete": case "get": + case "put": case "restore": return toPascalCase(name) + toPascalCase(itemForNamespace(ns)); 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 c640f809d..1618863a0 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 @@ -447,7 +447,7 @@ private Shape visit( } var oneOrAnyOf = unionSchema.getOneOf().or(unionSchema::getAnyOf).orElse(null); - if (oneOrAnyOf != null) { + if (!isExternallyTaggedUnion(unionSchema)) { oneOrAnyOf.forEach(s -> { String name; if (discriminatingField != null) { @@ -473,13 +473,22 @@ private Shape visit( } taggedUnion.addVariant(name, mapType(s)); }); - } else if (unionSchema.isObject() && unionSchema.getMaxProperties().orElse(Integer.MAX_VALUE) == 1) { - taggedUnion.setExternallyDiscriminated( - unionSchema.getMinProperties().orElse(0) == 1 - ? TaggedUnionShape.ExternallyDiscriminated.REQUIRED - : TaggedUnionShape.ExternallyDiscriminated.OPTIONAL - ); - unionSchema.getProperties().ifPresent(props -> props.forEach((k, v) -> taggedUnion.addVariant(k, mapType(v)))); + } else { + if (unionSchema.isObject()) { + taggedUnion.setExternallyDiscriminated( + unionSchema.getMinProperties().orElse(0) == 1 + ? TaggedUnionShape.ExternallyDiscriminated.REQUIRED + : TaggedUnionShape.ExternallyDiscriminated.OPTIONAL + ); + unionSchema.getProperties().ifPresent(props -> props.forEach((k, v) -> taggedUnion.addVariant(k, mapType(v)))); + } else { + taggedUnion.setExternallyDiscriminated(TaggedUnionShape.ExternallyDiscriminated.REQUIRED); + oneOrAnyOf.forEach(s -> { + var prop = s.getProperties().flatMap(m -> m.entrySet().stream().findFirst()).orElseThrow(); + + taggedUnion.addVariant(prop.getKey(), mapType(prop.getValue())); + }); + } } } else if (isShortcutPropertyObject || schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object) { if (schema.getProperties().isEmpty() @@ -976,7 +985,8 @@ private static boolean isTaggedUnion(OpenApiSchema schema) { if (schema.getDiscriminator().isPresent()) { return true; } - return isTaggedUnion(schema.getOneOf().orElseThrow()); + var oneOf = schema.getOneOf().orElseThrow(); + return isTaggedUnion(oneOf) || isExternallyTaggedUnion(oneOf); } if (schema.hasAnyOf()) { return isTaggedUnion(schema.getAnyOf().orElseThrow()); @@ -996,7 +1006,18 @@ private static boolean isTaggedUnion(OpenApiSchema schema) { } return isTaggedUnion(first) && second.isObject() || first.isObject() && isTaggedUnion(second); + } + + return isExternallyTaggedUnion(schema); + } + private static boolean isTaggedUnion(List oneOfAnyOf) { + return oneOfAnyOf.stream().allMatch(OpenApiSchema::hasTitle); + } + + private static boolean isExternallyTaggedUnion(OpenApiSchema schema) { + if (schema.hasOneOf()) { + return isExternallyTaggedUnion(schema.getOneOf().orElseThrow()); } if (schema.isObject() && schema.getProperties().isPresent()) { var maxProperties = schema.getMaxProperties().orElse(Integer.MAX_VALUE); @@ -1005,7 +1026,13 @@ private static boolean isTaggedUnion(OpenApiSchema schema) { return false; } - private static boolean isTaggedUnion(List oneOfAnyOf) { - return oneOfAnyOf.stream().allMatch(OpenApiSchema::hasTitle); + private static boolean isExternallyTaggedUnion(List oneOf) { + return oneOf.stream().allMatch(SpecTransformer::isExternallyTaggedUnionVariant); + } + + private static boolean isExternallyTaggedUnionVariant(OpenApiSchema schema) { + return schema.isObject() + && schema.getProperties().map(Map::size).orElse(0) == 1 + && schema.getRequired().map(Set::size).orElse(0) == 1; } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 287b11803..e3e266ef2 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -143,7 +143,10 @@ private static JsonPointer schema(String namespace, String name) { so -> so.withProperties(p -> p.with("_name", po -> po.withName("queryName"))) ) - .with(schema("_common.query_dsl", "QueryContainer"), so -> so.withClassName("Query")) + .with( + schema("_common.query_dsl", "QueryContainer"), + so -> so.withClassName("Query").withShouldGenerate(ShouldGenerate.Never) + ) .with( schema("_common.query_dsl", "RangeQuery").append("allOf", "1"), so -> so.withProperties( diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/VariantInterface.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/VariantInterface.mustache index 1c596dd6c..0801134b1 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/VariantInterface.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/TaggedUnionShape/VariantInterface.mustache @@ -2,7 +2,7 @@ {{unionClassName}}.Kind _{{#camelCase}}{{unionClassName}}{{/camelCase}}Kind(); {{#includeToUnionMethod}} - default {{unionClassName}} to{{unionClassName}}() { + default {{unionClassName}} _to{{unionClassName}}() { return new {{unionClassName}}(this); } {{/includeToUnionMethod}}