diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cat/IndicesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cat/IndicesRequest.java index 95a097b22c..59e07f3537 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/cat/IndicesRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cat/IndicesRequest.java @@ -137,7 +137,8 @@ public final Time clusterManagerTimeout() { } /** - * The type of index that wildcard patterns can match. + * The type of index that wildcard patterns can match. Supported values are all, open, closed, + * hidden, and none. *

* API name: {@code expand_wildcards} *

@@ -327,7 +328,8 @@ public final Builder clusterManagerTimeout(Functionall, open, + * closed, hidden, and none. *

* API name: {@code expand_wildcards} *

@@ -343,7 +345,8 @@ public final Builder expandWildcards(List list) { } /** - * The type of index that wildcard patterns can match. + * The type of index that wildcard patterns can match. Supported values are all, open, + * closed, hidden, and none. *

* API name: {@code expand_wildcards} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cat/SegmentReplicationRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cat/SegmentReplicationRequest.java index 3ba11e1cbe..a41b806db2 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/cat/SegmentReplicationRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cat/SegmentReplicationRequest.java @@ -183,7 +183,8 @@ public final Boolean detailed() { } /** - * Whether to expand the wildcard expression to include concrete indexes that are open, closed, or both. + * The type of index that wildcard patterns can match. Supported values are all, open, closed, + * hidden, and none. *

* API name: {@code expand_wildcards} *

@@ -413,7 +414,8 @@ public final Builder detailed(@Nullable Boolean value) { } /** - * Whether to expand the wildcard expression to include concrete indexes that are open, closed, or both. + * The type of index that wildcard patterns can match. Supported values are all, open, + * closed, hidden, and none. *

* API name: {@code expand_wildcards} *

@@ -429,7 +431,8 @@ public final Builder expandWildcards(List list) { } /** - * Whether to expand the wildcard expression to include concrete indexes that are open, closed, or both. + * The type of index that wildcard patterns can match. Supported values are all, open, + * closed, hidden, and none. *

* API name: {@code expand_wildcards} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerRequest.java new file mode 100644 index 0000000000..b0fa84faf2 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerRequest.java @@ -0,0 +1,268 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.create_controller.Request + +/** + * Creates a controller. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class CreateControllerRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + @Nonnull + private final Map userRateLimiter; + + // --------------------------------------------------------------------------------------------- + + private CreateControllerRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.userRateLimiter = ApiTypeHelper.unmodifiable(builder.userRateLimiter); + } + + public static CreateControllerRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code user_rate_limiter} + */ + @Nonnull + public final Map userRateLimiter() { + return this.userRateLimiter; + } + + /** + * 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.userRateLimiter)) { + generator.writeKey("user_rate_limiter"); + generator.writeStartObject(); + for (Map.Entry item0 : this.userRateLimiter.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateControllerRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + @Nullable + private Map userRateLimiter; + + public Builder() {} + + private Builder(CreateControllerRequest o) { + super(o); + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

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

+ * Adds an entry to userRateLimiter. + *

+ */ + @Nonnull + public final Builder userRateLimiter(String key, RateLimiter value) { + this.userRateLimiter = _mapPut(this.userRateLimiter, key, value); + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

+ */ + @Nonnull + public final Builder userRateLimiter(String key, Function> fn) { + return userRateLimiter(key, fn.apply(new RateLimiter.Builder()).build()); + } + + /** + * Builds a {@link CreateControllerRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateControllerRequest build() { + _checkSingleUse(); + + return new CreateControllerRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateControllerRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateControllerRequest::setupCreateControllerRequestDeserializer + ); + + protected static void setupCreateControllerRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::userRateLimiter, JsonpDeserializer.stringMapDeserializer(RateLimiter._DESERIALIZER), "user_rate_limiter"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.create_controller}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/controllers/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + CreateControllerResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + Objects.hashCode(this.userRateLimiter); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateControllerRequest other = (CreateControllerRequest) o; + return this.modelId.equals(other.modelId) && Objects.equals(this.userRateLimiter, other.userRateLimiter); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerResponse.java new file mode 100644 index 0000000000..207712184c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateControllerResponse.java @@ -0,0 +1,198 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.create_controller.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateControllerResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String modelId; + + @Nullable + private final Status status; + + // --------------------------------------------------------------------------------------------- + + private CreateControllerResponse(Builder builder) { + this.modelId = builder.modelId; + this.status = builder.status; + } + + public static CreateControllerResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code status} + */ + @Nullable + public final Status status() { + return this.status; + } + + /** + * 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.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + if (this.status != null) { + generator.writeKey("status"); + this.status.serialize(generator, mapper); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateControllerResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String modelId; + @Nullable + private Status status; + + public Builder() {} + + private Builder(CreateControllerResponse o) { + this.modelId = o.modelId; + this.status = o.status; + } + + private Builder(Builder o) { + this.modelId = o.modelId; + this.status = o.status; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code status} + */ + @Nonnull + public final Builder status(@Nullable Status value) { + this.status = value; + return this; + } + + /** + * Builds a {@link CreateControllerResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateControllerResponse build() { + _checkSingleUse(); + + return new CreateControllerResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateControllerResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateControllerResponse::setupCreateControllerResponseDeserializer + ); + + protected static void setupCreateControllerResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::status, Status._DESERIALIZER, "status"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.status); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateControllerResponse other = (CreateControllerResponse) o; + return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.status, other.status); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryRequest.java new file mode 100644 index 0000000000..0f4b437b86 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryRequest.java @@ -0,0 +1,203 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.create_memory.Request + +/** + * Create a memory. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class CreateMemoryRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String name; + + // --------------------------------------------------------------------------------------------- + + private CreateMemoryRequest(Builder builder) { + super(builder); + this.name = builder.name; + } + + public static CreateMemoryRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * 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.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateMemoryRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String name; + + public Builder() {} + + private Builder(CreateMemoryRequest o) { + super(o); + this.name = o.name; + } + + private Builder(Builder o) { + super(o); + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code name} + */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link CreateMemoryRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateMemoryRequest build() { + _checkSingleUse(); + + return new CreateMemoryRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateMemoryRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateMemoryRequest::setupCreateMemoryRequestDeserializer + ); + + protected static void setupCreateMemoryRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.create_memory}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/memory", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + CreateMemoryResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateMemoryRequest other = (CreateMemoryRequest) o; + return Objects.equals(this.name, other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryResponse.java new file mode 100644 index 0000000000..e159a4ff1b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMemoryResponse.java @@ -0,0 +1,159 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.create_memory.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateMemoryResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String memoryId; + + // --------------------------------------------------------------------------------------------- + + private CreateMemoryResponse(Builder builder) { + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + } + + public static CreateMemoryResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + /** + * 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("memory_id"); + generator.write(this.memoryId); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateMemoryResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String memoryId; + + public Builder() {} + + private Builder(CreateMemoryResponse o) { + this.memoryId = o.memoryId; + } + + private Builder(Builder o) { + this.memoryId = o.memoryId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * Builds a {@link CreateMemoryResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateMemoryResponse build() { + _checkSingleUse(); + + return new CreateMemoryResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateMemoryResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateMemoryResponse::setupCreateMemoryResponseDeserializer + ); + + protected static void setupCreateMemoryResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memoryId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateMemoryResponse other = (CreateMemoryResponse) o; + return this.memoryId.equals(other.memoryId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageRequest.java new file mode 100644 index 0000000000..8181e6e1ff --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageRequest.java @@ -0,0 +1,415 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.create_message.Request + +/** + * Create a message. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class CreateMessageRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String input; + + @Nonnull + private final String memoryId; + + @Nullable + private final String origin; + + @Nullable + private final String promptTemplate; + + @Nullable + private final String response; + + // --------------------------------------------------------------------------------------------- + + private CreateMessageRequest(Builder builder) { + super(builder); + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.input = builder.input; + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + this.origin = builder.origin; + this.promptTemplate = builder.promptTemplate; + this.response = builder.response; + } + + public static CreateMessageRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The question in the message. + *

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

+ */ + @Nullable + public final String input() { + return this.input; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nullable + public final String origin() { + return this.origin; + } + + /** + * The prompt template. + *

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

+ */ + @Nullable + public final String promptTemplate() { + return this.promptTemplate; + } + + /** + * The answer to the question. + *

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

+ */ + @Nullable + public final String response() { + return this.response; + } + + /** + * 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.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.input != null) { + generator.writeKey("input"); + generator.write(this.input); + } + + if (this.origin != null) { + generator.writeKey("origin"); + generator.write(this.origin); + } + + if (this.promptTemplate != null) { + generator.writeKey("prompt_template"); + generator.write(this.promptTemplate); + } + + if (this.response != null) { + generator.writeKey("response"); + generator.write(this.response); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateMessageRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String input; + private String memoryId; + @Nullable + private String origin; + @Nullable + private String promptTemplate; + @Nullable + private String response; + + public Builder() {} + + private Builder(CreateMessageRequest o) { + super(o); + this.additionalInfo = _mapCopy(o.additionalInfo); + this.input = o.input; + this.memoryId = o.memoryId; + this.origin = o.origin; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + } + + private Builder(Builder o) { + super(o); + this.additionalInfo = _mapCopy(o.additionalInfo); + this.input = o.input; + this.memoryId = o.memoryId; + this.origin = o.origin; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The question in the message. + *

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

+ */ + @Nonnull + public final Builder input(@Nullable String value) { + this.input = value; + return this; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nonnull + public final Builder origin(@Nullable String value) { + this.origin = value; + return this; + } + + /** + * The prompt template. + *

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

+ */ + @Nonnull + public final Builder promptTemplate(@Nullable String value) { + this.promptTemplate = value; + return this; + } + + /** + * The answer to the question. + *

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

+ */ + @Nonnull + public final Builder response(@Nullable String value) { + this.response = value; + return this; + } + + /** + * Builds a {@link CreateMessageRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateMessageRequest build() { + _checkSingleUse(); + + return new CreateMessageRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateMessageRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateMessageRequest::setupCreateMessageRequestDeserializer + ); + + protected static void setupCreateMessageRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::input, JsonpDeserializer.stringDeserializer(), "input"); + op.add(Builder::origin, JsonpDeserializer.stringDeserializer(), "origin"); + op.add(Builder::promptTemplate, JsonpDeserializer.stringDeserializer(), "prompt_template"); + op.add(Builder::response, JsonpDeserializer.stringDeserializer(), "response"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.create_message}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/"); + SimpleEndpoint.pathEncode(request.memoryId, buf); + buf.append("/messages"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + CreateMessageResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.input); + result = 31 * result + this.memoryId.hashCode(); + result = 31 * result + Objects.hashCode(this.origin); + result = 31 * result + Objects.hashCode(this.promptTemplate); + result = 31 * result + Objects.hashCode(this.response); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateMessageRequest other = (CreateMessageRequest) o; + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.input, other.input) + && this.memoryId.equals(other.memoryId) + && Objects.equals(this.origin, other.origin) + && Objects.equals(this.promptTemplate, other.promptTemplate) + && Objects.equals(this.response, other.response); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageResponse.java new file mode 100644 index 0000000000..cf1b39fb6c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateMessageResponse.java @@ -0,0 +1,162 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.create_message.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateMessageResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String messageId; + + // --------------------------------------------------------------------------------------------- + + private CreateMessageResponse(Builder builder) { + this.messageId = ApiTypeHelper.requireNonNull(builder.messageId, this, "messageId"); + } + + public static CreateMessageResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final String messageId() { + return this.messageId; + } + + /** + * 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("message_id"); + generator.write(this.messageId); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateMessageResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String messageId; + + public Builder() {} + + private Builder(CreateMessageResponse o) { + this.messageId = o.messageId; + } + + private Builder(Builder o) { + this.messageId = o.messageId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(String value) { + this.messageId = value; + return this; + } + + /** + * Builds a {@link CreateMessageResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateMessageResponse build() { + _checkSingleUse(); + + return new CreateMessageResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateMessageResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateMessageResponse::setupCreateMessageResponseDeserializer + ); + + protected static void setupCreateMessageResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::messageId, JsonpDeserializer.stringDeserializer(), "message_id"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.messageId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateMessageResponse other = (CreateMessageResponse) o; + return this.messageId.equals(other.messageId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaRequest.java new file mode 100644 index 0000000000..7114a0c291 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaRequest.java @@ -0,0 +1,486 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.create_model_meta.Request + +/** + * Registers model metadata. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class CreateModelMetaRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nonnull + private final ModelConfig modelConfig; + + @Nonnull + private final String modelContentHashValue; + + @Nonnull + private final ModelFormat modelFormat; + + @Nullable + private final String modelGroupId; + + @Nonnull + private final String name; + + private final long totalChunks; + + @Nullable + private final String url; + + @Nonnull + private final String version; + + // --------------------------------------------------------------------------------------------- + + private CreateModelMetaRequest(Builder builder) { + super(builder); + this.description = builder.description; + this.modelConfig = ApiTypeHelper.requireNonNull(builder.modelConfig, this, "modelConfig"); + this.modelContentHashValue = ApiTypeHelper.requireNonNull(builder.modelContentHashValue, this, "modelContentHashValue"); + this.modelFormat = ApiTypeHelper.requireNonNull(builder.modelFormat, this, "modelFormat"); + this.modelGroupId = builder.modelGroupId; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.totalChunks = ApiTypeHelper.requireNonNull(builder.totalChunks, this, "totalChunks"); + this.url = builder.url; + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + } + + public static CreateModelMetaRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final ModelConfig modelConfig() { + return this.modelConfig; + } + + /** + * Required - The model content hash value. + *

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

+ */ + @Nonnull + public final String modelContentHashValue() { + return this.modelContentHashValue; + } + + /** + * Required - API name: {@code model_format} + */ + @Nonnull + public final ModelFormat modelFormat() { + return this.modelFormat; + } + + /** + * API name: {@code model_group_id} + */ + @Nullable + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final String name() { + return this.name; + } + + /** + * Required - Number of chunks the model is split into. + *

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

+ */ + public final long totalChunks() { + return this.totalChunks; + } + + /** + * The model URL. + *

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

+ */ + @Nullable + public final String url() { + return this.url; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final String 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 (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("model_config"); + this.modelConfig.serialize(generator, mapper); + + generator.writeKey("model_content_hash_value"); + generator.write(this.modelContentHashValue); + + generator.writeKey("model_format"); + this.modelFormat.serialize(generator, mapper); + + if (this.modelGroupId != null) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + } + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("total_chunks"); + generator.write(this.totalChunks); + + if (this.url != null) { + generator.writeKey("url"); + generator.write(this.url); + } + + 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 CreateModelMetaRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String description; + private ModelConfig modelConfig; + private String modelContentHashValue; + private ModelFormat modelFormat; + @Nullable + private String modelGroupId; + private String name; + private Long totalChunks; + @Nullable + private String url; + private String version; + + public Builder() {} + + private Builder(CreateModelMetaRequest o) { + super(o); + this.description = o.description; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.totalChunks = o.totalChunks; + this.url = o.url; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.description = o.description; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.totalChunks = o.totalChunks; + this.url = o.url; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The model description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(ModelConfig value) { + this.modelConfig = value; + return this; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(Function> fn) { + return modelConfig(fn.apply(new ModelConfig.Builder()).build()); + } + + /** + * Required - The model content hash value. + *

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

+ */ + @Nonnull + public final Builder modelContentHashValue(String value) { + this.modelContentHashValue = value; + return this; + } + + /** + * Required - API name: {@code model_format} + */ + @Nonnull + public final Builder modelFormat(ModelFormat value) { + this.modelFormat = value; + return this; + } + + /** + * API name: {@code model_group_id} + */ + @Nonnull + public final Builder modelGroupId(@Nullable String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - Number of chunks the model is split into. + *

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

+ */ + @Nonnull + public final Builder totalChunks(long value) { + this.totalChunks = value; + return this; + } + + /** + * The model URL. + *

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

+ */ + @Nonnull + public final Builder url(@Nullable String value) { + this.url = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link CreateModelMetaRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateModelMetaRequest build() { + _checkSingleUse(); + + return new CreateModelMetaRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateModelMetaRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateModelMetaRequest::setupCreateModelMetaRequestDeserializer + ); + + protected static void setupCreateModelMetaRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelConfig, ModelConfig._DESERIALIZER, "model_config"); + op.add(Builder::modelContentHashValue, JsonpDeserializer.stringDeserializer(), "model_content_hash_value"); + op.add(Builder::modelFormat, ModelFormat._DESERIALIZER, "model_format"); + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::totalChunks, JsonpDeserializer.longDeserializer(), "total_chunks"); + op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.create_model_meta}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/models/meta", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + CreateModelMetaResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.modelConfig.hashCode(); + result = 31 * result + this.modelContentHashValue.hashCode(); + result = 31 * result + this.modelFormat.hashCode(); + result = 31 * result + Objects.hashCode(this.modelGroupId); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Long.hashCode(this.totalChunks); + result = 31 * result + Objects.hashCode(this.url); + result = 31 * result + this.version.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateModelMetaRequest other = (CreateModelMetaRequest) o; + return Objects.equals(this.description, other.description) + && this.modelConfig.equals(other.modelConfig) + && this.modelContentHashValue.equals(other.modelContentHashValue) + && this.modelFormat.equals(other.modelFormat) + && Objects.equals(this.modelGroupId, other.modelGroupId) + && this.name.equals(other.name) + && this.totalChunks == other.totalChunks + && Objects.equals(this.url, other.url) + && this.version.equals(other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaResponse.java new file mode 100644 index 0000000000..6c28c83a49 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/CreateModelMetaResponse.java @@ -0,0 +1,191 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.create_model_meta.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateModelMetaResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + @Nonnull + private final String status; + + // --------------------------------------------------------------------------------------------- + + private CreateModelMetaResponse(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + } + + public static CreateModelMetaResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final String status() { + return this.status; + } + + /** + * 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); + + generator.writeKey("status"); + generator.write(this.status); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link CreateModelMetaResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String modelId; + private String status; + + public Builder() {} + + private Builder(CreateModelMetaResponse o) { + this.modelId = o.modelId; + this.status = o.status; + } + + private Builder(Builder o) { + this.modelId = o.modelId; + this.status = o.status; + } + + @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; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Builds a {@link CreateModelMetaResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public CreateModelMetaResponse build() { + _checkSingleUse(); + + return new CreateModelMetaResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CreateModelMetaResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CreateModelMetaResponse::setupCreateModelMetaResponseDeserializer + ); + + protected static void setupCreateModelMetaResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + this.status.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateModelMetaResponse other = (CreateModelMetaResponse) o; + return this.modelId.equals(other.modelId) && this.status.equals(other.status); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerRequest.java new file mode 100644 index 0000000000..84df53cc88 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerRequest.java @@ -0,0 +1,167 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.delete_controller.Request + +/** + * Deletes a controller. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class DeleteControllerRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private DeleteControllerRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static DeleteControllerRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteControllerRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + + public Builder() {} + + private Builder(DeleteControllerRequest o) { + super(o); + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link DeleteControllerRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteControllerRequest build() { + _checkSingleUse(); + + return new DeleteControllerRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_controller}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/controllers/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + DeleteControllerResponse._DESERIALIZER + ); + + @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; + DeleteControllerRequest other = (DeleteControllerRequest) o; + return this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerResponse.java new file mode 100644 index 0000000000..bba279a73e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteControllerResponse.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.delete_controller.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteControllerResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private DeleteControllerResponse(Builder builder) { + super(builder); + } + + public static DeleteControllerResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteControllerResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteControllerResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteControllerResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteControllerResponse build() { + _checkSingleUse(); + + return new DeleteControllerResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteControllerResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteControllerResponse::setupDeleteControllerResponseDeserializer + ); + + protected static void setupDeleteControllerResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryRequest.java new file mode 100644 index 0000000000..d236e6a4af --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryRequest.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.delete_memory.Request + +/** + * Delete a memory. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class DeleteMemoryRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String memoryId; + + // --------------------------------------------------------------------------------------------- + + private DeleteMemoryRequest(Builder builder) { + super(builder); + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + } + + public static DeleteMemoryRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteMemoryRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String memoryId; + + public Builder() {} + + private Builder(DeleteMemoryRequest o) { + super(o); + this.memoryId = o.memoryId; + } + + private Builder(Builder o) { + super(o); + this.memoryId = o.memoryId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * Builds a {@link DeleteMemoryRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteMemoryRequest build() { + _checkSingleUse(); + + return new DeleteMemoryRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.delete_memory}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "DELETE", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/"); + SimpleEndpoint.pathEncode(request.memoryId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + DeleteMemoryResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memoryId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteMemoryRequest other = (DeleteMemoryRequest) o; + return this.memoryId.equals(other.memoryId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryResponse.java new file mode 100644 index 0000000000..9adcb5cef8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/DeleteMemoryResponse.java @@ -0,0 +1,163 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.delete_memory.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteMemoryResponse implements PlainJsonSerializable, ToCopyableBuilder { + + private final boolean success; + + // --------------------------------------------------------------------------------------------- + + private DeleteMemoryResponse(Builder builder) { + this.success = ApiTypeHelper.requireNonNull(builder.success, this, "success"); + } + + public static DeleteMemoryResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether the memory was deleted successfully. + *

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

+ */ + public final boolean success() { + return this.success; + } + + /** + * 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("success"); + generator.write(this.success); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link DeleteMemoryResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Boolean success; + + public Builder() {} + + private Builder(DeleteMemoryResponse o) { + this.success = o.success; + } + + private Builder(Builder o) { + this.success = o.success; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - Whether the memory was deleted successfully. + *

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

+ */ + @Nonnull + public final Builder success(boolean value) { + this.success = value; + return this; + } + + /** + * Builds a {@link DeleteMemoryResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public DeleteMemoryResponse build() { + _checkSingleUse(); + + return new DeleteMemoryResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteMemoryResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DeleteMemoryResponse::setupDeleteMemoryResponseDeserializer + ); + + protected static void setupDeleteMemoryResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::success, JsonpDeserializer.booleanDeserializer(), "success"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.success); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteMemoryResponse other = (DeleteMemoryResponse) o; + return this.success == other.success; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java new file mode 100644 index 0000000000..4c702d8790 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesRequest.java @@ -0,0 +1,201 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_all_memories.Request + +/** + * Get all memories. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetAllMemoriesRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Integer maxResults; + + @Nullable + private final Integer nextToken; + + // --------------------------------------------------------------------------------------------- + + private GetAllMemoriesRequest(Builder builder) { + super(builder); + this.maxResults = builder.maxResults; + this.nextToken = builder.nextToken; + } + + public static GetAllMemoriesRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_results} + */ + @Nullable + public final Integer maxResults() { + return this.maxResults; + } + + /** + * API name: {@code next_token} + */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetAllMemoriesRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Integer maxResults; + @Nullable + private Integer nextToken; + + public Builder() {} + + private Builder(GetAllMemoriesRequest o) { + super(o); + this.maxResults = o.maxResults; + this.nextToken = o.nextToken; + } + + private Builder(Builder o) { + super(o); + this.maxResults = o.maxResults; + this.nextToken = o.nextToken; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code max_results} + */ + @Nonnull + public final Builder maxResults(@Nullable Integer value) { + this.maxResults = value; + return this; + } + + /** + * API name: {@code next_token} + */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Builds a {@link GetAllMemoriesRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetAllMemoriesRequest build() { + _checkSingleUse(); + + return new GetAllMemoriesRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.maxResults != null) { + params.put("max_results", String.valueOf(this.maxResults)); + } + if (this.nextToken != null) { + params.put("next_token", String.valueOf(this.nextToken)); + } + } + + /** + * Endpoint "{@code ml.get_all_memories}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> "/_plugins/_ml/memory", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetAllMemoriesResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxResults); + result = 31 * result + Objects.hashCode(this.nextToken); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetAllMemoriesRequest other = (GetAllMemoriesRequest) o; + return Objects.equals(this.maxResults, other.maxResults) && Objects.equals(this.nextToken, other.nextToken); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesResponse.java new file mode 100644 index 0000000000..b6c72e2461 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMemoriesResponse.java @@ -0,0 +1,236 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_all_memories.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetAllMemoriesResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List memories; + + @Nullable + private final Integer nextToken; + + // --------------------------------------------------------------------------------------------- + + private GetAllMemoriesResponse(Builder builder) { + this.memories = ApiTypeHelper.unmodifiableRequired(builder.memories, this, "memories"); + this.nextToken = builder.nextToken; + } + + public static GetAllMemoriesResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memories} + */ + @Nonnull + public final List memories() { + return this.memories; + } + + /** + * The index of the next memory after the last memory in the returned list. + *

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

+ */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + /** + * 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("memories"); + generator.writeStartArray(); + for (Memory item0 : this.memories) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + if (this.nextToken != null) { + generator.writeKey("next_token"); + generator.write(this.nextToken); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetAllMemoriesResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List memories; + @Nullable + private Integer nextToken; + + public Builder() {} + + private Builder(GetAllMemoriesResponse o) { + this.memories = _listCopy(o.memories); + this.nextToken = o.nextToken; + } + + private Builder(Builder o) { + this.memories = _listCopy(o.memories); + this.nextToken = o.nextToken; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code memories} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder memories(Function> fn) { + return memories(fn.apply(new Memory.Builder()).build()); + } + + /** + * The index of the next memory after the last memory in the returned list. + *

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

+ */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Builds a {@link GetAllMemoriesResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetAllMemoriesResponse build() { + _checkSingleUse(); + + return new GetAllMemoriesResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetAllMemoriesResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetAllMemoriesResponse::setupGetAllMemoriesResponseDeserializer + ); + + protected static void setupGetAllMemoriesResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::memories, JsonpDeserializer.arrayDeserializer(Memory._DESERIALIZER), "memories"); + op.add(Builder::nextToken, JsonpDeserializer.integerDeserializer(), "next_token"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memories.hashCode(); + result = 31 * result + Objects.hashCode(this.nextToken); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetAllMemoriesResponse other = (GetAllMemoriesResponse) o; + return this.memories.equals(other.memories) && Objects.equals(this.nextToken, other.nextToken); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesRequest.java new file mode 100644 index 0000000000..f6efa1b4f9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesRequest.java @@ -0,0 +1,235 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_all_messages.Request + +/** + * Get all messages in a memory. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetAllMessagesRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Integer maxResults; + + @Nonnull + private final String memoryId; + + @Nullable + private final Integer nextToken; + + // --------------------------------------------------------------------------------------------- + + private GetAllMessagesRequest(Builder builder) { + super(builder); + this.maxResults = builder.maxResults; + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + this.nextToken = builder.nextToken; + } + + public static GetAllMessagesRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_results} + */ + @Nullable + public final Integer maxResults() { + return this.maxResults; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code next_token} + */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetAllMessagesRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Integer maxResults; + private String memoryId; + @Nullable + private Integer nextToken; + + public Builder() {} + + private Builder(GetAllMessagesRequest o) { + super(o); + this.maxResults = o.maxResults; + this.memoryId = o.memoryId; + this.nextToken = o.nextToken; + } + + private Builder(Builder o) { + super(o); + this.maxResults = o.maxResults; + this.memoryId = o.memoryId; + this.nextToken = o.nextToken; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code max_results} + */ + @Nonnull + public final Builder maxResults(@Nullable Integer value) { + this.maxResults = value; + return this; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code next_token} + */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Builds a {@link GetAllMessagesRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetAllMessagesRequest build() { + _checkSingleUse(); + + return new GetAllMessagesRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.maxResults != null) { + params.put("max_results", String.valueOf(this.maxResults)); + } + if (this.nextToken != null) { + params.put("next_token", String.valueOf(this.nextToken)); + } + } + + /** + * Endpoint "{@code ml.get_all_messages}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/"); + SimpleEndpoint.pathEncode(request.memoryId, buf); + buf.append("/messages"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetAllMessagesResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxResults); + result = 31 * result + this.memoryId.hashCode(); + result = 31 * result + Objects.hashCode(this.nextToken); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetAllMessagesRequest other = (GetAllMessagesRequest) o; + return Objects.equals(this.maxResults, other.maxResults) + && this.memoryId.equals(other.memoryId) + && Objects.equals(this.nextToken, other.nextToken); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesResponse.java new file mode 100644 index 0000000000..b6907b4af0 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetAllMessagesResponse.java @@ -0,0 +1,236 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_all_messages.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetAllMessagesResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List messages; + + @Nullable + private final Integer nextToken; + + // --------------------------------------------------------------------------------------------- + + private GetAllMessagesResponse(Builder builder) { + this.messages = ApiTypeHelper.unmodifiableRequired(builder.messages, this, "messages"); + this.nextToken = builder.nextToken; + } + + public static GetAllMessagesResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code messages} + */ + @Nonnull + public final List messages() { + return this.messages; + } + + /** + * The index of the next message after the last message in the returned list. + *

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

+ */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + /** + * 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("messages"); + generator.writeStartArray(); + for (Message item0 : this.messages) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + if (this.nextToken != null) { + generator.writeKey("next_token"); + generator.write(this.nextToken); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetAllMessagesResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List messages; + @Nullable + private Integer nextToken; + + public Builder() {} + + private Builder(GetAllMessagesResponse o) { + this.messages = _listCopy(o.messages); + this.nextToken = o.nextToken; + } + + private Builder(Builder o) { + this.messages = _listCopy(o.messages); + this.nextToken = o.nextToken; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code messages} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder messages(Function> fn) { + return messages(fn.apply(new Message.Builder()).build()); + } + + /** + * The index of the next message after the last message in the returned list. + *

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

+ */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Builds a {@link GetAllMessagesResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetAllMessagesResponse build() { + _checkSingleUse(); + + return new GetAllMessagesResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetAllMessagesResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetAllMessagesResponse::setupGetAllMessagesResponseDeserializer + ); + + protected static void setupGetAllMessagesResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::messages, JsonpDeserializer.arrayDeserializer(Message._DESERIALIZER), "messages"); + op.add(Builder::nextToken, JsonpDeserializer.integerDeserializer(), "next_token"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.messages.hashCode(); + result = 31 * result + Objects.hashCode(this.nextToken); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetAllMessagesResponse other = (GetAllMessagesResponse) o; + return this.messages.equals(other.messages) && Objects.equals(this.nextToken, other.nextToken); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorRequest.java new file mode 100644 index 0000000000..4f786a696e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorRequest.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_connector.Request + +/** + * Retrieves a standalone connector. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetConnectorRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String connectorId; + + // --------------------------------------------------------------------------------------------- + + private GetConnectorRequest(Builder builder) { + super(builder); + this.connectorId = ApiTypeHelper.requireNonNull(builder.connectorId, this, "connectorId"); + } + + public static GetConnectorRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code connector_id} + */ + @Nonnull + public final String connectorId() { + return this.connectorId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetConnectorRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String connectorId; + + public Builder() {} + + private Builder(GetConnectorRequest o) { + super(o); + this.connectorId = o.connectorId; + } + + private Builder(Builder o) { + super(o); + this.connectorId = o.connectorId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code connector_id} + */ + @Nonnull + public final Builder connectorId(String value) { + this.connectorId = value; + return this; + } + + /** + * Builds a {@link GetConnectorRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetConnectorRequest build() { + _checkSingleUse(); + + return new GetConnectorRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_connector}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/connectors/"); + SimpleEndpoint.pathEncode(request.connectorId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetConnectorResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.connectorId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetConnectorRequest other = (GetConnectorRequest) o; + return this.connectorId.equals(other.connectorId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorResponse.java new file mode 100644 index 0000000000..09c4879ea8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetConnectorResponse.java @@ -0,0 +1,477 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.get_connector.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetConnectorResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final List actions; + + @Nullable + private final Long createdTime; + + @Nullable + private final String description; + + @Nullable + private final Long lastUpdatedTime; + + @Nullable + private final String name; + + @Nonnull + private final Map parameters; + + @Nullable + private final String protocol; + + @Nullable + private final String version; + + // --------------------------------------------------------------------------------------------- + + private GetConnectorResponse(Builder builder) { + this.actions = ApiTypeHelper.unmodifiable(builder.actions); + this.createdTime = builder.createdTime; + this.description = builder.description; + this.lastUpdatedTime = builder.lastUpdatedTime; + this.name = builder.name; + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + this.protocol = builder.protocol; + this.version = builder.version; + } + + public static GetConnectorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code actions} + */ + @Nonnull + public final List actions() { + return this.actions; + } + + /** + * The created time. + *

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

+ */ + @Nullable + public final Long createdTime() { + return this.createdTime; + } + + /** + * The connector description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * The last updated time. + *

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

+ */ + @Nullable + public final Long lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * API name: {@code parameters} + */ + @Nonnull + public final Map parameters() { + return this.parameters; + } + + /** + * The connector protocol. + *

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

+ */ + @Nullable + public final String protocol() { + return this.protocol; + } + + /** + * API name: {@code version} + */ + @Nullable + public final String 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.actions)) { + generator.writeKey("actions"); + generator.writeStartArray(); + for (Action item0 : this.actions) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.createdTime != null) { + generator.writeKey("created_time"); + generator.write(this.createdTime); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.lastUpdatedTime != null) { + generator.writeKey("last_updated_time"); + generator.write(this.lastUpdatedTime); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.protocol != null) { + generator.writeKey("protocol"); + generator.write(this.protocol); + } + + 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 GetConnectorResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List actions; + @Nullable + private Long createdTime; + @Nullable + private String description; + @Nullable + private Long lastUpdatedTime; + @Nullable + private String name; + @Nullable + private Map parameters; + @Nullable + private String protocol; + @Nullable + private String version; + + public Builder() {} + + private Builder(GetConnectorResponse o) { + this.actions = _listCopy(o.actions); + this.createdTime = o.createdTime; + this.description = o.description; + this.lastUpdatedTime = o.lastUpdatedTime; + this.name = o.name; + this.parameters = _mapCopy(o.parameters); + this.protocol = o.protocol; + this.version = o.version; + } + + private Builder(Builder o) { + this.actions = _listCopy(o.actions); + this.createdTime = o.createdTime; + this.description = o.description; + this.lastUpdatedTime = o.lastUpdatedTime; + this.name = o.name; + this.parameters = _mapCopy(o.parameters); + this.protocol = o.protocol; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code actions} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder actions(Function> fn) { + return actions(fn.apply(new Action.Builder()).build()); + } + + /** + * The created time. + *

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

+ */ + @Nonnull + public final Builder createdTime(@Nullable Long value) { + this.createdTime = value; + return this; + } + + /** + * The connector description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * The last updated time. + *

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

+ */ + @Nonnull + public final Builder lastUpdatedTime(@Nullable Long value) { + this.lastUpdatedTime = value; + return this; + } + + /** + * API name: {@code name} + */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * API name: {@code parameters} + * + *

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

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

+ * Adds an entry to parameters. + *

+ */ + @Nonnull + public final Builder parameters(String key, JsonData value) { + this.parameters = _mapPut(this.parameters, key, value); + return this; + } + + /** + * The connector protocol. + *

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

+ */ + @Nonnull + public final Builder protocol(@Nullable String value) { + this.protocol = value; + return this; + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link GetConnectorResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetConnectorResponse build() { + _checkSingleUse(); + + return new GetConnectorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetConnectorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetConnectorResponse::setupGetConnectorResponseDeserializer + ); + + protected static void setupGetConnectorResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::actions, JsonpDeserializer.arrayDeserializer(Action._DESERIALIZER), "actions"); + op.add(Builder::createdTime, JsonpDeserializer.longDeserializer(), "created_time"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::lastUpdatedTime, JsonpDeserializer.longDeserializer(), "last_updated_time"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + op.add(Builder::protocol, JsonpDeserializer.stringDeserializer(), "protocol"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.actions); + result = 31 * result + Objects.hashCode(this.createdTime); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.lastUpdatedTime); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.parameters); + result = 31 * result + Objects.hashCode(this.protocol); + 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; + GetConnectorResponse other = (GetConnectorResponse) o; + return Objects.equals(this.actions, other.actions) + && Objects.equals(this.createdTime, other.createdTime) + && Objects.equals(this.description, other.description) + && Objects.equals(this.lastUpdatedTime, other.lastUpdatedTime) + && Objects.equals(this.name, other.name) + && Objects.equals(this.parameters, other.parameters) + && Objects.equals(this.protocol, other.protocol) + && Objects.equals(this.version, other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerRequest.java new file mode 100644 index 0000000000..31ed6a8556 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerRequest.java @@ -0,0 +1,167 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_controller.Request + +/** + * Retrieves a controller. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetControllerRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private GetControllerRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static GetControllerRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetControllerRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + + public Builder() {} + + private Builder(GetControllerRequest o) { + super(o); + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link GetControllerRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetControllerRequest build() { + _checkSingleUse(); + + return new GetControllerRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_controller}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/controllers/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetControllerResponse._DESERIALIZER + ); + + @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; + GetControllerRequest other = (GetControllerRequest) o; + return this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerResponse.java new file mode 100644 index 0000000000..3cf87631d9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetControllerResponse.java @@ -0,0 +1,234 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_controller.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetControllerResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String modelId; + + @Nonnull + private final Map userRateLimiter; + + // --------------------------------------------------------------------------------------------- + + private GetControllerResponse(Builder builder) { + this.modelId = builder.modelId; + this.userRateLimiter = ApiTypeHelper.unmodifiable(builder.userRateLimiter); + } + + public static GetControllerResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code user_rate_limiter} + */ + @Nonnull + public final Map userRateLimiter() { + return this.userRateLimiter; + } + + /** + * 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.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + if (ApiTypeHelper.isDefined(this.userRateLimiter)) { + generator.writeKey("user_rate_limiter"); + generator.writeStartObject(); + for (Map.Entry item0 : this.userRateLimiter.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetControllerResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String modelId; + @Nullable + private Map userRateLimiter; + + public Builder() {} + + private Builder(GetControllerResponse o) { + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + private Builder(Builder o) { + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

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

+ * Adds an entry to userRateLimiter. + *

+ */ + @Nonnull + public final Builder userRateLimiter(String key, RateLimiter value) { + this.userRateLimiter = _mapPut(this.userRateLimiter, key, value); + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

+ */ + @Nonnull + public final Builder userRateLimiter(String key, Function> fn) { + return userRateLimiter(key, fn.apply(new RateLimiter.Builder()).build()); + } + + /** + * Builds a {@link GetControllerResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetControllerResponse build() { + _checkSingleUse(); + + return new GetControllerResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetControllerResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetControllerResponse::setupGetControllerResponseDeserializer + ); + + protected static void setupGetControllerResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::userRateLimiter, JsonpDeserializer.stringMapDeserializer(RateLimiter._DESERIALIZER), "user_rate_limiter"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.userRateLimiter); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetControllerResponse other = (GetControllerResponse) o; + return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.userRateLimiter, other.userRateLimiter); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryRequest.java new file mode 100644 index 0000000000..f717ae5baf --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryRequest.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_memory.Request + +/** + * Get a memory. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetMemoryRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String memoryId; + + // --------------------------------------------------------------------------------------------- + + private GetMemoryRequest(Builder builder) { + super(builder); + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + } + + public static GetMemoryRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMemoryRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String memoryId; + + public Builder() {} + + private Builder(GetMemoryRequest o) { + super(o); + this.memoryId = o.memoryId; + } + + private Builder(Builder o) { + super(o); + this.memoryId = o.memoryId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * Builds a {@link GetMemoryRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMemoryRequest build() { + _checkSingleUse(); + + return new GetMemoryRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_memory}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/"); + SimpleEndpoint.pathEncode(request.memoryId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetMemoryResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memoryId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMemoryRequest other = (GetMemoryRequest) o; + return this.memoryId.equals(other.memoryId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryResponse.java new file mode 100644 index 0000000000..d9252dd18b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMemoryResponse.java @@ -0,0 +1,404 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.get_memory.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetMemoryResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String createTime; + + @Nullable + private final String memoryId; + + @Nullable + private final String name; + + @Nullable + private final String type; + + @Nullable + private final String updatedTime; + + @Nullable + private final String user; + + // --------------------------------------------------------------------------------------------- + + private GetMemoryResponse(Builder builder) { + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.createTime = builder.createTime; + this.memoryId = builder.memoryId; + this.name = builder.name; + this.type = builder.type; + this.updatedTime = builder.updatedTime; + this.user = builder.user; + } + + public static GetMemoryResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The create time. + *

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

+ */ + @Nullable + public final String createTime() { + return this.createTime; + } + + /** + * API name: {@code memory_id} + */ + @Nullable + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * API name: {@code type} + */ + @Nullable + public final String type() { + return this.type; + } + + /** + * The updated time. + *

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

+ */ + @Nullable + public final String updatedTime() { + return this.updatedTime; + } + + /** + * The username of the user. + *

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

+ */ + @Nullable + public final String user() { + return this.user; + } + + /** + * 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.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.memoryId != null) { + generator.writeKey("memory_id"); + generator.write(this.memoryId); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (this.type != null) { + generator.writeKey("type"); + generator.write(this.type); + } + + if (this.updatedTime != null) { + generator.writeKey("updated_time"); + generator.write(this.updatedTime); + } + + if (this.user != null) { + generator.writeKey("user"); + generator.write(this.user); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMemoryResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String createTime; + @Nullable + private String memoryId; + @Nullable + private String name; + @Nullable + private String type; + @Nullable + private String updatedTime; + @Nullable + private String user; + + public Builder() {} + + private Builder(GetMemoryResponse o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.memoryId = o.memoryId; + this.name = o.name; + this.type = o.type; + this.updatedTime = o.updatedTime; + this.user = o.user; + } + + private Builder(Builder o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.memoryId = o.memoryId; + this.name = o.name; + this.type = o.type; + this.updatedTime = o.updatedTime; + this.user = o.user; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The create time. + *

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

+ */ + @Nonnull + public final Builder createTime(@Nullable String value) { + this.createTime = value; + return this; + } + + /** + * API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(@Nullable String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code name} + */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * API name: {@code type} + */ + @Nonnull + public final Builder type(@Nullable String value) { + this.type = value; + return this; + } + + /** + * The updated time. + *

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

+ */ + @Nonnull + public final Builder updatedTime(@Nullable String value) { + this.updatedTime = value; + return this; + } + + /** + * The username of the user. + *

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

+ */ + @Nonnull + public final Builder user(@Nullable String value) { + this.user = value; + return this; + } + + /** + * Builds a {@link GetMemoryResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMemoryResponse build() { + _checkSingleUse(); + + return new GetMemoryResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetMemoryResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetMemoryResponse::setupGetMemoryResponseDeserializer + ); + + protected static void setupGetMemoryResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::createTime, JsonpDeserializer.stringDeserializer(), "create_time"); + op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::updatedTime, JsonpDeserializer.stringDeserializer(), "updated_time"); + op.add(Builder::user, JsonpDeserializer.stringDeserializer(), "user"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.createTime); + result = 31 * result + Objects.hashCode(this.memoryId); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.type); + result = 31 * result + Objects.hashCode(this.updatedTime); + result = 31 * result + Objects.hashCode(this.user); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMemoryResponse other = (GetMemoryResponse) o; + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.createTime, other.createTime) + && Objects.equals(this.memoryId, other.memoryId) + && Objects.equals(this.name, other.name) + && Objects.equals(this.type, other.type) + && Objects.equals(this.updatedTime, other.updatedTime) + && Objects.equals(this.user, other.user); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageRequest.java new file mode 100644 index 0000000000..7a0c0abf4f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageRequest.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_message.Request + +/** + * Get a message. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetMessageRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String messageId; + + // --------------------------------------------------------------------------------------------- + + private GetMessageRequest(Builder builder) { + super(builder); + this.messageId = ApiTypeHelper.requireNonNull(builder.messageId, this, "messageId"); + } + + public static GetMessageRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final String messageId() { + return this.messageId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMessageRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String messageId; + + public Builder() {} + + private Builder(GetMessageRequest o) { + super(o); + this.messageId = o.messageId; + } + + private Builder(Builder o) { + super(o); + this.messageId = o.messageId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(String value) { + this.messageId = value; + return this; + } + + /** + * Builds a {@link GetMessageRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMessageRequest build() { + _checkSingleUse(); + + return new GetMessageRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_message}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/message/"); + SimpleEndpoint.pathEncode(request.messageId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetMessageResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.messageId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMessageRequest other = (GetMessageRequest) o; + return this.messageId.equals(other.messageId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageResponse.java new file mode 100644 index 0000000000..1828051962 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageResponse.java @@ -0,0 +1,527 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.get_message.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetMessageResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String createTime; + + @Nullable + private final String input; + + @Nullable + private final String memoryId; + + @Nullable + private final String messageId; + + @Nullable + private final String origin; + + @Nullable + private final String parentMessageId; + + @Nullable + private final String promptTemplate; + + @Nullable + private final String response; + + @Nullable + private final Long traceNumber; + + // --------------------------------------------------------------------------------------------- + + private GetMessageResponse(Builder builder) { + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.createTime = builder.createTime; + this.input = builder.input; + this.memoryId = builder.memoryId; + this.messageId = builder.messageId; + this.origin = builder.origin; + this.parentMessageId = builder.parentMessageId; + this.promptTemplate = builder.promptTemplate; + this.response = builder.response; + this.traceNumber = builder.traceNumber; + } + + public static GetMessageResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The create time. + *

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

+ */ + @Nullable + public final String createTime() { + return this.createTime; + } + + /** + * The question in the message. + *

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

+ */ + @Nullable + public final String input() { + return this.input; + } + + /** + * API name: {@code memory_id} + */ + @Nullable + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code message_id} + */ + @Nullable + public final String messageId() { + return this.messageId; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nullable + public final String origin() { + return this.origin; + } + + /** + * The parent message ID. + *

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

+ */ + @Nullable + public final String parentMessageId() { + return this.parentMessageId; + } + + /** + * The prompt template. + *

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

+ */ + @Nullable + public final String promptTemplate() { + return this.promptTemplate; + } + + /** + * The answer to the question. + *

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

+ */ + @Nullable + public final String response() { + return this.response; + } + + /** + * The trace number. + *

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

+ */ + @Nullable + public final Long traceNumber() { + return this.traceNumber; + } + + /** + * 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.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.input != null) { + generator.writeKey("input"); + generator.write(this.input); + } + + if (this.memoryId != null) { + generator.writeKey("memory_id"); + generator.write(this.memoryId); + } + + if (this.messageId != null) { + generator.writeKey("message_id"); + generator.write(this.messageId); + } + + if (this.origin != null) { + generator.writeKey("origin"); + generator.write(this.origin); + } + + if (this.parentMessageId != null) { + generator.writeKey("parent_message_id"); + generator.write(this.parentMessageId); + } + + if (this.promptTemplate != null) { + generator.writeKey("prompt_template"); + generator.write(this.promptTemplate); + } + + if (this.response != null) { + generator.writeKey("response"); + generator.write(this.response); + } + + if (this.traceNumber != null) { + generator.writeKey("trace_number"); + generator.write(this.traceNumber); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMessageResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String createTime; + @Nullable + private String input; + @Nullable + private String memoryId; + @Nullable + private String messageId; + @Nullable + private String origin; + @Nullable + private String parentMessageId; + @Nullable + private String promptTemplate; + @Nullable + private String response; + @Nullable + private Long traceNumber; + + public Builder() {} + + private Builder(GetMessageResponse o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.input = o.input; + this.memoryId = o.memoryId; + this.messageId = o.messageId; + this.origin = o.origin; + this.parentMessageId = o.parentMessageId; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + this.traceNumber = o.traceNumber; + } + + private Builder(Builder o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.input = o.input; + this.memoryId = o.memoryId; + this.messageId = o.messageId; + this.origin = o.origin; + this.parentMessageId = o.parentMessageId; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + this.traceNumber = o.traceNumber; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The create time. + *

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

+ */ + @Nonnull + public final Builder createTime(@Nullable String value) { + this.createTime = value; + return this; + } + + /** + * The question in the message. + *

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

+ */ + @Nonnull + public final Builder input(@Nullable String value) { + this.input = value; + return this; + } + + /** + * API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(@Nullable String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(@Nullable String value) { + this.messageId = value; + return this; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nonnull + public final Builder origin(@Nullable String value) { + this.origin = value; + return this; + } + + /** + * The parent message ID. + *

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

+ */ + @Nonnull + public final Builder parentMessageId(@Nullable String value) { + this.parentMessageId = value; + return this; + } + + /** + * The prompt template. + *

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

+ */ + @Nonnull + public final Builder promptTemplate(@Nullable String value) { + this.promptTemplate = value; + return this; + } + + /** + * The answer to the question. + *

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

+ */ + @Nonnull + public final Builder response(@Nullable String value) { + this.response = value; + return this; + } + + /** + * The trace number. + *

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

+ */ + @Nonnull + public final Builder traceNumber(@Nullable Long value) { + this.traceNumber = value; + return this; + } + + /** + * Builds a {@link GetMessageResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMessageResponse build() { + _checkSingleUse(); + + return new GetMessageResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetMessageResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetMessageResponse::setupGetMessageResponseDeserializer + ); + + protected static void setupGetMessageResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::createTime, JsonpDeserializer.stringDeserializer(), "create_time"); + op.add(Builder::input, JsonpDeserializer.stringDeserializer(), "input"); + op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id"); + op.add(Builder::messageId, JsonpDeserializer.stringDeserializer(), "message_id"); + op.add(Builder::origin, JsonpDeserializer.stringDeserializer(), "origin"); + op.add(Builder::parentMessageId, JsonpDeserializer.stringDeserializer(), "parent_message_id"); + op.add(Builder::promptTemplate, JsonpDeserializer.stringDeserializer(), "prompt_template"); + op.add(Builder::response, JsonpDeserializer.stringDeserializer(), "response"); + op.add(Builder::traceNumber, JsonpDeserializer.longDeserializer(), "trace_number"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.createTime); + result = 31 * result + Objects.hashCode(this.input); + result = 31 * result + Objects.hashCode(this.memoryId); + result = 31 * result + Objects.hashCode(this.messageId); + result = 31 * result + Objects.hashCode(this.origin); + result = 31 * result + Objects.hashCode(this.parentMessageId); + result = 31 * result + Objects.hashCode(this.promptTemplate); + result = 31 * result + Objects.hashCode(this.response); + result = 31 * result + Objects.hashCode(this.traceNumber); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMessageResponse other = (GetMessageResponse) o; + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.createTime, other.createTime) + && Objects.equals(this.input, other.input) + && Objects.equals(this.memoryId, other.memoryId) + && Objects.equals(this.messageId, other.messageId) + && Objects.equals(this.origin, other.origin) + && Objects.equals(this.parentMessageId, other.parentMessageId) + && Objects.equals(this.promptTemplate, other.promptTemplate) + && Objects.equals(this.response, other.response) + && Objects.equals(this.traceNumber, other.traceNumber); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesRequest.java new file mode 100644 index 0000000000..b99b4f862f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesRequest.java @@ -0,0 +1,235 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_message_traces.Request + +/** + * Get a message traces. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetMessageTracesRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Integer maxResults; + + @Nonnull + private final String messageId; + + @Nullable + private final Integer nextToken; + + // --------------------------------------------------------------------------------------------- + + private GetMessageTracesRequest(Builder builder) { + super(builder); + this.maxResults = builder.maxResults; + this.messageId = ApiTypeHelper.requireNonNull(builder.messageId, this, "messageId"); + this.nextToken = builder.nextToken; + } + + public static GetMessageTracesRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_results} + */ + @Nullable + public final Integer maxResults() { + return this.maxResults; + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final String messageId() { + return this.messageId; + } + + /** + * API name: {@code next_token} + */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMessageTracesRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Integer maxResults; + private String messageId; + @Nullable + private Integer nextToken; + + public Builder() {} + + private Builder(GetMessageTracesRequest o) { + super(o); + this.maxResults = o.maxResults; + this.messageId = o.messageId; + this.nextToken = o.nextToken; + } + + private Builder(Builder o) { + super(o); + this.maxResults = o.maxResults; + this.messageId = o.messageId; + this.nextToken = o.nextToken; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code max_results} + */ + @Nonnull + public final Builder maxResults(@Nullable Integer value) { + this.maxResults = value; + return this; + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(String value) { + this.messageId = value; + return this; + } + + /** + * API name: {@code next_token} + */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Builds a {@link GetMessageTracesRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMessageTracesRequest build() { + _checkSingleUse(); + + return new GetMessageTracesRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + protected void applyQueryParameters(@Nonnull Map params) { + super.applyQueryParameters(params); + if (this.maxResults != null) { + params.put("max_results", String.valueOf(this.maxResults)); + } + if (this.nextToken != null) { + params.put("next_token", String.valueOf(this.nextToken)); + } + } + + /** + * Endpoint "{@code ml.get_message_traces}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/message/"); + SimpleEndpoint.pathEncode(request.messageId, buf); + buf.append("/traces"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetMessageTracesResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxResults); + result = 31 * result + this.messageId.hashCode(); + result = 31 * result + Objects.hashCode(this.nextToken); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMessageTracesRequest other = (GetMessageTracesRequest) o; + return Objects.equals(this.maxResults, other.maxResults) + && this.messageId.equals(other.messageId) + && Objects.equals(this.nextToken, other.nextToken); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesResponse.java new file mode 100644 index 0000000000..0c518ff0fb --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetMessageTracesResponse.java @@ -0,0 +1,230 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_message_traces.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetMessageTracesResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Integer nextToken; + + @Nonnull + private final List traces; + + // --------------------------------------------------------------------------------------------- + + private GetMessageTracesResponse(Builder builder) { + this.nextToken = builder.nextToken; + this.traces = ApiTypeHelper.unmodifiableRequired(builder.traces, this, "traces"); + } + + public static GetMessageTracesResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code next_token} + */ + @Nullable + public final Integer nextToken() { + return this.nextToken; + } + + /** + * Required - API name: {@code traces} + */ + @Nonnull + public final List traces() { + return this.traces; + } + + /** + * 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.nextToken != null) { + generator.writeKey("next_token"); + generator.write(this.nextToken); + } + + generator.writeKey("traces"); + generator.writeStartArray(); + for (Message item0 : this.traces) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetMessageTracesResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer nextToken; + private List traces; + + public Builder() {} + + private Builder(GetMessageTracesResponse o) { + this.nextToken = o.nextToken; + this.traces = _listCopy(o.traces); + } + + private Builder(Builder o) { + this.nextToken = o.nextToken; + this.traces = _listCopy(o.traces); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code next_token} + */ + @Nonnull + public final Builder nextToken(@Nullable Integer value) { + this.nextToken = value; + return this; + } + + /** + * Required - API name: {@code traces} + * + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder traces(Function> fn) { + return traces(fn.apply(new Message.Builder()).build()); + } + + /** + * Builds a {@link GetMessageTracesResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetMessageTracesResponse build() { + _checkSingleUse(); + + return new GetMessageTracesResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetMessageTracesResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetMessageTracesResponse::setupGetMessageTracesResponseDeserializer + ); + + protected static void setupGetMessageTracesResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::nextToken, JsonpDeserializer.integerDeserializer(), "next_token"); + op.add(Builder::traces, JsonpDeserializer.arrayDeserializer(Message._DESERIALIZER), "traces"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nextToken); + result = 31 * result + this.traces.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMessageTracesResponse other = (GetMessageTracesResponse) o; + return Objects.equals(this.nextToken, other.nextToken) && this.traces.equals(other.traces); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelRequest.java new file mode 100644 index 0000000000..62a80fd76a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelRequest.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.get_model.Request + +/** + * Retrieves a model. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetModelRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private GetModelRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static GetModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetModelRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + + public Builder() {} + + private Builder(GetModelRequest o) { + super(o); + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link GetModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetModelRequest build() { + _checkSingleUse(); + + return new GetModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + GetModelResponse._DESERIALIZER + ); + + @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; + GetModelRequest other = (GetModelRequest) o; + return this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelResponse.java new file mode 100644 index 0000000000..a68b9a7c4c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetModelResponse.java @@ -0,0 +1,670 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetModelResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String algorithm; + + @Nullable + private final Long createdTime; + + @Nullable + private final Boolean isHidden; + + @Nullable + private final Long lastRegisteredTime; + + @Nullable + private final Long lastUpdatedTime; + + @Nullable + private final ModelConfig modelConfig; + + @Nullable + private final String modelContentHashValue; + + @Nullable + private final Long modelContentSizeInBytes; + + @Nullable + private final ModelFormat modelFormat; + + @Nullable + private final String modelGroupId; + + @Nonnull + private final String modelState; + + @Nullable + private final String modelVersion; + + @Nullable + private final String name; + + @Nullable + private final Long totalChunks; + + // --------------------------------------------------------------------------------------------- + + private GetModelResponse(Builder builder) { + this.algorithm = builder.algorithm; + this.createdTime = builder.createdTime; + this.isHidden = builder.isHidden; + this.lastRegisteredTime = builder.lastRegisteredTime; + this.lastUpdatedTime = builder.lastUpdatedTime; + this.modelConfig = builder.modelConfig; + this.modelContentHashValue = builder.modelContentHashValue; + this.modelContentSizeInBytes = builder.modelContentSizeInBytes; + this.modelFormat = builder.modelFormat; + this.modelGroupId = builder.modelGroupId; + this.modelState = ApiTypeHelper.requireNonNull(builder.modelState, this, "modelState"); + this.modelVersion = builder.modelVersion; + this.name = builder.name; + this.totalChunks = builder.totalChunks; + } + + public static GetModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The algorithm. + *

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

+ */ + @Nullable + public final String algorithm() { + return this.algorithm; + } + + /** + * The created time. + *

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

+ */ + @Nullable + public final Long createdTime() { + return this.createdTime; + } + + /** + * Whether the model is hidden. + *

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

+ */ + @Nullable + public final Boolean isHidden() { + return this.isHidden; + } + + /** + * The last registered time. + *

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

+ */ + @Nullable + public final Long lastRegisteredTime() { + return this.lastRegisteredTime; + } + + /** + * The last updated time. + *

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

+ */ + @Nullable + public final Long lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * API name: {@code model_config} + */ + @Nullable + public final ModelConfig modelConfig() { + return this.modelConfig; + } + + /** + * The model content hash value. + *

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

+ */ + @Nullable + public final String modelContentHashValue() { + return this.modelContentHashValue; + } + + /** + * The model content size in bytes. + *

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

+ */ + @Nullable + public final Long modelContentSizeInBytes() { + return this.modelContentSizeInBytes; + } + + /** + * API name: {@code model_format} + */ + @Nullable + public final ModelFormat modelFormat() { + return this.modelFormat; + } + + /** + * The model group ID. + *

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

+ */ + @Nullable + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The model state. + *

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

+ */ + @Nonnull + public final String modelState() { + return this.modelState; + } + + /** + * The model version. + *

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

+ */ + @Nullable + public final String modelVersion() { + return this.modelVersion; + } + + /** + * The model name. + *

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

+ */ + @Nullable + public final String name() { + return this.name; + } + + /** + * The total chunks. + *

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

+ */ + @Nullable + public final Long totalChunks() { + return this.totalChunks; + } + + /** + * 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.algorithm != null) { + generator.writeKey("algorithm"); + generator.write(this.algorithm); + } + + if (this.createdTime != null) { + generator.writeKey("created_time"); + generator.write(this.createdTime); + } + + if (this.isHidden != null) { + generator.writeKey("is_hidden"); + generator.write(this.isHidden); + } + + if (this.lastRegisteredTime != null) { + generator.writeKey("last_registered_time"); + generator.write(this.lastRegisteredTime); + } + + if (this.lastUpdatedTime != null) { + generator.writeKey("last_updated_time"); + generator.write(this.lastUpdatedTime); + } + + if (this.modelConfig != null) { + generator.writeKey("model_config"); + this.modelConfig.serialize(generator, mapper); + } + + if (this.modelContentHashValue != null) { + generator.writeKey("model_content_hash_value"); + generator.write(this.modelContentHashValue); + } + + if (this.modelContentSizeInBytes != null) { + generator.writeKey("model_content_size_in_bytes"); + generator.write(this.modelContentSizeInBytes); + } + + if (this.modelFormat != null) { + generator.writeKey("model_format"); + this.modelFormat.serialize(generator, mapper); + } + + if (this.modelGroupId != null) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + } + + generator.writeKey("model_state"); + generator.write(this.modelState); + + if (this.modelVersion != null) { + generator.writeKey("model_version"); + generator.write(this.modelVersion); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (this.totalChunks != null) { + generator.writeKey("total_chunks"); + generator.write(this.totalChunks); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String algorithm; + @Nullable + private Long createdTime; + @Nullable + private Boolean isHidden; + @Nullable + private Long lastRegisteredTime; + @Nullable + private Long lastUpdatedTime; + @Nullable + private ModelConfig modelConfig; + @Nullable + private String modelContentHashValue; + @Nullable + private Long modelContentSizeInBytes; + @Nullable + private ModelFormat modelFormat; + @Nullable + private String modelGroupId; + private String modelState; + @Nullable + private String modelVersion; + @Nullable + private String name; + @Nullable + private Long totalChunks; + + public Builder() {} + + private Builder(GetModelResponse o) { + this.algorithm = o.algorithm; + this.createdTime = o.createdTime; + this.isHidden = o.isHidden; + this.lastRegisteredTime = o.lastRegisteredTime; + this.lastUpdatedTime = o.lastUpdatedTime; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelContentSizeInBytes = o.modelContentSizeInBytes; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.modelState = o.modelState; + this.modelVersion = o.modelVersion; + this.name = o.name; + this.totalChunks = o.totalChunks; + } + + private Builder(Builder o) { + this.algorithm = o.algorithm; + this.createdTime = o.createdTime; + this.isHidden = o.isHidden; + this.lastRegisteredTime = o.lastRegisteredTime; + this.lastUpdatedTime = o.lastUpdatedTime; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelContentSizeInBytes = o.modelContentSizeInBytes; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.modelState = o.modelState; + this.modelVersion = o.modelVersion; + this.name = o.name; + this.totalChunks = o.totalChunks; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The algorithm. + *

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

+ */ + @Nonnull + public final Builder algorithm(@Nullable String value) { + this.algorithm = value; + return this; + } + + /** + * The created time. + *

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

+ */ + @Nonnull + public final Builder createdTime(@Nullable Long value) { + this.createdTime = value; + return this; + } + + /** + * Whether the model is hidden. + *

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

+ */ + @Nonnull + public final Builder isHidden(@Nullable Boolean value) { + this.isHidden = value; + return this; + } + + /** + * The last registered time. + *

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

+ */ + @Nonnull + public final Builder lastRegisteredTime(@Nullable Long value) { + this.lastRegisteredTime = value; + return this; + } + + /** + * The last updated time. + *

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

+ */ + @Nonnull + public final Builder lastUpdatedTime(@Nullable Long value) { + this.lastUpdatedTime = value; + return this; + } + + /** + * API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(@Nullable ModelConfig value) { + this.modelConfig = value; + return this; + } + + /** + * API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(Function> fn) { + return modelConfig(fn.apply(new ModelConfig.Builder()).build()); + } + + /** + * The model content hash value. + *

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

+ */ + @Nonnull + public final Builder modelContentHashValue(@Nullable String value) { + this.modelContentHashValue = value; + return this; + } + + /** + * The model content size in bytes. + *

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

+ */ + @Nonnull + public final Builder modelContentSizeInBytes(@Nullable Long value) { + this.modelContentSizeInBytes = value; + return this; + } + + /** + * API name: {@code model_format} + */ + @Nonnull + public final Builder modelFormat(@Nullable ModelFormat value) { + this.modelFormat = value; + return this; + } + + /** + * The model group ID. + *

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

+ */ + @Nonnull + public final Builder modelGroupId(@Nullable String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The model state. + *

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

+ */ + @Nonnull + public final Builder modelState(String value) { + this.modelState = value; + return this; + } + + /** + * The model version. + *

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

+ */ + @Nonnull + public final Builder modelVersion(@Nullable String value) { + this.modelVersion = value; + return this; + } + + /** + * The model name. + *

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

+ */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * The total chunks. + *

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

+ */ + @Nonnull + public final Builder totalChunks(@Nullable Long value) { + this.totalChunks = value; + return this; + } + + /** + * Builds a {@link GetModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetModelResponse build() { + _checkSingleUse(); + + return new GetModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetModelResponse::setupGetModelResponseDeserializer + ); + + protected static void setupGetModelResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::algorithm, JsonpDeserializer.stringDeserializer(), "algorithm"); + op.add(Builder::createdTime, JsonpDeserializer.longDeserializer(), "created_time"); + op.add(Builder::isHidden, JsonpDeserializer.booleanDeserializer(), "is_hidden"); + op.add(Builder::lastRegisteredTime, JsonpDeserializer.longDeserializer(), "last_registered_time"); + op.add(Builder::lastUpdatedTime, JsonpDeserializer.longDeserializer(), "last_updated_time"); + op.add(Builder::modelConfig, ModelConfig._DESERIALIZER, "model_config"); + op.add(Builder::modelContentHashValue, JsonpDeserializer.stringDeserializer(), "model_content_hash_value"); + op.add(Builder::modelContentSizeInBytes, JsonpDeserializer.longDeserializer(), "model_content_size_in_bytes"); + op.add(Builder::modelFormat, ModelFormat._DESERIALIZER, "model_format"); + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::modelState, JsonpDeserializer.stringDeserializer(), "model_state"); + op.add(Builder::modelVersion, JsonpDeserializer.stringDeserializer(), "model_version"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::totalChunks, JsonpDeserializer.longDeserializer(), "total_chunks"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.algorithm); + result = 31 * result + Objects.hashCode(this.createdTime); + result = 31 * result + Objects.hashCode(this.isHidden); + result = 31 * result + Objects.hashCode(this.lastRegisteredTime); + result = 31 * result + Objects.hashCode(this.lastUpdatedTime); + result = 31 * result + Objects.hashCode(this.modelConfig); + result = 31 * result + Objects.hashCode(this.modelContentHashValue); + result = 31 * result + Objects.hashCode(this.modelContentSizeInBytes); + result = 31 * result + Objects.hashCode(this.modelFormat); + result = 31 * result + Objects.hashCode(this.modelGroupId); + result = 31 * result + this.modelState.hashCode(); + result = 31 * result + Objects.hashCode(this.modelVersion); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.totalChunks); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetModelResponse other = (GetModelResponse) o; + return Objects.equals(this.algorithm, other.algorithm) + && Objects.equals(this.createdTime, other.createdTime) + && Objects.equals(this.isHidden, other.isHidden) + && Objects.equals(this.lastRegisteredTime, other.lastRegisteredTime) + && Objects.equals(this.lastUpdatedTime, other.lastUpdatedTime) + && Objects.equals(this.modelConfig, other.modelConfig) + && Objects.equals(this.modelContentHashValue, other.modelContentHashValue) + && Objects.equals(this.modelContentSizeInBytes, other.modelContentSizeInBytes) + && Objects.equals(this.modelFormat, other.modelFormat) + && Objects.equals(this.modelGroupId, other.modelGroupId) + && this.modelState.equals(other.modelState) + && Objects.equals(this.modelVersion, other.modelVersion) + && Objects.equals(this.name, other.name) + && Objects.equals(this.totalChunks, other.totalChunks); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsRequest.java new file mode 100644 index 0000000000..95197d8a2b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsRequest.java @@ -0,0 +1,457 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_profile_models.Request + +/** + * Get a profile models. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetProfileModelsRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String modelId; + + @Nonnull + private final List modelIds; + + @Nonnull + private final List nodeIds; + + @Nullable + private final Boolean returnAllModels; + + @Nullable + private final Boolean returnAllTasks; + + @Nonnull + private final List taskIds; + + // --------------------------------------------------------------------------------------------- + + private GetProfileModelsRequest(Builder builder) { + super(builder); + this.modelId = builder.modelId; + this.modelIds = ApiTypeHelper.unmodifiable(builder.modelIds); + this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); + this.returnAllModels = builder.returnAllModels; + this.returnAllTasks = builder.returnAllTasks; + this.taskIds = ApiTypeHelper.unmodifiable(builder.taskIds); + } + + public static GetProfileModelsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code model_ids} + */ + @Nonnull + public final List modelIds() { + return this.modelIds; + } + + /** + * API name: {@code node_ids} + */ + @Nonnull + public final List nodeIds() { + return this.nodeIds; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nullable + public final Boolean returnAllModels() { + return this.returnAllModels; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nullable + public final Boolean returnAllTasks() { + return this.returnAllTasks; + } + + /** + * API name: {@code task_ids} + */ + @Nonnull + public final List taskIds() { + return this.taskIds; + } + + /** + * 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.modelIds)) { + generator.writeKey("model_ids"); + generator.writeStartArray(); + for (String item0 : this.modelIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.nodeIds)) { + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.returnAllModels != null) { + generator.writeKey("return_all_models"); + generator.write(this.returnAllModels); + } + + if (this.returnAllTasks != null) { + generator.writeKey("return_all_tasks"); + generator.write(this.returnAllTasks); + } + + if (ApiTypeHelper.isDefined(this.taskIds)) { + generator.writeKey("task_ids"); + generator.writeStartArray(); + for (String item0 : this.taskIds) { + 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 GetProfileModelsRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String modelId; + @Nullable + private List modelIds; + @Nullable + private List nodeIds; + @Nullable + private Boolean returnAllModels; + @Nullable + private Boolean returnAllTasks; + @Nullable + private List taskIds; + + public Builder() {} + + private Builder(GetProfileModelsRequest o) { + super(o); + this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskIds = _listCopy(o.taskIds); + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskIds = _listCopy(o.taskIds); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code model_ids} + * + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder nodeIds(String value, String... values) { + this.nodeIds = _listAdd(this.nodeIds, value, values); + return this; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nonnull + public final Builder returnAllModels(@Nullable Boolean value) { + this.returnAllModels = value; + return this; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nonnull + public final Builder returnAllTasks(@Nullable Boolean value) { + this.returnAllTasks = value; + return this; + } + + /** + * API name: {@code task_ids} + * + *

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

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

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

+ */ + @Nonnull + public final Builder taskIds(String value, String... values) { + this.taskIds = _listAdd(this.taskIds, value, values); + return this; + } + + /** + * Builds a {@link GetProfileModelsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileModelsRequest build() { + _checkSingleUse(); + + return new GetProfileModelsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileModelsRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileModelsRequest::setupGetProfileModelsRequestDeserializer + ); + + protected static void setupGetProfileModelsRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::modelIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "model_ids"); + op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); + op.add(Builder::returnAllModels, JsonpDeserializer.booleanDeserializer(), "return_all_models"); + op.add(Builder::returnAllTasks, JsonpDeserializer.booleanDeserializer(), "return_all_tasks"); + op.add(Builder::taskIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "task_ids"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_profile_models}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _modelId = 1 << 0; + + int propsSet = 0; + + if (request.modelId() != null) propsSet |= _modelId; + + if (propsSet == 0) { + return "/_plugins/_ml/profile/models"; + } + if (propsSet == (_modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/profile/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + GetProfileModelsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.modelIds); + result = 31 * result + Objects.hashCode(this.nodeIds); + result = 31 * result + Objects.hashCode(this.returnAllModels); + result = 31 * result + Objects.hashCode(this.returnAllTasks); + result = 31 * result + Objects.hashCode(this.taskIds); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileModelsRequest other = (GetProfileModelsRequest) o; + return Objects.equals(this.modelId, other.modelId) + && Objects.equals(this.modelIds, other.modelIds) + && Objects.equals(this.nodeIds, other.nodeIds) + && Objects.equals(this.returnAllModels, other.returnAllModels) + && Objects.equals(this.returnAllTasks, other.returnAllTasks) + && Objects.equals(this.taskIds, other.taskIds); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsResponse.java new file mode 100644 index 0000000000..4f6f3a8cbd --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileModelsResponse.java @@ -0,0 +1,202 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_profile_models.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetProfileModelsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map nodes; + + // --------------------------------------------------------------------------------------------- + + private GetProfileModelsResponse(Builder builder) { + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + } + + public static GetProfileModelsResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + /** + * 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.nodes)) { + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetProfileModelsResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map nodes; + + public Builder() {} + + private Builder(GetProfileModelsResponse o) { + this.nodes = _mapCopy(o.nodes); + } + + private Builder(Builder o) { + this.nodes = _mapCopy(o.nodes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code nodes} + * + *

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

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

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, Node value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + + /** + * API name: {@code nodes} + * + *

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

+ */ + @Nonnull + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new Node.Builder()).build()); + } + + /** + * Builds a {@link GetProfileModelsResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileModelsResponse build() { + _checkSingleUse(); + + return new GetProfileModelsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileModelsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileModelsResponse::setupGetProfileModelsResponseDeserializer + ); + + protected static void setupGetProfileModelsResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(Node._DESERIALIZER), "nodes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileModelsResponse other = (GetProfileModelsResponse) o; + return Objects.equals(this.nodes, other.nodes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileRequest.java new file mode 100644 index 0000000000..4e58eb1e57 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileRequest.java @@ -0,0 +1,412 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_profile.Request + +/** + * Get a profile. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetProfileRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List modelIds; + + @Nonnull + private final List nodeIds; + + @Nullable + private final Boolean returnAllModels; + + @Nullable + private final Boolean returnAllTasks; + + @Nonnull + private final List taskIds; + + // --------------------------------------------------------------------------------------------- + + private GetProfileRequest(Builder builder) { + super(builder); + this.modelIds = ApiTypeHelper.unmodifiable(builder.modelIds); + this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); + this.returnAllModels = builder.returnAllModels; + this.returnAllTasks = builder.returnAllTasks; + this.taskIds = ApiTypeHelper.unmodifiable(builder.taskIds); + } + + public static GetProfileRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_ids} + */ + @Nonnull + public final List modelIds() { + return this.modelIds; + } + + /** + * API name: {@code node_ids} + */ + @Nonnull + public final List nodeIds() { + return this.nodeIds; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nullable + public final Boolean returnAllModels() { + return this.returnAllModels; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nullable + public final Boolean returnAllTasks() { + return this.returnAllTasks; + } + + /** + * API name: {@code task_ids} + */ + @Nonnull + public final List taskIds() { + return this.taskIds; + } + + /** + * 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.modelIds)) { + generator.writeKey("model_ids"); + generator.writeStartArray(); + for (String item0 : this.modelIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.nodeIds)) { + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.returnAllModels != null) { + generator.writeKey("return_all_models"); + generator.write(this.returnAllModels); + } + + if (this.returnAllTasks != null) { + generator.writeKey("return_all_tasks"); + generator.write(this.returnAllTasks); + } + + if (ApiTypeHelper.isDefined(this.taskIds)) { + generator.writeKey("task_ids"); + generator.writeStartArray(); + for (String item0 : this.taskIds) { + 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 GetProfileRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private List modelIds; + @Nullable + private List nodeIds; + @Nullable + private Boolean returnAllModels; + @Nullable + private Boolean returnAllTasks; + @Nullable + private List taskIds; + + public Builder() {} + + private Builder(GetProfileRequest o) { + super(o); + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskIds = _listCopy(o.taskIds); + } + + private Builder(Builder o) { + super(o); + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskIds = _listCopy(o.taskIds); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code model_ids} + * + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder nodeIds(String value, String... values) { + this.nodeIds = _listAdd(this.nodeIds, value, values); + return this; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nonnull + public final Builder returnAllModels(@Nullable Boolean value) { + this.returnAllModels = value; + return this; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nonnull + public final Builder returnAllTasks(@Nullable Boolean value) { + this.returnAllTasks = value; + return this; + } + + /** + * API name: {@code task_ids} + * + *

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

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

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

+ */ + @Nonnull + public final Builder taskIds(String value, String... values) { + this.taskIds = _listAdd(this.taskIds, value, values); + return this; + } + + /** + * Builds a {@link GetProfileRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileRequest build() { + _checkSingleUse(); + + return new GetProfileRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileRequest::setupGetProfileRequestDeserializer + ); + + protected static void setupGetProfileRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::modelIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "model_ids"); + op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); + op.add(Builder::returnAllModels, JsonpDeserializer.booleanDeserializer(), "return_all_models"); + op.add(Builder::returnAllTasks, JsonpDeserializer.booleanDeserializer(), "return_all_tasks"); + op.add(Builder::taskIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "task_ids"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_profile}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> "/_plugins/_ml/profile", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + GetProfileResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelIds); + result = 31 * result + Objects.hashCode(this.nodeIds); + result = 31 * result + Objects.hashCode(this.returnAllModels); + result = 31 * result + Objects.hashCode(this.returnAllTasks); + result = 31 * result + Objects.hashCode(this.taskIds); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileRequest other = (GetProfileRequest) o; + return Objects.equals(this.modelIds, other.modelIds) + && Objects.equals(this.nodeIds, other.nodeIds) + && Objects.equals(this.returnAllModels, other.returnAllModels) + && Objects.equals(this.returnAllTasks, other.returnAllTasks) + && Objects.equals(this.taskIds, other.taskIds); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileResponse.java new file mode 100644 index 0000000000..da28fb5051 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileResponse.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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_profile.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetProfileResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map nodes; + + // --------------------------------------------------------------------------------------------- + + private GetProfileResponse(Builder builder) { + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + } + + public static GetProfileResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + /** + * 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.nodes)) { + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetProfileResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map nodes; + + public Builder() {} + + private Builder(GetProfileResponse o) { + this.nodes = _mapCopy(o.nodes); + } + + private Builder(Builder o) { + this.nodes = _mapCopy(o.nodes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code nodes} + * + *

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

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

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, Node value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + + /** + * API name: {@code nodes} + * + *

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

+ */ + @Nonnull + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new Node.Builder()).build()); + } + + /** + * Builds a {@link GetProfileResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileResponse build() { + _checkSingleUse(); + + return new GetProfileResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileResponse::setupGetProfileResponseDeserializer + ); + + protected static void setupGetProfileResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(Node._DESERIALIZER), "nodes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileResponse other = (GetProfileResponse) o; + return Objects.equals(this.nodes, other.nodes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksRequest.java new file mode 100644 index 0000000000..2f48ff7f32 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksRequest.java @@ -0,0 +1,457 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.get_profile_tasks.Request + +/** + * Get a profile tasks. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class GetProfileTasksRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List modelIds; + + @Nonnull + private final List nodeIds; + + @Nullable + private final Boolean returnAllModels; + + @Nullable + private final Boolean returnAllTasks; + + @Nullable + private final String taskId; + + @Nonnull + private final List taskIds; + + // --------------------------------------------------------------------------------------------- + + private GetProfileTasksRequest(Builder builder) { + super(builder); + this.modelIds = ApiTypeHelper.unmodifiable(builder.modelIds); + this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); + this.returnAllModels = builder.returnAllModels; + this.returnAllTasks = builder.returnAllTasks; + this.taskId = builder.taskId; + this.taskIds = ApiTypeHelper.unmodifiable(builder.taskIds); + } + + public static GetProfileTasksRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_ids} + */ + @Nonnull + public final List modelIds() { + return this.modelIds; + } + + /** + * API name: {@code node_ids} + */ + @Nonnull + public final List nodeIds() { + return this.nodeIds; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nullable + public final Boolean returnAllModels() { + return this.returnAllModels; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nullable + public final Boolean returnAllTasks() { + return this.returnAllTasks; + } + + /** + * API name: {@code task_id} + */ + @Nullable + public final String taskId() { + return this.taskId; + } + + /** + * API name: {@code task_ids} + */ + @Nonnull + public final List taskIds() { + return this.taskIds; + } + + /** + * 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.modelIds)) { + generator.writeKey("model_ids"); + generator.writeStartArray(); + for (String item0 : this.modelIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.nodeIds)) { + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.returnAllModels != null) { + generator.writeKey("return_all_models"); + generator.write(this.returnAllModels); + } + + if (this.returnAllTasks != null) { + generator.writeKey("return_all_tasks"); + generator.write(this.returnAllTasks); + } + + if (ApiTypeHelper.isDefined(this.taskIds)) { + generator.writeKey("task_ids"); + generator.writeStartArray(); + for (String item0 : this.taskIds) { + 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 GetProfileTasksRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private List modelIds; + @Nullable + private List nodeIds; + @Nullable + private Boolean returnAllModels; + @Nullable + private Boolean returnAllTasks; + @Nullable + private String taskId; + @Nullable + private List taskIds; + + public Builder() {} + + private Builder(GetProfileTasksRequest o) { + super(o); + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskId = o.taskId; + this.taskIds = _listCopy(o.taskIds); + } + + private Builder(Builder o) { + super(o); + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + this.returnAllModels = o.returnAllModels; + this.returnAllTasks = o.returnAllTasks; + this.taskId = o.taskId; + this.taskIds = _listCopy(o.taskIds); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code model_ids} + * + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder nodeIds(String value, String... values) { + this.nodeIds = _listAdd(this.nodeIds, value, values); + return this; + } + + /** + * Whether to return all models. + *

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

+ */ + @Nonnull + public final Builder returnAllModels(@Nullable Boolean value) { + this.returnAllModels = value; + return this; + } + + /** + * Whether to return all tasks. + *

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

+ */ + @Nonnull + public final Builder returnAllTasks(@Nullable Boolean value) { + this.returnAllTasks = value; + return this; + } + + /** + * API name: {@code task_id} + */ + @Nonnull + public final Builder taskId(@Nullable String value) { + this.taskId = value; + return this; + } + + /** + * API name: {@code task_ids} + * + *

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

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

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

+ */ + @Nonnull + public final Builder taskIds(String value, String... values) { + this.taskIds = _listAdd(this.taskIds, value, values); + return this; + } + + /** + * Builds a {@link GetProfileTasksRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileTasksRequest build() { + _checkSingleUse(); + + return new GetProfileTasksRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileTasksRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileTasksRequest::setupGetProfileTasksRequestDeserializer + ); + + protected static void setupGetProfileTasksRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::modelIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "model_ids"); + op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); + op.add(Builder::returnAllModels, JsonpDeserializer.booleanDeserializer(), "return_all_models"); + op.add(Builder::returnAllTasks, JsonpDeserializer.booleanDeserializer(), "return_all_tasks"); + op.add(Builder::taskIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "task_ids"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.get_profile_tasks}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _taskId = 1 << 0; + + int propsSet = 0; + + if (request.taskId() != null) propsSet |= _taskId; + + if (propsSet == 0) { + return "/_plugins/_ml/profile/tasks"; + } + if (propsSet == (_taskId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/profile/tasks/"); + SimpleEndpoint.pathEncode(request.taskId, buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + GetProfileTasksResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelIds); + result = 31 * result + Objects.hashCode(this.nodeIds); + result = 31 * result + Objects.hashCode(this.returnAllModels); + result = 31 * result + Objects.hashCode(this.returnAllTasks); + result = 31 * result + Objects.hashCode(this.taskId); + result = 31 * result + Objects.hashCode(this.taskIds); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileTasksRequest other = (GetProfileTasksRequest) o; + return Objects.equals(this.modelIds, other.modelIds) + && Objects.equals(this.nodeIds, other.nodeIds) + && Objects.equals(this.returnAllModels, other.returnAllModels) + && Objects.equals(this.returnAllTasks, other.returnAllTasks) + && Objects.equals(this.taskId, other.taskId) + && Objects.equals(this.taskIds, other.taskIds); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksResponse.java new file mode 100644 index 0000000000..5eaed958bc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GetProfileTasksResponse.java @@ -0,0 +1,202 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.get_profile_tasks.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetProfileTasksResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map nodes; + + // --------------------------------------------------------------------------------------------- + + private GetProfileTasksResponse(Builder builder) { + this.nodes = ApiTypeHelper.unmodifiable(builder.nodes); + } + + public static GetProfileTasksResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code nodes} + */ + @Nonnull + public final Map nodes() { + return this.nodes; + } + + /** + * 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.nodes)) { + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GetProfileTasksResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map nodes; + + public Builder() {} + + private Builder(GetProfileTasksResponse o) { + this.nodes = _mapCopy(o.nodes); + } + + private Builder(Builder o) { + this.nodes = _mapCopy(o.nodes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code nodes} + * + *

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

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

+ * Adds an entry to nodes. + *

+ */ + @Nonnull + public final Builder nodes(String key, Node value) { + this.nodes = _mapPut(this.nodes, key, value); + return this; + } + + /** + * API name: {@code nodes} + * + *

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

+ */ + @Nonnull + public final Builder nodes(String key, Function> fn) { + return nodes(key, fn.apply(new Node.Builder()).build()); + } + + /** + * Builds a {@link GetProfileTasksResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GetProfileTasksResponse build() { + _checkSingleUse(); + + return new GetProfileTasksResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetProfileTasksResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetProfileTasksResponse::setupGetProfileTasksResponseDeserializer + ); + + protected static void setupGetProfileTasksResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(Node._DESERIALIZER), "nodes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetProfileTasksResponse other = (GetProfileTasksResponse) o; + return Objects.equals(this.nodes, other.nodes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Guardrails.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Guardrails.java new file mode 100644 index 0000000000..7747f26c1e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Guardrails.java @@ -0,0 +1,577 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.Guardrails + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Guardrails implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String indexName; + + @Nullable + private final GuardrailsInputOutput inputGuardrail; + + @Nullable + private final String modelId; + + @Nullable + private final GuardrailsInputOutput outputGuardrail; + + @Nonnull + private final Map regex; + + @Nullable + private final String responseFilter; + + @Nullable + private final String responseValidationRegex; + + @Nonnull + private final List sourceFields; + + @Nonnull + private final List stopWords; + + @Nullable + private final String type; + + // --------------------------------------------------------------------------------------------- + + private Guardrails(Builder builder) { + this.indexName = builder.indexName; + this.inputGuardrail = builder.inputGuardrail; + this.modelId = builder.modelId; + this.outputGuardrail = builder.outputGuardrail; + this.regex = ApiTypeHelper.unmodifiable(builder.regex); + this.responseFilter = builder.responseFilter; + this.responseValidationRegex = builder.responseValidationRegex; + this.sourceFields = ApiTypeHelper.unmodifiable(builder.sourceFields); + this.stopWords = ApiTypeHelper.unmodifiable(builder.stopWords); + this.type = builder.type; + } + + public static Guardrails of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code index_name} + */ + @Nullable + public final String indexName() { + return this.indexName; + } + + /** + * API name: {@code input_guardrail} + */ + @Nullable + public final GuardrailsInputOutput inputGuardrail() { + return this.inputGuardrail; + } + + /** + * The model ID. + *

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

+ */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code output_guardrail} + */ + @Nullable + public final GuardrailsInputOutput outputGuardrail() { + return this.outputGuardrail; + } + + /** + * The regex used for input/output validation. + *

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

+ */ + @Nonnull + public final Map regex() { + return this.regex; + } + + /** + * The response filter. + *

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

+ */ + @Nullable + public final String responseFilter() { + return this.responseFilter; + } + + /** + * The response validation regex. + *

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

+ */ + @Nullable + public final String responseValidationRegex() { + return this.responseValidationRegex; + } + + /** + * API name: {@code source_fields} + */ + @Nonnull + public final List sourceFields() { + return this.sourceFields; + } + + /** + * API name: {@code stop_words} + */ + @Nonnull + public final List stopWords() { + return this.stopWords; + } + + /** + * The guardrails type. + *

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

+ */ + @Nullable + public final String type() { + return this.type; + } + + /** + * 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.indexName != null) { + generator.writeKey("index_name"); + generator.write(this.indexName); + } + + if (this.inputGuardrail != null) { + generator.writeKey("input_guardrail"); + this.inputGuardrail.serialize(generator, mapper); + } + + if (this.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + if (this.outputGuardrail != null) { + generator.writeKey("output_guardrail"); + this.outputGuardrail.serialize(generator, mapper); + } + + if (ApiTypeHelper.isDefined(this.regex)) { + generator.writeKey("regex"); + generator.writeStartObject(); + for (Map.Entry item0 : this.regex.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.responseFilter != null) { + generator.writeKey("response_filter"); + generator.write(this.responseFilter); + } + + if (this.responseValidationRegex != null) { + generator.writeKey("response_validation_regex"); + generator.write(this.responseValidationRegex); + } + + if (ApiTypeHelper.isDefined(this.sourceFields)) { + generator.writeKey("source_fields"); + generator.writeStartArray(); + for (String item0 : this.sourceFields) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.stopWords)) { + generator.writeKey("stop_words"); + generator.writeStartArray(); + for (String item0 : this.stopWords) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.type != null) { + generator.writeKey("type"); + generator.write(this.type); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Guardrails}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String indexName; + @Nullable + private GuardrailsInputOutput inputGuardrail; + @Nullable + private String modelId; + @Nullable + private GuardrailsInputOutput outputGuardrail; + @Nullable + private Map regex; + @Nullable + private String responseFilter; + @Nullable + private String responseValidationRegex; + @Nullable + private List sourceFields; + @Nullable + private List stopWords; + @Nullable + private String type; + + public Builder() {} + + private Builder(Guardrails o) { + this.indexName = o.indexName; + this.inputGuardrail = o.inputGuardrail; + this.modelId = o.modelId; + this.outputGuardrail = o.outputGuardrail; + this.regex = _mapCopy(o.regex); + this.responseFilter = o.responseFilter; + this.responseValidationRegex = o.responseValidationRegex; + this.sourceFields = _listCopy(o.sourceFields); + this.stopWords = _listCopy(o.stopWords); + this.type = o.type; + } + + private Builder(Builder o) { + this.indexName = o.indexName; + this.inputGuardrail = o.inputGuardrail; + this.modelId = o.modelId; + this.outputGuardrail = o.outputGuardrail; + this.regex = _mapCopy(o.regex); + this.responseFilter = o.responseFilter; + this.responseValidationRegex = o.responseValidationRegex; + this.sourceFields = _listCopy(o.sourceFields); + this.stopWords = _listCopy(o.stopWords); + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code index_name} + */ + @Nonnull + public final Builder indexName(@Nullable String value) { + this.indexName = value; + return this; + } + + /** + * API name: {@code input_guardrail} + */ + @Nonnull + public final Builder inputGuardrail(@Nullable GuardrailsInputOutput value) { + this.inputGuardrail = value; + return this; + } + + /** + * API name: {@code input_guardrail} + */ + @Nonnull + public final Builder inputGuardrail(Function> fn) { + return inputGuardrail(fn.apply(new GuardrailsInputOutput.Builder()).build()); + } + + /** + * The model ID. + *

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

+ */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code output_guardrail} + */ + @Nonnull + public final Builder outputGuardrail(@Nullable GuardrailsInputOutput value) { + this.outputGuardrail = value; + return this; + } + + /** + * API name: {@code output_guardrail} + */ + @Nonnull + public final Builder outputGuardrail(Function> fn) { + return outputGuardrail(fn.apply(new GuardrailsInputOutput.Builder()).build()); + } + + /** + * The regex used for input/output validation. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder regex(Map map) { + this.regex = _mapPutAll(this.regex, map); + return this; + } + + /** + * The regex used for input/output validation. + *

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

+ * + *

+ * Adds an entry to regex. + *

+ */ + @Nonnull + public final Builder regex(String key, JsonData value) { + this.regex = _mapPut(this.regex, key, value); + return this; + } + + /** + * The response filter. + *

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

+ */ + @Nonnull + public final Builder responseFilter(@Nullable String value) { + this.responseFilter = value; + return this; + } + + /** + * The response validation regex. + *

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

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

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder stopWords(String value, String... values) { + this.stopWords = _listAdd(this.stopWords, value, values); + return this; + } + + /** + * The guardrails type. + *

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

+ */ + @Nonnull + public final Builder type(@Nullable String value) { + this.type = value; + return this; + } + + /** + * Builds a {@link Guardrails}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Guardrails build() { + _checkSingleUse(); + + return new Guardrails(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Guardrails} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Guardrails::setupGuardrailsDeserializer + ); + + protected static void setupGuardrailsDeserializer(ObjectDeserializer op) { + op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); + op.add(Builder::inputGuardrail, GuardrailsInputOutput._DESERIALIZER, "input_guardrail"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::outputGuardrail, GuardrailsInputOutput._DESERIALIZER, "output_guardrail"); + op.add(Builder::regex, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "regex"); + op.add(Builder::responseFilter, JsonpDeserializer.stringDeserializer(), "response_filter"); + op.add(Builder::responseValidationRegex, JsonpDeserializer.stringDeserializer(), "response_validation_regex"); + op.add(Builder::sourceFields, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "source_fields"); + op.add(Builder::stopWords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "stop_words"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.indexName); + result = 31 * result + Objects.hashCode(this.inputGuardrail); + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.outputGuardrail); + result = 31 * result + Objects.hashCode(this.regex); + result = 31 * result + Objects.hashCode(this.responseFilter); + result = 31 * result + Objects.hashCode(this.responseValidationRegex); + result = 31 * result + Objects.hashCode(this.sourceFields); + result = 31 * result + Objects.hashCode(this.stopWords); + result = 31 * result + Objects.hashCode(this.type); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Guardrails other = (Guardrails) o; + return Objects.equals(this.indexName, other.indexName) + && Objects.equals(this.inputGuardrail, other.inputGuardrail) + && Objects.equals(this.modelId, other.modelId) + && Objects.equals(this.outputGuardrail, other.outputGuardrail) + && Objects.equals(this.regex, other.regex) + && Objects.equals(this.responseFilter, other.responseFilter) + && Objects.equals(this.responseValidationRegex, other.responseValidationRegex) + && Objects.equals(this.sourceFields, other.sourceFields) + && Objects.equals(this.stopWords, other.stopWords) + && Objects.equals(this.type, other.type); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GuardrailsInputOutput.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GuardrailsInputOutput.java new file mode 100644 index 0000000000..5ffee1f9e8 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/GuardrailsInputOutput.java @@ -0,0 +1,210 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.GuardrailsInputOutput + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GuardrailsInputOutput + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String modelId; + + @Nullable + private final String responseValidationRegex; + + // --------------------------------------------------------------------------------------------- + + private GuardrailsInputOutput(Builder builder) { + this.modelId = builder.modelId; + this.responseValidationRegex = builder.responseValidationRegex; + } + + public static GuardrailsInputOutput of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model ID. + *

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

+ */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * The response validation regex. + *

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

+ */ + @Nullable + public final String responseValidationRegex() { + return this.responseValidationRegex; + } + + /** + * 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.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + if (this.responseValidationRegex != null) { + generator.writeKey("response_validation_regex"); + generator.write(this.responseValidationRegex); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link GuardrailsInputOutput}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String modelId; + @Nullable + private String responseValidationRegex; + + public Builder() {} + + private Builder(GuardrailsInputOutput o) { + this.modelId = o.modelId; + this.responseValidationRegex = o.responseValidationRegex; + } + + private Builder(Builder o) { + this.modelId = o.modelId; + this.responseValidationRegex = o.responseValidationRegex; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The model ID. + *

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

+ */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * The response validation regex. + *

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

+ */ + @Nonnull + public final Builder responseValidationRegex(@Nullable String value) { + this.responseValidationRegex = value; + return this; + } + + /** + * Builds a {@link GuardrailsInputOutput}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public GuardrailsInputOutput build() { + _checkSingleUse(); + + return new GuardrailsInputOutput(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GuardrailsInputOutput} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GuardrailsInputOutput::setupGuardrailsInputOutputDeserializer + ); + + protected static void setupGuardrailsInputOutputDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::responseValidationRegex, JsonpDeserializer.stringDeserializer(), "response_validation_regex"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.responseValidationRegex); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GuardrailsInputOutput other = (GuardrailsInputOutput) o; + return Objects.equals(this.modelId, other.modelId) && Objects.equals(this.responseValidationRegex, other.responseValidationRegex); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelRequest.java new file mode 100644 index 0000000000..698f4d023a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelRequest.java @@ -0,0 +1,166 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.load_model.Request + +/** + * Deploys a model. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class LoadModelRequest extends RequestBase implements ToCopyableBuilder { + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private LoadModelRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static LoadModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link LoadModelRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + + public Builder() {} + + private Builder(LoadModelRequest o) { + super(o); + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link LoadModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public LoadModelRequest build() { + _checkSingleUse(); + + return new LoadModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.load_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_load"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + false, + LoadModelResponse._DESERIALIZER + ); + + @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; + LoadModelRequest other = (LoadModelRequest) o; + return this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelResponse.java new file mode 100644 index 0000000000..50603d6389 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/LoadModelResponse.java @@ -0,0 +1,217 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.load_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class LoadModelResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String status; + + @Nonnull + private final String taskId; + + @Nonnull + private final String taskType; + + // --------------------------------------------------------------------------------------------- + + private LoadModelResponse(Builder builder) { + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + } + + public static LoadModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final String status() { + return this.status; + } + + /** + * Required - API name: {@code task_id} + */ + @Nonnull + public final String taskId() { + return this.taskId; + } + + /** + * Required - API name: {@code task_type} + */ + @Nonnull + public final String taskType() { + return this.taskType; + } + + /** + * 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("status"); + generator.write(this.status); + + generator.writeKey("task_id"); + generator.write(this.taskId); + + generator.writeKey("task_type"); + generator.write(this.taskType); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link LoadModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String status; + private String taskId; + private String taskType; + + public Builder() {} + + private Builder(LoadModelResponse o) { + this.status = o.status; + this.taskId = o.taskId; + this.taskType = o.taskType; + } + + private Builder(Builder o) { + this.status = o.status; + this.taskId = o.taskId; + this.taskType = o.taskType; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code task_id} + */ + @Nonnull + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * Required - API name: {@code task_type} + */ + @Nonnull + public final Builder taskType(String value) { + this.taskType = value; + return this; + } + + /** + * Builds a {@link LoadModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public LoadModelResponse build() { + _checkSingleUse(); + + return new LoadModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link LoadModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + LoadModelResponse::setupLoadModelResponseDeserializer + ); + + protected static void setupLoadModelResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + op.add(Builder::taskType, JsonpDeserializer.stringDeserializer(), "task_type"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.status.hashCode(); + result = 31 * result + this.taskId.hashCode(); + result = 31 * result + this.taskType.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + LoadModelResponse other = (LoadModelResponse) o; + return this.status.equals(other.status) && this.taskId.equals(other.taskId) && this.taskType.equals(other.taskType); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java index 84491e00e0..00ec14ceb3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Memory.java @@ -13,17 +13,20 @@ package org.opensearch.client.opensearch.ml; 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.JsonData; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -35,19 +38,78 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class Memory implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String createTime; + + @Nullable + private final String memoryId; + + @Nullable + private final String name; + @Nullable private final String type; + @Nullable + private final String updatedTime; + + @Nullable + private final String user; + // --------------------------------------------------------------------------------------------- private Memory(Builder builder) { + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.createTime = builder.createTime; + this.memoryId = builder.memoryId; + this.name = builder.name; this.type = builder.type; + this.updatedTime = builder.updatedTime; + this.user = builder.user; } public static Memory of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The create time. + *

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

+ */ + @Nullable + public final String createTime() { + return this.createTime; + } + + /** + * API name: {@code memory_id} + */ + @Nullable + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + /** * API name: {@code type} */ @@ -56,6 +118,28 @@ public final String type() { return this.type; } + /** + * The updated time. + *

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

+ */ + @Nullable + public final String updatedTime() { + return this.updatedTime; + } + + /** + * The username of the user. + *

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

+ */ + @Nullable + public final String user() { + return this.user; + } + /** * Serialize this object to JSON. */ @@ -67,10 +151,45 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.memoryId != null) { + generator.writeKey("memory_id"); + generator.write(this.memoryId); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + if (this.type != null) { generator.writeKey("type"); generator.write(this.type); } + + if (this.updatedTime != null) { + generator.writeKey("updated_time"); + generator.write(this.updatedTime); + } + + if (this.user != null) { + generator.writeKey("user"); + generator.write(this.user); + } } // --------------------------------------------------------------------------------------------- @@ -90,17 +209,41 @@ public static Builder builder() { * Builder for {@link Memory}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String createTime; + @Nullable + private String memoryId; + @Nullable + private String name; @Nullable private String type; + @Nullable + private String updatedTime; + @Nullable + private String user; public Builder() {} private Builder(Memory o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.memoryId = o.memoryId; + this.name = o.name; this.type = o.type; + this.updatedTime = o.updatedTime; + this.user = o.user; } private Builder(Builder o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.memoryId = o.memoryId; + this.name = o.name; this.type = o.type; + this.updatedTime = o.updatedTime; + this.user = o.user; } @Override @@ -109,6 +252,62 @@ public Builder copy() { return new Builder(this); } + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The create time. + *

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

+ */ + @Nonnull + public final Builder createTime(@Nullable String value) { + this.createTime = value; + return this; + } + + /** + * API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(@Nullable String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code name} + */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + /** * API name: {@code type} */ @@ -118,6 +317,30 @@ public final Builder type(@Nullable String value) { return this; } + /** + * The updated time. + *

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

+ */ + @Nonnull + public final Builder updatedTime(@Nullable String value) { + this.updatedTime = value; + return this; + } + + /** + * The username of the user. + *

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

+ */ + @Nonnull + public final Builder user(@Nullable String value) { + this.user = value; + return this; + } + /** * Builds a {@link Memory}. * @@ -143,13 +366,25 @@ public Memory build() { ); protected static void setupMemoryDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::createTime, JsonpDeserializer.stringDeserializer(), "create_time"); + op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::updatedTime, JsonpDeserializer.stringDeserializer(), "updated_time"); + op.add(Builder::user, JsonpDeserializer.stringDeserializer(), "user"); } @Override public int hashCode() { int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.createTime); + result = 31 * result + Objects.hashCode(this.memoryId); + result = 31 * result + Objects.hashCode(this.name); result = 31 * result + Objects.hashCode(this.type); + result = 31 * result + Objects.hashCode(this.updatedTime); + result = 31 * result + Objects.hashCode(this.user); return result; } @@ -158,6 +393,12 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; Memory other = (Memory) o; - return Objects.equals(this.type, other.type); + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.createTime, other.createTime) + && Objects.equals(this.memoryId, other.memoryId) + && Objects.equals(this.name, other.name) + && Objects.equals(this.type, other.type) + && Objects.equals(this.updatedTime, other.updatedTime) + && Objects.equals(this.user, other.user); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Message.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Message.java new file mode 100644 index 0000000000..8f9597f8e6 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Message.java @@ -0,0 +1,527 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.Message + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Message implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String createTime; + + @Nullable + private final String input; + + @Nullable + private final String memoryId; + + @Nullable + private final String messageId; + + @Nullable + private final String origin; + + @Nullable + private final String parentMessageId; + + @Nullable + private final String promptTemplate; + + @Nullable + private final String response; + + @Nullable + private final Long traceNumber; + + // --------------------------------------------------------------------------------------------- + + private Message(Builder builder) { + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.createTime = builder.createTime; + this.input = builder.input; + this.memoryId = builder.memoryId; + this.messageId = builder.messageId; + this.origin = builder.origin; + this.parentMessageId = builder.parentMessageId; + this.promptTemplate = builder.promptTemplate; + this.response = builder.response; + this.traceNumber = builder.traceNumber; + } + + public static Message of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The create time. + *

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

+ */ + @Nullable + public final String createTime() { + return this.createTime; + } + + /** + * The question in the message. + *

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

+ */ + @Nullable + public final String input() { + return this.input; + } + + /** + * API name: {@code memory_id} + */ + @Nullable + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code message_id} + */ + @Nullable + public final String messageId() { + return this.messageId; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nullable + public final String origin() { + return this.origin; + } + + /** + * The parent message ID. + *

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

+ */ + @Nullable + public final String parentMessageId() { + return this.parentMessageId; + } + + /** + * The prompt template. + *

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

+ */ + @Nullable + public final String promptTemplate() { + return this.promptTemplate; + } + + /** + * The answer to the question. + *

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

+ */ + @Nullable + public final String response() { + return this.response; + } + + /** + * The trace number. + *

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

+ */ + @Nullable + public final Long traceNumber() { + return this.traceNumber; + } + + /** + * 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.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.input != null) { + generator.writeKey("input"); + generator.write(this.input); + } + + if (this.memoryId != null) { + generator.writeKey("memory_id"); + generator.write(this.memoryId); + } + + if (this.messageId != null) { + generator.writeKey("message_id"); + generator.write(this.messageId); + } + + if (this.origin != null) { + generator.writeKey("origin"); + generator.write(this.origin); + } + + if (this.parentMessageId != null) { + generator.writeKey("parent_message_id"); + generator.write(this.parentMessageId); + } + + if (this.promptTemplate != null) { + generator.writeKey("prompt_template"); + generator.write(this.promptTemplate); + } + + if (this.response != null) { + generator.writeKey("response"); + generator.write(this.response); + } + + if (this.traceNumber != null) { + generator.writeKey("trace_number"); + generator.write(this.traceNumber); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Message}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String createTime; + @Nullable + private String input; + @Nullable + private String memoryId; + @Nullable + private String messageId; + @Nullable + private String origin; + @Nullable + private String parentMessageId; + @Nullable + private String promptTemplate; + @Nullable + private String response; + @Nullable + private Long traceNumber; + + public Builder() {} + + private Builder(Message o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.input = o.input; + this.memoryId = o.memoryId; + this.messageId = o.messageId; + this.origin = o.origin; + this.parentMessageId = o.parentMessageId; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + this.traceNumber = o.traceNumber; + } + + private Builder(Builder o) { + this.additionalInfo = _mapCopy(o.additionalInfo); + this.createTime = o.createTime; + this.input = o.input; + this.memoryId = o.memoryId; + this.messageId = o.messageId; + this.origin = o.origin; + this.parentMessageId = o.parentMessageId; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + this.traceNumber = o.traceNumber; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The create time. + *

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

+ */ + @Nonnull + public final Builder createTime(@Nullable String value) { + this.createTime = value; + return this; + } + + /** + * The question in the message. + *

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

+ */ + @Nonnull + public final Builder input(@Nullable String value) { + this.input = value; + return this; + } + + /** + * API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(@Nullable String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(@Nullable String value) { + this.messageId = value; + return this; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nonnull + public final Builder origin(@Nullable String value) { + this.origin = value; + return this; + } + + /** + * The parent message ID. + *

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

+ */ + @Nonnull + public final Builder parentMessageId(@Nullable String value) { + this.parentMessageId = value; + return this; + } + + /** + * The prompt template. + *

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

+ */ + @Nonnull + public final Builder promptTemplate(@Nullable String value) { + this.promptTemplate = value; + return this; + } + + /** + * The answer to the question. + *

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

+ */ + @Nonnull + public final Builder response(@Nullable String value) { + this.response = value; + return this; + } + + /** + * The trace number. + *

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

+ */ + @Nonnull + public final Builder traceNumber(@Nullable Long value) { + this.traceNumber = value; + return this; + } + + /** + * Builds a {@link Message}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Message build() { + _checkSingleUse(); + + return new Message(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Message} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Message::setupMessageDeserializer + ); + + protected static void setupMessageDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::createTime, JsonpDeserializer.stringDeserializer(), "create_time"); + op.add(Builder::input, JsonpDeserializer.stringDeserializer(), "input"); + op.add(Builder::memoryId, JsonpDeserializer.stringDeserializer(), "memory_id"); + op.add(Builder::messageId, JsonpDeserializer.stringDeserializer(), "message_id"); + op.add(Builder::origin, JsonpDeserializer.stringDeserializer(), "origin"); + op.add(Builder::parentMessageId, JsonpDeserializer.stringDeserializer(), "parent_message_id"); + op.add(Builder::promptTemplate, JsonpDeserializer.stringDeserializer(), "prompt_template"); + op.add(Builder::response, JsonpDeserializer.stringDeserializer(), "response"); + op.add(Builder::traceNumber, JsonpDeserializer.longDeserializer(), "trace_number"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.createTime); + result = 31 * result + Objects.hashCode(this.input); + result = 31 * result + Objects.hashCode(this.memoryId); + result = 31 * result + Objects.hashCode(this.messageId); + result = 31 * result + Objects.hashCode(this.origin); + result = 31 * result + Objects.hashCode(this.parentMessageId); + result = 31 * result + Objects.hashCode(this.promptTemplate); + result = 31 * result + Objects.hashCode(this.response); + result = 31 * result + Objects.hashCode(this.traceNumber); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Message other = (Message) o; + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.createTime, other.createTime) + && Objects.equals(this.input, other.input) + && Objects.equals(this.memoryId, other.memoryId) + && Objects.equals(this.messageId, other.messageId) + && Objects.equals(this.origin, other.origin) + && Objects.equals(this.parentMessageId, other.parentMessageId) + && Objects.equals(this.promptTemplate, other.promptTemplate) + && Objects.equals(this.response, other.response) + && Objects.equals(this.traceNumber, other.traceNumber); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelConfig.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelConfig.java new file mode 100644 index 0000000000..baa1dd8755 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelConfig.java @@ -0,0 +1,286 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.ModelConfig + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ModelConfig implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String allConfig; + + @Nullable + private final Long embeddingDimension; + + @Nullable + private final String frameworkType; + + @Nullable + private final String modelType; + + // --------------------------------------------------------------------------------------------- + + private ModelConfig(Builder builder) { + this.allConfig = builder.allConfig; + this.embeddingDimension = builder.embeddingDimension; + this.frameworkType = builder.frameworkType; + this.modelType = builder.modelType; + } + + public static ModelConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The all config. + *

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

+ */ + @Nullable + public final String allConfig() { + return this.allConfig; + } + + /** + * The embedding dimension. + *

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

+ */ + @Nullable + public final Long embeddingDimension() { + return this.embeddingDimension; + } + + /** + * The framework type. + *

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

+ */ + @Nullable + public final String frameworkType() { + return this.frameworkType; + } + + /** + * The model type. + *

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

+ */ + @Nullable + public final String modelType() { + return this.modelType; + } + + /** + * 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.allConfig != null) { + generator.writeKey("all_config"); + generator.write(this.allConfig); + } + + if (this.embeddingDimension != null) { + generator.writeKey("embedding_dimension"); + generator.write(this.embeddingDimension); + } + + if (this.frameworkType != null) { + generator.writeKey("framework_type"); + generator.write(this.frameworkType); + } + + if (this.modelType != null) { + generator.writeKey("model_type"); + generator.write(this.modelType); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ModelConfig}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String allConfig; + @Nullable + private Long embeddingDimension; + @Nullable + private String frameworkType; + @Nullable + private String modelType; + + public Builder() {} + + private Builder(ModelConfig o) { + this.allConfig = o.allConfig; + this.embeddingDimension = o.embeddingDimension; + this.frameworkType = o.frameworkType; + this.modelType = o.modelType; + } + + private Builder(Builder o) { + this.allConfig = o.allConfig; + this.embeddingDimension = o.embeddingDimension; + this.frameworkType = o.frameworkType; + this.modelType = o.modelType; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The all config. + *

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

+ */ + @Nonnull + public final Builder allConfig(@Nullable String value) { + this.allConfig = value; + return this; + } + + /** + * The embedding dimension. + *

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

+ */ + @Nonnull + public final Builder embeddingDimension(@Nullable Long value) { + this.embeddingDimension = value; + return this; + } + + /** + * The framework type. + *

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

+ */ + @Nonnull + public final Builder frameworkType(@Nullable String value) { + this.frameworkType = value; + return this; + } + + /** + * The model type. + *

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

+ */ + @Nonnull + public final Builder modelType(@Nullable String value) { + this.modelType = value; + return this; + } + + /** + * Builds a {@link ModelConfig}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ModelConfig build() { + _checkSingleUse(); + + return new ModelConfig(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ModelConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ModelConfig::setupModelConfigDeserializer + ); + + protected static void setupModelConfigDeserializer(ObjectDeserializer op) { + op.add(Builder::allConfig, JsonpDeserializer.stringDeserializer(), "all_config"); + op.add(Builder::embeddingDimension, JsonpDeserializer.longDeserializer(), "embedding_dimension"); + op.add(Builder::frameworkType, JsonpDeserializer.stringDeserializer(), "framework_type"); + op.add(Builder::modelType, JsonpDeserializer.stringDeserializer(), "model_type"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allConfig); + result = 31 * result + Objects.hashCode(this.embeddingDimension); + result = 31 * result + Objects.hashCode(this.frameworkType); + result = 31 * result + Objects.hashCode(this.modelType); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ModelConfig other = (ModelConfig) o; + return Objects.equals(this.allConfig, other.allConfig) + && Objects.equals(this.embeddingDimension, other.embeddingDimension) + && Objects.equals(this.frameworkType, other.frameworkType) + && Objects.equals(this.modelType, other.modelType); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelFormat.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelFormat.java new file mode 100644 index 0000000000..ace85f764e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelFormat.java @@ -0,0 +1,39 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: ml.ModelFormat + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ModelFormat implements JsonEnum { + Onnx("ONNX"), + + TorchScript("TORCH_SCRIPT"); + + private final String jsonValue; + + ModelFormat(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ModelFormat.values()); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java new file mode 100644 index 0000000000..737bd47fe5 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/ModelProfile.java @@ -0,0 +1,453 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.ModelProfile + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ModelProfile implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long memorySizeEstimationCpu; + + @Nullable + private final Long memorySizeEstimationGpu; + + @Nullable + private final String modelState; + + @Nullable + private final PredictRequestStats predictRequestStats; + + @Nullable + private final String predictor; + + @Nonnull + private final List> targetWorkerNodes; + + @Nonnull + private final List> workerNodes; + + // --------------------------------------------------------------------------------------------- + + private ModelProfile(Builder builder) { + this.memorySizeEstimationCpu = builder.memorySizeEstimationCpu; + this.memorySizeEstimationGpu = builder.memorySizeEstimationGpu; + this.modelState = builder.modelState; + this.predictRequestStats = builder.predictRequestStats; + this.predictor = builder.predictor; + this.targetWorkerNodes = ApiTypeHelper.unmodifiable(builder.targetWorkerNodes); + this.workerNodes = ApiTypeHelper.unmodifiable(builder.workerNodes); + } + + public static ModelProfile of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The estimated memory size in CPU. + *

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

+ */ + @Nullable + public final Long memorySizeEstimationCpu() { + return this.memorySizeEstimationCpu; + } + + /** + * The estimated memory size in GPU. + *

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

+ */ + @Nullable + public final Long memorySizeEstimationGpu() { + return this.memorySizeEstimationGpu; + } + + /** + * The model state. + *

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

+ */ + @Nullable + public final String modelState() { + return this.modelState; + } + + /** + * API name: {@code predict_request_stats} + */ + @Nullable + public final PredictRequestStats predictRequestStats() { + return this.predictRequestStats; + } + + /** + * The predictor. + *

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

+ */ + @Nullable + public final String predictor() { + return this.predictor; + } + + /** + * API name: {@code target_worker_nodes} + */ + @Nonnull + public final List> targetWorkerNodes() { + return this.targetWorkerNodes; + } + + /** + * API name: {@code worker_nodes} + */ + @Nonnull + public final List> workerNodes() { + return this.workerNodes; + } + + /** + * 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.memorySizeEstimationCpu != null) { + generator.writeKey("memory_size_estimation_cpu"); + generator.write(this.memorySizeEstimationCpu); + } + + if (this.memorySizeEstimationGpu != null) { + generator.writeKey("memory_size_estimation_gpu"); + generator.write(this.memorySizeEstimationGpu); + } + + if (this.modelState != null) { + generator.writeKey("model_state"); + generator.write(this.modelState); + } + + if (this.predictRequestStats != null) { + generator.writeKey("predict_request_stats"); + this.predictRequestStats.serialize(generator, mapper); + } + + if (this.predictor != null) { + generator.writeKey("predictor"); + generator.write(this.predictor); + } + + if (ApiTypeHelper.isDefined(this.targetWorkerNodes)) { + generator.writeKey("target_worker_nodes"); + generator.writeStartArray(); + for (List item0 : this.targetWorkerNodes) { + generator.writeStartArray(); + for (String item1 : item0) { + generator.write(item1); + } + generator.writeEnd(); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.workerNodes)) { + generator.writeKey("worker_nodes"); + generator.writeStartArray(); + for (List item0 : this.workerNodes) { + generator.writeStartArray(); + for (String item1 : item0) { + generator.write(item1); + } + generator.writeEnd(); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ModelProfile}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long memorySizeEstimationCpu; + @Nullable + private Long memorySizeEstimationGpu; + @Nullable + private String modelState; + @Nullable + private PredictRequestStats predictRequestStats; + @Nullable + private String predictor; + @Nullable + private List> targetWorkerNodes; + @Nullable + private List> workerNodes; + + public Builder() {} + + private Builder(ModelProfile o) { + this.memorySizeEstimationCpu = o.memorySizeEstimationCpu; + this.memorySizeEstimationGpu = o.memorySizeEstimationGpu; + this.modelState = o.modelState; + this.predictRequestStats = o.predictRequestStats; + this.predictor = o.predictor; + this.targetWorkerNodes = _listCopy(o.targetWorkerNodes); + this.workerNodes = _listCopy(o.workerNodes); + } + + private Builder(Builder o) { + this.memorySizeEstimationCpu = o.memorySizeEstimationCpu; + this.memorySizeEstimationGpu = o.memorySizeEstimationGpu; + this.modelState = o.modelState; + this.predictRequestStats = o.predictRequestStats; + this.predictor = o.predictor; + this.targetWorkerNodes = _listCopy(o.targetWorkerNodes); + this.workerNodes = _listCopy(o.workerNodes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The estimated memory size in CPU. + *

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

+ */ + @Nonnull + public final Builder memorySizeEstimationCpu(@Nullable Long value) { + this.memorySizeEstimationCpu = value; + return this; + } + + /** + * The estimated memory size in GPU. + *

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

+ */ + @Nonnull + public final Builder memorySizeEstimationGpu(@Nullable Long value) { + this.memorySizeEstimationGpu = value; + return this; + } + + /** + * The model state. + *

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

+ */ + @Nonnull + public final Builder modelState(@Nullable String value) { + this.modelState = value; + return this; + } + + /** + * API name: {@code predict_request_stats} + */ + @Nonnull + public final Builder predictRequestStats(@Nullable PredictRequestStats value) { + this.predictRequestStats = value; + return this; + } + + /** + * API name: {@code predict_request_stats} + */ + @Nonnull + public final Builder predictRequestStats(Function> fn) { + return predictRequestStats(fn.apply(new PredictRequestStats.Builder()).build()); + } + + /** + * The predictor. + *

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

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

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder workerNodes(List value, List... values) { + this.workerNodes = _listAdd(this.workerNodes, value, values); + return this; + } + + /** + * Builds a {@link ModelProfile}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ModelProfile build() { + _checkSingleUse(); + + return new ModelProfile(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ModelProfile} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ModelProfile::setupModelProfileDeserializer + ); + + protected static void setupModelProfileDeserializer(ObjectDeserializer op) { + op.add(Builder::memorySizeEstimationCpu, JsonpDeserializer.longDeserializer(), "memory_size_estimation_cpu"); + op.add(Builder::memorySizeEstimationGpu, JsonpDeserializer.longDeserializer(), "memory_size_estimation_gpu"); + op.add(Builder::modelState, JsonpDeserializer.stringDeserializer(), "model_state"); + op.add(Builder::predictRequestStats, PredictRequestStats._DESERIALIZER, "predict_request_stats"); + op.add(Builder::predictor, JsonpDeserializer.stringDeserializer(), "predictor"); + op.add( + Builder::targetWorkerNodes, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), + "target_worker_nodes" + ); + op.add( + Builder::workerNodes, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), + "worker_nodes" + ); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.memorySizeEstimationCpu); + result = 31 * result + Objects.hashCode(this.memorySizeEstimationGpu); + result = 31 * result + Objects.hashCode(this.modelState); + result = 31 * result + Objects.hashCode(this.predictRequestStats); + result = 31 * result + Objects.hashCode(this.predictor); + result = 31 * result + Objects.hashCode(this.targetWorkerNodes); + result = 31 * result + Objects.hashCode(this.workerNodes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ModelProfile other = (ModelProfile) o; + return Objects.equals(this.memorySizeEstimationCpu, other.memorySizeEstimationCpu) + && Objects.equals(this.memorySizeEstimationGpu, other.memorySizeEstimationGpu) + && Objects.equals(this.modelState, other.modelState) + && Objects.equals(this.predictRequestStats, other.predictRequestStats) + && Objects.equals(this.predictor, other.predictor) + && Objects.equals(this.targetWorkerNodes, other.targetWorkerNodes) + && Objects.equals(this.workerNodes, other.workerNodes); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Node.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Node.java new file mode 100644 index 0000000000..e132b2e472 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Node.java @@ -0,0 +1,262 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.Node + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Node implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map models; + + @Nonnull + private final Map tasks; + + // --------------------------------------------------------------------------------------------- + + private Node(Builder builder) { + this.models = ApiTypeHelper.unmodifiable(builder.models); + this.tasks = ApiTypeHelper.unmodifiable(builder.tasks); + } + + public static Node of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code models} + */ + @Nonnull + public final Map models() { + return this.models; + } + + /** + * API name: {@code tasks} + */ + @Nonnull + public final Map tasks() { + return this.tasks; + } + + /** + * 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.models)) { + generator.writeKey("models"); + generator.writeStartObject(); + for (Map.Entry item0 : this.models.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.tasks)) { + generator.writeKey("tasks"); + generator.writeStartObject(); + for (Map.Entry item0 : this.tasks.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Node}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map models; + @Nullable + private Map tasks; + + public Builder() {} + + private Builder(Node o) { + this.models = _mapCopy(o.models); + this.tasks = _mapCopy(o.tasks); + } + + private Builder(Builder o) { + this.models = _mapCopy(o.models); + this.tasks = _mapCopy(o.tasks); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code models} + * + *

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

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

+ * Adds an entry to models. + *

+ */ + @Nonnull + public final Builder models(String key, ModelProfile value) { + this.models = _mapPut(this.models, key, value); + return this; + } + + /** + * API name: {@code models} + * + *

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

+ */ + @Nonnull + public final Builder models(String key, Function> fn) { + return models(key, fn.apply(new ModelProfile.Builder()).build()); + } + + /** + * API name: {@code tasks} + * + *

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

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

+ * Adds an entry to tasks. + *

+ */ + @Nonnull + public final Builder tasks(String key, Task value) { + this.tasks = _mapPut(this.tasks, key, value); + return this; + } + + /** + * API name: {@code tasks} + * + *

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

+ */ + @Nonnull + public final Builder tasks(String key, Function> fn) { + return tasks(key, fn.apply(new Task.Builder()).build()); + } + + /** + * Builds a {@link Node}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Node build() { + _checkSingleUse(); + + return new Node(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Node} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Node::setupNodeDeserializer); + + protected static void setupNodeDeserializer(ObjectDeserializer op) { + op.add(Builder::models, JsonpDeserializer.stringMapDeserializer(ModelProfile._DESERIALIZER), "models"); + op.add(Builder::tasks, JsonpDeserializer.stringMapDeserializer(Task._DESERIALIZER), "tasks"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.models); + result = 31 * result + Objects.hashCode(this.tasks); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Node other = (Node) o; + return Objects.equals(this.models, other.models) && Objects.equals(this.tasks, other.tasks); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java index 4f5332eb7f..279546ef45 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlAsyncClient.java @@ -62,6 +62,97 @@ public final CompletableFuture createConnector( return createConnector(fn.apply(new CreateConnectorRequest.Builder()).build()); } + // ----- Endpoint: ml.create_controller + + /** + * Creates a controller. + */ + public CompletableFuture createController(CreateControllerRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CreateControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a controller. + * + * @param fn a function that initializes a builder to create the {@link CreateControllerRequest} + */ + public final CompletableFuture createController( + Function> fn + ) throws IOException, OpenSearchException { + return createController(fn.apply(new CreateControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.create_memory + + /** + * Create a memory. + */ + public CompletableFuture createMemory(CreateMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CreateMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Create a memory. + * + * @param fn a function that initializes a builder to create the {@link CreateMemoryRequest} + */ + public final CompletableFuture createMemory( + Function> fn + ) throws IOException, OpenSearchException { + return createMemory(fn.apply(new CreateMemoryRequest.Builder()).build()); + } + + /** + * Create a memory. + */ + public final CompletableFuture createMemory() throws IOException, OpenSearchException { + return createMemory(new CreateMemoryRequest.Builder().build()); + } + + // ----- Endpoint: ml.create_message + + /** + * Create a message. + */ + public CompletableFuture createMessage(CreateMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CreateMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Create a message. + * + * @param fn a function that initializes a builder to create the {@link CreateMessageRequest} + */ + public final CompletableFuture createMessage( + Function> fn + ) throws IOException, OpenSearchException { + return createMessage(fn.apply(new CreateMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.create_model_meta + + /** + * Registers model metadata. + */ + @Deprecated + public CompletableFuture createModelMeta(CreateModelMetaRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CreateModelMetaRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers model metadata. + * + * @param fn a function that initializes a builder to create the {@link CreateModelMetaRequest} + */ + @Deprecated + public final CompletableFuture createModelMeta( + Function> fn + ) throws IOException, OpenSearchException { + return createModelMeta(fn.apply(new CreateModelMetaRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_agent /** @@ -103,6 +194,47 @@ public final CompletableFuture deleteConnector( return deleteConnector(fn.apply(new DeleteConnectorRequest.Builder()).build()); } + // ----- Endpoint: ml.delete_controller + + /** + * Deletes a controller. + */ + public CompletableFuture deleteController(DeleteControllerRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DeleteControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a controller. + * + * @param fn a function that initializes a builder to create the {@link DeleteControllerRequest} + */ + public final CompletableFuture deleteController( + Function> fn + ) throws IOException, OpenSearchException { + return deleteController(fn.apply(new DeleteControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_memory + + /** + * Delete a memory. + */ + public CompletableFuture deleteMemory(DeleteMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Delete a memory. + * + * @param fn a function that initializes a builder to create the {@link DeleteMemoryRequest} + */ + public final CompletableFuture deleteMemory( + Function> fn + ) throws IOException, OpenSearchException { + return deleteMemory(fn.apply(new DeleteMemoryRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_model /** @@ -183,6 +315,171 @@ public final CompletableFuture deployModel( return deployModel(fn.apply(new DeployModelRequest.Builder()).build()); } + // ----- Endpoint: ml.get_all_memories + + /** + * Get all memories. + */ + public CompletableFuture getAllMemories(GetAllMemoriesRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetAllMemoriesRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get all memories. + * + * @param fn a function that initializes a builder to create the {@link GetAllMemoriesRequest} + */ + public final CompletableFuture getAllMemories( + Function> fn + ) throws IOException, OpenSearchException { + return getAllMemories(fn.apply(new GetAllMemoriesRequest.Builder()).build()); + } + + /** + * Get all memories. + */ + public final CompletableFuture getAllMemories() throws IOException, OpenSearchException { + return getAllMemories(new GetAllMemoriesRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_all_messages + + /** + * Get all messages in a memory. + */ + public CompletableFuture getAllMessages(GetAllMessagesRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetAllMessagesRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get all messages in a memory. + * + * @param fn a function that initializes a builder to create the {@link GetAllMessagesRequest} + */ + public final CompletableFuture getAllMessages( + Function> fn + ) throws IOException, OpenSearchException { + return getAllMessages(fn.apply(new GetAllMessagesRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_connector + + /** + * Retrieves a standalone connector. + */ + public CompletableFuture getConnector(GetConnectorRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link GetConnectorRequest} + */ + public final CompletableFuture getConnector( + Function> fn + ) throws IOException, OpenSearchException { + return getConnector(fn.apply(new GetConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_controller + + /** + * Retrieves a controller. + */ + public CompletableFuture getController(GetControllerRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a controller. + * + * @param fn a function that initializes a builder to create the {@link GetControllerRequest} + */ + public final CompletableFuture getController( + Function> fn + ) throws IOException, OpenSearchException { + return getController(fn.apply(new GetControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_memory + + /** + * Get a memory. + */ + public CompletableFuture getMemory(GetMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a memory. + * + * @param fn a function that initializes a builder to create the {@link GetMemoryRequest} + */ + public final CompletableFuture getMemory(Function> fn) + throws IOException, OpenSearchException { + return getMemory(fn.apply(new GetMemoryRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_message + + /** + * Get a message. + */ + public CompletableFuture getMessage(GetMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a message. + * + * @param fn a function that initializes a builder to create the {@link GetMessageRequest} + */ + public final CompletableFuture getMessage(Function> fn) + throws IOException, OpenSearchException { + return getMessage(fn.apply(new GetMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_message_traces + + /** + * Get a message traces. + */ + public CompletableFuture getMessageTraces(GetMessageTracesRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, GetMessageTracesRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a message traces. + * + * @param fn a function that initializes a builder to create the {@link GetMessageTracesRequest} + */ + public final CompletableFuture getMessageTraces( + Function> fn + ) throws IOException, OpenSearchException { + return getMessageTraces(fn.apply(new GetMessageTracesRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_model + + /** + * Retrieves a model. + */ + public CompletableFuture getModel(GetModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a model. + * + * @param fn a function that initializes a builder to create the {@link GetModelRequest} + */ + public final CompletableFuture getModel(Function> fn) + throws IOException, OpenSearchException { + return getModel(fn.apply(new GetModelRequest.Builder()).build()); + } + // ----- Endpoint: ml.get_model_group /** @@ -203,6 +500,88 @@ public final CompletableFuture getModelGroup( return getModelGroup(fn.apply(new GetModelGroupRequest.Builder()).build()); } + // ----- Endpoint: ml.get_profile + + /** + * Get a profile. + */ + public CompletableFuture getProfile(GetProfileRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetProfileRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a profile. + * + * @param fn a function that initializes a builder to create the {@link GetProfileRequest} + */ + public final CompletableFuture getProfile(Function> fn) + throws IOException, OpenSearchException { + return getProfile(fn.apply(new GetProfileRequest.Builder()).build()); + } + + /** + * Get a profile. + */ + public final CompletableFuture getProfile() throws IOException, OpenSearchException { + return getProfile(new GetProfileRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_profile_models + + /** + * Get a profile models. + */ + public CompletableFuture getProfileModels(GetProfileModelsRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, GetProfileModelsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a profile models. + * + * @param fn a function that initializes a builder to create the {@link GetProfileModelsRequest} + */ + public final CompletableFuture getProfileModels( + Function> fn + ) throws IOException, OpenSearchException { + return getProfileModels(fn.apply(new GetProfileModelsRequest.Builder()).build()); + } + + /** + * Get a profile models. + */ + public final CompletableFuture getProfileModels() throws IOException, OpenSearchException { + return getProfileModels(new GetProfileModelsRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_profile_tasks + + /** + * Get a profile tasks. + */ + public CompletableFuture getProfileTasks(GetProfileTasksRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, GetProfileTasksRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a profile tasks. + * + * @param fn a function that initializes a builder to create the {@link GetProfileTasksRequest} + */ + public final CompletableFuture getProfileTasks( + Function> fn + ) throws IOException, OpenSearchException { + return getProfileTasks(fn.apply(new GetProfileTasksRequest.Builder()).build()); + } + + /** + * Get a profile tasks. + */ + public final CompletableFuture getProfileTasks() throws IOException, OpenSearchException { + return getProfileTasks(new GetProfileTasksRequest.Builder().build()); + } + // ----- Endpoint: ml.get_task /** @@ -222,6 +601,27 @@ public final CompletableFuture getTask(Function loadModel(LoadModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, LoadModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deploys a model. + * + * @param fn a function that initializes a builder to create the {@link LoadModelRequest} + */ + @Deprecated + public final CompletableFuture loadModel(Function> fn) + throws IOException, OpenSearchException { + return loadModel(fn.apply(new LoadModelRequest.Builder()).build()); + } + // ----- Endpoint: ml.register_agents /** @@ -283,6 +683,27 @@ public final CompletableFuture registerModelGroup( return registerModelGroup(fn.apply(new RegisterModelGroupRequest.Builder()).build()); } + // ----- Endpoint: ml.register_model_meta + + /** + * Registers model metadata. + */ + public CompletableFuture registerModelMeta(RegisterModelMetaRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, RegisterModelMetaRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers model metadata. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelMetaRequest} + */ + public final CompletableFuture registerModelMeta( + Function> fn + ) throws IOException, OpenSearchException { + return registerModelMeta(fn.apply(new RegisterModelMetaRequest.Builder()).build()); + } + // ----- Endpoint: ml.undeploy_model /** @@ -302,4 +723,206 @@ public final CompletableFuture undeployModel( ) throws IOException, OpenSearchException { return undeployModel(fn.apply(new UndeployModelRequest.Builder()).build()); } + + /** + * Undeploys a model. + */ + public final CompletableFuture undeployModel() throws IOException, OpenSearchException { + return undeployModel(new UndeployModelRequest.Builder().build()); + } + + // ----- Endpoint: ml.unload_model + + /** + * Unloads a model. + */ + @Deprecated + public CompletableFuture unloadModel(UnloadModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UnloadModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Unloads a model. + * + * @param fn a function that initializes a builder to create the {@link UnloadModelRequest} + */ + @Deprecated + public final CompletableFuture unloadModel( + Function> fn + ) throws IOException, OpenSearchException { + return unloadModel(fn.apply(new UnloadModelRequest.Builder()).build()); + } + + /** + * Unloads a model. + */ + @Deprecated + public final CompletableFuture unloadModel() throws IOException, OpenSearchException { + return unloadModel(new UnloadModelRequest.Builder().build()); + } + + // ----- Endpoint: ml.update_connector + + /** + * Updates a standalone connector. + */ + public CompletableFuture updateConnector(UpdateConnectorRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, UpdateConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link UpdateConnectorRequest} + */ + public final CompletableFuture updateConnector( + Function> fn + ) throws IOException, OpenSearchException { + return updateConnector(fn.apply(new UpdateConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_controller + + /** + * Updates a controller. + */ + public CompletableFuture updateController(UpdateControllerRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, UpdateControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a controller. + * + * @param fn a function that initializes a builder to create the {@link UpdateControllerRequest} + */ + public final CompletableFuture updateController( + Function> fn + ) throws IOException, OpenSearchException { + return updateController(fn.apply(new UpdateControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_memory + + /** + * Update a memory. + */ + public CompletableFuture updateMemory(UpdateMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UpdateMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Update a memory. + * + * @param fn a function that initializes a builder to create the {@link UpdateMemoryRequest} + */ + public final CompletableFuture updateMemory( + Function> fn + ) throws IOException, OpenSearchException { + return updateMemory(fn.apply(new UpdateMemoryRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_message + + /** + * Update a message. + */ + public CompletableFuture updateMessage(UpdateMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UpdateMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Update a message. + * + * @param fn a function that initializes a builder to create the {@link UpdateMessageRequest} + */ + public final CompletableFuture updateMessage( + Function> fn + ) throws IOException, OpenSearchException { + return updateMessage(fn.apply(new UpdateMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_model + + /** + * Updates a model. + */ + public CompletableFuture updateModel(UpdateModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UpdateModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a model. + * + * @param fn a function that initializes a builder to create the {@link UpdateModelRequest} + */ + public final CompletableFuture updateModel( + Function> fn + ) throws IOException, OpenSearchException { + return updateModel(fn.apply(new UpdateModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_model_group + + /** + * Updates a model group. + */ + public CompletableFuture updateModelGroup(UpdateModelGroupRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, UpdateModelGroupRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a model group. + * + * @param fn a function that initializes a builder to create the {@link UpdateModelGroupRequest} + */ + public final CompletableFuture updateModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return updateModelGroup(fn.apply(new UpdateModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.upload_chunk + + /** + * Uploads model chunk. + */ + public CompletableFuture uploadChunk(UploadChunkRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UploadChunkRequest._ENDPOINT, this.transportOptions); + } + + /** + * Uploads model chunk. + * + * @param fn a function that initializes a builder to create the {@link UploadChunkRequest} + */ + public final CompletableFuture uploadChunk( + Function> fn + ) throws IOException, OpenSearchException { + return uploadChunk(fn.apply(new UploadChunkRequest.Builder()).build()); + } + + // ----- Endpoint: ml.upload_model + + /** + * Registers a model. + */ + @Deprecated + public CompletableFuture uploadModel(UploadModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, UploadModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers a model. + * + * @param fn a function that initializes a builder to create the {@link UploadModelRequest} + */ + @Deprecated + public final CompletableFuture uploadModel( + Function> fn + ) throws IOException, OpenSearchException { + return uploadModel(fn.apply(new UploadModelRequest.Builder()).build()); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java index a93402b689..877895595f 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/OpenSearchMlClient.java @@ -59,6 +59,92 @@ public final CreateConnectorResponse createConnector(Function> fn + ) throws IOException, OpenSearchException { + return createController(fn.apply(new CreateControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.create_memory + + /** + * Create a memory. + */ + public CreateMemoryResponse createMemory(CreateMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CreateMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Create a memory. + * + * @param fn a function that initializes a builder to create the {@link CreateMemoryRequest} + */ + public final CreateMemoryResponse createMemory(Function> fn) + throws IOException, OpenSearchException { + return createMemory(fn.apply(new CreateMemoryRequest.Builder()).build()); + } + + /** + * Create a memory. + */ + public final CreateMemoryResponse createMemory() throws IOException, OpenSearchException { + return createMemory(new CreateMemoryRequest.Builder().build()); + } + + // ----- Endpoint: ml.create_message + + /** + * Create a message. + */ + public CreateMessageResponse createMessage(CreateMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CreateMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Create a message. + * + * @param fn a function that initializes a builder to create the {@link CreateMessageRequest} + */ + public final CreateMessageResponse createMessage(Function> fn) + throws IOException, OpenSearchException { + return createMessage(fn.apply(new CreateMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.create_model_meta + + /** + * Registers model metadata. + */ + @Deprecated + public CreateModelMetaResponse createModelMeta(CreateModelMetaRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CreateModelMetaRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers model metadata. + * + * @param fn a function that initializes a builder to create the {@link CreateModelMetaRequest} + */ + @Deprecated + public final CreateModelMetaResponse createModelMeta(Function> fn) + throws IOException, OpenSearchException { + return createModelMeta(fn.apply(new CreateModelMetaRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_agent /** @@ -97,6 +183,45 @@ public final DeleteConnectorResponse deleteConnector(Function> fn + ) throws IOException, OpenSearchException { + return deleteController(fn.apply(new DeleteControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.delete_memory + + /** + * Delete a memory. + */ + public DeleteMemoryResponse deleteMemory(DeleteMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Delete a memory. + * + * @param fn a function that initializes a builder to create the {@link DeleteMemoryRequest} + */ + public final DeleteMemoryResponse deleteMemory(Function> fn) + throws IOException, OpenSearchException { + return deleteMemory(fn.apply(new DeleteMemoryRequest.Builder()).build()); + } + // ----- Endpoint: ml.delete_model /** @@ -174,6 +299,166 @@ public final DeployModelResponse deployModel(Function> fn) + throws IOException, OpenSearchException { + return getAllMemories(fn.apply(new GetAllMemoriesRequest.Builder()).build()); + } + + /** + * Get all memories. + */ + public final GetAllMemoriesResponse getAllMemories() throws IOException, OpenSearchException { + return getAllMemories(new GetAllMemoriesRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_all_messages + + /** + * Get all messages in a memory. + */ + public GetAllMessagesResponse getAllMessages(GetAllMessagesRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetAllMessagesRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get all messages in a memory. + * + * @param fn a function that initializes a builder to create the {@link GetAllMessagesRequest} + */ + public final GetAllMessagesResponse getAllMessages(Function> fn) + throws IOException, OpenSearchException { + return getAllMessages(fn.apply(new GetAllMessagesRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_connector + + /** + * Retrieves a standalone connector. + */ + public GetConnectorResponse getConnector(GetConnectorRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link GetConnectorRequest} + */ + public final GetConnectorResponse getConnector(Function> fn) + throws IOException, OpenSearchException { + return getConnector(fn.apply(new GetConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_controller + + /** + * Retrieves a controller. + */ + public GetControllerResponse getController(GetControllerRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a controller. + * + * @param fn a function that initializes a builder to create the {@link GetControllerRequest} + */ + public final GetControllerResponse getController(Function> fn) + throws IOException, OpenSearchException { + return getController(fn.apply(new GetControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_memory + + /** + * Get a memory. + */ + public GetMemoryResponse getMemory(GetMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a memory. + * + * @param fn a function that initializes a builder to create the {@link GetMemoryRequest} + */ + public final GetMemoryResponse getMemory(Function> fn) throws IOException, + OpenSearchException { + return getMemory(fn.apply(new GetMemoryRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_message + + /** + * Get a message. + */ + public GetMessageResponse getMessage(GetMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a message. + * + * @param fn a function that initializes a builder to create the {@link GetMessageRequest} + */ + public final GetMessageResponse getMessage(Function> fn) throws IOException, + OpenSearchException { + return getMessage(fn.apply(new GetMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_message_traces + + /** + * Get a message traces. + */ + public GetMessageTracesResponse getMessageTraces(GetMessageTracesRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetMessageTracesRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a message traces. + * + * @param fn a function that initializes a builder to create the {@link GetMessageTracesRequest} + */ + public final GetMessageTracesResponse getMessageTraces( + Function> fn + ) throws IOException, OpenSearchException { + return getMessageTraces(fn.apply(new GetMessageTracesRequest.Builder()).build()); + } + + // ----- Endpoint: ml.get_model + + /** + * Retrieves a model. + */ + public GetModelResponse getModel(GetModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Retrieves a model. + * + * @param fn a function that initializes a builder to create the {@link GetModelRequest} + */ + public final GetModelResponse getModel(Function> fn) throws IOException, + OpenSearchException { + return getModel(fn.apply(new GetModelRequest.Builder()).build()); + } + // ----- Endpoint: ml.get_model_group /** @@ -193,6 +478,85 @@ public final GetModelGroupResponse getModelGroup(Function> fn) throws IOException, + OpenSearchException { + return getProfile(fn.apply(new GetProfileRequest.Builder()).build()); + } + + /** + * Get a profile. + */ + public final GetProfileResponse getProfile() throws IOException, OpenSearchException { + return getProfile(new GetProfileRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_profile_models + + /** + * Get a profile models. + */ + public GetProfileModelsResponse getProfileModels(GetProfileModelsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetProfileModelsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a profile models. + * + * @param fn a function that initializes a builder to create the {@link GetProfileModelsRequest} + */ + public final GetProfileModelsResponse getProfileModels( + Function> fn + ) throws IOException, OpenSearchException { + return getProfileModels(fn.apply(new GetProfileModelsRequest.Builder()).build()); + } + + /** + * Get a profile models. + */ + public final GetProfileModelsResponse getProfileModels() throws IOException, OpenSearchException { + return getProfileModels(new GetProfileModelsRequest.Builder().build()); + } + + // ----- Endpoint: ml.get_profile_tasks + + /** + * Get a profile tasks. + */ + public GetProfileTasksResponse getProfileTasks(GetProfileTasksRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetProfileTasksRequest._ENDPOINT, this.transportOptions); + } + + /** + * Get a profile tasks. + * + * @param fn a function that initializes a builder to create the {@link GetProfileTasksRequest} + */ + public final GetProfileTasksResponse getProfileTasks(Function> fn) + throws IOException, OpenSearchException { + return getProfileTasks(fn.apply(new GetProfileTasksRequest.Builder()).build()); + } + + /** + * Get a profile tasks. + */ + public final GetProfileTasksResponse getProfileTasks() throws IOException, OpenSearchException { + return getProfileTasks(new GetProfileTasksRequest.Builder().build()); + } + // ----- Endpoint: ml.get_task /** @@ -212,6 +576,27 @@ public final GetTaskResponse getTask(Function> fn) throws IOException, + OpenSearchException { + return loadModel(fn.apply(new LoadModelRequest.Builder()).build()); + } + // ----- Endpoint: ml.register_agents /** @@ -270,6 +655,26 @@ public final RegisterModelGroupResponse registerModelGroup( return registerModelGroup(fn.apply(new RegisterModelGroupRequest.Builder()).build()); } + // ----- Endpoint: ml.register_model_meta + + /** + * Registers model metadata. + */ + public RegisterModelMetaResponse registerModelMeta(RegisterModelMetaRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RegisterModelMetaRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers model metadata. + * + * @param fn a function that initializes a builder to create the {@link RegisterModelMetaRequest} + */ + public final RegisterModelMetaResponse registerModelMeta( + Function> fn + ) throws IOException, OpenSearchException { + return registerModelMeta(fn.apply(new RegisterModelMetaRequest.Builder()).build()); + } + // ----- Endpoint: ml.undeploy_model /** @@ -288,4 +693,196 @@ public final UndeployModelResponse undeployModel(Function> fn) + throws IOException, OpenSearchException { + return unloadModel(fn.apply(new UnloadModelRequest.Builder()).build()); + } + + /** + * Unloads a model. + */ + @Deprecated + public final UnloadModelResponse unloadModel() throws IOException, OpenSearchException { + return unloadModel(new UnloadModelRequest.Builder().build()); + } + + // ----- Endpoint: ml.update_connector + + /** + * Updates a standalone connector. + */ + public UpdateConnectorResponse updateConnector(UpdateConnectorRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateConnectorRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a standalone connector. + * + * @param fn a function that initializes a builder to create the {@link UpdateConnectorRequest} + */ + public final UpdateConnectorResponse updateConnector(Function> fn) + throws IOException, OpenSearchException { + return updateConnector(fn.apply(new UpdateConnectorRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_controller + + /** + * Updates a controller. + */ + public UpdateControllerResponse updateController(UpdateControllerRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateControllerRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a controller. + * + * @param fn a function that initializes a builder to create the {@link UpdateControllerRequest} + */ + public final UpdateControllerResponse updateController( + Function> fn + ) throws IOException, OpenSearchException { + return updateController(fn.apply(new UpdateControllerRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_memory + + /** + * Update a memory. + */ + public UpdateMemoryResponse updateMemory(UpdateMemoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateMemoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Update a memory. + * + * @param fn a function that initializes a builder to create the {@link UpdateMemoryRequest} + */ + public final UpdateMemoryResponse updateMemory(Function> fn) + throws IOException, OpenSearchException { + return updateMemory(fn.apply(new UpdateMemoryRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_message + + /** + * Update a message. + */ + public UpdateMessageResponse updateMessage(UpdateMessageRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateMessageRequest._ENDPOINT, this.transportOptions); + } + + /** + * Update a message. + * + * @param fn a function that initializes a builder to create the {@link UpdateMessageRequest} + */ + public final UpdateMessageResponse updateMessage(Function> fn) + throws IOException, OpenSearchException { + return updateMessage(fn.apply(new UpdateMessageRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_model + + /** + * Updates a model. + */ + public UpdateModelResponse updateModel(UpdateModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a model. + * + * @param fn a function that initializes a builder to create the {@link UpdateModelRequest} + */ + public final UpdateModelResponse updateModel(Function> fn) + throws IOException, OpenSearchException { + return updateModel(fn.apply(new UpdateModelRequest.Builder()).build()); + } + + // ----- Endpoint: ml.update_model_group + + /** + * Updates a model group. + */ + public UpdateModelGroupResponse updateModelGroup(UpdateModelGroupRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UpdateModelGroupRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates a model group. + * + * @param fn a function that initializes a builder to create the {@link UpdateModelGroupRequest} + */ + public final UpdateModelGroupResponse updateModelGroup( + Function> fn + ) throws IOException, OpenSearchException { + return updateModelGroup(fn.apply(new UpdateModelGroupRequest.Builder()).build()); + } + + // ----- Endpoint: ml.upload_chunk + + /** + * Uploads model chunk. + */ + public UploadChunkResponse uploadChunk(UploadChunkRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UploadChunkRequest._ENDPOINT, this.transportOptions); + } + + /** + * Uploads model chunk. + * + * @param fn a function that initializes a builder to create the {@link UploadChunkRequest} + */ + public final UploadChunkResponse uploadChunk(Function> fn) + throws IOException, OpenSearchException { + return uploadChunk(fn.apply(new UploadChunkRequest.Builder()).build()); + } + + // ----- Endpoint: ml.upload_model + + /** + * Registers a model. + */ + @Deprecated + public UploadModelResponse uploadModel(UploadModelRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, UploadModelRequest._ENDPOINT, this.transportOptions); + } + + /** + * Registers a model. + * + * @param fn a function that initializes a builder to create the {@link UploadModelRequest} + */ + @Deprecated + public final UploadModelResponse uploadModel(Function> fn) + throws IOException, OpenSearchException { + return uploadModel(fn.apply(new UploadModelRequest.Builder()).build()); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictRequestStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictRequestStats.java new file mode 100644 index 0000000000..891dc2437a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/PredictRequestStats.java @@ -0,0 +1,403 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.PredictRequestStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PredictRequestStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Double average; + + @Nullable + private final Long count; + + @Nullable + private final Double max; + + @Nullable + private final Double min; + + @Nullable + private final Double p50; + + @Nullable + private final Double p90; + + @Nullable + private final Double p99; + + // --------------------------------------------------------------------------------------------- + + private PredictRequestStats(Builder builder) { + this.average = builder.average; + this.count = builder.count; + this.max = builder.max; + this.min = builder.min; + this.p50 = builder.p50; + this.p90 = builder.p90; + this.p99 = builder.p99; + } + + public static PredictRequestStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The average latency in milliseconds. + *

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

+ */ + @Nullable + public final Double average() { + return this.average; + } + + /** + * The total predict requests on this node. + *

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

+ */ + @Nullable + public final Long count() { + return this.count; + } + + /** + * The maximum latency in milliseconds. + *

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

+ */ + @Nullable + public final Double max() { + return this.max; + } + + /** + * The minimum latency in milliseconds. + *

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

+ */ + @Nullable + public final Double min() { + return this.min; + } + + /** + * The 50th percentile latency in milliseconds. + *

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

+ */ + @Nullable + public final Double p50() { + return this.p50; + } + + /** + * The 90th percentile latency in milliseconds. + *

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

+ */ + @Nullable + public final Double p90() { + return this.p90; + } + + /** + * The 99th percentile latency in milliseconds. + *

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

+ */ + @Nullable + public final Double p99() { + return this.p99; + } + + /** + * 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.average != null) { + generator.writeKey("average"); + generator.write(this.average); + } + + if (this.count != null) { + generator.writeKey("count"); + generator.write(this.count); + } + + if (this.max != null) { + generator.writeKey("max"); + generator.write(this.max); + } + + if (this.min != null) { + generator.writeKey("min"); + generator.write(this.min); + } + + if (this.p50 != null) { + generator.writeKey("p50"); + generator.write(this.p50); + } + + if (this.p90 != null) { + generator.writeKey("p90"); + generator.write(this.p90); + } + + if (this.p99 != null) { + generator.writeKey("p99"); + generator.write(this.p99); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link PredictRequestStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Double average; + @Nullable + private Long count; + @Nullable + private Double max; + @Nullable + private Double min; + @Nullable + private Double p50; + @Nullable + private Double p90; + @Nullable + private Double p99; + + public Builder() {} + + private Builder(PredictRequestStats o) { + this.average = o.average; + this.count = o.count; + this.max = o.max; + this.min = o.min; + this.p50 = o.p50; + this.p90 = o.p90; + this.p99 = o.p99; + } + + private Builder(Builder o) { + this.average = o.average; + this.count = o.count; + this.max = o.max; + this.min = o.min; + this.p50 = o.p50; + this.p90 = o.p90; + this.p99 = o.p99; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The average latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder average(@Nullable Double value) { + this.average = value; + return this; + } + + /** + * The total predict requests on this node. + *

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

+ */ + @Nonnull + public final Builder count(@Nullable Long value) { + this.count = value; + return this; + } + + /** + * The maximum latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder max(@Nullable Double value) { + this.max = value; + return this; + } + + /** + * The minimum latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder min(@Nullable Double value) { + this.min = value; + return this; + } + + /** + * The 50th percentile latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder p50(@Nullable Double value) { + this.p50 = value; + return this; + } + + /** + * The 90th percentile latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder p90(@Nullable Double value) { + this.p90 = value; + return this; + } + + /** + * The 99th percentile latency in milliseconds. + *

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

+ */ + @Nonnull + public final Builder p99(@Nullable Double value) { + this.p99 = value; + return this; + } + + /** + * Builds a {@link PredictRequestStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public PredictRequestStats build() { + _checkSingleUse(); + + return new PredictRequestStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PredictRequestStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PredictRequestStats::setupPredictRequestStatsDeserializer + ); + + protected static void setupPredictRequestStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::average, JsonpDeserializer.doubleDeserializer(), "average"); + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::max, JsonpDeserializer.doubleDeserializer(), "max"); + op.add(Builder::min, JsonpDeserializer.doubleDeserializer(), "min"); + op.add(Builder::p50, JsonpDeserializer.doubleDeserializer(), "p50"); + op.add(Builder::p90, JsonpDeserializer.doubleDeserializer(), "p90"); + op.add(Builder::p99, JsonpDeserializer.doubleDeserializer(), "p99"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.average); + result = 31 * result + Objects.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.max); + result = 31 * result + Objects.hashCode(this.min); + result = 31 * result + Objects.hashCode(this.p50); + result = 31 * result + Objects.hashCode(this.p90); + result = 31 * result + Objects.hashCode(this.p99); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PredictRequestStats other = (PredictRequestStats) o; + return Objects.equals(this.average, other.average) + && Objects.equals(this.count, other.count) + && Objects.equals(this.max, other.max) + && Objects.equals(this.min, other.min) + && Objects.equals(this.p50, other.p50) + && Objects.equals(this.p90, other.p90) + && Objects.equals(this.p99, other.p99); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RateLimiter.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RateLimiter.java new file mode 100644 index 0000000000..5c9adba95d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RateLimiter.java @@ -0,0 +1,198 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.RateLimiter + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RateLimiter implements PlainJsonSerializable, ToCopyableBuilder { + + private final double limit; + + @Nonnull + private final String unit; + + // --------------------------------------------------------------------------------------------- + + private RateLimiter(Builder builder) { + this.limit = ApiTypeHelper.requireNonNull(builder.limit, this, "limit"); + this.unit = ApiTypeHelper.requireNonNull(builder.unit, this, "unit"); + } + + public static RateLimiter of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The maximum limit. + *

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

+ */ + public final double limit() { + return this.limit; + } + + /** + * Required - The unit of time. + *

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

+ */ + @Nonnull + public final String unit() { + return this.unit; + } + + /** + * 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("limit"); + generator.write(this.limit); + + generator.writeKey("unit"); + generator.write(this.unit); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RateLimiter}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Double limit; + private String unit; + + public Builder() {} + + private Builder(RateLimiter o) { + this.limit = o.limit; + this.unit = o.unit; + } + + private Builder(Builder o) { + this.limit = o.limit; + this.unit = o.unit; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The maximum limit. + *

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

+ */ + @Nonnull + public final Builder limit(double value) { + this.limit = value; + return this; + } + + /** + * Required - The unit of time. + *

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

+ */ + @Nonnull + public final Builder unit(String value) { + this.unit = value; + return this; + } + + /** + * Builds a {@link RateLimiter}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RateLimiter build() { + _checkSingleUse(); + + return new RateLimiter(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RateLimiter} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RateLimiter::setupRateLimiterDeserializer + ); + + protected static void setupRateLimiterDeserializer(ObjectDeserializer op) { + op.add(Builder::limit, JsonpDeserializer.doubleDeserializer(), "limit"); + op.add(Builder::unit, JsonpDeserializer.stringDeserializer(), "unit"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.limit); + result = 31 * result + this.unit.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RateLimiter other = (RateLimiter) o; + return this.limit == other.limit && this.unit.equals(other.unit); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaRequest.java new file mode 100644 index 0000000000..3ba72aa43b --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaRequest.java @@ -0,0 +1,486 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.register_model_meta.Request + +/** + * Registers model metadata. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class RegisterModelMetaRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nonnull + private final ModelConfig modelConfig; + + @Nonnull + private final String modelContentHashValue; + + @Nonnull + private final ModelFormat modelFormat; + + @Nullable + private final String modelGroupId; + + @Nonnull + private final String name; + + private final long totalChunks; + + @Nullable + private final String url; + + @Nonnull + private final String version; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelMetaRequest(Builder builder) { + super(builder); + this.description = builder.description; + this.modelConfig = ApiTypeHelper.requireNonNull(builder.modelConfig, this, "modelConfig"); + this.modelContentHashValue = ApiTypeHelper.requireNonNull(builder.modelContentHashValue, this, "modelContentHashValue"); + this.modelFormat = ApiTypeHelper.requireNonNull(builder.modelFormat, this, "modelFormat"); + this.modelGroupId = builder.modelGroupId; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.totalChunks = ApiTypeHelper.requireNonNull(builder.totalChunks, this, "totalChunks"); + this.url = builder.url; + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + } + + public static RegisterModelMetaRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final ModelConfig modelConfig() { + return this.modelConfig; + } + + /** + * Required - The model content hash value. + *

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

+ */ + @Nonnull + public final String modelContentHashValue() { + return this.modelContentHashValue; + } + + /** + * Required - API name: {@code model_format} + */ + @Nonnull + public final ModelFormat modelFormat() { + return this.modelFormat; + } + + /** + * API name: {@code model_group_id} + */ + @Nullable + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final String name() { + return this.name; + } + + /** + * Required - Number of chunks the model is split into. + *

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

+ */ + public final long totalChunks() { + return this.totalChunks; + } + + /** + * The model URL. + *

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

+ */ + @Nullable + public final String url() { + return this.url; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final String 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 (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + generator.writeKey("model_config"); + this.modelConfig.serialize(generator, mapper); + + generator.writeKey("model_content_hash_value"); + generator.write(this.modelContentHashValue); + + generator.writeKey("model_format"); + this.modelFormat.serialize(generator, mapper); + + if (this.modelGroupId != null) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + } + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("total_chunks"); + generator.write(this.totalChunks); + + if (this.url != null) { + generator.writeKey("url"); + generator.write(this.url); + } + + 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 RegisterModelMetaRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String description; + private ModelConfig modelConfig; + private String modelContentHashValue; + private ModelFormat modelFormat; + @Nullable + private String modelGroupId; + private String name; + private Long totalChunks; + @Nullable + private String url; + private String version; + + public Builder() {} + + private Builder(RegisterModelMetaRequest o) { + super(o); + this.description = o.description; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.totalChunks = o.totalChunks; + this.url = o.url; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.description = o.description; + this.modelConfig = o.modelConfig; + this.modelContentHashValue = o.modelContentHashValue; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.totalChunks = o.totalChunks; + this.url = o.url; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The model description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(ModelConfig value) { + this.modelConfig = value; + return this; + } + + /** + * Required - API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(Function> fn) { + return modelConfig(fn.apply(new ModelConfig.Builder()).build()); + } + + /** + * Required - The model content hash value. + *

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

+ */ + @Nonnull + public final Builder modelContentHashValue(String value) { + this.modelContentHashValue = value; + return this; + } + + /** + * Required - API name: {@code model_format} + */ + @Nonnull + public final Builder modelFormat(ModelFormat value) { + this.modelFormat = value; + return this; + } + + /** + * API name: {@code model_group_id} + */ + @Nonnull + public final Builder modelGroupId(@Nullable String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - Number of chunks the model is split into. + *

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

+ */ + @Nonnull + public final Builder totalChunks(long value) { + this.totalChunks = value; + return this; + } + + /** + * The model URL. + *

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

+ */ + @Nonnull + public final Builder url(@Nullable String value) { + this.url = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link RegisterModelMetaRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RegisterModelMetaRequest build() { + _checkSingleUse(); + + return new RegisterModelMetaRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelMetaRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelMetaRequest::setupRegisterModelMetaRequestDeserializer + ); + + protected static void setupRegisterModelMetaRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelConfig, ModelConfig._DESERIALIZER, "model_config"); + op.add(Builder::modelContentHashValue, JsonpDeserializer.stringDeserializer(), "model_content_hash_value"); + op.add(Builder::modelFormat, ModelFormat._DESERIALIZER, "model_format"); + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::totalChunks, JsonpDeserializer.longDeserializer(), "total_chunks"); + op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.register_model_meta}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/models/_register_meta", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + RegisterModelMetaResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + this.modelConfig.hashCode(); + result = 31 * result + this.modelContentHashValue.hashCode(); + result = 31 * result + this.modelFormat.hashCode(); + result = 31 * result + Objects.hashCode(this.modelGroupId); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Long.hashCode(this.totalChunks); + result = 31 * result + Objects.hashCode(this.url); + result = 31 * result + this.version.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RegisterModelMetaRequest other = (RegisterModelMetaRequest) o; + return Objects.equals(this.description, other.description) + && this.modelConfig.equals(other.modelConfig) + && this.modelContentHashValue.equals(other.modelContentHashValue) + && this.modelFormat.equals(other.modelFormat) + && Objects.equals(this.modelGroupId, other.modelGroupId) + && this.name.equals(other.name) + && this.totalChunks == other.totalChunks + && Objects.equals(this.url, other.url) + && this.version.equals(other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaResponse.java new file mode 100644 index 0000000000..f5c4e23e68 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelMetaResponse.java @@ -0,0 +1,191 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.register_model_meta.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RegisterModelMetaResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + @Nonnull + private final String status; + + // --------------------------------------------------------------------------------------------- + + private RegisterModelMetaResponse(Builder builder) { + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + } + + public static RegisterModelMetaResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final String status() { + return this.status; + } + + /** + * 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); + + generator.writeKey("status"); + generator.write(this.status); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RegisterModelMetaResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String modelId; + private String status; + + public Builder() {} + + private Builder(RegisterModelMetaResponse o) { + this.modelId = o.modelId; + this.status = o.status; + } + + private Builder(Builder o) { + this.modelId = o.modelId; + this.status = o.status; + } + + @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; + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Builds a {@link RegisterModelMetaResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RegisterModelMetaResponse build() { + _checkSingleUse(); + + return new RegisterModelMetaResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RegisterModelMetaResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RegisterModelMetaResponse::setupRegisterModelMetaResponseDeserializer + ); + + protected static void setupRegisterModelMetaResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + this.status.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RegisterModelMetaResponse other = (RegisterModelMetaResponse) o; + return this.modelId.equals(other.modelId) && this.status.equals(other.status); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java index 9892bec807..e3d556d69c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/RegisterModelRequest.java @@ -50,8 +50,8 @@ public final class RegisterModelRequest extends RequestBase @Nullable private final String description; - @Nonnull - private final String modelFormat; + @Nullable + private final ModelFormat modelFormat; @Nullable private final String modelGroupId; @@ -67,7 +67,7 @@ public final class RegisterModelRequest extends RequestBase private RegisterModelRequest(Builder builder) { super(builder); this.description = builder.description; - this.modelFormat = ApiTypeHelper.requireNonNull(builder.modelFormat, this, "modelFormat"); + this.modelFormat = builder.modelFormat; this.modelGroupId = builder.modelGroupId; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); @@ -89,21 +89,15 @@ public final String description() { } /** - * Required - The portable format of the model file. - *

* API name: {@code model_format} - *

*/ - @Nonnull - public final String modelFormat() { + @Nullable + public final ModelFormat modelFormat() { return this.modelFormat; } /** - * The ID of the model group to which to register the model. - *

* API name: {@code model_group_id} - *

*/ @Nullable public final String modelGroupId() { @@ -122,10 +116,7 @@ public final String name() { } /** - * Required - The model version. - *

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

+ * Required - API name: {@code version} */ @Nonnull public final String version() { @@ -148,8 +139,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.description); } - generator.writeKey("model_format"); - generator.write(this.modelFormat); + if (this.modelFormat != null) { + generator.writeKey("model_format"); + this.modelFormat.serialize(generator, mapper); + } if (this.modelGroupId != null) { generator.writeKey("model_group_id"); @@ -181,7 +174,8 @@ public static Builder builder() { public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { @Nullable private String description; - private String modelFormat; + @Nullable + private ModelFormat modelFormat; @Nullable private String modelGroupId; private String name; @@ -232,22 +226,16 @@ public final Builder description(@Nullable String value) { } /** - * Required - The portable format of the model file. - *

* API name: {@code model_format} - *

*/ @Nonnull - public final Builder modelFormat(String value) { + public final Builder modelFormat(@Nullable ModelFormat value) { this.modelFormat = value; return this; } /** - * The ID of the model group to which to register the model. - *

* API name: {@code model_group_id} - *

*/ @Nonnull public final Builder modelGroupId(@Nullable String value) { @@ -268,10 +256,7 @@ public final Builder name(String value) { } /** - * Required - The model version. - *

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

+ * Required - API name: {@code version} */ @Nonnull public final Builder version(String value) { @@ -305,7 +290,7 @@ public RegisterModelRequest build() { protected static void setupRegisterModelRequestDeserializer(ObjectDeserializer op) { op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::modelFormat, JsonpDeserializer.stringDeserializer(), "model_format"); + op.add(Builder::modelFormat, ModelFormat._DESERIALIZER, "model_format"); op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); @@ -336,7 +321,7 @@ protected static void setupRegisterModelRequestDeserializer(ObjectDeserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Status.values()); +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Task.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Task.java new file mode 100644 index 0000000000..1b007d9e85 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/Task.java @@ -0,0 +1,491 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.Task + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Task implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Long createTime; + + @Nullable + private final String error; + + @Nullable + private final String functionName; + + @Nullable + private final Boolean isAsync; + + @Nullable + private final Long lastUpdateTime; + + @Nullable + private final String modelId; + + @Nonnull + private final String state; + + @Nullable + private final String taskId; + + @Nullable + private final String taskType; + + @Nonnull + private final List> workerNode; + + // --------------------------------------------------------------------------------------------- + + private Task(Builder builder) { + this.createTime = builder.createTime; + this.error = builder.error; + this.functionName = builder.functionName; + this.isAsync = builder.isAsync; + this.lastUpdateTime = builder.lastUpdateTime; + this.modelId = builder.modelId; + this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.taskId = builder.taskId; + this.taskType = builder.taskType; + this.workerNode = ApiTypeHelper.unmodifiable(builder.workerNode); + } + + public static Task of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code create_time} + */ + @Nullable + public final Long createTime() { + return this.createTime; + } + + /** + * API name: {@code error} + */ + @Nullable + public final String error() { + return this.error; + } + + /** + * API name: {@code function_name} + */ + @Nullable + public final String functionName() { + return this.functionName; + } + + /** + * API name: {@code is_async} + */ + @Nullable + public final Boolean isAsync() { + return this.isAsync; + } + + /** + * API name: {@code last_update_time} + */ + @Nullable + public final Long lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * Required - API name: {@code state} + */ + @Nonnull + public final String state() { + return this.state; + } + + /** + * API name: {@code task_id} + */ + @Nullable + public final String taskId() { + return this.taskId; + } + + /** + * Task type. + *

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

+ */ + @Nullable + public final String taskType() { + return this.taskType; + } + + /** + * API name: {@code worker_node} + */ + @Nonnull + public final List> workerNode() { + return this.workerNode; + } + + /** + * 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.createTime != null) { + generator.writeKey("create_time"); + generator.write(this.createTime); + } + + if (this.error != null) { + generator.writeKey("error"); + generator.write(this.error); + } + + if (this.functionName != null) { + generator.writeKey("function_name"); + generator.write(this.functionName); + } + + if (this.isAsync != null) { + generator.writeKey("is_async"); + generator.write(this.isAsync); + } + + if (this.lastUpdateTime != null) { + generator.writeKey("last_update_time"); + generator.write(this.lastUpdateTime); + } + + if (this.modelId != null) { + generator.writeKey("model_id"); + generator.write(this.modelId); + } + + generator.writeKey("state"); + generator.write(this.state); + + if (this.taskId != null) { + generator.writeKey("task_id"); + generator.write(this.taskId); + } + + if (this.taskType != null) { + generator.writeKey("task_type"); + generator.write(this.taskType); + } + + if (ApiTypeHelper.isDefined(this.workerNode)) { + generator.writeKey("worker_node"); + generator.writeStartArray(); + for (List item0 : this.workerNode) { + generator.writeStartArray(); + for (String item1 : item0) { + generator.write(item1); + } + generator.writeEnd(); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link Task}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long createTime; + @Nullable + private String error; + @Nullable + private String functionName; + @Nullable + private Boolean isAsync; + @Nullable + private Long lastUpdateTime; + @Nullable + private String modelId; + private String state; + @Nullable + private String taskId; + @Nullable + private String taskType; + @Nullable + private List> workerNode; + + public Builder() {} + + private Builder(Task o) { + this.createTime = o.createTime; + this.error = o.error; + this.functionName = o.functionName; + this.isAsync = o.isAsync; + this.lastUpdateTime = o.lastUpdateTime; + this.modelId = o.modelId; + this.state = o.state; + this.taskId = o.taskId; + this.taskType = o.taskType; + this.workerNode = _listCopy(o.workerNode); + } + + private Builder(Builder o) { + this.createTime = o.createTime; + this.error = o.error; + this.functionName = o.functionName; + this.isAsync = o.isAsync; + this.lastUpdateTime = o.lastUpdateTime; + this.modelId = o.modelId; + this.state = o.state; + this.taskId = o.taskId; + this.taskType = o.taskType; + this.workerNode = _listCopy(o.workerNode); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code create_time} + */ + @Nonnull + public final Builder createTime(@Nullable Long value) { + this.createTime = value; + return this; + } + + /** + * API name: {@code error} + */ + @Nonnull + public final Builder error(@Nullable String value) { + this.error = value; + return this; + } + + /** + * API name: {@code function_name} + */ + @Nonnull + public final Builder functionName(@Nullable String value) { + this.functionName = value; + return this; + } + + /** + * API name: {@code is_async} + */ + @Nonnull + public final Builder isAsync(@Nullable Boolean value) { + this.isAsync = value; + return this; + } + + /** + * API name: {@code last_update_time} + */ + @Nonnull + public final Builder lastUpdateTime(@Nullable Long value) { + this.lastUpdateTime = value; + return this; + } + + /** + * API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * Required - API name: {@code state} + */ + @Nonnull + public final Builder state(String value) { + this.state = value; + return this; + } + + /** + * API name: {@code task_id} + */ + @Nonnull + public final Builder taskId(@Nullable String value) { + this.taskId = value; + return this; + } + + /** + * Task type. + *

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

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

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

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

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

+ */ + @Nonnull + public final Builder workerNode(List value, List... values) { + this.workerNode = _listAdd(this.workerNode, value, values); + return this; + } + + /** + * Builds a {@link Task}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public Task build() { + _checkSingleUse(); + + return new Task(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Task} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Task::setupTaskDeserializer); + + protected static void setupTaskDeserializer(ObjectDeserializer op) { + op.add(Builder::createTime, JsonpDeserializer.longDeserializer(), "create_time"); + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + op.add(Builder::functionName, JsonpDeserializer.stringDeserializer(), "function_name"); + op.add(Builder::isAsync, JsonpDeserializer.booleanDeserializer(), "is_async"); + op.add(Builder::lastUpdateTime, JsonpDeserializer.longDeserializer(), "last_update_time"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + op.add(Builder::taskType, JsonpDeserializer.stringDeserializer(), "task_type"); + op.add( + Builder::workerNode, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())), + "worker_node" + ); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.createTime); + result = 31 * result + Objects.hashCode(this.error); + result = 31 * result + Objects.hashCode(this.functionName); + result = 31 * result + Objects.hashCode(this.isAsync); + result = 31 * result + Objects.hashCode(this.lastUpdateTime); + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + this.state.hashCode(); + result = 31 * result + Objects.hashCode(this.taskId); + result = 31 * result + Objects.hashCode(this.taskType); + result = 31 * result + Objects.hashCode(this.workerNode); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Task other = (Task) o; + return Objects.equals(this.createTime, other.createTime) + && Objects.equals(this.error, other.error) + && Objects.equals(this.functionName, other.functionName) + && Objects.equals(this.isAsync, other.isAsync) + && Objects.equals(this.lastUpdateTime, other.lastUpdateTime) + && Objects.equals(this.modelId, other.modelId) + && this.state.equals(other.state) + && Objects.equals(this.taskId, other.taskId) + && Objects.equals(this.taskType, other.taskType) + && Objects.equals(this.workerNode, other.workerNode); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java index d941595bf7..d1d93662f9 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UndeployModelRequest.java @@ -12,11 +12,21 @@ package org.opensearch.client.opensearch.ml; +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.transport.Endpoint; @@ -31,19 +41,29 @@ /** * Undeploys a model. */ +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") public final class UndeployModelRequest extends RequestBase implements + PlainJsonSerializable, ToCopyableBuilder { - @Nonnull + @Nullable private final String modelId; + @Nonnull + private final List modelIds; + + @Nonnull + private final List nodeIds; + // --------------------------------------------------------------------------------------------- private UndeployModelRequest(Builder builder) { super(builder); - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.modelId = builder.modelId; + this.modelIds = ApiTypeHelper.unmodifiable(builder.modelIds); + this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); } public static UndeployModelRequest of(Function> fn) { @@ -51,13 +71,58 @@ public static UndeployModelRequest of(Function modelIds() { + return this.modelIds; + } + + /** + * API name: {@code node_ids} + */ + @Nonnull + public final List nodeIds() { + return this.nodeIds; + } + + /** + * 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.modelIds)) { + generator.writeKey("model_ids"); + generator.writeStartArray(); + for (String item0 : this.modelIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.nodeIds)) { + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + generator.write(item0); + } + generator.writeEnd(); + } + } // --------------------------------------------------------------------------------------------- @Override @@ -75,18 +140,27 @@ public static Builder builder() { * Builder for {@link UndeployModelRequest}. */ public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable private String modelId; + @Nullable + private List modelIds; + @Nullable + private List nodeIds; public Builder() {} private Builder(UndeployModelRequest o) { super(o); this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); } private Builder(Builder o) { super(o); this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); } @Override @@ -102,14 +176,66 @@ protected Builder self() { } /** - * Required - API name: {@code model_id} + * API name: {@code model_id} */ @Nonnull - public final Builder modelId(String value) { + public final Builder modelId(@Nullable String value) { this.modelId = value; return this; } + /** + * API name: {@code model_ids} + * + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder nodeIds(String value, String... values) { + this.nodeIds = _listAdd(this.nodeIds, value, values); + return this; + } + /** * Builds a {@link UndeployModelRequest}. * @@ -126,6 +252,21 @@ public UndeployModelRequest build() { // --------------------------------------------------------------------------------------------- + /** + * Json deserializer for {@link UndeployModelRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UndeployModelRequest::setupUndeployModelRequestDeserializer + ); + + protected static void setupUndeployModelRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::modelIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "model_ids"); + op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); + } + + // --------------------------------------------------------------------------------------------- + /** * Endpoint "{@code ml.undeploy_model}". */ @@ -134,11 +275,24 @@ public UndeployModelRequest build() { request -> "POST", // Request path request -> { - StringBuilder buf = new StringBuilder(); - buf.append("/_plugins/_ml/models/"); - SimpleEndpoint.pathEncode(request.modelId, buf); - buf.append("/_undeploy"); - return buf.toString(); + final int _modelId = 1 << 0; + + int propsSet = 0; + + if (request.modelId() != null) propsSet |= _modelId; + + if (propsSet == 0) { + return "/_plugins/_ml/models/_undeploy"; + } + if (propsSet == (_modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_undeploy"); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); }, // Request parameters request -> { @@ -147,14 +301,16 @@ public UndeployModelRequest build() { return params; }, SimpleEndpoint.emptyMap(), - false, + true, UndeployModelResponse._DESERIALIZER ); @Override public int hashCode() { int result = 17; - result = 31 * result + this.modelId.hashCode(); + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.modelIds); + result = 31 * result + Objects.hashCode(this.nodeIds); return result; } @@ -163,6 +319,8 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; UndeployModelRequest other = (UndeployModelRequest) o; - return this.modelId.equals(other.modelId); + return Objects.equals(this.modelId, other.modelId) + && Objects.equals(this.modelIds, other.modelIds) + && Objects.equals(this.nodeIds, other.nodeIds); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelNode.java new file mode 100644 index 0000000000..1ebfec026d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelNode.java @@ -0,0 +1,188 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.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: ml.UnloadModelNode + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UnloadModelNode implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map stats; + + // --------------------------------------------------------------------------------------------- + + private UnloadModelNode(Builder builder) { + this.stats = ApiTypeHelper.unmodifiable(builder.stats); + } + + public static UnloadModelNode of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code stats} + */ + @Nonnull + public final Map stats() { + return this.stats; + } + + /** + * 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.stats)) { + generator.writeKey("stats"); + generator.writeStartObject(); + for (Map.Entry item0 : this.stats.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UnloadModelNode}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map stats; + + public Builder() {} + + private Builder(UnloadModelNode o) { + this.stats = _mapCopy(o.stats); + } + + private Builder(Builder o) { + this.stats = _mapCopy(o.stats); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code stats} + * + *

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

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

+ * Adds an entry to stats. + *

+ */ + @Nonnull + public final Builder stats(String key, JsonData value) { + this.stats = _mapPut(this.stats, key, value); + return this; + } + + /** + * Builds a {@link UnloadModelNode}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UnloadModelNode build() { + _checkSingleUse(); + + return new UnloadModelNode(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UnloadModelNode} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UnloadModelNode::setupUnloadModelNodeDeserializer + ); + + protected static void setupUnloadModelNodeDeserializer(ObjectDeserializer op) { + op.add(Builder::stats, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "stats"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.stats); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UnloadModelNode other = (UnloadModelNode) o; + return Objects.equals(this.stats, other.stats); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelRequest.java new file mode 100644 index 0000000000..1ddbdf0b56 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelRequest.java @@ -0,0 +1,326 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.unload_model.Request + +/** + * Unloads a model. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UnloadModelRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String modelId; + + @Nonnull + private final List modelIds; + + @Nonnull + private final List nodeIds; + + // --------------------------------------------------------------------------------------------- + + private UnloadModelRequest(Builder builder) { + super(builder); + this.modelId = builder.modelId; + this.modelIds = ApiTypeHelper.unmodifiable(builder.modelIds); + this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); + } + + public static UnloadModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code model_id} + */ + @Nullable + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code model_ids} + */ + @Nonnull + public final List modelIds() { + return this.modelIds; + } + + /** + * API name: {@code node_ids} + */ + @Nonnull + public final List nodeIds() { + return this.nodeIds; + } + + /** + * 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.modelIds)) { + generator.writeKey("model_ids"); + generator.writeStartArray(); + for (String item0 : this.modelIds) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.nodeIds)) { + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + 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 UnloadModelRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String modelId; + @Nullable + private List modelIds; + @Nullable + private List nodeIds; + + public Builder() {} + + private Builder(UnloadModelRequest o) { + super(o); + this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + this.modelIds = _listCopy(o.modelIds); + this.nodeIds = _listCopy(o.nodeIds); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(@Nullable String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code model_ids} + * + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder nodeIds(String value, String... values) { + this.nodeIds = _listAdd(this.nodeIds, value, values); + return this; + } + + /** + * Builds a {@link UnloadModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UnloadModelRequest build() { + _checkSingleUse(); + + return new UnloadModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UnloadModelRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UnloadModelRequest::setupUnloadModelRequestDeserializer + ); + + protected static void setupUnloadModelRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::modelIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "model_ids"); + op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.unload_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + final int _modelId = 1 << 0; + + int propsSet = 0; + + if (request.modelId() != null) propsSet |= _modelId; + + if (propsSet == 0) { + return "/_plugins/_ml/models/_unload"; + } + if (propsSet == (_modelId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/_unload"); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UnloadModelResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.modelId); + result = 31 * result + Objects.hashCode(this.modelIds); + result = 31 * result + Objects.hashCode(this.nodeIds); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UnloadModelRequest other = (UnloadModelRequest) o; + return Objects.equals(this.modelId, other.modelId) + && Objects.equals(this.modelIds, other.modelIds) + && Objects.equals(this.nodeIds, other.nodeIds); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelResponse.java new file mode 100644 index 0000000000..00cb0f71dc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UnloadModelResponse.java @@ -0,0 +1,81 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.unload_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UnloadModelResponse extends DictionaryResponse { + // --------------------------------------------------------------------------------------------- + + private UnloadModelResponse(Builder builder) { + super(builder); + } + + public static UnloadModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link UnloadModelResponse}. + */ + public static class Builder extends DictionaryResponse.AbstractBuilder + implements + ObjectBuilder { + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UnloadModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public UnloadModelResponse build() { + _checkSingleUse(); + super.tKeySerializer(null); + super.tValueSerializer(null); + + return new UnloadModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UnloadModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UnloadModelResponse::setupUnloadModelResponseDeserializer + ); + + protected static void setupUnloadModelResponseDeserializer(ObjectDeserializer op) { + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), UnloadModelNode._DESERIALIZER); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorRequest.java new file mode 100644 index 0000000000..9698b891f9 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorRequest.java @@ -0,0 +1,655 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_connector.Request + +/** + * Updates a standalone connector. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateConnectorRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String accessMode; + + @Nonnull + private final List actions; + + @Nonnull + private final List backendRoles; + + @Nonnull + private final String connectorId; + + @Nullable + private final Credential credential; + + @Nullable + private final String description; + + @Nullable + private final String name; + + @Nonnull + private final Map parameters; + + @Nullable + private final Boolean parametersSkipValidatingMissingParameters; + + @Nullable + private final String protocol; + + @Nullable + private final Long version; + + // --------------------------------------------------------------------------------------------- + + private UpdateConnectorRequest(Builder builder) { + super(builder); + this.accessMode = builder.accessMode; + this.actions = ApiTypeHelper.unmodifiable(builder.actions); + this.backendRoles = ApiTypeHelper.unmodifiable(builder.backendRoles); + this.connectorId = ApiTypeHelper.requireNonNull(builder.connectorId, this, "connectorId"); + this.credential = builder.credential; + this.description = builder.description; + this.name = builder.name; + this.parameters = ApiTypeHelper.unmodifiable(builder.parameters); + this.parametersSkipValidatingMissingParameters = builder.parametersSkipValidatingMissingParameters; + this.protocol = builder.protocol; + this.version = builder.version; + } + + public static UpdateConnectorRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model group access mode. + *

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

+ */ + @Nullable + public final String accessMode() { + return this.accessMode; + } + + /** + * API name: {@code actions} + */ + @Nonnull + public final List actions() { + return this.actions; + } + + /** + * The backend roles. + *

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

+ */ + @Nonnull + public final List backendRoles() { + return this.backendRoles; + } + + /** + * Required - API name: {@code connector_id} + */ + @Nonnull + public final String connectorId() { + return this.connectorId; + } + + /** + * API name: {@code credential} + */ + @Nullable + public final Credential credential() { + return this.credential; + } + + /** + * The connector description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * API name: {@code parameters} + */ + @Nonnull + public final Map parameters() { + return this.parameters; + } + + /** + * Whether to skip validating missing parameters. + *

+ * API name: {@code parameters.skip_validating_missing_parameters} + *

+ */ + @Nullable + public final Boolean parametersSkipValidatingMissingParameters() { + return this.parametersSkipValidatingMissingParameters; + } + + /** + * The connector protocol. + *

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

+ */ + @Nullable + public final String protocol() { + return this.protocol; + } + + /** + * API name: {@code version} + */ + @Nullable + public final Long 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 (this.accessMode != null) { + generator.writeKey("access_mode"); + generator.write(this.accessMode); + } + + if (ApiTypeHelper.isDefined(this.actions)) { + generator.writeKey("actions"); + generator.writeStartArray(); + for (Action item0 : this.actions) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.backendRoles)) { + generator.writeKey("backend_roles"); + generator.writeStartArray(); + for (String item0 : this.backendRoles) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.credential != null) { + generator.writeKey("credential"); + this.credential.serialize(generator, mapper); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (ApiTypeHelper.isDefined(this.parameters)) { + generator.writeKey("parameters"); + generator.writeStartObject(); + for (Map.Entry item0 : this.parameters.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.parametersSkipValidatingMissingParameters != null) { + generator.writeKey("parameters.skip_validating_missing_parameters"); + generator.write(this.parametersSkipValidatingMissingParameters); + } + + if (this.protocol != null) { + generator.writeKey("protocol"); + generator.write(this.protocol); + } + + 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 UpdateConnectorRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String accessMode; + @Nullable + private List actions; + @Nullable + private List backendRoles; + private String connectorId; + @Nullable + private Credential credential; + @Nullable + private String description; + @Nullable + private String name; + @Nullable + private Map parameters; + @Nullable + private Boolean parametersSkipValidatingMissingParameters; + @Nullable + private String protocol; + @Nullable + private Long version; + + public Builder() {} + + private Builder(UpdateConnectorRequest o) { + super(o); + this.accessMode = o.accessMode; + this.actions = _listCopy(o.actions); + this.backendRoles = _listCopy(o.backendRoles); + this.connectorId = o.connectorId; + this.credential = o.credential; + this.description = o.description; + this.name = o.name; + this.parameters = _mapCopy(o.parameters); + this.parametersSkipValidatingMissingParameters = o.parametersSkipValidatingMissingParameters; + this.protocol = o.protocol; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.accessMode = o.accessMode; + this.actions = _listCopy(o.actions); + this.backendRoles = _listCopy(o.backendRoles); + this.connectorId = o.connectorId; + this.credential = o.credential; + this.description = o.description; + this.name = o.name; + this.parameters = _mapCopy(o.parameters); + this.parametersSkipValidatingMissingParameters = o.parametersSkipValidatingMissingParameters; + this.protocol = o.protocol; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The model group access mode. + *

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

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

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

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

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

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

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

+ */ + @Nonnull + public final Builder actions(Function> fn) { + return actions(fn.apply(new Action.Builder()).build()); + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder backendRoles(List list) { + this.backendRoles = _listAddAll(this.backendRoles, list); + return this; + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder backendRoles(String value, String... values) { + this.backendRoles = _listAdd(this.backendRoles, value, values); + return this; + } + + /** + * Required - API name: {@code connector_id} + */ + @Nonnull + public final Builder connectorId(String value) { + this.connectorId = value; + return this; + } + + /** + * API name: {@code credential} + */ + @Nonnull + public final Builder credential(@Nullable Credential value) { + this.credential = value; + return this; + } + + /** + * API name: {@code credential} + */ + @Nonnull + public final Builder credential(Function> fn) { + return credential(fn.apply(new Credential.Builder()).build()); + } + + /** + * The connector description. + *

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

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

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

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

+ * Adds an entry to parameters. + *

+ */ + @Nonnull + public final Builder parameters(String key, JsonData value) { + this.parameters = _mapPut(this.parameters, key, value); + return this; + } + + /** + * Whether to skip validating missing parameters. + *

+ * API name: {@code parameters.skip_validating_missing_parameters} + *

+ */ + @Nonnull + public final Builder parametersSkipValidatingMissingParameters(@Nullable Boolean value) { + this.parametersSkipValidatingMissingParameters = value; + return this; + } + + /** + * The connector protocol. + *

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

+ */ + @Nonnull + public final Builder protocol(@Nullable String value) { + this.protocol = value; + return this; + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable Long value) { + this.version = value; + return this; + } + + /** + * Builds a {@link UpdateConnectorRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateConnectorRequest build() { + _checkSingleUse(); + + return new UpdateConnectorRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateConnectorRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateConnectorRequest::setupUpdateConnectorRequestDeserializer + ); + + protected static void setupUpdateConnectorRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::accessMode, JsonpDeserializer.stringDeserializer(), "access_mode"); + op.add(Builder::actions, JsonpDeserializer.arrayDeserializer(Action._DESERIALIZER), "actions"); + op.add(Builder::backendRoles, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "backend_roles"); + op.add(Builder::credential, Credential._DESERIALIZER, "credential"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::parameters, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "parameters"); + op.add( + Builder::parametersSkipValidatingMissingParameters, + JsonpDeserializer.booleanDeserializer(), + "parameters.skip_validating_missing_parameters" + ); + op.add(Builder::protocol, JsonpDeserializer.stringDeserializer(), "protocol"); + op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_connector}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/connectors/"); + SimpleEndpoint.pathEncode(request.connectorId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateConnectorResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.accessMode); + result = 31 * result + Objects.hashCode(this.actions); + result = 31 * result + Objects.hashCode(this.backendRoles); + result = 31 * result + this.connectorId.hashCode(); + result = 31 * result + Objects.hashCode(this.credential); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.parameters); + result = 31 * result + Objects.hashCode(this.parametersSkipValidatingMissingParameters); + result = 31 * result + Objects.hashCode(this.protocol); + 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; + UpdateConnectorRequest other = (UpdateConnectorRequest) o; + return Objects.equals(this.accessMode, other.accessMode) + && Objects.equals(this.actions, other.actions) + && Objects.equals(this.backendRoles, other.backendRoles) + && this.connectorId.equals(other.connectorId) + && Objects.equals(this.credential, other.credential) + && Objects.equals(this.description, other.description) + && Objects.equals(this.name, other.name) + && Objects.equals(this.parameters, other.parameters) + && Objects.equals(this.parametersSkipValidatingMissingParameters, other.parametersSkipValidatingMissingParameters) + && Objects.equals(this.protocol, other.protocol) + && Objects.equals(this.version, other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorResponse.java new file mode 100644 index 0000000000..d847c5fd3c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateConnectorResponse.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_connector.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateConnectorResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private UpdateConnectorResponse(Builder builder) { + super(builder); + } + + public static UpdateConnectorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateConnectorResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(UpdateConnectorResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UpdateConnectorResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateConnectorResponse build() { + _checkSingleUse(); + + return new UpdateConnectorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateConnectorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateConnectorResponse::setupUpdateConnectorResponseDeserializer + ); + + protected static void setupUpdateConnectorResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerRequest.java new file mode 100644 index 0000000000..ab0f5a4ce5 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerRequest.java @@ -0,0 +1,268 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.update_controller.Request + +/** + * Updates a controller. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateControllerRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String modelId; + + @Nonnull + private final Map userRateLimiter; + + // --------------------------------------------------------------------------------------------- + + private UpdateControllerRequest(Builder builder) { + super(builder); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.userRateLimiter = ApiTypeHelper.unmodifiable(builder.userRateLimiter); + } + + public static UpdateControllerRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * API name: {@code user_rate_limiter} + */ + @Nonnull + public final Map userRateLimiter() { + return this.userRateLimiter; + } + + /** + * 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.userRateLimiter)) { + generator.writeKey("user_rate_limiter"); + generator.writeStartObject(); + for (Map.Entry item0 : this.userRateLimiter.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateControllerRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String modelId; + @Nullable + private Map userRateLimiter; + + public Builder() {} + + private Builder(UpdateControllerRequest o) { + super(o); + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + private Builder(Builder o) { + super(o); + this.modelId = o.modelId; + this.userRateLimiter = _mapCopy(o.userRateLimiter); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

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

+ * Adds an entry to userRateLimiter. + *

+ */ + @Nonnull + public final Builder userRateLimiter(String key, RateLimiter value) { + this.userRateLimiter = _mapPut(this.userRateLimiter, key, value); + return this; + } + + /** + * API name: {@code user_rate_limiter} + * + *

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

+ */ + @Nonnull + public final Builder userRateLimiter(String key, Function> fn) { + return userRateLimiter(key, fn.apply(new RateLimiter.Builder()).build()); + } + + /** + * Builds a {@link UpdateControllerRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateControllerRequest build() { + _checkSingleUse(); + + return new UpdateControllerRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateControllerRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateControllerRequest::setupUpdateControllerRequestDeserializer + ); + + protected static void setupUpdateControllerRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::userRateLimiter, JsonpDeserializer.stringMapDeserializer(RateLimiter._DESERIALIZER), "user_rate_limiter"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_controller}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/controllers/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateControllerResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + Objects.hashCode(this.userRateLimiter); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateControllerRequest other = (UpdateControllerRequest) o; + return this.modelId.equals(other.modelId) && Objects.equals(this.userRateLimiter, other.userRateLimiter); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerResponse.java new file mode 100644 index 0000000000..7321680ad1 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateControllerResponse.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_controller.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateControllerResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private UpdateControllerResponse(Builder builder) { + super(builder); + } + + public static UpdateControllerResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateControllerResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(UpdateControllerResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UpdateControllerResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateControllerResponse build() { + _checkSingleUse(); + + return new UpdateControllerResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateControllerResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateControllerResponse::setupUpdateControllerResponseDeserializer + ); + + protected static void setupUpdateControllerResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryRequest.java new file mode 100644 index 0000000000..19e95dae5a --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryRequest.java @@ -0,0 +1,234 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.update_memory.Request + +/** + * Update a memory. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateMemoryRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String memoryId; + + @Nullable + private final String name; + + // --------------------------------------------------------------------------------------------- + + private UpdateMemoryRequest(Builder builder) { + super(builder); + this.memoryId = ApiTypeHelper.requireNonNull(builder.memoryId, this, "memoryId"); + this.name = builder.name; + } + + public static UpdateMemoryRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final String memoryId() { + return this.memoryId; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * 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.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateMemoryRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String memoryId; + @Nullable + private String name; + + public Builder() {} + + private Builder(UpdateMemoryRequest o) { + super(o); + this.memoryId = o.memoryId; + this.name = o.name; + } + + private Builder(Builder o) { + super(o); + this.memoryId = o.memoryId; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - API name: {@code memory_id} + */ + @Nonnull + public final Builder memoryId(String value) { + this.memoryId = value; + return this; + } + + /** + * API name: {@code name} + */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link UpdateMemoryRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateMemoryRequest build() { + _checkSingleUse(); + + return new UpdateMemoryRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateMemoryRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateMemoryRequest::setupUpdateMemoryRequestDeserializer + ); + + protected static void setupUpdateMemoryRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_memory}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/"); + SimpleEndpoint.pathEncode(request.memoryId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateMemoryResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memoryId.hashCode(); + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateMemoryRequest other = (UpdateMemoryRequest) o; + return this.memoryId.equals(other.memoryId) && Objects.equals(this.name, other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryResponse.java new file mode 100644 index 0000000000..93b1f714cc --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMemoryResponse.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_memory.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateMemoryResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private UpdateMemoryResponse(Builder builder) { + super(builder); + } + + public static UpdateMemoryResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateMemoryResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(UpdateMemoryResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UpdateMemoryResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateMemoryResponse build() { + _checkSingleUse(); + + return new UpdateMemoryResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateMemoryResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateMemoryResponse::setupUpdateMemoryResponseDeserializer + ); + + protected static void setupUpdateMemoryResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageRequest.java new file mode 100644 index 0000000000..fa14abc82d --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageRequest.java @@ -0,0 +1,414 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_message.Request + +/** + * Update a message. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateMessageRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map additionalInfo; + + @Nullable + private final String input; + + @Nonnull + private final String messageId; + + @Nullable + private final String origin; + + @Nullable + private final String promptTemplate; + + @Nullable + private final String response; + + // --------------------------------------------------------------------------------------------- + + private UpdateMessageRequest(Builder builder) { + super(builder); + this.additionalInfo = ApiTypeHelper.unmodifiable(builder.additionalInfo); + this.input = builder.input; + this.messageId = ApiTypeHelper.requireNonNull(builder.messageId, this, "messageId"); + this.origin = builder.origin; + this.promptTemplate = builder.promptTemplate; + this.response = builder.response; + } + + public static UpdateMessageRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code additional_info} + */ + @Nonnull + public final Map additionalInfo() { + return this.additionalInfo; + } + + /** + * The question in the message. + *

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

+ */ + @Nullable + public final String input() { + return this.input; + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final String messageId() { + return this.messageId; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nullable + public final String origin() { + return this.origin; + } + + /** + * The prompt template. + *

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

+ */ + @Nullable + public final String promptTemplate() { + return this.promptTemplate; + } + + /** + * The answer to the question. + *

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

+ */ + @Nullable + public final String response() { + return this.response; + } + + /** + * 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.additionalInfo)) { + generator.writeKey("additional_info"); + generator.writeStartObject(); + for (Map.Entry item0 : this.additionalInfo.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.input != null) { + generator.writeKey("input"); + generator.write(this.input); + } + + if (this.origin != null) { + generator.writeKey("origin"); + generator.write(this.origin); + } + + if (this.promptTemplate != null) { + generator.writeKey("prompt_template"); + generator.write(this.promptTemplate); + } + + if (this.response != null) { + generator.writeKey("response"); + generator.write(this.response); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateMessageRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Map additionalInfo; + @Nullable + private String input; + private String messageId; + @Nullable + private String origin; + @Nullable + private String promptTemplate; + @Nullable + private String response; + + public Builder() {} + + private Builder(UpdateMessageRequest o) { + super(o); + this.additionalInfo = _mapCopy(o.additionalInfo); + this.input = o.input; + this.messageId = o.messageId; + this.origin = o.origin; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + } + + private Builder(Builder o) { + super(o); + this.additionalInfo = _mapCopy(o.additionalInfo); + this.input = o.input; + this.messageId = o.messageId; + this.origin = o.origin; + this.promptTemplate = o.promptTemplate; + this.response = o.response; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * API name: {@code additional_info} + * + *

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

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

+ * Adds an entry to additionalInfo. + *

+ */ + @Nonnull + public final Builder additionalInfo(String key, JsonData value) { + this.additionalInfo = _mapPut(this.additionalInfo, key, value); + return this; + } + + /** + * The question in the message. + *

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

+ */ + @Nonnull + public final Builder input(@Nullable String value) { + this.input = value; + return this; + } + + /** + * Required - API name: {@code message_id} + */ + @Nonnull + public final Builder messageId(String value) { + this.messageId = value; + return this; + } + + /** + * The system name that generated the response. + *

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

+ */ + @Nonnull + public final Builder origin(@Nullable String value) { + this.origin = value; + return this; + } + + /** + * The prompt template. + *

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

+ */ + @Nonnull + public final Builder promptTemplate(@Nullable String value) { + this.promptTemplate = value; + return this; + } + + /** + * The answer to the question. + *

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

+ */ + @Nonnull + public final Builder response(@Nullable String value) { + this.response = value; + return this; + } + + /** + * Builds a {@link UpdateMessageRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateMessageRequest build() { + _checkSingleUse(); + + return new UpdateMessageRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateMessageRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateMessageRequest::setupUpdateMessageRequestDeserializer + ); + + protected static void setupUpdateMessageRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::additionalInfo, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "additional_info"); + op.add(Builder::input, JsonpDeserializer.stringDeserializer(), "input"); + op.add(Builder::origin, JsonpDeserializer.stringDeserializer(), "origin"); + op.add(Builder::promptTemplate, JsonpDeserializer.stringDeserializer(), "prompt_template"); + op.add(Builder::response, JsonpDeserializer.stringDeserializer(), "response"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_message}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/memory/message/"); + SimpleEndpoint.pathEncode(request.messageId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateMessageResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.additionalInfo); + result = 31 * result + Objects.hashCode(this.input); + result = 31 * result + this.messageId.hashCode(); + result = 31 * result + Objects.hashCode(this.origin); + result = 31 * result + Objects.hashCode(this.promptTemplate); + result = 31 * result + Objects.hashCode(this.response); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateMessageRequest other = (UpdateMessageRequest) o; + return Objects.equals(this.additionalInfo, other.additionalInfo) + && Objects.equals(this.input, other.input) + && this.messageId.equals(other.messageId) + && Objects.equals(this.origin, other.origin) + && Objects.equals(this.promptTemplate, other.promptTemplate) + && Objects.equals(this.response, other.response); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageResponse.java new file mode 100644 index 0000000000..033e3ad0f3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateMessageResponse.java @@ -0,0 +1,130 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_message.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateMessageResponse extends WriteResponseBase + implements + ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private UpdateMessageResponse(Builder builder) { + super(builder); + } + + public static UpdateMessageResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateMessageResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(UpdateMessageResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UpdateMessageResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateMessageResponse build() { + _checkSingleUse(); + + return new UpdateMessageResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateMessageResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateMessageResponse::setupUpdateMessageResponseDeserializer + ); + + protected static void setupUpdateMessageResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupRequest.java new file mode 100644 index 0000000000..102b3d0553 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupRequest.java @@ -0,0 +1,485 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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.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: ml.update_model_group.Request + +/** + * Updates a model group. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateModelGroupRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Boolean addAllBackendRoles; + + @Nonnull + private final List addBackendRoles; + + @Nonnull + private final List backendRoles; + + @Nullable + private final String description; + + @Nullable + private final String modelAccessName; + + @Nonnull + private final String modelGroupId; + + @Nullable + private final String name; + + // --------------------------------------------------------------------------------------------- + + private UpdateModelGroupRequest(Builder builder) { + super(builder); + this.addAllBackendRoles = builder.addAllBackendRoles; + this.addBackendRoles = ApiTypeHelper.unmodifiable(builder.addBackendRoles); + this.backendRoles = ApiTypeHelper.unmodifiable(builder.backendRoles); + this.description = builder.description; + this.modelAccessName = builder.modelAccessName; + this.modelGroupId = ApiTypeHelper.requireNonNull(builder.modelGroupId, this, "modelGroupId"); + this.name = builder.name; + } + + public static UpdateModelGroupRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Whether to include all backend roles. + *

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

+ */ + @Nullable + public final Boolean addAllBackendRoles() { + return this.addAllBackendRoles; + } + + /** + * The backend roles to add. + *

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

+ */ + @Nonnull + public final List addBackendRoles() { + return this.addBackendRoles; + } + + /** + * The backend roles. + *

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

+ */ + @Nonnull + public final List backendRoles() { + return this.backendRoles; + } + + /** + * The model group description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * The model access name + *

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

+ */ + @Nullable + public final String modelAccessName() { + return this.modelAccessName; + } + + /** + * Required - API name: {@code model_group_id} + */ + @Nonnull + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * The model group name. + *

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

+ */ + @Nullable + public final String name() { + return this.name; + } + + /** + * 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.addAllBackendRoles != null) { + generator.writeKey("add_all_backend_roles"); + generator.write(this.addAllBackendRoles); + } + + if (ApiTypeHelper.isDefined(this.addBackendRoles)) { + generator.writeKey("add_backend_roles"); + generator.writeStartArray(); + for (String item0 : this.addBackendRoles) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (ApiTypeHelper.isDefined(this.backendRoles)) { + generator.writeKey("backend_roles"); + generator.writeStartArray(); + for (String item0 : this.backendRoles) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.modelAccessName != null) { + generator.writeKey("model_access_name"); + generator.write(this.modelAccessName); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateModelGroupRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Boolean addAllBackendRoles; + @Nullable + private List addBackendRoles; + @Nullable + private List backendRoles; + @Nullable + private String description; + @Nullable + private String modelAccessName; + private String modelGroupId; + @Nullable + private String name; + + public Builder() {} + + private Builder(UpdateModelGroupRequest o) { + super(o); + this.addAllBackendRoles = o.addAllBackendRoles; + this.addBackendRoles = _listCopy(o.addBackendRoles); + this.backendRoles = _listCopy(o.backendRoles); + this.description = o.description; + this.modelAccessName = o.modelAccessName; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + } + + private Builder(Builder o) { + super(o); + this.addAllBackendRoles = o.addAllBackendRoles; + this.addBackendRoles = _listCopy(o.addBackendRoles); + this.backendRoles = _listCopy(o.backendRoles); + this.description = o.description; + this.modelAccessName = o.modelAccessName; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Whether to include all backend roles. + *

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

+ */ + @Nonnull + public final Builder addAllBackendRoles(@Nullable Boolean value) { + this.addAllBackendRoles = value; + return this; + } + + /** + * The backend roles to add. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder addBackendRoles(List list) { + this.addBackendRoles = _listAddAll(this.addBackendRoles, list); + return this; + } + + /** + * The backend roles to add. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder addBackendRoles(String value, String... values) { + this.addBackendRoles = _listAdd(this.addBackendRoles, value, values); + return this; + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder backendRoles(List list) { + this.backendRoles = _listAddAll(this.backendRoles, list); + return this; + } + + /** + * The backend roles. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder backendRoles(String value, String... values) { + this.backendRoles = _listAdd(this.backendRoles, value, values); + return this; + } + + /** + * The model group description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * The model access name + *

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

+ */ + @Nonnull + public final Builder modelAccessName(@Nullable String value) { + this.modelAccessName = value; + return this; + } + + /** + * Required - API name: {@code model_group_id} + */ + @Nonnull + public final Builder modelGroupId(String value) { + this.modelGroupId = value; + return this; + } + + /** + * The model group name. + *

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

+ */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * Builds a {@link UpdateModelGroupRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateModelGroupRequest build() { + _checkSingleUse(); + + return new UpdateModelGroupRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateModelGroupRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateModelGroupRequest::setupUpdateModelGroupRequestDeserializer + ); + + protected static void setupUpdateModelGroupRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::addAllBackendRoles, JsonpDeserializer.booleanDeserializer(), "add_all_backend_roles"); + op.add(Builder::addBackendRoles, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "add_backend_roles"); + op.add(Builder::backendRoles, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "backend_roles"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelAccessName, JsonpDeserializer.stringDeserializer(), "model_access_name"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_model_group}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/model_groups/"); + SimpleEndpoint.pathEncode(request.modelGroupId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateModelGroupResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.addAllBackendRoles); + result = 31 * result + Objects.hashCode(this.addBackendRoles); + result = 31 * result + Objects.hashCode(this.backendRoles); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.modelAccessName); + result = 31 * result + this.modelGroupId.hashCode(); + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateModelGroupRequest other = (UpdateModelGroupRequest) o; + return Objects.equals(this.addAllBackendRoles, other.addAllBackendRoles) + && Objects.equals(this.addBackendRoles, other.addBackendRoles) + && Objects.equals(this.backendRoles, other.backendRoles) + && Objects.equals(this.description, other.description) + && Objects.equals(this.modelAccessName, other.modelAccessName) + && this.modelGroupId.equals(other.modelGroupId) + && Objects.equals(this.name, other.name); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupResponse.java new file mode 100644 index 0000000000..a20d6c9220 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelGroupResponse.java @@ -0,0 +1,172 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.update_model_group.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateModelGroupResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String status; + + // --------------------------------------------------------------------------------------------- + + private UpdateModelGroupResponse(Builder builder) { + this.status = builder.status; + } + + public static UpdateModelGroupResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The status. + *

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

+ */ + @Nullable + public final String status() { + return this.status; + } + + /** + * 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.status != null) { + generator.writeKey("status"); + generator.write(this.status); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateModelGroupResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String status; + + public Builder() {} + + private Builder(UpdateModelGroupResponse o) { + this.status = o.status; + } + + private Builder(Builder o) { + this.status = o.status; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * The status. + *

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

+ */ + @Nonnull + public final Builder status(@Nullable String value) { + this.status = value; + return this; + } + + /** + * Builds a {@link UpdateModelGroupResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateModelGroupResponse build() { + _checkSingleUse(); + + return new UpdateModelGroupResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateModelGroupResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateModelGroupResponse::setupUpdateModelGroupResponseDeserializer + ); + + protected static void setupUpdateModelGroupResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.status); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateModelGroupResponse other = (UpdateModelGroupResponse) o; + return Objects.equals(this.status, other.status); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelRequest.java new file mode 100644 index 0000000000..26277ba757 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelRequest.java @@ -0,0 +1,610 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.json.JsonData; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_model.Request + +/** + * Updates a model. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UpdateModelRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map connector; + + @Nullable + private final String connectorId; + + @Nullable + private final String description; + + @Nullable + private final Guardrails guardrails; + + @Nonnull + private final Map interface_; + + @Nullable + private final Boolean isEnabled; + + @Nullable + private final ModelConfig modelConfig; + + @Nonnull + private final String modelId; + + @Nullable + private final String name; + + @Nullable + private final RateLimiter rateLimiter; + + // --------------------------------------------------------------------------------------------- + + private UpdateModelRequest(Builder builder) { + super(builder); + this.connector = ApiTypeHelper.unmodifiable(builder.connector); + this.connectorId = builder.connectorId; + this.description = builder.description; + this.guardrails = builder.guardrails; + this.interface_ = ApiTypeHelper.unmodifiable(builder.interface_); + this.isEnabled = builder.isEnabled; + this.modelConfig = builder.modelConfig; + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.name = builder.name; + this.rateLimiter = builder.rateLimiter; + } + + public static UpdateModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The connector to use for the model. + *

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

+ */ + @Nonnull + public final Map connector() { + return this.connector; + } + + /** + * The connector ID. + *

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

+ */ + @Nullable + public final String connectorId() { + return this.connectorId; + } + + /** + * The model description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code guardrails} + */ + @Nullable + public final Guardrails guardrails() { + return this.guardrails; + } + + /** + * The model interface. + *

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

+ */ + @Nonnull + public final Map interface_() { + return this.interface_; + } + + /** + * Whether the model is enabled. + *

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

+ */ + @Nullable + public final Boolean isEnabled() { + return this.isEnabled; + } + + /** + * API name: {@code model_config} + */ + @Nullable + public final ModelConfig modelConfig() { + return this.modelConfig; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final String modelId() { + return this.modelId; + } + + /** + * The model name. + *

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

+ */ + @Nullable + public final String name() { + return this.name; + } + + /** + * API name: {@code rate_limiter} + */ + @Nullable + public final RateLimiter rateLimiter() { + return this.rateLimiter; + } + + /** + * 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.connector)) { + generator.writeKey("connector"); + generator.writeStartObject(); + for (Map.Entry item0 : this.connector.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.connectorId != null) { + generator.writeKey("connector_id"); + generator.write(this.connectorId); + } + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.guardrails != null) { + generator.writeKey("guardrails"); + this.guardrails.serialize(generator, mapper); + } + + if (ApiTypeHelper.isDefined(this.interface_)) { + generator.writeKey("interface"); + generator.writeStartObject(); + for (Map.Entry item0 : this.interface_.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.isEnabled != null) { + generator.writeKey("is_enabled"); + generator.write(this.isEnabled); + } + + if (this.modelConfig != null) { + generator.writeKey("model_config"); + this.modelConfig.serialize(generator, mapper); + } + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + } + + if (this.rateLimiter != null) { + generator.writeKey("rate_limiter"); + this.rateLimiter.serialize(generator, mapper); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateModelRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private Map connector; + @Nullable + private String connectorId; + @Nullable + private String description; + @Nullable + private Guardrails guardrails; + @Nullable + private Map interface_; + @Nullable + private Boolean isEnabled; + @Nullable + private ModelConfig modelConfig; + private String modelId; + @Nullable + private String name; + @Nullable + private RateLimiter rateLimiter; + + public Builder() {} + + private Builder(UpdateModelRequest o) { + super(o); + this.connector = _mapCopy(o.connector); + this.connectorId = o.connectorId; + this.description = o.description; + this.guardrails = o.guardrails; + this.interface_ = _mapCopy(o.interface_); + this.isEnabled = o.isEnabled; + this.modelConfig = o.modelConfig; + this.modelId = o.modelId; + this.name = o.name; + this.rateLimiter = o.rateLimiter; + } + + private Builder(Builder o) { + super(o); + this.connector = _mapCopy(o.connector); + this.connectorId = o.connectorId; + this.description = o.description; + this.guardrails = o.guardrails; + this.interface_ = _mapCopy(o.interface_); + this.isEnabled = o.isEnabled; + this.modelConfig = o.modelConfig; + this.modelId = o.modelId; + this.name = o.name; + this.rateLimiter = o.rateLimiter; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The connector to use for the model. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder connector(Map map) { + this.connector = _mapPutAll(this.connector, map); + return this; + } + + /** + * The connector to use for the model. + *

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

+ * + *

+ * Adds an entry to connector. + *

+ */ + @Nonnull + public final Builder connector(String key, JsonData value) { + this.connector = _mapPut(this.connector, key, value); + return this; + } + + /** + * The connector ID. + *

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

+ */ + @Nonnull + public final Builder connectorId(@Nullable String value) { + this.connectorId = value; + return this; + } + + /** + * The model description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code guardrails} + */ + @Nonnull + public final Builder guardrails(@Nullable Guardrails value) { + this.guardrails = value; + return this; + } + + /** + * API name: {@code guardrails} + */ + @Nonnull + public final Builder guardrails(Function> fn) { + return guardrails(fn.apply(new Guardrails.Builder()).build()); + } + + /** + * The model interface. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder interface_(Map map) { + this.interface_ = _mapPutAll(this.interface_, map); + return this; + } + + /** + * The model interface. + *

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

+ * + *

+ * Adds an entry to interface_. + *

+ */ + @Nonnull + public final Builder interface_(String key, JsonData value) { + this.interface_ = _mapPut(this.interface_, key, value); + return this; + } + + /** + * Whether the model is enabled. + *

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

+ */ + @Nonnull + public final Builder isEnabled(@Nullable Boolean value) { + this.isEnabled = value; + return this; + } + + /** + * API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(@Nullable ModelConfig value) { + this.modelConfig = value; + return this; + } + + /** + * API name: {@code model_config} + */ + @Nonnull + public final Builder modelConfig(Function> fn) { + return modelConfig(fn.apply(new ModelConfig.Builder()).build()); + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * The model name. + *

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

+ */ + @Nonnull + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + /** + * API name: {@code rate_limiter} + */ + @Nonnull + public final Builder rateLimiter(@Nullable RateLimiter value) { + this.rateLimiter = value; + return this; + } + + /** + * API name: {@code rate_limiter} + */ + @Nonnull + public final Builder rateLimiter(Function> fn) { + return rateLimiter(fn.apply(new RateLimiter.Builder()).build()); + } + + /** + * Builds a {@link UpdateModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateModelRequest build() { + _checkSingleUse(); + + return new UpdateModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateModelRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateModelRequest::setupUpdateModelRequestDeserializer + ); + + protected static void setupUpdateModelRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::connector, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "connector"); + op.add(Builder::connectorId, JsonpDeserializer.stringDeserializer(), "connector_id"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::guardrails, Guardrails._DESERIALIZER, "guardrails"); + op.add(Builder::interface_, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "interface"); + op.add(Builder::isEnabled, JsonpDeserializer.booleanDeserializer(), "is_enabled"); + op.add(Builder::modelConfig, ModelConfig._DESERIALIZER, "model_config"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::rateLimiter, RateLimiter._DESERIALIZER, "rate_limiter"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.update_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "PUT", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UpdateModelResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.connector); + result = 31 * result + Objects.hashCode(this.connectorId); + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.guardrails); + result = 31 * result + Objects.hashCode(this.interface_); + result = 31 * result + Objects.hashCode(this.isEnabled); + result = 31 * result + Objects.hashCode(this.modelConfig); + result = 31 * result + this.modelId.hashCode(); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + Objects.hashCode(this.rateLimiter); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UpdateModelRequest other = (UpdateModelRequest) o; + return Objects.equals(this.connector, other.connector) + && Objects.equals(this.connectorId, other.connectorId) + && Objects.equals(this.description, other.description) + && Objects.equals(this.guardrails, other.guardrails) + && Objects.equals(this.interface_, other.interface_) + && Objects.equals(this.isEnabled, other.isEnabled) + && Objects.equals(this.modelConfig, other.modelConfig) + && this.modelId.equals(other.modelId) + && Objects.equals(this.name, other.name) + && Objects.equals(this.rateLimiter, other.rateLimiter); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelResponse.java new file mode 100644 index 0000000000..db299e6373 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UpdateModelResponse.java @@ -0,0 +1,128 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.WriteResponseBase; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.update_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UpdateModelResponse extends WriteResponseBase implements ToCopyableBuilder { + + // --------------------------------------------------------------------------------------------- + + private UpdateModelResponse(Builder builder) { + super(builder); + } + + public static UpdateModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UpdateModelResponse}. + */ + public static class Builder extends WriteResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(UpdateModelResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Builds a {@link UpdateModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UpdateModelResponse build() { + _checkSingleUse(); + + return new UpdateModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UpdateModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UpdateModelResponse::setupUpdateModelResponseDeserializer + ); + + protected static void setupUpdateModelResponseDeserializer(ObjectDeserializer op) { + setupWriteResponseBaseDeserializer(op); + } + + @Override + public int hashCode() { + int result = super.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkRequest.java new file mode 100644 index 0000000000..5215f5f094 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkRequest.java @@ -0,0 +1,260 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +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.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: ml.upload_chunk.Request + +/** + * Uploads model chunk. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UploadChunkRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final String chunk; + + private final long chunkNumber; + + @Nonnull + private final String modelId; + + // --------------------------------------------------------------------------------------------- + + private UploadChunkRequest(Builder builder) { + super(builder); + this.chunk = ApiTypeHelper.requireNonNull(builder.chunk, this, "chunk"); + this.chunkNumber = ApiTypeHelper.requireNonNull(builder.chunkNumber, this, "chunkNumber"); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + } + + public static UploadChunkRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The model chunk. + *

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

+ */ + @Nonnull + public final String chunk() { + return this.chunk; + } + + /** + * Required - API name: {@code chunk_number} + */ + public final long chunkNumber() { + return this.chunkNumber; + } + + /** + * 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("chunk"); + generator.write(this.chunk); + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UploadChunkRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + private String chunk; + private Long chunkNumber; + private String modelId; + + public Builder() {} + + private Builder(UploadChunkRequest o) { + super(o); + this.chunk = o.chunk; + this.chunkNumber = o.chunkNumber; + this.modelId = o.modelId; + } + + private Builder(Builder o) { + super(o); + this.chunk = o.chunk; + this.chunkNumber = o.chunkNumber; + this.modelId = o.modelId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * Required - The model chunk. + *

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

+ */ + @Nonnull + public final Builder chunk(String value) { + this.chunk = value; + return this; + } + + /** + * Required - API name: {@code chunk_number} + */ + @Nonnull + public final Builder chunkNumber(long value) { + this.chunkNumber = value; + return this; + } + + /** + * Required - API name: {@code model_id} + */ + @Nonnull + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Builds a {@link UploadChunkRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UploadChunkRequest build() { + _checkSingleUse(); + + return new UploadChunkRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UploadChunkRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UploadChunkRequest::setupUploadChunkRequestDeserializer + ); + + protected static void setupUploadChunkRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::chunk, JsonpDeserializer.stringDeserializer(), "chunk"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.upload_chunk}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_plugins/_ml/models/"); + SimpleEndpoint.pathEncode(request.modelId, buf); + buf.append("/upload_chunk/"); + SimpleEndpoint.pathEncode(String.valueOf(request.chunkNumber), buf); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UploadChunkResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.chunk.hashCode(); + result = 31 * result + Long.hashCode(this.chunkNumber); + 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; + UploadChunkRequest other = (UploadChunkRequest) o; + return this.chunk.equals(other.chunk) && this.chunkNumber == other.chunkNumber && this.modelId.equals(other.modelId); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkResponse.java new file mode 100644 index 0000000000..487724216f --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadChunkResponse.java @@ -0,0 +1,165 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.upload_chunk.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UploadChunkResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String status; + + // --------------------------------------------------------------------------------------------- + + private UploadChunkResponse(Builder builder) { + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + } + + public static UploadChunkResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The status of the chunk upload operation. + *

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

+ */ + @Nonnull + public final String status() { + return this.status; + } + + /** + * 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("status"); + generator.write(this.status); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UploadChunkResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String status; + + public Builder() {} + + private Builder(UploadChunkResponse o) { + this.status = o.status; + } + + private Builder(Builder o) { + this.status = o.status; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The status of the chunk upload operation. + *

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

+ */ + @Nonnull + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Builds a {@link UploadChunkResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UploadChunkResponse build() { + _checkSingleUse(); + + return new UploadChunkResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UploadChunkResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UploadChunkResponse::setupUploadChunkResponseDeserializer + ); + + protected static void setupUploadChunkResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.status.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UploadChunkResponse other = (UploadChunkResponse) o; + return this.status.equals(other.status); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelRequest.java new file mode 100644 index 0000000000..148e44a403 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelRequest.java @@ -0,0 +1,342 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +import jakarta.json.stream.JsonGenerator; +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.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.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: ml.upload_model.Request + +/** + * Registers a model. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public final class UploadModelRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String description; + + @Nullable + private final ModelFormat modelFormat; + + @Nullable + private final String modelGroupId; + + @Nonnull + private final String name; + + @Nonnull + private final String version; + + // --------------------------------------------------------------------------------------------- + + private UploadModelRequest(Builder builder) { + super(builder); + this.description = builder.description; + this.modelFormat = builder.modelFormat; + this.modelGroupId = builder.modelGroupId; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + } + + public static UploadModelRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The model description. + *

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

+ */ + @Nullable + public final String description() { + return this.description; + } + + /** + * API name: {@code model_format} + */ + @Nullable + public final ModelFormat modelFormat() { + return this.modelFormat; + } + + /** + * API name: {@code model_group_id} + */ + @Nullable + public final String modelGroupId() { + return this.modelGroupId; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final String 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 (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + } + + if (this.modelFormat != null) { + generator.writeKey("model_format"); + this.modelFormat.serialize(generator, mapper); + } + + if (this.modelGroupId != null) { + generator.writeKey("model_group_id"); + generator.write(this.modelGroupId); + } + + generator.writeKey("name"); + generator.write(this.name); + + 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 UploadModelRequest}. + */ + public static class Builder extends RequestBase.AbstractBuilder implements CopyableBuilder { + @Nullable + private String description; + @Nullable + private ModelFormat modelFormat; + @Nullable + private String modelGroupId; + private String name; + private String version; + + public Builder() {} + + private Builder(UploadModelRequest o) { + super(o); + this.description = o.description; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.version = o.version; + } + + private Builder(Builder o) { + super(o); + this.description = o.description; + this.modelFormat = o.modelFormat; + this.modelGroupId = o.modelGroupId; + this.name = o.name; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + + /** + * The model description. + *

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

+ */ + @Nonnull + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * API name: {@code model_format} + */ + @Nonnull + public final Builder modelFormat(@Nullable ModelFormat value) { + this.modelFormat = value; + return this; + } + + /** + * API name: {@code model_group_id} + */ + @Nonnull + public final Builder modelGroupId(@Nullable String value) { + this.modelGroupId = value; + return this; + } + + /** + * Required - The model name. + *

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

+ */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + @Nonnull + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link UploadModelRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UploadModelRequest build() { + _checkSingleUse(); + + return new UploadModelRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UploadModelRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UploadModelRequest::setupUploadModelRequestDeserializer + ); + + protected static void setupUploadModelRequestDeserializer(ObjectDeserializer op) { + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::modelFormat, ModelFormat._DESERIALIZER, "model_format"); + op.add(Builder::modelGroupId, JsonpDeserializer.stringDeserializer(), "model_group_id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code ml.upload_model}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> "/_plugins/_ml/models/_upload", + // Request parameters + request -> { + Map params = new HashMap<>(); + request.applyQueryParameters(params); + return params; + }, + SimpleEndpoint.emptyMap(), + true, + UploadModelResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.description); + result = 31 * result + Objects.hashCode(this.modelFormat); + result = 31 * result + Objects.hashCode(this.modelGroupId); + result = 31 * result + this.name.hashCode(); + result = 31 * result + this.version.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UploadModelRequest other = (UploadModelRequest) o; + return Objects.equals(this.description, other.description) + && Objects.equals(this.modelFormat, other.modelFormat) + && Objects.equals(this.modelGroupId, other.modelGroupId) + && this.name.equals(other.name) + && this.version.equals(other.version); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelResponse.java new file mode 100644 index 0000000000..cf87fa677c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/ml/UploadModelResponse.java @@ -0,0 +1,188 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.ml; + +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: ml.upload_model.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UploadModelResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String status; + + @Nonnull + private final String taskId; + + // --------------------------------------------------------------------------------------------- + + private UploadModelResponse(Builder builder) { + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskId = ApiTypeHelper.requireNonNull(builder.taskId, this, "taskId"); + } + + public static UploadModelResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final String status() { + return this.status; + } + + /** + * Required - API name: {@code task_id} + */ + @Nonnull + public final String taskId() { + return this.taskId; + } + + /** + * 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("status"); + generator.write(this.status); + + generator.writeKey("task_id"); + generator.write(this.taskId); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link UploadModelResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String status; + private String taskId; + + public Builder() {} + + private Builder(UploadModelResponse o) { + this.status = o.status; + this.taskId = o.taskId; + } + + private Builder(Builder o) { + this.status = o.status; + this.taskId = o.taskId; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code status} + */ + @Nonnull + public final Builder status(String value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code task_id} + */ + @Nonnull + public final Builder taskId(String value) { + this.taskId = value; + return this; + } + + /** + * Builds a {@link UploadModelResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public UploadModelResponse build() { + _checkSingleUse(); + + return new UploadModelResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link UploadModelResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + UploadModelResponse::setupUploadModelResponseDeserializer + ); + + protected static void setupUploadModelResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status"); + op.add(Builder::taskId, JsonpDeserializer.stringDeserializer(), "task_id"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.status.hashCode(); + result = 31 * result + this.taskId.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UploadModelResponse other = (UploadModelResponse) o; + return this.status.equals(other.status) && this.taskId.equals(other.taskId); + } +} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 132b59bce7..10c8907567 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -3646,7 +3646,7 @@ paths: operationId: asynchronous_search.search.0 x-operation-group: asynchronous_search.search x-version-added: '1.0' - description: Perform an asynchronous search. + description: Performs an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#rest-api parameters: @@ -3669,7 +3669,7 @@ paths: operationId: asynchronous_search.delete.0 x-operation-group: asynchronous_search.delete x-version-added: '1.0' - description: Delete asynchronous search. + description: Deletes any responses from an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#delete-searches-and-results parameters: @@ -3686,7 +3686,7 @@ paths: operationId: asynchronous_search.get.0 x-operation-group: asynchronous_search.get x-version-added: '1.0' - description: Get partial responses from asynchronous search. + description: Gets partial responses from an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#get-partial-results parameters: @@ -3704,7 +3704,7 @@ paths: operationId: asynchronous_search.stats.0 x-operation-group: asynchronous_search.stats x-version-added: '1.0' - description: Monitoring of asynchronous searches that are running, completed, and/or persisted. + description: Monitors any asynchronous searches that are `running`, `completed`, `persisted`. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#monitor-stats responses: @@ -4814,6 +4814,306 @@ paths: responses: '200': $ref: '#/components/responses/ml.update_connector___200' + /_plugins/_ml/controllers/{model_id}: + delete: + operationId: ml.delete_controller.0 + x-operation-group: ml.delete_controller + x-version-added: '2.12' + description: Deletes a controller. + parameters: + - $ref: '#/components/parameters/ml.delete_controller___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.delete_controller___200' + get: + operationId: ml.get_controller.0 + x-operation-group: ml.get_controller + x-version-added: '2.12' + description: Retrieves a controller. + parameters: + - $ref: '#/components/parameters/ml.get_controller___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_controller___200' + post: + operationId: ml.create_controller.0 + x-operation-group: ml.create_controller + x-version-added: '2.12' + description: Creates a controller. + requestBody: + $ref: '#/components/requestBodies/ml.create_controller' + parameters: + - $ref: '#/components/parameters/ml.create_controller___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.create_controller___200' + put: + operationId: ml.update_controller.0 + x-operation-group: ml.update_controller + x-version-added: '2.12' + description: Updates a controller. + requestBody: + $ref: '#/components/requestBodies/ml.update_controller' + parameters: + - $ref: '#/components/parameters/ml.update_controller___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.update_controller___200' + /_plugins/_ml/memory: + get: + operationId: ml.get_all_memories.0 + x-operation-group: ml.get_all_memories + x-version-added: '2.12' + description: Get all memories. + parameters: + - $ref: '#/components/parameters/ml.get_all_memories___query.max_results' + - $ref: '#/components/parameters/ml.get_all_memories___query.next_token' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_all_memories___200' + post: + operationId: ml.create_memory.0 + x-operation-group: ml.create_memory + x-version-added: '2.12' + description: Create a memory. + requestBody: + $ref: '#/components/requestBodies/ml.create_memory' + responses: + '200': + $ref: '#/components/responses/ml.create_memory___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/memory/_search: + get: + operationId: ml.search_memory.0 + x-operation-group: ml.search_memory + x-version-added: '2.12' + description: Search memory. + requestBody: + $ref: '#/components/requestBodies/ml.search_memory' + responses: + '200': + $ref: '#/components/responses/ml.search_memory___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + post: + operationId: ml.search_memory.1 + x-operation-group: ml.search_memory + x-version-added: '2.12' + description: Search memory. + requestBody: + $ref: '#/components/requestBodies/ml.search_memory' + responses: + '200': + $ref: '#/components/responses/ml.search_memory___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/memory/{memory_id}: + delete: + operationId: ml.delete_memory.0 + x-operation-group: ml.delete_memory + x-version-added: '2.12' + description: Delete a memory. + parameters: + - $ref: '#/components/parameters/ml.delete_memory___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.delete_memory___200' + get: + operationId: ml.get_memory.0 + x-operation-group: ml.get_memory + x-version-added: '2.12' + description: Get a memory. + parameters: + - $ref: '#/components/parameters/ml.get_memory___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_memory___200' + put: + operationId: ml.update_memory.0 + x-operation-group: ml.update_memory + x-version-added: '2.12' + description: Update a memory. + parameters: + - $ref: '#/components/parameters/ml.update_memory___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.update_memory' + responses: + '200': + $ref: '#/components/responses/ml.update_memory___200' + /_plugins/_ml/memory/{memory_id}/_search: + get: + operationId: ml.search_message.0 + x-operation-group: ml.search_message + x-version-added: '2.12' + description: Search messages. + parameters: + - $ref: '#/components/parameters/ml.search_message___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.search_message' + responses: + '200': + $ref: '#/components/responses/ml.search_message___200' + post: + operationId: ml.search_message.1 + x-operation-group: ml.search_message + x-version-added: '2.12' + description: Search messages. + parameters: + - $ref: '#/components/parameters/ml.search_message___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.search_message' + responses: + '200': + $ref: '#/components/responses/ml.search_message___200' + /_plugins/_ml/memory/{memory_id}/messages: + get: + operationId: ml.get_all_messages.0 + x-operation-group: ml.get_all_messages + x-version-added: '2.12' + description: Get all messages in a memory. + parameters: + - $ref: '#/components/parameters/ml.get_all_messages___path.memory_id' + - $ref: '#/components/parameters/ml.get_all_messages___query.max_results' + - $ref: '#/components/parameters/ml.get_all_messages___query.next_token' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_all_messages___200' + post: + operationId: ml.create_message.0 + x-operation-group: ml.create_message + x-version-added: '2.12' + description: Create a message. + parameters: + - $ref: '#/components/parameters/ml.create_message___path.memory_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.create_message' + responses: + '200': + $ref: '#/components/responses/ml.create_message___200' + /_plugins/_ml/memory/message/{message_id}: + get: + operationId: ml.get_message.0 + x-operation-group: ml.get_message + x-version-added: '2.12' + description: Get a message. + parameters: + - $ref: '#/components/parameters/ml.get_message___path.message_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_message___200' + put: + operationId: ml.update_message.0 + x-operation-group: ml.update_message + x-version-added: '2.12' + description: Update a message. + parameters: + - $ref: '#/components/parameters/ml.update_message___path.message_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.update_message' + responses: + '200': + $ref: '#/components/responses/ml.update_message___200' + /_plugins/_ml/memory/message/{message_id}/traces: + get: + operationId: ml.get_message_traces.0 + x-operation-group: ml.get_message_traces + x-version-added: '2.12' + description: Get a message traces. + parameters: + - $ref: '#/components/parameters/ml.get_message_traces___path.message_id' + - $ref: '#/components/parameters/ml.get_message_traces___query.max_results' + - $ref: '#/components/parameters/ml.get_message_traces___query.next_token' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_message_traces___200' /_plugins/_ml/model_groups/_register: post: operationId: ml.register_model_group.0 @@ -4913,6 +5213,7 @@ paths: post: operationId: ml.register_model.0 x-operation-group: ml.register_model + x-version-added: '2.7' description: Registers a model. requestBody: $ref: '#/components/requestBodies/ml.register_model' @@ -4925,10 +5226,44 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/models/_register_meta: + post: + operationId: ml.register_model_meta.0 + x-operation-group: ml.register_model_meta + x-version-added: '2.7' + description: Registers model metadata. + requestBody: + $ref: '#/components/requestBodies/ml.register_model_meta' + responses: + '200': + $ref: '#/components/responses/ml.register_model_meta___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' /_plugins/_ml/models/_search: get: operationId: ml.search_models.0 x-operation-group: ml.search_models + x-version-added: '1.3' + description: Searches for models. + requestBody: + $ref: '#/components/requestBodies/ml.search_models' + responses: + '200': + $ref: '#/components/responses/ml.search_models___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + post: + operationId: ml.search_models.1 + x-operation-group: ml.search_models + x-version-added: '1.3' description: Searches for models. requestBody: $ref: '#/components/requestBodies/ml.search_models' @@ -4941,10 +5276,66 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/models/_undeploy: + post: + operationId: ml.undeploy_model.1 + x-operation-group: ml.undeploy_model + x-version-added: '2.7' + description: Undeploys a model. + requestBody: + $ref: '#/components/requestBodies/ml.undeploy_model' + responses: + '200': + $ref: '#/components/responses/ml.undeploy_model___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/models/_unload: + post: + operationId: ml.unload_model.1 + x-operation-group: ml.unload_model + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `undeploy_model` instead. + description: Unloads a model. + requestBody: + $ref: '#/components/requestBodies/ml.unload_model' + responses: + '200': + $ref: '#/components/responses/ml.unload_model___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/models/_upload: + post: + operationId: ml.upload_model.0 + x-operation-group: ml.upload_model + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `register_model` instead. + description: Registers a model. + requestBody: + $ref: '#/components/requestBodies/ml.upload_model' + responses: + '200': + $ref: '#/components/responses/ml.upload_model___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' /_plugins/_ml/models/{model_id}: delete: operationId: ml.delete_model.0 x-operation-group: ml.delete_model + x-version-added: '1.3' description: Deletes a model. parameters: - $ref: '#/components/parameters/ml.delete_model___path.model_id' @@ -4956,10 +5347,43 @@ paths: responses: '200': $ref: '#/components/responses/ml.delete_model___200' + get: + operationId: ml.get_model.0 + x-operation-group: ml.get_model + x-version-added: '1.3' + description: Retrieves a model. + parameters: + - $ref: '#/components/parameters/ml.get_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_model___200' + put: + operationId: ml.update_model.0 + x-operation-group: ml.update_model + x-version-added: '2.12' + description: Updates a model. + parameters: + - $ref: '#/components/parameters/ml.update_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.update_model' + responses: + '200': + $ref: '#/components/responses/ml.update_model___200' /_plugins/_ml/models/{model_id}/_deploy: post: operationId: ml.deploy_model.0 x-operation-group: ml.deploy_model + x-version-added: '2.7' description: Deploys a model. parameters: - $ref: '#/components/parameters/ml.deploy_model___path.model_id' @@ -4971,10 +5395,47 @@ paths: responses: '200': $ref: '#/components/responses/ml.deploy_model___200' + /_plugins/_ml/models/{model_id}/_load: + post: + operationId: ml.load_model.0 + x-operation-group: ml.load_model + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `deploy_model` instead. + description: Deploys a model. + parameters: + - $ref: '#/components/parameters/ml.load_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.load_model___200' + /_plugins/_ml/models/{model_id}/_predict: + post: + operationId: ml.predict_model.0 + x-operation-group: ml.predict_model + x-version-added: '2.12' + description: Predicts a model. + parameters: + - $ref: '#/components/parameters/ml.predict_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.predict_model' + responses: + '200': + $ref: '#/components/responses/ml.predict_model___200' /_plugins/_ml/models/{model_id}/_undeploy: post: operationId: ml.undeploy_model.0 x-operation-group: ml.undeploy_model + x-version-added: '2.7' description: Undeploys a model. parameters: - $ref: '#/components/parameters/ml.undeploy_model___path.model_id' @@ -4983,9 +5444,177 @@ paths: - $ref: '#/components/parameters/_global___query.error_trace' - $ref: '#/components/parameters/_global___query.source' - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.undeploy_model' responses: '200': $ref: '#/components/responses/ml.undeploy_model___200' + /_plugins/_ml/models/{model_id}/_unload: + post: + operationId: ml.unload_model.0 + x-operation-group: ml.unload_model + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `undeploy_model` instead. + description: Unloads a model. + parameters: + - $ref: '#/components/parameters/ml.unload_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.unload_model' + responses: + '200': + $ref: '#/components/responses/ml.unload_model___200' + /_plugins/_ml/models/{model_id}/chunk/{chunk_number}: + post: + operationId: ml.chunk_model.0 + x-operation-group: ml.chunk_model + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `upload_chunk` instead. + description: Uploads model chunk. + parameters: + - $ref: '#/components/parameters/ml.chunk_model___path.chunk_number' + - $ref: '#/components/parameters/ml.chunk_model___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.chunk_model' + responses: + '200': + $ref: '#/components/responses/ml.chunk_model___200' + /_plugins/_ml/models/{model_id}/upload_chunk/{chunk_number}: + post: + operationId: ml.upload_chunk.0 + x-operation-group: ml.upload_chunk + x-version-added: '2.7' + description: Uploads model chunk. + parameters: + - $ref: '#/components/parameters/ml.upload_chunk___path.chunk_number' + - $ref: '#/components/parameters/ml.upload_chunk___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ml.upload_chunk' + responses: + '200': + $ref: '#/components/responses/ml.upload_chunk___200' + /_plugins/_ml/models/meta: + post: + operationId: ml.create_model_meta.0 + x-operation-group: ml.create_model_meta + deprecated: true + x-version-deprecated: '2.7' + x-deprecation-message: Use `_register_meta` instead. + description: Registers model metadata. + requestBody: + $ref: '#/components/requestBodies/ml.create_model_meta' + responses: + '200': + $ref: '#/components/responses/ml.create_model_meta___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/profile: + get: + operationId: ml.get_profile.0 + x-operation-group: ml.get_profile + x-version-added: '2.4' + description: Get a profile. + requestBody: + $ref: '#/components/requestBodies/ml.get_profile' + responses: + '200': + $ref: '#/components/responses/ml.get_profile___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/profile/models: + get: + operationId: ml.get_profile_models.0 + x-operation-group: ml.get_profile_models + x-version-added: '2.4' + description: Get a profile models. + requestBody: + $ref: '#/components/requestBodies/ml.get_profile_models' + responses: + '200': + $ref: '#/components/responses/ml.get_profile_models___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/profile/models/{model_id}: + get: + operationId: ml.get_profile_models.1 + x-operation-group: ml.get_profile_models + x-version-added: '2.11' + description: Get a profile models. + requestBody: + $ref: '#/components/requestBodies/ml.get_profile_models' + parameters: + - $ref: '#/components/parameters/ml.get_profile_models___path.model_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_profile_models___200' + /_plugins/_ml/profile/tasks: + get: + operationId: ml.get_profile_tasks.0 + x-operation-group: ml.get_profile_tasks + x-version-added: '2.4' + description: Get a profile tasks. + requestBody: + $ref: '#/components/requestBodies/ml.get_profile_tasks' + responses: + '200': + $ref: '#/components/responses/ml.get_profile_tasks___200' + parameters: + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + /_plugins/_ml/profile/tasks/{task_id}: + get: + operationId: ml.get_profile_tasks.1 + x-operation-group: ml.get_profile_tasks + x-version-added: '2.11' + description: Get a profile tasks. + requestBody: + $ref: '#/components/requestBodies/ml.get_profile_tasks' + parameters: + - $ref: '#/components/parameters/ml.get_profile_tasks___path.task_id' + - $ref: '#/components/parameters/_global___query.pretty' + - $ref: '#/components/parameters/_global___query.human' + - $ref: '#/components/parameters/_global___query.error_trace' + - $ref: '#/components/parameters/_global___query.source' + - $ref: '#/components/parameters/_global___query.filter_path' + responses: + '200': + $ref: '#/components/responses/ml.get_profile_tasks___200' /_plugins/_ml/tasks/{task_id}: delete: operationId: ml.delete_task.0 @@ -12652,7 +13281,7 @@ paths: operationId: asynchronous_search.search.0_superseded x-operation-group: asynchronous_search.search x-version-added: '1.0' - description: Perform an asynchronous search. + description: Performs an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#rest-api parameters: @@ -12677,7 +13306,7 @@ paths: operationId: asynchronous_search.stats.0_superseded x-operation-group: asynchronous_search.stats x-version-added: '1.0' - description: Monitoring of asynchronous searches that are running, completed, and/or persisted. + description: Monitors any asynchronous searches that are `running`, `completed`, `persisted`. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#monitor-stats responses: @@ -12696,7 +13325,7 @@ paths: operationId: asynchronous_search.get.0_superseded x-operation-group: asynchronous_search.get x-version-added: '1.0' - description: Get partial responses from asynchronous search. + description: Gets partial responses from an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#get-partial-results parameters: @@ -12715,7 +13344,7 @@ paths: operationId: asynchronous_search.delete.0_superseded x-operation-group: asynchronous_search.delete x-version-added: '1.0' - description: Delete asynchronous search. + description: Deletes any responses from an asynchronous search. externalDocs: url: https://opensearch.org/docs/latest/search-plugins/async/index/#delete-searches-and-results parameters: @@ -15157,19 +15786,22 @@ components: asynchronous_search.search___query.keep_alive: name: keep_alive in: query - description: The amount of time that the result is saved in the cluster. For example, `2d` means that the results are stored in the cluster for 48 hours. The saved search results are deleted after this period or if the search is canceled. Note that this includes the query execution time. If the query overruns this time, the process cancels this query automatically. + description: |- + The amount of time that the result is saved in the cluster. For example, `2d` means that the results are stored in the cluster for 48 hours. + The saved search results are deleted after this period or if the search is canceled. Note that this includes the query execution time. + If the query overruns this time, the process cancels this query automatically. schema: type: string asynchronous_search.search___query.keep_on_completion: name: keep_on_completion in: query - description: Whether you want to save the results in the cluster after the search is complete. + description: Whether you want to save the results in the cluster after the search is complete. You can examine the stored results at a later time. schema: type: boolean asynchronous_search.search___query.wait_for_completion_timeout: name: wait_for_completion_timeout in: query - description: The amount of time that you plan to wait for the results. You can poll the remaining results based on an ID. The maximum value is `300s`. Default is `1s`. + description: The amount of time that you plan to wait for the results. You can poll the remaining results based on an ID. The maximum value is 300 seconds. Default is `1s`. schema: type: string bulk_stream___path.index: @@ -15456,11 +16088,11 @@ components: cat.all_pit_segments___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.all_pit_segments___query.s: name: s in: query @@ -15592,11 +16224,11 @@ components: cat.cluster_manager___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.cluster_manager___query.local: name: local in: query @@ -15664,11 +16296,11 @@ components: cat.count___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.count___query.s: name: s in: query @@ -15733,11 +16365,11 @@ components: cat.fielddata___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.fielddata___query.s: name: s in: query @@ -15778,11 +16410,11 @@ components: cat.health___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.health___query.s: name: s in: query @@ -15844,7 +16476,7 @@ components: cat.indices___query.expand_wildcards: in: query name: expand_wildcards - description: The type of index that wildcard patterns can match. + description: The type of index that wildcard patterns can match. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. schema: $ref: '#/components/schemas/_common___ExpandWildcards' style: form @@ -15876,11 +16508,11 @@ components: cat.indices___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.indices___query.include_unloaded_segments: in: query name: include_unloaded_segments @@ -15968,11 +16600,11 @@ components: cat.master___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.master___query.local: name: local in: query @@ -16037,11 +16669,11 @@ components: cat.nodeattrs___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.nodeattrs___query.local: name: local in: query @@ -16121,11 +16753,11 @@ components: cat.nodes___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.nodes___query.local: name: local in: query @@ -16199,11 +16831,11 @@ components: cat.pending_tasks___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.pending_tasks___query.local: name: local in: query @@ -16273,11 +16905,11 @@ components: cat.pit_segments___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.pit_segments___query.s: name: s in: query @@ -16325,11 +16957,11 @@ components: cat.plugins___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.plugins___query.local: name: local in: query @@ -16420,11 +17052,11 @@ components: cat.recovery___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.recovery___query.index: name: index in: query @@ -16493,11 +17125,11 @@ components: cat.repositories___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.repositories___query.local: name: local in: query @@ -16588,7 +17220,7 @@ components: cat.segment_replication___query.expand_wildcards: name: expand_wildcards in: query - description: Whether to expand the wildcard expression to include concrete indexes that are open, closed, or both. + description: The type of index that wildcard patterns can match. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. schema: $ref: '#/components/schemas/_common___ExpandWildcards' cat.segment_replication___query.format: @@ -16612,11 +17244,11 @@ components: cat.segment_replication___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.segment_replication___query.ignore_throttled: name: ignore_throttled in: query @@ -16813,11 +17445,11 @@ components: cat.shards___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.shards___query.local: name: local in: query @@ -16900,11 +17532,11 @@ components: cat.snapshots___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.snapshots___query.ignore_unavailable: in: query name: ignore_unavailable @@ -16996,11 +17628,11 @@ components: cat.tasks___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.tasks___query.nodes: name: nodes in: query @@ -17085,11 +17717,11 @@ components: cat.templates___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.templates___query.local: name: local in: query @@ -17164,11 +17796,11 @@ components: cat.thread_pool___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: type: boolean default: false - description: Return help information. + description: Returns help information. cat.thread_pool___query.local: name: local in: query @@ -22991,6 +23623,31 @@ components: schema: $ref: '#/components/schemas/_common___Fields' style: form + ml.chunk_model___path.chunk_number: + name: chunk_number + in: path + required: true + schema: + type: integer + format: int64 + ml.chunk_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.create_controller___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.create_message___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string ml.delete_agent___path.agent_id: name: agent_id in: path @@ -23003,6 +23660,18 @@ components: required: true schema: type: string + ml.delete_controller___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.delete_memory___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string ml.delete_model_group___path.model_group_id: name: model_group_id in: path @@ -23027,24 +23696,128 @@ components: required: true schema: type: string + ml.get_all_memories___query.max_results: + name: max_results + in: query + required: false + schema: + description: The maximum number of results to return. If there are fewer memories than the number set in `max_results`, the response returns only the number of memories that exist. Default is `10`. + type: integer + format: int32 + ml.get_all_memories___query.next_token: + name: next_token + in: query + required: false + schema: + description: The index of the first memory in the sorted list of memories to return. Memories are ordered by `create_time`. For example, if memories `A`, `B`, and `C` exist, `next_token=1` returns memories `B` and `C`. Default is `0` (return all memories). + type: integer + format: int32 + ml.get_all_messages___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string + ml.get_all_messages___query.max_results: + name: max_results + in: query + required: false + schema: + type: integer + format: int32 + ml.get_all_messages___query.next_token: + name: next_token + in: query + required: false + schema: + type: integer + format: int32 ml.get_connector___path.connector_id: name: connector_id in: path required: true schema: type: string + ml.get_controller___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.get_memory___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string + ml.get_message_traces___path.message_id: + name: message_id + in: path + required: true + schema: + type: string + ml.get_message_traces___query.max_results: + name: max_results + in: query + required: false + schema: + type: integer + format: int32 + ml.get_message_traces___query.next_token: + name: next_token + in: query + required: false + schema: + type: integer + format: int32 + ml.get_message___path.message_id: + name: message_id + in: path + required: true + schema: + type: string ml.get_model_group___path.model_group_id: name: model_group_id in: path required: true schema: type: string + ml.get_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.get_profile_models___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.get_profile_tasks___path.task_id: + name: task_id + in: path + required: true + schema: + type: string ml.get_task___path.task_id: name: task_id in: path required: true schema: type: string + ml.load_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.predict_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string ml.predict___path.algorithm_name: name: algorithm_name in: path @@ -23057,6 +23830,12 @@ components: required: true schema: type: string + ml.search_message___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string ml.train_predict___path.algorithm_name: name: algorithm_name in: path @@ -23075,18 +23854,61 @@ components: required: true schema: type: string + ml.unload_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string ml.update_connector___path.connector_id: name: connector_id in: path required: true schema: type: string + ml.update_controller___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.update_memory___path.memory_id: + name: memory_id + in: path + required: true + schema: + type: string + ml.update_message___path.message_id: + name: message_id + in: path + required: true + schema: + type: string ml.update_model_group___path.model_group_id: name: model_group_id in: path required: true schema: type: string + ml.update_model___path.model_id: + name: model_id + in: path + required: true + schema: + type: string + ml.upload_chunk___path.chunk_number: + name: chunk_number + in: path + required: true + schema: + type: integer + format: int64 + ml.upload_chunk___path.model_id: + name: model_id + in: path + required: true + schema: + type: string msearch_template___path.index: in: path name: index @@ -27250,6 +28072,17 @@ components: $ref: '#/components/schemas/_common___Ids' description: Document identifiers; can be either `docs` (containing full document information) or `ids` (when index is provided in the URL. required: true + ml.chunk_model: + content: + application/json: + schema: + type: object + properties: + chunk: + type: string + description: The model chunk. + required: + - chunk ml.create_connector: content: application/json: @@ -27285,6 +28118,96 @@ components: - parameters - protocol - version + ml.create_controller: + content: + application/json: + schema: + type: object + properties: + user_rate_limiter: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___RateLimiter' + ml.create_memory: + content: + application/json: + schema: + type: object + properties: + name: + $ref: '#/components/schemas/_common___Name' + ml.create_message: + content: + application/json: + schema: + type: object + properties: + input: + type: string + description: The question in the message. + prompt_template: + type: string + description: The prompt template. + response: + type: string + description: The answer to the question. + origin: + type: string + description: The system name that generated the response. + additional_info: + $ref: '#/components/schemas/ml._common___AdditionalInfo' + ml.create_model_meta: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: The model name. + version: + $ref: '#/components/schemas/_common___VersionString' + model_format: + $ref: '#/components/schemas/ml._common___ModelFormat' + model_group_id: + $ref: '#/components/schemas/_common___Id' + model_content_hash_value: + type: string + description: The model content hash value. + model_config: + $ref: '#/components/schemas/ml._common___ModelConfig' + total_chunks: + type: integer + format: int64 + description: Number of chunks the model is split into. + url: + type: string + description: The model URL. + description: + type: string + description: The model description. + required: + - model_config + - model_content_hash_value + - model_format + - name + - total_chunks + - version + ml.get_profile: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___ProfileRequest' + ml.get_profile_models: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___ProfileRequest' + ml.get_profile_tasks: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___ProfileRequest' ml.predict: content: application/json: @@ -27311,6 +28234,22 @@ components: items: type: string description: The target response. + ml.predict_model: + content: + application/json: + schema: + type: object + properties: + query_text: + type: string + description: The query text. + text_docs: + type: array + items: + type: string + description: The text documents. + required: + - text_docs ml.register_agents: content: application/json: @@ -27348,22 +28287,15 @@ components: type: string description: The model name. version: - type: string - description: The model version. + $ref: '#/components/schemas/_common___VersionString' model_format: - type: string - description: The portable format of the model file. - enum: - - ONNX - - TORCH_SCRIPT + $ref: '#/components/schemas/ml._common___ModelFormat' description: type: string description: The model description. model_group_id: - type: string - description: The ID of the model group to which to register the model. + $ref: '#/components/schemas/_common___Id' required: - - model_format - name - version ml.register_model_group: @@ -27395,6 +28327,43 @@ components: description: The add all backend roles. required: - name + ml.register_model_meta: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: The model name. + version: + $ref: '#/components/schemas/_common___VersionString' + model_format: + $ref: '#/components/schemas/ml._common___ModelFormat' + model_group_id: + $ref: '#/components/schemas/_common___Id' + model_content_hash_value: + type: string + description: The model content hash value. + model_config: + $ref: '#/components/schemas/ml._common___ModelConfig' + total_chunks: + type: integer + format: int64 + description: Number of chunks the model is split into. + url: + type: string + description: The model URL. + description: + type: string + description: The model description. + required: + - model_config + - model_content_hash_value + - model_format + - name + - total_chunks + - version ml.search_connectors: content: application/json: @@ -27411,6 +28380,40 @@ components: items: type: string description: The sort order. + ml.search_memory: + content: + application/json: + schema: + type: object + properties: + query: + $ref: '#/components/schemas/ml._common___Query' + size: + type: integer + format: int64 + description: The number of memories to return. + sort: + type: array + items: + $ref: '#/components/schemas/ml._common___SortMemory' + description: The sort order. + ml.search_message: + content: + application/json: + schema: + type: object + properties: + query: + $ref: '#/components/schemas/ml._common___Query' + size: + type: integer + format: int64 + description: The number of messages to return. + sort: + type: array + items: + $ref: '#/components/schemas/ml._common___SortMessage' + description: The sort order. ml.search_model_group: content: application/json: @@ -27478,6 +28481,34 @@ components: type: string input_data: $ref: '#/components/schemas/ml._common___PredictionResult' + ml.undeploy_model: + content: + application/json: + schema: + type: object + properties: + node_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + model_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + ml.unload_model: + content: + application/json: + schema: + type: object + properties: + node_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + model_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' ml.update_connector: content: application/json: @@ -27520,6 +28551,76 @@ components: parameters.skip_validating_missing_parameters: type: boolean description: Whether to skip validating missing parameters. + ml.update_controller: + content: + application/json: + schema: + type: object + properties: + user_rate_limiter: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___RateLimiter' + model_id: + $ref: '#/components/schemas/_common___Name' + ml.update_memory: + content: + application/json: + schema: + type: object + properties: + name: + $ref: '#/components/schemas/_common___Name' + ml.update_message: + content: + application/json: + schema: + type: object + properties: + input: + type: string + description: The question in the message. + prompt_template: + type: string + description: The prompt template. + response: + type: string + description: The answer to the question. + origin: + type: string + description: The system name that generated the response. + additional_info: + $ref: '#/components/schemas/ml._common___AdditionalInfo' + ml.update_model: + content: + application/json: + schema: + type: object + properties: + connector: + type: object + description: The connector to use for the model. + connector_id: + type: string + description: The connector ID. + is_enabled: + type: boolean + description: Whether the model is enabled. + description: + type: string + description: The model description. + model_config: + $ref: '#/components/schemas/ml._common___ModelConfig' + name: + type: string + description: The model name. + rate_limiter: + $ref: '#/components/schemas/ml._common___RateLimiter' + guardrails: + $ref: '#/components/schemas/ml._common___Guardrails' + interface: + type: object + description: The model interface. ml.update_model_group: content: application/json: @@ -27548,6 +28649,38 @@ components: items: type: string description: The backend roles to add. + ml.upload_chunk: + content: + application/json: + schema: + type: object + properties: + chunk: + type: string + description: The model chunk. + required: + - chunk + ml.upload_model: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: The model name. + version: + $ref: '#/components/schemas/_common___VersionString' + model_format: + $ref: '#/components/schemas/ml._common___ModelFormat' + description: + type: string + description: The model description. + model_group_id: + $ref: '#/components/schemas/_common___Id' + required: + - name + - version msearch: content: application/x-ndjson: @@ -27842,6 +28975,11 @@ components: type: object additionalProperties: $ref: '#/components/schemas/_common.aggregations___AggregationContainer' + aggs: + description: Defines the aggregations that are run as part of the search request. + type: object + additionalProperties: + $ref: '#/components/schemas/_common.aggregations___AggregationContainer' collapse: $ref: '#/components/schemas/_core.search___FieldCollapse' explain: @@ -30495,6 +31633,18 @@ components: required: - docs description: '' + ml.chunk_model___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: The status of the chunk upload operation. + required: + - status + description: '' ml.create_connector___200: content: application/json: @@ -30504,6 +31654,53 @@ components: connector_id: type: string description: '' + ml.create_controller___200: + content: + application/json: + schema: + type: object + properties: + model_id: + $ref: '#/components/schemas/_common___Name' + status: + $ref: '#/components/schemas/ml._common___Status' + description: '' + ml.create_memory___200: + content: + application/json: + schema: + type: object + properties: + memory_id: + $ref: '#/components/schemas/_common___Name' + required: + - memory_id + description: '' + ml.create_message___200: + content: + application/json: + schema: + type: object + properties: + message_id: + $ref: '#/components/schemas/_common___Name' + required: + - message_id + description: '' + ml.create_model_meta___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + model_id: + type: string + required: + - model_id + - status + description: '' ml.delete_agent___200: content: application/json: @@ -30516,6 +31713,24 @@ components: schema: $ref: '#/components/schemas/_common___WriteResponseBase' description: '' + ml.delete_controller___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' + ml.delete_memory___200: + content: + application/json: + schema: + type: object + properties: + success: + type: boolean + description: Whether the memory was deleted successfully. + required: + - success + description: '' ml.delete_model_group___200: content: application/json: @@ -30550,24 +31765,155 @@ components: - status - task_id description: '' + ml.get_all_memories___200: + content: + application/json: + schema: + type: object + properties: + memories: + type: array + items: + $ref: '#/components/schemas/ml._common___Memory' + next_token: + description: The index of the next memory after the last memory in the returned list. + type: integer + format: int32 + required: + - memories + description: '' + ml.get_all_messages___200: + content: + application/json: + schema: + type: object + properties: + messages: + type: array + items: + $ref: '#/components/schemas/ml._common___Message' + next_token: + description: The index of the next message after the last message in the returned list. + type: integer + format: int32 + required: + - messages + description: '' ml.get_connector___200: content: application/json: schema: $ref: '#/components/schemas/ml._common___GetConnectorResponse' description: '' + ml.get_controller___200: + content: + application/json: + schema: + type: object + properties: + user_rate_limiter: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___RateLimiter' + model_id: + $ref: '#/components/schemas/_common___Name' + description: '' + ml.get_memory___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___Memory' + description: '' + ml.get_message_traces___200: + content: + application/json: + schema: + type: object + properties: + traces: + type: array + items: + $ref: '#/components/schemas/ml._common___Message' + next_token: + type: integer + format: int32 + required: + - traces + description: '' + ml.get_message___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___Message' + description: '' ml.get_model_group___200: content: application/json: schema: $ref: '#/components/schemas/ml._common___ModelGroup' description: '' + ml.get_model___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___Model' + description: '' + ml.get_profile_models___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___GetProfileResponse' + description: '' + ml.get_profile_tasks___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___GetProfileResponse' + description: '' + ml.get_profile___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___GetProfileResponse' + description: '' ml.get_task___200: content: application/json: schema: $ref: '#/components/schemas/ml._common___Task' description: '' + ml.load_model___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + task_id: + type: string + task_type: + type: string + enum: + - BATCH_INGEST + - BATCH_PREDICTION + - DEPLOY_MODEL + - EXECUTION + - PREDICTION + - REGISTER_MODEL + - TRAINING + - TRAINING_AND_PREDICTION + required: + - status + - task_id + - task_type + description: '' + ml.predict_model___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___PredictModelResponse' + description: '' ml.predict___200: content: application/json: @@ -30589,6 +31935,20 @@ components: schema: $ref: '#/components/schemas/ml._common___ModelGroupRegistration' description: '' + ml.register_model_meta___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + model_id: + type: string + required: + - model_id + - status + description: '' ml.register_model___200: content: application/json: @@ -30609,6 +31969,18 @@ components: schema: $ref: '#/components/schemas/ml._common___SearchConnectorsResponse' description: '' + ml.search_memory___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___SearchMemoryResponse' + description: '' + ml.search_message___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___SearchMessageResponse' + description: '' ml.search_model_group___200: content: application/json: @@ -30639,18 +32011,74 @@ components: schema: $ref: '#/components/schemas/ml._common___UndeployModelResponse' description: '' + ml.unload_model___200: + content: + application/json: + schema: + $ref: '#/components/schemas/ml._common___UnloadModelResponse' + description: '' ml.update_connector___200: content: application/json: schema: $ref: '#/components/schemas/_common___WriteResponseBase' description: '' + ml.update_controller___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' + ml.update_memory___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' + ml.update_message___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' ml.update_model_group___200: content: application/json: schema: $ref: '#/components/schemas/ml._common___UpdateModelGroupResponse' description: '' + ml.update_model___200: + content: + application/json: + schema: + $ref: '#/components/schemas/_common___WriteResponseBase' + description: '' + ml.upload_chunk___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + description: The status of the chunk upload operation. + required: + - status + description: '' + ml.upload_model___200: + content: + application/json: + schema: + type: object + properties: + status: + type: string + task_id: + type: string + required: + - status + - task_id + description: '' msearch_template___200: content: application/json: @@ -54073,6 +55501,11 @@ components: type: string post_process_function: type: string + ml._common___AdditionalInfo: + type: object + description: Additional information query. + properties: {} + additionalProperties: true ml._common___Algorithm: type: object description: The algorithm. @@ -54226,6 +55659,51 @@ components: type: integer format: int64 description: The last updated time. + ml._common___GetProfileResponse: + type: object + properties: + nodes: + $ref: '#/components/schemas/ml._common___Nodes' + ml._common___Guardrails: + type: object + properties: + type: + type: string + description: The guardrails type. + enum: + - local_regex + - model + input_guardrail: + $ref: '#/components/schemas/ml._common___GuardrailsInputOutput' + output_guardrail: + $ref: '#/components/schemas/ml._common___GuardrailsInputOutput' + stop_words: + $ref: '#/components/schemas/_common.analysis___StopWords' + index_name: + $ref: '#/components/schemas/_common___IndexName' + source_fields: + $ref: '#/components/schemas/_common___Fields' + regex: + type: object + description: The regex used for input/output validation. + model_id: + type: string + description: The model ID. + response_filter: + type: string + description: The response filter. + response_validation_regex: + type: string + description: The response validation regex. + ml._common___GuardrailsInputOutput: + type: object + properties: + model_id: + type: string + description: The model ID. + response_validation_regex: + type: string + description: The response validation regex. ml._common___Headers: type: object properties: @@ -54296,6 +55774,7 @@ components: description: type: string description: The description. + additionalProperties: true ml._common___MatchAllQuery: type: object description: The match all query. @@ -54305,6 +55784,123 @@ components: properties: type: type: string + memory_id: + $ref: '#/components/schemas/_common___Name' + create_time: + type: string + format: date-time + description: The create time. + updated_time: + type: string + format: date-time + description: The updated time. + name: + $ref: '#/components/schemas/_common___Name' + user: + type: string + description: The username of the user. + additional_info: + $ref: '#/components/schemas/ml._common___AdditionalInfo' + ml._common___Message: + type: object + properties: + memory_id: + $ref: '#/components/schemas/_common___Name' + message_id: + $ref: '#/components/schemas/_common___Name' + create_time: + type: string + format: date-time + description: The create time. + input: + type: + - 'null' + - string + description: The question in the message. + prompt_template: + type: + - 'null' + - string + description: The prompt template. + response: + type: + - 'null' + - string + description: The answer to the question. + origin: + type: + - 'null' + - string + description: The system name that generated the response. + additional_info: + $ref: '#/components/schemas/ml._common___AdditionalInfo' + parent_message_id: + type: + - 'null' + - string + description: The parent message ID. + trace_number: + type: integer + format: int64 + description: The trace number. + ml._common___Model: + type: object + properties: + name: + type: string + description: The model name. + model_group_id: + type: string + description: The model group ID. + algorithm: + type: string + description: The algorithm. + model_version: + type: string + description: The model version. + model_format: + $ref: '#/components/schemas/ml._common___ModelFormat' + model_state: + type: string + description: The model state. + enum: + - DEPLOYED + - DEPLOYING + - DEPLOY_FAILED + - PARTIALLY_DEPLOYED + - REGISTERED + - REGISTERING + - UNDEPLOYED + model_content_size_in_bytes: + type: integer + format: int64 + description: The model content size in bytes. + model_content_hash_value: + type: string + description: The model content hash value. + model_config: + $ref: '#/components/schemas/ml._common___ModelConfig' + created_time: + type: integer + format: int64 + description: The created time. + last_updated_time: + type: integer + format: int64 + description: The last updated time. + last_registered_time: + type: integer + format: int64 + description: The last registered time. + total_chunks: + type: integer + format: int64 + description: The total chunks. + is_hidden: + type: boolean + description: Whether the model is hidden. + required: + - model_state ml._common___ModelConfig: type: object properties: @@ -54321,6 +55917,11 @@ components: framework_type: type: string description: The framework type. + ml._common___ModelFormat: + type: string + enum: + - ONNX + - TORCH_SCRIPT ml._common___ModelGroup: type: object properties: @@ -54365,6 +55966,45 @@ components: required: - model_group_id - status + ml._common___ModelProfile: + type: object + properties: + model_state: + type: string + description: The model state. + enum: + - DEPLOYED + - DEPLOYING + - DEPLOY_FAILED + - PARTIALLY_DEPLOYED + - REGISTERED + - REGISTERING + - UNDEPLOYED + predictor: + type: string + description: The predictor. + worker_nodes: + type: array + items: + $ref: '#/components/schemas/_common___NodeIds' + predict_request_stats: + $ref: '#/components/schemas/ml._common___PredictRequestStats' + target_worker_nodes: + type: array + items: + $ref: '#/components/schemas/_common___NodeIds' + memory_size_estimation_cpu: + type: integer + format: int64 + description: The estimated memory size in CPU. + memory_size_estimation_gpu: + type: integer + format: int64 + description: The estimated memory size in GPU. + ml._common___Models: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___ModelProfile' ml._common___Nested: type: object description: The nested filter. @@ -54388,6 +56028,17 @@ components: boost: type: number description: Adjust the relevance score of a match. + ml._common___Node: + type: object + properties: + tasks: + $ref: '#/components/schemas/ml._common___Tasks' + models: + $ref: '#/components/schemas/ml._common___Models' + ml._common___Nodes: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___Node' ml._common___Output: type: object properties: @@ -54474,6 +56125,87 @@ components: type: array items: $ref: '#/components/schemas/ml._common___Rows' + ml._common___PredictModelOutput: + type: object + properties: + name: + type: string + description: The output name. + data_type: + type: string + description: The output data type. + enum: + - BOOLEAN + - FLOAT16 + - FLOAT32 + - FLOAT64 + - INT32 + - INT64 + - INT8 + - STRING + - UINT8 + - UNKNOWN + shape: + type: array + items: + type: integer + format: int64 + description: The output shape. + data: + type: array + items: + type: number + format: double + description: The output data. + byte_buffer: + $ref: '#/components/schemas/ml._common___ByteBuffer' + required: + - data + ml._common___PredictModelResponse: + type: object + properties: + inference_results: + type: array + items: + $ref: '#/components/schemas/ml._common___PredictModelResult' + ml._common___PredictModelResult: + type: object + properties: + output: + type: array + items: + $ref: '#/components/schemas/ml._common___PredictModelOutput' + ml._common___PredictRequestStats: + type: object + properties: + count: + type: integer + format: int64 + description: The total predict requests on this node. + max: + type: number + format: double + description: The maximum latency in milliseconds. + min: + type: number + format: double + description: The minimum latency in milliseconds. + average: + type: number + format: double + description: The average latency in milliseconds. + p50: + type: number + format: double + description: The 50th percentile latency in milliseconds. + p90: + type: number + format: double + description: The 90th percentile latency in milliseconds. + p99: + type: number + format: double + description: The 99th percentile latency in milliseconds. ml._common___PredictResponse: type: object properties: @@ -54485,12 +56217,35 @@ components: $ref: '#/components/schemas/ml._common___Status' prediction_result: $ref: '#/components/schemas/ml._common___PredictionResult' + ml._common___ProfileRequest: + type: object + properties: + node_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + model_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + task_ids: + type: array + items: + $ref: '#/components/schemas/_common___Id' + return_all_tasks: + type: boolean + description: Whether to return all tasks. + return_all_models: + type: boolean + description: Whether to return all models. ml._common___Query: type: object description: The query. properties: bool: $ref: '#/components/schemas/ml._common___BoolQuery' + match: + $ref: '#/components/schemas/ml._common___Match' match_all: $ref: '#/components/schemas/ml._common___MatchAllQuery' term: @@ -54505,6 +56260,26 @@ components: $ref: '#/components/schemas/ml._common___Key' k3: $ref: '#/components/schemas/ml._common___Key' + ml._common___RateLimiter: + type: object + properties: + limit: + description: The maximum limit. + $ref: '#/components/schemas/_common___StringifiedDouble' + unit: + type: string + description: The unit of time. + enum: + - DAYS + - HOURS + - MICROSECONDS + - MILLISECONDS + - MINUTES + - NANOSECONDS + - SECONDS + required: + - limit + - unit ml._common___Rows: type: object properties: @@ -54524,8 +56299,9 @@ components: items: $ref: '#/components/schemas/ml._common___SearchHitsHit' max_score: - type: number - format: float + type: + - 'null' + - number description: The maximum score. required: - hits @@ -54552,8 +56328,18 @@ components: $ref: '#/components/schemas/ml._common___Source' model_id: $ref: '#/components/schemas/_common___Name' + sort: + type: array + items: + type: number + format: float + description: The sort values. required: - _score + ml._common___SearchMemoryResponse: + $ref: '#/components/schemas/ml._common___SearchResponse' + ml._common___SearchMessageResponse: + $ref: '#/components/schemas/ml._common___SearchResponse' ml._common___SearchModelGroupsResponse: $ref: '#/components/schemas/ml._common___SearchResponse' ml._common___SearchModelsResponse: @@ -54621,6 +56407,52 @@ components: $ref: '#/components/schemas/ml._common___SortOrder' _score: $ref: '#/components/schemas/ml._common___SortOrder' + ml._common___SortMemory: + type: object + description: The sort memory query. + properties: + additional_info: + $ref: '#/components/schemas/ml._common___SortOrder' + application_time: + $ref: '#/components/schemas/ml._common___SortOrder' + create_time: + $ref: '#/components/schemas/ml._common___SortOrder' + updated_time: + $ref: '#/components/schemas/ml._common___SortOrder' + user: + $ref: '#/components/schemas/ml._common___SortOrder' + _id: + $ref: '#/components/schemas/ml._common___SortOrder' + _index: + $ref: '#/components/schemas/ml._common___SortOrder' + _score: + $ref: '#/components/schemas/ml._common___SortOrder' + _seq_no: + $ref: '#/components/schemas/ml._common___SortOrder' + ml._common___SortMessage: + type: object + description: The sort message query. + properties: + additional_info: + $ref: '#/components/schemas/ml._common___SortOrder' + create_time: + $ref: '#/components/schemas/ml._common___SortOrder' + memory_id: + $ref: '#/components/schemas/ml._common___SortOrder' + origin: + $ref: '#/components/schemas/ml._common___SortOrder' + parent_message_id: + $ref: '#/components/schemas/ml._common___SortOrder' + trace_number: + $ref: '#/components/schemas/ml._common___SortOrder' + _id: + $ref: '#/components/schemas/ml._common___SortOrder' + _index: + $ref: '#/components/schemas/ml._common___SortOrder' + _score: + $ref: '#/components/schemas/ml._common___SortOrder' + _seq_no: + $ref: '#/components/schemas/ml._common___SortOrder' ml._common___SortOrder: type: object description: The order of the sort. @@ -54686,8 +56518,7 @@ components: model_config: $ref: '#/components/schemas/ml._common___ModelConfig' model_format: - type: string - description: The model format. + $ref: '#/components/schemas/ml._common___ModelFormat' model_task_type: type: string description: The model task type. @@ -54704,8 +56535,7 @@ components: format: int64 description: The auto redeploy retry times. name: - type: string - description: The model name. + $ref: '#/components/schemas/_common___Name' connector_id: type: string description: The connector ID. @@ -54758,6 +56588,56 @@ components: type: array items: $ref: '#/components/schemas/ml._common___Action' + updated_time: + type: string + format: date-time + description: The updated time. + create_time: + type: string + format: date-time + description: The create time. + application_type: + type: + - 'null' + - string + description: The application type. + additional_info: + $ref: '#/components/schemas/ml._common___AdditionalInfo' + user: + type: string + description: The username of the user. + input: + type: + - 'null' + - string + description: The question in the message. + memory_id: + $ref: '#/components/schemas/_common___Name' + trace_number: + type: + - 'null' + - string + description: The trace number. + response: + type: + - 'null' + - string + description: The answer to the question. + origin: + type: + - 'null' + - string + description: The system name that generated the response. + parent_message_id: + type: + - 'null' + - string + description: The parent message ID. + prompt_template: + type: + - 'null' + - string + description: The prompt template. ml._common___Status: type: string description: The status. @@ -54810,6 +56690,10 @@ components: type: string required: - state + ml._common___Tasks: + type: object + additionalProperties: + $ref: '#/components/schemas/ml._common___Task' ml._common___Term: type: object description: Term to match the query. @@ -54822,6 +56706,8 @@ components: $ref: '#/components/schemas/_common___Id' model_id: $ref: '#/components/schemas/_common___Name' + name: + $ref: '#/components/schemas/ml._common___OwnerNameKeyword' owner.name.keyword: $ref: '#/components/schemas/ml._common___OwnerNameKeyword' ml._common___ToolItems: @@ -54883,6 +56769,19 @@ components: additionalProperties: title: nodes $ref: '#/components/schemas/ml._common___UndeployModelNode' + ml._common___UnloadModelNode: + type: object + properties: + stats: + $ref: '#/components/schemas/ml._common___UnloadModelNodeStats' + ml._common___UnloadModelNodeStats: + type: object + additionalProperties: true + ml._common___UnloadModelResponse: + type: object + additionalProperties: + title: nodes + $ref: '#/components/schemas/ml._common___UnloadModelNode' ml._common___UpdateModelGroupResponse: type: object properties: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 67b4e0680d..9464e5b95f 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 @@ -90,14 +90,7 @@ public class CodeGenerator { namespace(is("ml")), name( // TODO: search_models is complex and ideally should re-use the search structures - not( - or( - contains("predict"), - contains("search"), - contains("train"), - isOneOf("get_connector", "update_connector", "update_model_group") - ) - ) + not(or(contains("predict"), contains("search"), contains("train"), isOneOf("chunk_model"))) ) ), and( 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 1af4500cfc..fe5556c9e0 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 @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.BiConsumer; +import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -148,7 +149,8 @@ private void visit(@Nonnull OperationGroup group, @Nonnull List c.get(MimeType.Json)) .flatMap(OpenApiMediaType::getSchema) .ifPresent(s -> { - if (s.has$ref()) { - var name = s.getTitle().or(() -> s.resolve().getName()).orElseThrow(); + if (s.has$ref() && s.hasTitle()) { + var name = s.getTitle().orElseThrow(); shape.setDelegatedBodyField(name, mapType(s)); } else { visitInto(s.resolve(), shape); @@ -369,12 +371,29 @@ private Shape visit(OpenApiSchema schema) { } private Shape visit(Namespace parent, String className, String typedefName, OpenApiSchema schema, ShouldGenerate shouldGenerate) { - Shape shape = visitedSchemas.get(schema); + return visit(parent, className, typedefName, schema, shouldGenerate, false); + } + + private Shape visit( + Namespace parent, + String className, + String typedefName, + final OpenApiSchema schema, + ShouldGenerate shouldGenerate, + final boolean uncached + ) { + Shape shape; - if (shape != null) { + if (!uncached && (shape = visitedSchemas.get(schema)) != null) { return shape; } + Consumer cache = s -> { + if (!uncached) { + visitedSchemas.putIfAbsent(schema, s); + } + }; + LOGGER.info("Visiting Schema: {}", schema); var description = schema.getDescription().orElse(null); @@ -384,39 +403,40 @@ private Shape visit(Namespace parent, String className, String typedefName, Open if (schema.isArray()) { shape = new ArrayShape(parent, className, mapType(schema), typedefName, description, shouldGenerate); - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); } else if (isEnum(schema)) { var enumShape = new EnumShape(parent, className, typedefName, description, shouldGenerate); shape = enumShape; - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); visitInto(schema, enumShape); } else if (isTaggedUnion) { var taggedUnion = new TaggedUnionShape(parent, className, typedefName, description, shouldGenerate); shape = taggedUnion; - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); - while (schema.hasAllOf()) { - var allOf = schema.getAllOf().orElseThrow(); + var unionSchema = schema; + while (unionSchema.hasAllOf()) { + var allOf = unionSchema.getAllOf().orElseThrow(); var first = allOf.get(0); var second = allOf.get(1); if (first.has$ref()) { shape.setExtendsType(mapType(first)); - schema = second; + unionSchema = second; } else if (isTaggedUnion(first)) { - schema = first; + unionSchema = first; visitInto(second, taggedUnion); } else if (isTaggedUnion(second)) { - schema = second; + unionSchema = second; visitInto(first, taggedUnion); } else { - throw new IllegalStateException("allOf is not a tagged union: " + schema.getPointer()); + throw new IllegalStateException("allOf is not a tagged union: " + unionSchema.getPointer()); } } String discriminatingField; - var discriminator = schema.getDiscriminator().orElse(null); + var discriminator = unionSchema.getDiscriminator().orElse(null); if (discriminator != null) { discriminatingField = discriminator.getPropertyName().orElse(null); @@ -426,7 +446,7 @@ private Shape visit(Namespace parent, String className, String typedefName, Open discriminatingField = null; } - var oneOrAnyOf = schema.getOneOf().or(schema::getAnyOf).orElse(null); + var oneOrAnyOf = unionSchema.getOneOf().or(unionSchema::getAnyOf).orElse(null); if (oneOrAnyOf != null) { oneOrAnyOf.forEach(s -> { String name; @@ -453,9 +473,9 @@ private Shape visit(Namespace parent, String className, String typedefName, Open } taggedUnion.addVariant(name, mapType(s)); }); - } else if (schema.isObject() && schema.getMaxProperties().orElse(Integer.MAX_VALUE) == 1) { + } else if (unionSchema.isObject() && unionSchema.getMaxProperties().orElse(Integer.MAX_VALUE) == 1) { taggedUnion.setExternallyDiscriminated(true); - schema.getProperties().ifPresent(props -> props.forEach((k, v) -> taggedUnion.addVariant(k, mapType(v)))); + unionSchema.getProperties().ifPresent(props -> props.forEach((k, v) -> taggedUnion.addVariant(k, mapType(v)))); } } else if (isShortcutPropertyObject || schema.determineSingleType().orElse(null) == OpenApiSchemaType.Object) { if (schema.getProperties().isEmpty() && schema.getAdditionalProperties().isPresent()) { @@ -468,24 +488,25 @@ private Shape visit(Namespace parent, String className, String typedefName, Open mapType(schema.getAdditionalProperties().orElseThrow()), shouldGenerate ); - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); } else { var objShape = new ObjectShape(parent, className, typedefName, description, shouldGenerate); shape = objShape; - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); + var objSchema = schema; if (isShortcutPropertyObject) { var oneOf = schema.getOneOf().orElseThrow(); var shortcutProperty = oneOf.get(0).getTitle().orElseThrow(); objShape.setShortcutProperty(shortcutProperty); - schema = oneOf.get(1); + objSchema = oneOf.get(1); } - visitInto(schema, objShape); + visitInto(objSchema, objShape); } } else { shape = new DelegatedShape(parent, className, typedefName, description, shouldGenerate, mapType(schema)); - visitedSchemas.putIfAbsent(schema, shape); + cache.accept(shape); } parent.addShape(shape); @@ -496,9 +517,13 @@ private Shape visit(Namespace parent, String className, String typedefName, Open private void visitInto(OpenApiSchema schema, ObjectShapeBase shape) { var allOf = schema.getAllOf(); if (allOf.isPresent()) { - var baseSchema = allOf.get().get(0); - shape.setExtendsType(mapType(baseSchema)); - schema = allOf.get().get(1); + if (allOf.get().size() == 2) { + var baseSchema = allOf.get().get(0); + shape.setExtendsType(mapType(baseSchema)); + schema = allOf.get().get(1); + } else if (allOf.get().size() == 1) { + schema = allOf.get().get(0); + } } final var properties = new HashMap(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java index 216ddc6081..131da9ede3 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/NameSanitizer.java @@ -15,6 +15,7 @@ public class NameSanitizer { private static final Set reservedWords = Set.of( "default", "if", + "interface", "native", "transient", "boolean", diff --git a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java index 3036ef2c89..693262e27e 100644 --- a/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java +++ b/samples/src/main/java/org/opensearch/client/samples/neural/NeuralSearch.java @@ -30,6 +30,7 @@ import org.opensearch.client.opensearch.ml.DeleteTaskRequest; import org.opensearch.client.opensearch.ml.DeployModelRequest; import org.opensearch.client.opensearch.ml.GetTaskRequest; +import org.opensearch.client.opensearch.ml.ModelFormat; import org.opensearch.client.opensearch.ml.RegisterModelRequest; import org.opensearch.client.opensearch.ml.UndeployModelRequest; import org.opensearch.client.samples.SampleClient; @@ -88,7 +89,7 @@ public static void main(String[] args) { new RegisterModelRequest.Builder().name("huggingface/sentence-transformers/msmarco-distilbert-base-tas-b") .version("1.0.1") .modelGroupId(modelGroupId) - .modelFormat("TORCH_SCRIPT") + .modelFormat(ModelFormat.TorchScript) .build() ); if (!"CREATED".equals(modelRegistration.status())) throw new Exception(