From 76b7df266992247f160cc93a40515a9d503d0d15 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 12 Dec 2024 15:40:44 +1300 Subject: [PATCH 1/4] Generate snapshot repository requests Signed-off-by: Thomas Farr --- UPGRADING.md | 5 +- .../snapshot/CreateRepositoryRequest.java | 250 ++++++++++++------ .../snapshot/CreateRepositoryResponse.java | 70 ++++- .../snapshot/DeleteRepositoryRequest.java | 216 +++++++++------ .../snapshot/DeleteRepositoryResponse.java | 70 ++++- .../snapshot/GetRepositoryRequest.java | 213 ++++++++++----- .../snapshot/GetRepositoryResponse.java | 19 +- .../OpenSearchSnapshotAsyncClientBase.java | 69 +++++ .../OpenSearchSnapshotClientBase.java | 66 +++++ .../opensearch/snapshot/Repository.java | 139 +++++++--- .../snapshot/RepositorySettings.java | 117 ++++++-- .../OpenSearchSnapshotAsyncClient.java | 115 -------- .../snapshot/OpenSearchSnapshotClient.java | 112 -------- java-codegen/opensearch-openapi.yaml | 14 +- .../client/codegen/CodeGenerator.java | 2 +- .../client/codegen/model/RequestShape.java | 9 +- .../client/codegen/model/SpecTransformer.java | 7 +- .../model/overrides/OperationOverride.java | 76 ++++++ .../codegen/model/overrides/Overrides.java | 181 ++++++++----- .../overrides/PathParameterOverride.java | 68 +++++ 20 files changed, 1185 insertions(+), 633 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java (83%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/Repository.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java (68%) create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/OperationOverride.java create mode 100644 java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PathParameterOverride.java diff --git a/UPGRADING.md b/UPGRADING.md index f98573bf9c..09f333f642 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -160,4 +160,7 @@ After: ### DataStreamIndexInfo renamed to DataStreamIndex - The `DataStreamIndexInfo` class has been renamed to `DataStreamIndex`, this affects: - - `DataStream`'s (previously `DataStreamInfo`) `indices` field. \ No newline at end of file + - `DataStream`'s (previously `DataStreamInfo`) `indices` field. + +### RepositorySettings +- The `concurrentStreams` property is now of type `Integer` instead of `String`. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java index dfe04f47e8..28645f58d8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -49,34 +56,43 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.create_repository.Request /** * Creates a repository. - * */ @JsonpDeserializable -public class CreateRepositoryRequest extends RequestBase implements PlainJsonSerializable { - @Deprecated - @Nullable - private final Time masterTimeout; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateRepositoryRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Time clusterManagerTimeout; + @Deprecated + @Nullable + private final Time masterTimeout; + + @Nonnull private final String name; @Nullable private final Repository repository; + @Nonnull private final RepositorySettings settings; @Nullable private final Time timeout; + @Nonnull private final String type; @Nullable @@ -85,48 +101,50 @@ public class CreateRepositoryRequest extends RequestBase implements PlainJsonSer // --------------------------------------------------------------------------------------------- private CreateRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.repository = builder.repository; this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); this.timeout = builder.timeout; this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.verify = builder.verify; - } - public static CreateRepositoryRequest of(Function> fn) { + public static CreateRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** * Explicit operation timeout for connection to cluster-manager node *

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * Required - A repository name *

* API name: {@code repository} + *

*/ + @Nonnull public final String name() { return this.name; } @@ -142,6 +160,7 @@ public final Repository repository() { /** * Required - API name: {@code settings} */ + @Nonnull public final RepositorySettings settings() { return this.settings; } @@ -150,6 +169,7 @@ public final RepositorySettings settings() { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -159,6 +179,7 @@ public final Time timeout() { /** * Required - API name: {@code type} */ + @Nonnull public final String type() { return this.type; } @@ -167,6 +188,7 @@ public final String type() { * Whether to verify the repository after creation *

* API name: {@code verify} + *

*/ @Nullable public final Boolean verify() { @@ -176,6 +198,7 @@ public final Boolean verify() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -183,94 +206,133 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.repository != null) { generator.writeKey("repository"); this.repository.serialize(generator, mapper); - } + generator.writeKey("settings"); this.settings.serialize(generator, mapper); 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 CreateRepositoryRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; - + @Nullable + private Time masterTimeout; private String name; - @Nullable private Repository repository; - private RepositorySettings settings; - @Nullable private Time timeout; - private String type; - @Nullable private Boolean verify; + public Builder() {} + + private Builder(CreateRepositoryRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.repository = o.repository; + this.settings = o.settings; + this.timeout = o.timeout; + this.type = o.type; + this.verify = o.verify; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.repository = o.repository; + this.settings = o.settings; + this.timeout = o.timeout; + this.type = o.type; + this.verify = o.verify; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** * Explicit operation timeout for connection to cluster-manager node *

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

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

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ + @Nonnull public final Builder name(String value) { this.name = value; return this; @@ -279,6 +341,7 @@ public final Builder name(String value) { /** * API name: {@code repository} */ + @Nonnull public final Builder repository(@Nullable Repository value) { this.repository = value; return this; @@ -287,13 +350,15 @@ public final Builder repository(@Nullable Repository value) { /** * API name: {@code repository} */ + @Nonnull public final Builder repository(Function> fn) { - return this.repository(fn.apply(new Repository.Builder()).build()); + return repository(fn.apply(new Repository.Builder()).build()); } /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(RepositorySettings value) { this.settings = value; return this; @@ -302,15 +367,18 @@ public final Builder settings(RepositorySettings value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new RepositorySettings.Builder()).build()); + return settings(fn.apply(new RepositorySettings.Builder()).build()); } /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; @@ -320,14 +388,17 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code type} */ + @Nonnull public final Builder type(String value) { this.type = value; return this; @@ -337,7 +408,9 @@ public final Builder type(String value) { * Whether to verify the repository after creation *

* API name: {@code verify} + *

*/ + @Nonnull public final Builder verify(@Nullable Boolean value) { this.verify = value; return this; @@ -346,9 +419,10 @@ public final Builder verify(@Nullable Boolean value) { /** * Builds a {@link CreateRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CreateRepositoryRequest build() { _checkSingleUse(); @@ -367,11 +441,10 @@ public CreateRepositoryRequest build() { ); protected static void setupCreateRepositoryRequestDeserializer(ObjectDeserializer op) { - + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::repository, Repository._DESERIALIZER, "repository"); op.add(Builder::settings, RepositorySettings._DESERIALIZER, "settings"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - } // --------------------------------------------------------------------------------------------- @@ -380,52 +453,63 @@ protected static void setupCreateRepositoryRequestDeserializer(ObjectDeserialize * Endpoint "{@code snapshot.create_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.verify != null) { - params.put("verify", String.valueOf(request.verify)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } + if (request.verify != null) { + params.put("verify", String.valueOf(request.verify)); + } return params; - }, SimpleEndpoint.emptyMap(), true, CreateRepositoryResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.repository); + result = 31 * result + this.settings.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + this.type.hashCode(); + result = 31 * result + Objects.hashCode(this.verify); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CreateRepositoryRequest other = (CreateRepositoryRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name) + && Objects.equals(this.repository, other.repository) + && this.settings.equals(other.settings) + && Objects.equals(this.timeout, other.timeout) + && this.type.equals(other.type) + && Objects.equals(this.verify, other.verify); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java index 33b2585dde..9a9be3e5c8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CreateRepositoryResponse.java @@ -30,41 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.create_repository.Response @JsonpDeserializable -public class CreateRepositoryResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CreateRepositoryResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private CreateRepositoryResponse(Builder builder) { super(builder); - } - public static CreateRepositoryResponse of(Function> fn) { + public static CreateRepositoryResponse 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 CreateRepositoryResponse}. */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(CreateRepositoryResponse 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; } @@ -72,9 +111,10 @@ protected Builder self() { /** * Builds a {@link CreateRepositoryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CreateRepositoryResponse build() { _checkSingleUse(); @@ -93,8 +133,22 @@ public CreateRepositoryResponse build() { ); protected static void setupCreateRepositoryResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java index bc42a3d20a..66f0aa35e4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +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; @@ -44,24 +50,29 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.delete_repository.Request /** * Deletes a repository. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteRepositoryRequest extends RequestBase + implements + ToCopyableBuilder { -public class DeleteRepositoryRequest extends RequestBase { - @Deprecated @Nullable - private final Time masterTimeout; + private final Time clusterManagerTimeout; + @Deprecated @Nullable - private final Time clusterManagerTimeout; + private final Time masterTimeout; + @Nonnull private final List name; @Nullable @@ -70,44 +81,46 @@ public class DeleteRepositoryRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private DeleteRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); this.timeout = builder.timeout; - } - public static DeleteRepositoryRequest of(Function> fn) { + public static DeleteRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** - * Required - Name of the snapshot repository to unregister. Wildcard - * (*) patterns are supported. + * Required - Name of the snapshot repository to unregister. Wildcard (*) patterns are supported. *

* API name: {@code repository} + *

*/ + @Nonnull public final List name() { return this.name; } @@ -116,6 +129,7 @@ public final List name() { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -124,84 +138,126 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteRepositoryRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; - + @Nullable + private Time masterTimeout; private List name; - @Nullable private Time timeout; + public Builder() {} + + private Builder(DeleteRepositoryRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** * Explicit operation timeout for connection to cluster-manager node *

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

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

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - Name of the snapshot repository to unregister. Wildcard - * (*) patterns are supported. + * Required - Name of the snapshot repository to unregister. Wildcard (*) patterns are supported. *

* API name: {@code repository} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; } /** - * Required - Name of the snapshot repository to unregister. Wildcard - * (*) patterns are supported. + * Required - Name of the snapshot repository to unregister. Wildcard (*) patterns are supported. *

* API name: {@code repository} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -211,7 +267,9 @@ public final Builder name(String value, String... values) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; @@ -221,17 +279,20 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link DeleteRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteRepositoryRequest build() { _checkSingleUse(); @@ -245,49 +306,52 @@ public DeleteRepositoryRequest build() { * Endpoint "{@code snapshot.delete_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteRepositoryResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteRepositoryRequest other = (DeleteRepositoryRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java index 78541abe80..f1709184ed 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteRepositoryResponse.java @@ -30,41 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.delete_repository.Response @JsonpDeserializable -public class DeleteRepositoryResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteRepositoryResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DeleteRepositoryResponse(Builder builder) { super(builder); - } - public static DeleteRepositoryResponse of(Function> fn) { + public static DeleteRepositoryResponse 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 DeleteRepositoryResponse}. */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteRepositoryResponse 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; } @@ -72,9 +111,10 @@ protected Builder self() { /** * Builds a {@link DeleteRepositoryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteRepositoryResponse build() { _checkSingleUse(); @@ -93,8 +133,22 @@ public DeleteRepositoryResponse build() { ); protected static void setupDeleteRepositoryResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java index fb8e7c8de5..31e8b5aaf1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +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; @@ -44,16 +50,22 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.get_repository.Request /** * Returns information about a repository. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetRepositoryRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class GetRepositoryRequest extends RequestBase { @Nullable private final Boolean local; @@ -61,145 +73,186 @@ public class GetRepositoryRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final List name; // --------------------------------------------------------------------------------------------- private GetRepositoryRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = ApiTypeHelper.unmodifiable(builder.name); - } - public static GetRepositoryRequest of(Function> fn) { + public static GetRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Operation timeout for connection to cluster-manager node. *

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

*/ @Nullable - public final Boolean local() { - return this.local; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to master node + * Return local information, do not retrieve the state from cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code local} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Boolean local() { + return this.local; } /** * Explicit operation timeout for connection to cluster-manager node *

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * A comma-separated list of repository names *

* API name: {@code repository} + *

*/ + @Nonnull public final List name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetRepositoryRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private List name; + public Builder() {} + + private Builder(GetRepositoryRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to master node + * Return local information, do not retrieve the state from cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code local} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder local(@Nullable Boolean value) { + this.local = value; + return this; } /** * Explicit operation timeout for connection to cluster-manager node *

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

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

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * A comma-separated list of repository names *

* API name: {@code repository} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; @@ -209,9 +262,13 @@ public final Builder name(List list) { * A comma-separated list of repository names *

* API name: {@code repository} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -220,9 +277,10 @@ public final Builder name(String value, String... values) { /** * Builds a {@link GetRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetRepositoryRequest build() { _checkSingleUse(); @@ -236,13 +294,8 @@ public GetRepositoryRequest build() { * Endpoint "{@code snapshot.get_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _name = 1 << 0; @@ -252,38 +305,54 @@ public GetRepositoryRequest build() { if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - return buf.toString(); + return "/_snapshot"; } if (propsSet == (_name)) { StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, GetRepositoryResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + 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; + GetRepositoryRequest other = (GetRepositoryRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java index 1ee954697c..e3f7d77ea6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/GetRepositoryResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -43,15 +49,15 @@ // typedef: snapshot.get_repository.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetRepositoryResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private GetRepositoryResponse(Builder builder) { super(builder); - } - public static GetRepositoryResponse of(Function> fn) { + public static GetRepositoryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,11 +66,11 @@ public static GetRepositoryResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -72,8 +78,7 @@ protected Builder self() { /** * Builds a {@link GetRepositoryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetRepositoryResponse build() { _checkSingleUse(); @@ -95,8 +100,6 @@ public GetRepositoryResponse build() { ); protected static void setupGetRepositoryResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), Repository._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), Repository._DESERIALIZER); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java index 615f8a5882..a473778254 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java @@ -119,6 +119,48 @@ public final CompletableFuture create( return create(fn.apply(new CreateSnapshotRequest.Builder()).build()); } + // ----- Endpoint: snapshot.create_repository + + /** + * Creates a repository. + */ + public CompletableFuture createRepository(CreateRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CreateRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates a repository. + * + * @param fn a function that initializes a builder to create the {@link CreateRepositoryRequest} + */ + public final CompletableFuture createRepository( + Function> fn + ) throws IOException, OpenSearchException { + return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.delete_repository + + /** + * Deletes a repository. + */ + public CompletableFuture deleteRepository(DeleteRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, DeleteRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a repository. + * + * @param fn a function that initializes a builder to create the {@link DeleteRepositoryRequest} + */ + public final CompletableFuture deleteRepository( + Function> fn + ) throws IOException, OpenSearchException { + return deleteRepository(fn.apply(new DeleteRepositoryRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.get /** @@ -138,6 +180,33 @@ public final CompletableFuture get(Function getRepository(GetRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about a repository. + * + * @param fn a function that initializes a builder to create the {@link GetRepositoryRequest} + */ + public final CompletableFuture getRepository( + Function> fn + ) throws IOException, OpenSearchException { + return getRepository(fn.apply(new GetRepositoryRequest.Builder()).build()); + } + + /** + * Returns information about a repository. + */ + public final CompletableFuture getRepository() throws IOException, OpenSearchException { + return getRepository(new GetRepositoryRequest.Builder().build()); + } + // ----- Endpoint: snapshot.verify_repository /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java index 84844ee8cb..537152424d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java @@ -115,6 +115,46 @@ public final CreateSnapshotResponse create(Function> fn + ) throws IOException, OpenSearchException { + return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.delete_repository + + /** + * Deletes a repository. + */ + public DeleteRepositoryResponse deleteRepository(DeleteRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a repository. + * + * @param fn a function that initializes a builder to create the {@link DeleteRepositoryRequest} + */ + public final DeleteRepositoryResponse deleteRepository( + Function> fn + ) throws IOException, OpenSearchException { + return deleteRepository(fn.apply(new DeleteRepositoryRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.get /** @@ -134,6 +174,32 @@ public final GetSnapshotResponse get(Function> fn) + throws IOException, OpenSearchException { + return getRepository(fn.apply(new GetRepositoryRequest.Builder()).build()); + } + + /** + * Returns information about a repository. + */ + public final GetRepositoryResponse getRepository() throws IOException, OpenSearchException { + return getRepository(new GetRepositoryRequest.Builder().build()); + } + // ----- Endpoint: snapshot.verify_repository /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Repository.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Repository.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Repository.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Repository.java index a74628a5fb..91665ef306 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Repository.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Repository.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -42,37 +49,50 @@ 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: snapshot._types.Repository +// typedef: snapshot.Repository @JsonpDeserializable -public class Repository implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Repository implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final RepositorySettings settings; + + @Nonnull private final String type; @Nullable private final String uuid; - private final RepositorySettings settings; - // --------------------------------------------------------------------------------------------- private Repository(Builder builder) { - + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.uuid = builder.uuid; - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - } - public static Repository of(Function> fn) { + public static Repository of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - API name: {@code settings} + */ + @Nonnull + public final RepositorySettings settings() { + return this.settings; + } + /** * Required - API name: {@code type} */ + @Nonnull public final String type() { return this.type; } @@ -85,16 +105,10 @@ public final String uuid() { return this.uuid; } - /** - * Required - API name: {@code settings} - */ - public final RepositorySettings settings() { - return this.settings; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -102,6 +116,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); generator.writeKey("type"); generator.write(this.type); @@ -109,46 +125,55 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.uuid != null) { generator.writeKey("uuid"); generator.write(this.uuid); - } - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Repository}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private RepositorySettings settings; private String type; - @Nullable private String uuid; - private RepositorySettings settings; + public Builder() {} - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; + private Builder(Repository o) { + this.settings = o.settings; + this.type = o.type; + this.uuid = o.uuid; } - /** - * API name: {@code uuid} - */ - public final Builder uuid(@Nullable String value) { - this.uuid = value; - return this; + private Builder(Builder o) { + this.settings = o.settings; + this.type = o.type; + this.uuid = o.uuid; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(RepositorySettings value) { this.settings = value; return this; @@ -157,16 +182,36 @@ public final Builder settings(RepositorySettings value) { /** * Required - API name: {@code settings} */ + @Nonnull public final Builder settings(Function> fn) { - return this.settings(fn.apply(new RepositorySettings.Builder()).build()); + return settings(fn.apply(new RepositorySettings.Builder()).build()); + } + + /** + * Required - API name: {@code type} + */ + @Nonnull + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * API name: {@code uuid} + */ + @Nonnull + public final Builder uuid(@Nullable String value) { + this.uuid = value; + return this; } /** * Builds a {@link Repository}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Repository build() { _checkSingleUse(); @@ -185,11 +230,25 @@ public Repository build() { ); protected static void setupRepositoryDeserializer(ObjectDeserializer op) { - + op.add(Builder::settings, RepositorySettings._DESERIALIZER, "settings"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); - op.add(Builder::settings, RepositorySettings._DESERIALIZER, "settings"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.settings.hashCode(); + result = 31 * result + this.type.hashCode(); + result = 31 * result + Objects.hashCode(this.uuid); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Repository other = (Repository) o; + return this.settings.equals(other.settings) && this.type.equals(other.type) && Objects.equals(this.uuid, other.uuid); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java index 601a2de702..1c32397b47 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RepositorySettings.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -42,13 +49,17 @@ 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: snapshot._types.RepositorySettings +// typedef: snapshot.RepositorySettings @JsonpDeserializable -public class RepositorySettings implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RepositorySettings implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final String chunkSize; @@ -56,8 +67,9 @@ public class RepositorySettings implements PlainJsonSerializable { private final Boolean compress; @Nullable - private final String concurrentStreams; + private final Integer concurrentStreams; + @Nonnull private final String location; @Nullable @@ -66,16 +78,14 @@ public class RepositorySettings implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private RepositorySettings(Builder builder) { - this.chunkSize = builder.chunkSize; this.compress = builder.compress; this.concurrentStreams = builder.concurrentStreams; this.location = ApiTypeHelper.requireNonNull(builder.location, this, "location"); this.readOnly = builder.readOnly; - } - public static RepositorySettings of(Function> fn) { + public static RepositorySettings of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -99,13 +109,14 @@ public final Boolean compress() { * API name: {@code concurrent_streams} */ @Nullable - public final String concurrentStreams() { + public final Integer concurrentStreams() { return this.concurrentStreams; } /** * Required - API name: {@code location} */ + @Nonnull public final String location() { return this.location; } @@ -121,6 +132,7 @@ public final Boolean readOnly() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -128,57 +140,85 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.chunkSize != null) { generator.writeKey("chunk_size"); generator.write(this.chunkSize); - } + if (this.compress != null) { generator.writeKey("compress"); generator.write(this.compress); - } + if (this.concurrentStreams != null) { generator.writeKey("concurrent_streams"); generator.write(this.concurrentStreams); - } + generator.writeKey("location"); generator.write(this.location); if (this.readOnly != null) { generator.writeKey("read_only"); generator.write(this.readOnly); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RepositorySettings}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String chunkSize; - @Nullable private Boolean compress; - @Nullable - private String concurrentStreams; - + private Integer concurrentStreams; private String location; - @Nullable private Boolean readOnly; + public Builder() {} + + private Builder(RepositorySettings o) { + this.chunkSize = o.chunkSize; + this.compress = o.compress; + this.concurrentStreams = o.concurrentStreams; + this.location = o.location; + this.readOnly = o.readOnly; + } + + private Builder(Builder o) { + this.chunkSize = o.chunkSize; + this.compress = o.compress; + this.concurrentStreams = o.concurrentStreams; + this.location = o.location; + this.readOnly = o.readOnly; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code chunk_size} */ + @Nonnull public final Builder chunkSize(@Nullable String value) { this.chunkSize = value; return this; @@ -187,6 +227,7 @@ public final Builder chunkSize(@Nullable String value) { /** * API name: {@code compress} */ + @Nonnull public final Builder compress(@Nullable Boolean value) { this.compress = value; return this; @@ -195,7 +236,8 @@ public final Builder compress(@Nullable Boolean value) { /** * API name: {@code concurrent_streams} */ - public final Builder concurrentStreams(@Nullable String value) { + @Nonnull + public final Builder concurrentStreams(@Nullable Integer value) { this.concurrentStreams = value; return this; } @@ -203,6 +245,7 @@ public final Builder concurrentStreams(@Nullable String value) { /** * Required - API name: {@code location} */ + @Nonnull public final Builder location(String value) { this.location = value; return this; @@ -211,6 +254,7 @@ public final Builder location(String value) { /** * API name: {@code read_only} */ + @Nonnull public final Builder readOnly(@Nullable Boolean value) { this.readOnly = value; return this; @@ -219,9 +263,10 @@ public final Builder readOnly(@Nullable Boolean value) { /** * Builds a {@link RepositorySettings}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RepositorySettings build() { _checkSingleUse(); @@ -240,13 +285,33 @@ public RepositorySettings build() { ); protected static void setupRepositorySettingsDeserializer(ObjectDeserializer op) { - op.add(Builder::chunkSize, JsonpDeserializer.stringDeserializer(), "chunk_size"); op.add(Builder::compress, JsonpDeserializer.booleanDeserializer(), "compress"); - op.add(Builder::concurrentStreams, JsonpDeserializer.stringDeserializer(), "concurrent_streams"); + op.add(Builder::concurrentStreams, JsonpDeserializer.integerDeserializer(), "concurrent_streams"); op.add(Builder::location, JsonpDeserializer.stringDeserializer(), "location"); - op.add(Builder::readOnly, JsonpDeserializer.booleanDeserializer(), "read_only", "readonly"); + op.add(Builder::readOnly, JsonpDeserializer.booleanDeserializer(), "read_only"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.chunkSize); + result = 31 * result + Objects.hashCode(this.compress); + result = 31 * result + Objects.hashCode(this.concurrentStreams); + result = 31 * result + this.location.hashCode(); + result = 31 * result + Objects.hashCode(this.readOnly); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RepositorySettings other = (RepositorySettings) o; + return Objects.equals(this.chunkSize, other.chunkSize) + && Objects.equals(this.compress, other.compress) + && Objects.equals(this.concurrentStreams, other.concurrentStreams) + && this.location.equals(other.location) + && Objects.equals(this.readOnly, other.readOnly); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index 86e3016d6b..d73e7d5c97 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -79,40 +79,6 @@ public CompletableFuture create(CreateSnapshotRequest re return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } - // ----- Endpoint: snapshot.create_repository - - /** - * Creates a repository. - * - * - */ - - public CompletableFuture createRepository(CreateRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CreateRepositoryRequest, - CreateRepositoryResponse, - ErrorResponse>) CreateRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Creates a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRepositoryRequest} - * - */ - - public final CompletableFuture createRepository( - Function> fn - ) throws IOException, OpenSearchException { - return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.delete /** @@ -146,87 +112,6 @@ public final CompletableFuture delete( return delete(fn.apply(new DeleteSnapshotRequest.Builder()).build()); } - // ----- Endpoint: snapshot.delete_repository - - /** - * Deletes a repository. - * - * - */ - - public CompletableFuture deleteRepository(DeleteRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteRepositoryRequest, - DeleteRepositoryResponse, - ErrorResponse>) DeleteRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRepositoryRequest} - * - */ - - public final CompletableFuture deleteRepository( - Function> fn - ) throws IOException, OpenSearchException { - return deleteRepository(fn.apply(new DeleteRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.get_repository - - /** - * Returns information about a repository. - * - * - */ - - public CompletableFuture getRepository(GetRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetRepositoryRequest, - GetRepositoryResponse, - ErrorResponse>) GetRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRepositoryRequest} - * - */ - - public final CompletableFuture getRepository( - Function> fn - ) throws IOException, OpenSearchException { - return getRepository(fn.apply(new GetRepositoryRequest.Builder()).build()); - } - - /** - * Returns information about a repository. - * - * - */ - - public CompletableFuture getRepository() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetRepositoryRequest.Builder().build(), - GetRepositoryRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: snapshot.restore /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index e80cf77ee8..dda8c56e95 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -78,39 +78,6 @@ public CreateSnapshotResponse create(CreateSnapshotRequest request) throws IOExc return this.transport.performRequest(request, endpoint, this.transportOptions); } - // ----- Endpoint: snapshot.create_repository - - /** - * Creates a repository. - * - * - */ - - public CreateRepositoryResponse createRepository(CreateRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CreateRepositoryRequest, - CreateRepositoryResponse, - ErrorResponse>) CreateRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Creates a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CreateRepositoryRequest} - * - */ - - public final CreateRepositoryResponse createRepository( - Function> fn - ) throws IOException, OpenSearchException { - return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.delete /** @@ -143,85 +110,6 @@ public final DeleteSnapshotResponse delete(Function endpoint = (JsonEndpoint< - DeleteRepositoryRequest, - DeleteRepositoryResponse, - ErrorResponse>) DeleteRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteRepositoryRequest} - * - */ - - public final DeleteRepositoryResponse deleteRepository( - Function> fn - ) throws IOException, OpenSearchException { - return deleteRepository(fn.apply(new DeleteRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.get_repository - - /** - * Returns information about a repository. - * - * - */ - - public GetRepositoryResponse getRepository(GetRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetRepositoryRequest, - GetRepositoryResponse, - ErrorResponse>) GetRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link GetRepositoryRequest} - * - */ - - public final GetRepositoryResponse getRepository(Function> fn) - throws IOException, OpenSearchException { - return getRepository(fn.apply(new GetRepositoryRequest.Builder()).build()); - } - - /** - * Returns information about a repository. - * - * - */ - - public GetRepositoryResponse getRepository() throws IOException, OpenSearchException { - return this.transport.performRequest( - new GetRepositoryRequest.Builder().build(), - GetRepositoryRequest._ENDPOINT, - this.transportOptions - ); - } - // ----- Endpoint: snapshot.restore /** diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index f21d3aa555..64b87dc3bd 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -53466,7 +53466,7 @@ components: type: boolean model_index_status: oneOf: - - $ref: '#/components/schemas/_common___HealthStatusCapitalized' + - $ref: '#/components/schemas/_common___HealthStatus' - type: 'null' nodes: type: object @@ -58620,19 +58620,13 @@ components: chunk_size: type: string compress: - oneOf: - - type: string - - type: boolean + $ref: '#/components/schemas/_common___StringifiedBoolean' concurrent_streams: - oneOf: - - type: string - - type: number + $ref: '#/components/schemas/_common___StringifiedInteger' location: type: string read_only: - oneOf: - - type: string - - type: boolean + $ref: '#/components/schemas/_common___StringifiedBoolean' required: - location snapshot._common___ShardsStats: 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 cfbd41466e..beaaea57a0 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 @@ -68,7 +68,7 @@ public class CodeGenerator { isNot("search_models") ) ), - and(namespace(is("snapshot")), name(isOneOf("cleanup_repository", "clone", "create", "get", "verify_repository"))), + and(namespace(is("snapshot")), name(or(contains("repository"), isOneOf("clone", "create", "get")))), and(namespace(is("tasks"))) ); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index c806b31fee..8e750f8fec 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -16,6 +16,7 @@ import java.util.Objects; import java.util.Set; import java.util.TreeMap; +import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.Pair; @@ -103,7 +104,13 @@ public boolean canBeSingleton() { @Override public Collection getFieldsToDeserialize() { var fields = new TreeMap<>(bodyFields); - fields.putAll(pathParams); + var wireNameSet = bodyFields.values().stream().map(Field::getWireName).collect(Collectors.toSet()); + pathParams.forEach((k, v) -> { + if (wireNameSet.contains(v.getWireName())) { + v = v.toBuilder().withWireName(v.getName()).build(); + } + fields.put(k, v); + }); return fields.values(); } 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 d0116d6178..49a3fc34e2 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 @@ -27,6 +27,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.client.codegen.model.overrides.Overrides; +import org.opensearch.client.codegen.model.overrides.PathParameterOverride; import org.opensearch.client.codegen.model.overrides.PropertyOverride; import org.opensearch.client.codegen.model.overrides.SchemaOverride; import org.opensearch.client.codegen.model.overrides.ShouldGenerate; @@ -149,6 +150,7 @@ private void visit(@Nonnull OperationGroup group, @Nonnull List variants) { + var overrides = this.overrides.getOperation(group); var seenHttpPaths = new HashSet(); HashSet requiredPathParams = null; var allPathParams = new HashMap(); @@ -170,7 +172,10 @@ private RequestShape visit(@Nonnull Namespace parent, @Nonnull OperationGroup gr variant.getAllRelevantParameters(In.Path).forEach(parameter -> { var paramName = parameter.getName().orElseThrow(); if (!allPathParams.containsKey(paramName)) { - allPathParams.put(paramName, visit(parameter)); + var paramOverrides = overrides.flatMap(o -> o.getPathParameter(paramName)); + var paramBuilder = visit(parameter).toBuilder(); + paramOverrides.flatMap(PathParameterOverride::getName).ifPresent(paramBuilder::withName); + allPathParams.put(paramName, paramBuilder.build()); } }); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/OperationOverride.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/OperationOverride.java new file mode 100644 index 0000000000..c83c0fe235 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/OperationOverride.java @@ -0,0 +1,76 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model.overrides; + +import java.util.Collections; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.model.OperationGroup; +import org.opensearch.client.codegen.utils.builder.ObjectBuilder; +import org.opensearch.client.codegen.utils.builder.ObjectBuilderBase; +import org.opensearch.client.codegen.utils.builder.ObjectMapBuilderBase; + +public final class OperationOverride { + @Nonnull + private final Map pathParameters; + + private OperationOverride(Builder builder) { + this.pathParameters = builder.pathParameters != null ? builder.pathParameters : Collections.emptyMap(); + } + + @Nonnull + public Optional getPathParameter(@Nonnull String key) { + return Optional.ofNullable(pathParameters.get(key)); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + @Nonnull + public static MapBuilder mapBuilder() { + return new MapBuilder(); + } + + public static final class Builder extends ObjectBuilderBase { + @Nullable + private Map pathParameters; + + private Builder() {} + + @Nonnull + @Override + protected OperationOverride construct() { + return new OperationOverride(this); + } + + @Nonnull + public Builder withPathParameters( + @Nonnull Function>> fn + ) { + this.pathParameters = Objects.requireNonNull(fn, "fn must not be null").apply(PathParameterOverride.mapBuilder()).build(); + return this; + } + } + + public static final class MapBuilder extends ObjectMapBuilderBase { + private MapBuilder() {} + + @Nonnull + @Override + protected Builder valueBuilder() { + return builder(); + } + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 99f90a1b82..81e66f4613 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -16,6 +16,7 @@ import java.util.function.Function; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.codegen.model.OperationGroup; import org.opensearch.client.codegen.model.Types; import org.opensearch.client.codegen.openapi.JsonPointer; import org.opensearch.client.codegen.openapi.OpenApiSchema; @@ -27,86 +28,109 @@ private static JsonPointer schema(String namespace, String name) { return OpenApiSchema.COMPONENTS_SCHEMAS.append(namespace + OpenApiSchema.NAMESPACE_NAME_SEPARATOR + name); } - public static final Overrides OVERRIDES = builder().withSchemas( - s -> s.with(schema("_common", "Duration"), so -> so.withMappedType(Types.Client.OpenSearch._Types.Time)) - .with(schema("_common", "FieldValue"), so -> so.withMappedType(Types.Client.OpenSearch._Types.FieldValue)) - .with(schema("_common", "StringifiedBoolean"), so -> so.withMappedType(Types.Primitive.Boolean)) - .with(schema("_common", "StringifiedDouble"), so -> so.withMappedType(Types.Primitive.Double)) - .with(schema("_common", "StringifiedInteger"), so -> so.withMappedType(Types.Primitive.Int)) - .with(schema("_common", "StringifiedLong"), so -> so.withMappedType(Types.Primitive.Long)) - .with(schema("_common", "StringifiedEpochTimeUnitMillis"), so -> so.withMappedType(Types.Primitive.Long)) - - .with(schema("_common", "DistanceUnit"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common", "GeoBounds"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common", "GeoDistanceType"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common", "GeoShapeRelation"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - - .with(schema("_common", "ScriptSort"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + public static final Overrides OVERRIDES = builder().withOperations( + o -> o.with( + OperationGroup.from("snapshot.create_repository"), + oo -> oo.withPathParameters(pp -> pp.with("repository", po -> po.withName("name"))) + ) .with( - schema("_common", "SortOptions"), - so -> so.withMappedType(t -> t.withPackage(Types.Client.OpenSearch._Types.PACKAGE).withName("SortOptions")) + OperationGroup.from("snapshot.delete_repository"), + oo -> oo.withPathParameters(pp -> pp.with("repository", po -> po.withName("name"))) ) - - .with( - schema("_common.aggregations", "AggregationContainer"), - so -> so.withClassName("Aggregation").withShouldGenerate(ShouldGenerate.Never) - ) - - // TODO: Remove this once figuring out how best to handle these schemas - .with(schema("_common.query_dsl", "DecayFunction"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with( - schema("_common.query_dsl", "FunctionScoreContainer"), - so -> so.withShouldGenerate(ShouldGenerate.Never).withClassName("FunctionScore") - ) - .with(schema("_common.query_dsl", "DistanceFeatureQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "GeoBoundingBoxQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "GeoDistanceQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "GeoPolygonQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "GeoShapeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "RangeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "RankFeatureFunctionLinear"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "RankFeatureFunctionLogarithm"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "RankFeatureFunctionSaturation"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "RankFeatureFunctionSigmoid"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with( - schema("_common.query_dsl", "SpanGapQuery"), - so -> so.withMappedType(t -> t.withPackage(Types.Client.OpenSearch._Types.PACKAGE + ".query_dsl").withName("SpanGapQuery")) - ) - .with(schema("_common.query_dsl", "TermsQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - .with(schema("_common.query_dsl", "TermsQueryField"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common.query_dsl", "XyShapeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) - - .with(schema("_common.query_dsl", "FieldValueFactorModifier"), so -> so.withShouldGenerate(ShouldGenerate.Always)) - .with(schema("_common.query_dsl", "IntervalsContainer"), so -> so.withClassName("Intervals")) - - .with(schema("_common.query_dsl", "QueryBase"), so -> so.withProperties(p -> p.with("_name", po -> po.withName("queryName")))) - - .with(schema("_common.query_dsl", "QueryContainer"), so -> so.withClassName("Query")) - .with( - schema("_core.search", "SourceFilter").append("oneOf", "1"), - so -> so.withAliasProvider(k -> k.endsWith("cludes") ? Set.of(k.substring(0, k.length() - 1)) : null) + OperationGroup.from("snapshot.get_repository"), + oo -> oo.withPathParameters(pp -> pp.with("repository", po -> po.withName("name"))) ) + ) + .withSchemas( + s -> s.with(schema("_common", "Duration"), so -> so.withMappedType(Types.Client.OpenSearch._Types.Time)) + .with(schema("_common", "FieldValue"), so -> so.withMappedType(Types.Client.OpenSearch._Types.FieldValue)) + .with(schema("_common", "StringifiedBoolean"), so -> so.withMappedType(Types.Primitive.Boolean)) + .with(schema("_common", "StringifiedDouble"), so -> so.withMappedType(Types.Primitive.Double)) + .with(schema("_common", "StringifiedInteger"), so -> so.withMappedType(Types.Primitive.Int)) + .with(schema("_common", "StringifiedLong"), so -> so.withMappedType(Types.Primitive.Long)) + .with(schema("_common", "StringifiedEpochTimeUnitMillis"), so -> so.withMappedType(Types.Primitive.Long)) + + .with(schema("_common", "DistanceUnit"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with(schema("_common", "GeoBounds"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with(schema("_common", "GeoDistanceType"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with(schema("_common", "GeoShapeRelation"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + + .with(schema("_common", "ScriptSort"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with( + schema("_common", "SortOptions"), + so -> so.withMappedType(t -> t.withPackage(Types.Client.OpenSearch._Types.PACKAGE).withName("SortOptions")) + ) + + .with( + schema("_common.aggregations", "AggregationContainer"), + so -> so.withClassName("Aggregation").withShouldGenerate(ShouldGenerate.Never) + ) + + // TODO: Remove this once figuring out how best to handle these schemas + .with(schema("_common.query_dsl", "DecayFunction"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with( + schema("_common.query_dsl", "FunctionScoreContainer"), + so -> so.withShouldGenerate(ShouldGenerate.Never).withClassName("FunctionScore") + ) + .with(schema("_common.query_dsl", "DistanceFeatureQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "GeoBoundingBoxQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "GeoDistanceQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "GeoPolygonQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "GeoShapeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "RangeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "RankFeatureFunctionLinear"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "RankFeatureFunctionLogarithm"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "RankFeatureFunctionSaturation"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "RankFeatureFunctionSigmoid"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with( + schema("_common.query_dsl", "SpanGapQuery"), + so -> so.withMappedType( + t -> t.withPackage(Types.Client.OpenSearch._Types.PACKAGE + ".query_dsl").withName("SpanGapQuery") + ) + ) + .with(schema("_common.query_dsl", "TermsQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + .with(schema("_common.query_dsl", "TermsQueryField"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with(schema("_common.query_dsl", "XyShapeQuery"), so -> so.withShouldGenerate(ShouldGenerate.Never)) + + .with(schema("_common.query_dsl", "FieldValueFactorModifier"), so -> so.withShouldGenerate(ShouldGenerate.Always)) + .with(schema("_common.query_dsl", "IntervalsContainer"), so -> so.withClassName("Intervals")) + + .with( + schema("_common.query_dsl", "QueryBase"), + so -> so.withProperties(p -> p.with("_name", po -> po.withName("queryName"))) + ) + + .with(schema("_common.query_dsl", "QueryContainer"), so -> so.withClassName("Query")) + + .with( + schema("_core.search", "SourceFilter").append("oneOf", "1"), + so -> so.withAliasProvider(k -> k.endsWith("cludes") ? Set.of(k.substring(0, k.length() - 1)) : null) + ) + + .with(schema("indices._common", "IndexSettings"), so -> so.withAliasProvider(k -> { + switch (k) { + case "index": + case "indexing": + case "mapping": + case "search": + case "settings": + case "top_metrics_max_size": + return null; + default: + return Set.of("index." + k); + } + })) + ) + .build(); - .with(schema("indices._common", "IndexSettings"), so -> so.withAliasProvider(k -> { - switch (k) { - case "index": - case "indexing": - case "mapping": - case "search": - case "settings": - case "top_metrics_max_size": - return null; - default: - return Set.of("index." + k); - } - })) - ).build(); - + @Nonnull + private final Map operations; @Nonnull private final Map schemas; private Overrides(Builder builder) { + this.operations = builder.operations != null ? Collections.unmodifiableMap(builder.operations) : Collections.emptyMap(); this.schemas = builder.schemas != null ? Collections.unmodifiableMap(builder.schemas) : Collections.emptyMap(); } @@ -120,12 +144,19 @@ public Optional getSchema(@Nonnull JsonPointer pointer) { return Optional.ofNullable(schemas.get(pointer)); } + @Nonnull + public Optional getOperation(@Nonnull OperationGroup group) { + return Optional.ofNullable(operations.get(group)); + } + @Nonnull public static Builder builder() { return new Builder(); } public static final class Builder extends ObjectBuilderBase { + @Nullable + private Map operations; @Nullable private Map schemas; @@ -137,6 +168,14 @@ protected Overrides construct() { return new Overrides(this); } + @Nonnull + public Builder withOperations( + @Nonnull Function>> fn + ) { + this.operations = Objects.requireNonNull(fn, "fn must not be null").apply(OperationOverride.mapBuilder()).build(); + return this; + } + @Nonnull public Builder withSchemas(@Nonnull Function>> fn) { this.schemas = Objects.requireNonNull(fn, "fn must not be null").apply(SchemaOverride.mapBuilder()).build(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PathParameterOverride.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PathParameterOverride.java new file mode 100644 index 0000000000..6cd745217f --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/PathParameterOverride.java @@ -0,0 +1,68 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model.overrides; + +import java.util.Optional; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.codegen.utils.builder.ObjectBuilderBase; +import org.opensearch.client.codegen.utils.builder.ObjectMapBuilderBase; + +public final class PathParameterOverride { + @Nullable + private final String name; + + private PathParameterOverride(Builder builder) { + this.name = builder.name; + } + + @Nonnull + public Optional getName() { + return Optional.ofNullable(name); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + @Nonnull + public static MapBuilder mapBuilder() { + return new MapBuilder(); + } + + public static final class Builder extends ObjectBuilderBase { + @Nullable + private String name; + + private Builder() {} + + @Nonnull + @Override + protected PathParameterOverride construct() { + return new PathParameterOverride(this); + } + + @Nonnull + public Builder withName(@Nullable String value) { + this.name = value; + return this; + } + } + + public static final class MapBuilder extends ObjectMapBuilderBase { + private MapBuilder() {} + + @Nonnull + @Override + protected Builder valueBuilder() { + return builder(); + } + } +} From fb48675c6d228a992dcd4e7f7eca405f412bcb60 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 12 Dec 2024 16:36:07 +1300 Subject: [PATCH 2/4] Generate remaining snapshot requests Signed-off-by: Thomas Farr --- UPGRADING.md | 5 +- .../snapshot/DeleteSnapshotRequest.java | 202 ++-- .../snapshot/DeleteSnapshotResponse.java | 70 +- .../snapshot/FileCountSnapshotStats.java | 79 +- ...ava => OpenSearchSnapshotAsyncClient.java} | 81 +- ...ase.java => OpenSearchSnapshotClient.java} | 79 +- .../opensearch/snapshot/RestoreRequest.java | 1020 +++++++++++++++++ .../opensearch/snapshot/RestoreResponse.java | 132 ++- .../opensearch/snapshot/ShardsStats.java | 101 +- .../opensearch/snapshot/ShardsStatsStage.java | 27 +- .../snapshot/ShardsStatsSummary.java | 185 ++- .../snapshot/ShardsStatsSummaryItem.java | 79 +- .../snapshot/SnapshotIndexStats.java | 122 +- .../snapshot/SnapshotShardsStatus.java | 84 +- .../opensearch/snapshot/SnapshotStats.java | 143 ++- .../snapshot/SnapshotStatusRequest.java | 226 ++-- .../snapshot/SnapshotStatusResponse.java | 96 +- .../client/opensearch/snapshot/Status.java | 162 ++- .../snapshot/restore/SnapshotRestore.java | 146 ++- .../OpenSearchSnapshotAsyncClient.java | 193 ---- .../snapshot/OpenSearchSnapshotClient.java | 190 --- .../opensearch/snapshot/RestoreRequest.java | 634 ---------- .../snapshot/get/SnapshotResponseItem.java | 228 ---- java-codegen/opensearch-openapi.yaml | 132 ++- .../client/codegen/CodeGenerator.java | 4 +- .../client/codegen/model/Namespace.java | 2 +- .../client/codegen/model/RequestShape.java | 4 + 27 files changed, 2689 insertions(+), 1737 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java (68%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{OpenSearchSnapshotAsyncClientBase.java => OpenSearchSnapshotAsyncClient.java} (73%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{OpenSearchSnapshotClientBase.java => OpenSearchSnapshotClient.java} (74%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java (50%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java (71%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java (80%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java (69%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/Status.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java (69%) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/snapshot/get/SnapshotResponseItem.java diff --git a/UPGRADING.md b/UPGRADING.md index 09f333f642..90b6a8e0d9 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -163,4 +163,7 @@ After: - `DataStream`'s (previously `DataStreamInfo`) `indices` field. ### RepositorySettings -- The `concurrentStreams` property is now of type `Integer` instead of `String`. \ No newline at end of file +- The `concurrentStreams` property is now of type `Integer` instead of `String`. + +### snapshot.RestoreRequest +- The `indexSettings` property has been corrected to be of type `IndexSettings` instead of `PutIndicesSettingsRequest`. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java index 850ca3458c..d1f539cc4a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotRequest.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -42,152 +49,203 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.delete.Request /** * Deletes a snapshot. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteSnapshotRequest extends RequestBase implements ToCopyableBuilder { -public class DeleteSnapshotRequest extends RequestBase { - @Deprecated @Nullable - private final Time masterTimeout; + private final Time clusterManagerTimeout; + @Deprecated @Nullable - private final Time clusterManagerTimeout; + private final Time masterTimeout; + @Nonnull private final String repository; + @Nonnull private final String snapshot; // --------------------------------------------------------------------------------------------- private DeleteSnapshotRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.masterTimeout = builder.masterTimeout; this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); - } - public static DeleteSnapshotRequest of(Function> fn) { + public static DeleteSnapshotRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * Required - A repository name *

* API name: {@code repository} + *

*/ + @Nonnull public final String repository() { return this.repository; } /** - * Required - A snapshot name + * Required - A comma-separated list of snapshot names *

* API name: {@code snapshot} + *

*/ + @Nonnull public final String snapshot() { return this.snapshot; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteSnapshotRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Time masterTimeout; + private String repository; + private String snapshot; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} - private String repository; + private Builder(DeleteSnapshotRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.repository = o.repository; + this.snapshot = o.snapshot; + } - private String snapshot; + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.repository = o.repository; + this.snapshot = o.snapshot; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** * Explicit operation timeout for connection to cluster-manager node *

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

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

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ + @Nonnull public final Builder repository(String value) { this.repository = value; return this; } /** - * Required - A snapshot name + * Required - A comma-separated list of snapshot names *

* API name: {@code snapshot} + *

*/ + @Nonnull public final Builder snapshot(String value) { this.snapshot = value; return this; @@ -196,9 +254,10 @@ public final Builder snapshot(String value) { /** * Builds a {@link DeleteSnapshotRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteSnapshotRequest build() { _checkSingleUse(); @@ -212,50 +271,51 @@ public DeleteSnapshotRequest build() { * Endpoint "{@code snapshot.delete}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _repository = 1 << 0; - final int _snapshot = 1 << 1; - - int propsSet = 0; - - propsSet |= _repository; - propsSet |= _snapshot; - - if (propsSet == (_repository | _snapshot)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.repository, buf); - buf.append("/"); - SimpleEndpoint.pathEncode(request.snapshot, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.snapshot, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteSnapshotResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.repository.hashCode(); + result = 31 * result + this.snapshot.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteSnapshotRequest other = (DeleteSnapshotRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.repository.equals(other.repository) + && this.snapshot.equals(other.snapshot); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java index adb84b2fe2..1b0d535350 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/DeleteSnapshotResponse.java @@ -30,39 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.delete.Response @JsonpDeserializable -public class DeleteSnapshotResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteSnapshotResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DeleteSnapshotResponse(Builder builder) { super(builder); - } - public static DeleteSnapshotResponse of(Function> fn) { + public static DeleteSnapshotResponse 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 DeleteSnapshotResponse}. */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteSnapshotResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +111,10 @@ protected Builder self() { /** * Builds a {@link DeleteSnapshotResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteSnapshotResponse build() { _checkSingleUse(); @@ -91,8 +133,22 @@ public DeleteSnapshotResponse build() { ); protected static void setupDeleteSnapshotResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java index 710ad248a8..845a842775 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/FileCountSnapshotStats.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -41,13 +47,20 @@ 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: snapshot._types.FileCountSnapshotStats +// typedef: snapshot.FileCountSnapshotStats @JsonpDeserializable -public class FileCountSnapshotStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FileCountSnapshotStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final int fileCount; private final long sizeInBytes; @@ -55,13 +68,11 @@ public class FileCountSnapshotStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private FileCountSnapshotStats(Builder builder) { - this.fileCount = ApiTypeHelper.requireNonNull(builder.fileCount, this, "fileCount"); this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - } - public static FileCountSnapshotStats of(Function> fn) { + public static FileCountSnapshotStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -82,6 +93,7 @@ public final long sizeInBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +101,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("file_count"); generator.write(this.fileCount); generator.writeKey("size_in_bytes"); generator.write(this.sizeInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link FileCountSnapshotStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer fileCount; - private Long sizeInBytes; + public Builder() {} + + private Builder(FileCountSnapshotStats o) { + this.fileCount = o.fileCount; + this.sizeInBytes = o.sizeInBytes; + } + + private Builder(Builder o) { + this.fileCount = o.fileCount; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code file_count} */ + @Nonnull public final Builder fileCount(int value) { this.fileCount = value; return this; @@ -120,6 +158,7 @@ public final Builder fileCount(int value) { /** * Required - API name: {@code size_in_bytes} */ + @Nonnull public final Builder sizeInBytes(long value) { this.sizeInBytes = value; return this; @@ -128,9 +167,10 @@ public final Builder sizeInBytes(long value) { /** * Builds a {@link FileCountSnapshotStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FileCountSnapshotStats build() { _checkSingleUse(); @@ -149,10 +189,23 @@ public FileCountSnapshotStats build() { ); protected static void setupFileCountSnapshotStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::fileCount, JsonpDeserializer.integerDeserializer(), "file_count"); op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.fileCount); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FileCountSnapshotStats other = (FileCountSnapshotStats) o; + return this.fileCount == other.fileCount && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java similarity index 73% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index a473778254..b77f2f22a3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -51,13 +51,20 @@ * Client for the snapshot namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public abstract class OpenSearchSnapshotAsyncClientBase> extends ApiClient< - OpenSearchTransport, - Self> { - public OpenSearchSnapshotAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public class OpenSearchSnapshotAsyncClient extends ApiClient { + public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchSnapshotAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchSnapshotAsyncClient(this.transport, transportOptions); + } + // ----- Endpoint: snapshot.cleanup_repository /** @@ -140,6 +147,26 @@ public final CompletableFuture createRepository( return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); } + // ----- Endpoint: snapshot.delete + + /** + * Deletes a snapshot. + */ + public CompletableFuture delete(DeleteSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a snapshot. + * + * @param fn a function that initializes a builder to create the {@link DeleteSnapshotRequest} + */ + public final CompletableFuture delete( + Function> fn + ) throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteSnapshotRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.delete_repository /** @@ -207,6 +234,52 @@ public final CompletableFuture getRepository() throws IOE return getRepository(new GetRepositoryRequest.Builder().build()); } + // ----- Endpoint: snapshot.restore + + /** + * Restores a snapshot. + */ + public CompletableFuture restore(RestoreRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RestoreRequest._ENDPOINT, this.transportOptions); + } + + /** + * Restores a snapshot. + * + * @param fn a function that initializes a builder to create the {@link RestoreRequest} + */ + public final CompletableFuture restore(Function> fn) + throws IOException, OpenSearchException { + return restore(fn.apply(new RestoreRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.status + + /** + * Returns information about the status of a snapshot. + */ + public CompletableFuture status(SnapshotStatusRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, SnapshotStatusRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about the status of a snapshot. + * + * @param fn a function that initializes a builder to create the {@link SnapshotStatusRequest} + */ + public final CompletableFuture status( + Function> fn + ) throws IOException, OpenSearchException { + return status(fn.apply(new SnapshotStatusRequest.Builder()).build()); + } + + /** + * Returns information about the status of a snapshot. + */ + public final CompletableFuture status() throws IOException, OpenSearchException { + return status(new SnapshotStatusRequest.Builder().build()); + } + // ----- Endpoint: snapshot.verify_repository /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java similarity index 74% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index 537152424d..4e6d872b32 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -50,13 +50,20 @@ * Client for the snapshot namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public abstract class OpenSearchSnapshotClientBase> extends ApiClient< - OpenSearchTransport, - Self> { - public OpenSearchSnapshotClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public class OpenSearchSnapshotClient extends ApiClient { + public OpenSearchSnapshotClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchSnapshotClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchSnapshotClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchSnapshotClient(this.transport, transportOptions); + } + // ----- Endpoint: snapshot.cleanup_repository /** @@ -135,6 +142,25 @@ public final CreateRepositoryResponse createRepository( return createRepository(fn.apply(new CreateRepositoryRequest.Builder()).build()); } + // ----- Endpoint: snapshot.delete + + /** + * Deletes a snapshot. + */ + public DeleteSnapshotResponse delete(DeleteSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes a snapshot. + * + * @param fn a function that initializes a builder to create the {@link DeleteSnapshotRequest} + */ + public final DeleteSnapshotResponse delete(Function> fn) + throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteSnapshotRequest.Builder()).build()); + } + // ----- Endpoint: snapshot.delete_repository /** @@ -200,6 +226,51 @@ public final GetRepositoryResponse getRepository() throws IOException, OpenSearc return getRepository(new GetRepositoryRequest.Builder().build()); } + // ----- Endpoint: snapshot.restore + + /** + * Restores a snapshot. + */ + public RestoreResponse restore(RestoreRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RestoreRequest._ENDPOINT, this.transportOptions); + } + + /** + * Restores a snapshot. + * + * @param fn a function that initializes a builder to create the {@link RestoreRequest} + */ + public final RestoreResponse restore(Function> fn) throws IOException, + OpenSearchException { + return restore(fn.apply(new RestoreRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.status + + /** + * Returns information about the status of a snapshot. + */ + public SnapshotStatusResponse status(SnapshotStatusRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, SnapshotStatusRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about the status of a snapshot. + * + * @param fn a function that initializes a builder to create the {@link SnapshotStatusRequest} + */ + public final SnapshotStatusResponse status(Function> fn) + throws IOException, OpenSearchException { + return status(fn.apply(new SnapshotStatusRequest.Builder()).build()); + } + + /** + * Returns information about the status of a snapshot. + */ + public final SnapshotStatusResponse status() throws IOException, OpenSearchException { + return status(new SnapshotStatusRequest.Builder().build()); + } + // ----- Endpoint: snapshot.verify_repository /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java new file mode 100644 index 0000000000..ca9892e124 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java @@ -0,0 +1,1020 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.snapshot; + +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch.indices.IndexSettings; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: snapshot.restore.Request + +/** + * Restores a snapshot. + */ +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RestoreRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull + private final List ignoreIndexSettings; + + @Nullable + private final Boolean ignoreUnavailable; + + @Nullable + private final Boolean includeAliases; + + @Nullable + private final Boolean includeGlobalState; + + @Nullable + private final IndexSettings indexSettings; + + @Nonnull + private final List indices; + + @Deprecated + @Nullable + private final Time masterTimeout; + + @Nullable + private final Boolean partial; + + @Nullable + private final String renameAliasPattern; + + @Nullable + private final String renameAliasReplacement; + + @Nullable + private final String renamePattern; + + @Nullable + private final String renameReplacement; + + @Nonnull + private final String repository; + + @Nonnull + private final String snapshot; + + @Nullable + private final String sourceRemoteStoreRepository; + + @Nullable + private final String storageType; + + @Nullable + private final Boolean waitForCompletion; + + // --------------------------------------------------------------------------------------------- + + private RestoreRequest(Builder builder) { + this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.ignoreIndexSettings = ApiTypeHelper.unmodifiable(builder.ignoreIndexSettings); + this.ignoreUnavailable = builder.ignoreUnavailable; + this.includeAliases = builder.includeAliases; + this.includeGlobalState = builder.includeGlobalState; + this.indexSettings = builder.indexSettings; + this.indices = ApiTypeHelper.unmodifiable(builder.indices); + this.masterTimeout = builder.masterTimeout; + this.partial = builder.partial; + this.renameAliasPattern = builder.renameAliasPattern; + this.renameAliasReplacement = builder.renameAliasReplacement; + this.renamePattern = builder.renamePattern; + this.renameReplacement = builder.renameReplacement; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); + this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); + this.sourceRemoteStoreRepository = builder.sourceRemoteStoreRepository; + this.storageType = builder.storageType; + this.waitForCompletion = builder.waitForCompletion; + } + + public static RestoreRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * A comma-delimited list of index settings that you don't want to restore from a snapshot. + *

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

+ */ + @Nonnull + public final List ignoreIndexSettings() { + return this.ignoreIndexSettings; + } + + /** + * How to handle data streams or indexes that are missing or closed. If false, the request returns an error for any data + * stream or index that is missing or closed. If true, the request ignores data streams and indexes in indexes that are + * missing or closed. Defaults to false. + *

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

+ */ + @Nullable + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; + } + + /** + * How to handle index aliases from the original snapshot. If true, index aliases from the original snapshot are restored. + * If false, aliases along with associated indexes are not restored. Defaults to true. + *

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

+ */ + @Nullable + public final Boolean includeAliases() { + return this.includeAliases; + } + + /** + * Whether to restore the current cluster state. If false, the cluster state is not restored. If true, the current cluster + * state is restored. Defaults to false. + *

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

+ */ + @Nullable + public final Boolean includeGlobalState() { + return this.includeGlobalState; + } + + /** + * A comma-delimited list of settings to add or change in all restored indexes. Use this parameter to override index settings during + * snapshot restoration. For data streams, these index settings are applied to the restored backing indexes. + *

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

+ */ + @Nullable + public final IndexSettings indexSettings() { + return this.indexSettings; + } + + /** + * A comma-delimited list of data streams and indexes to restore from the snapshot. Multi-index syntax is supported. By default, a + * restore operation includes all data streams and indexes in the snapshot. If this argument is provided, the restore operation only + * includes the data streams and indexes that you specify. + *

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

+ */ + @Nonnull + public final List indices() { + return this.indices; + } + + /** + * Explicit operation timeout for connection to cluster-manager node + *

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

+ */ + @Deprecated + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * How the restore operation will behave if indexes in the snapshot do not have all primary shards available. If false, the + * entire restore operation fails if any indexes in the snapshot do not have all primary shards available. If true, allows + * the restoration of a partial snapshot of indexes with unavailable shards. Only shards that were successfully included in the snapshot + * are restored. All missing shards are recreated as empty. By default, the entire restore operation fails if one or more indexes + * included in the snapshot do not have all primary shards available. To change this behavior, set partial to + * true. Defaults to false. + *

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

+ */ + @Nullable + public final Boolean partial() { + return this.partial; + } + + /** + * The pattern to apply to the restored aliases. Aliases matching the rename pattern will be renamed according to the + * rename_alias_replacement setting. The rename pattern is applied as defined by the regular expression that supports + * referencing the original text. If two or more aliases are renamed into the same name, these aliases will be merged into one. + *

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

+ */ + @Nullable + public final String renameAliasPattern() { + return this.renameAliasPattern; + } + + /** + * The rename replacement string for aliases. + *

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

+ */ + @Nullable + public final String renameAliasReplacement() { + return this.renameAliasReplacement; + } + + /** + * The pattern to apply to the restored data streams and indexes. Data streams and indexes matching the rename pattern will be renamed + * according to the rename_replacement setting. The rename pattern is applied as defined by the regular expression that + * supports referencing the original text. The request fails if two or more data streams or indexes are renamed into the same name. If + * you rename a restored data stream, its backing indexes are also renamed. For example, if you rename the logs data stream to + * recovered-logs, the backing index .ds-logs-1 is renamed to .ds-recovered-logs-1. If you rename + * a restored stream, ensure an index template matches the new stream name. If there are no matching index template names, the stream + * cannot roll over and new backing indexes are not created. + *

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

+ */ + @Nullable + public final String renamePattern() { + return this.renamePattern; + } + + /** + * The rename replacement string. + *

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

+ */ + @Nullable + public final String renameReplacement() { + return this.renameReplacement; + } + + /** + * Required - A repository name + *

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

+ */ + @Nonnull + public final String repository() { + return this.repository; + } + + /** + * Required - A snapshot name + *

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

+ */ + @Nonnull + public final String snapshot() { + return this.snapshot; + } + + /** + * The name of the remote store repository of the source index being restored. If not provided, the Snapshot Restore API will use the + * repository that was registered when the snapshot was created. + *

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

+ */ + @Nullable + public final String sourceRemoteStoreRepository() { + return this.sourceRemoteStoreRepository; + } + + /** + * Where will be the authoritative store of the restored indexes' data. A value of local indicates that all snapshot + * metadata and index data will be downloaded to local storage. A value of remote_snapshot indicates that snapshot metadata + * will be downloaded to the cluster, but the remote repository will remain the authoritative store of the index data. Data will be + * downloaded and cached as necessary to service queries. At least one node in the cluster must be configured with the search role in + * order to restore a snapshot using the type remote_snapshot. Defaults to local. + *

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

+ */ + @Nullable + public final String storageType() { + return this.storageType; + } + + /** + * Should this request wait until the operation has completed before returning + *

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

+ */ + @Nullable + public final Boolean waitForCompletion() { + return this.waitForCompletion; + } + + /** + * 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.ignoreIndexSettings)) { + generator.writeKey("ignore_index_settings"); + generator.writeStartArray(); + for (String item0 : this.ignoreIndexSettings) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.ignoreUnavailable != null) { + generator.writeKey("ignore_unavailable"); + generator.write(this.ignoreUnavailable); + } + + if (this.includeAliases != null) { + generator.writeKey("include_aliases"); + generator.write(this.includeAliases); + } + + if (this.includeGlobalState != null) { + generator.writeKey("include_global_state"); + generator.write(this.includeGlobalState); + } + + if (this.indexSettings != null) { + generator.writeKey("index_settings"); + this.indexSettings.serialize(generator, mapper); + } + + if (ApiTypeHelper.isDefined(this.indices)) { + generator.writeKey("indices"); + generator.writeStartArray(); + for (String item0 : this.indices) { + generator.write(item0); + } + generator.writeEnd(); + } + + if (this.partial != null) { + generator.writeKey("partial"); + generator.write(this.partial); + } + + if (this.renameAliasPattern != null) { + generator.writeKey("rename_alias_pattern"); + generator.write(this.renameAliasPattern); + } + + if (this.renameAliasReplacement != null) { + generator.writeKey("rename_alias_replacement"); + generator.write(this.renameAliasReplacement); + } + + if (this.renamePattern != null) { + generator.writeKey("rename_pattern"); + generator.write(this.renamePattern); + } + + if (this.renameReplacement != null) { + generator.writeKey("rename_replacement"); + generator.write(this.renameReplacement); + } + + if (this.sourceRemoteStoreRepository != null) { + generator.writeKey("source_remote_store_repository"); + generator.write(this.sourceRemoteStoreRepository); + } + + if (this.storageType != null) { + generator.writeKey("storage_type"); + generator.write(this.storageType); + } + } + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link RestoreRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; + @Nullable + private List ignoreIndexSettings; + @Nullable + private Boolean ignoreUnavailable; + @Nullable + private Boolean includeAliases; + @Nullable + private Boolean includeGlobalState; + @Nullable + private IndexSettings indexSettings; + @Nullable + private List indices; + @Nullable + private Time masterTimeout; + @Nullable + private Boolean partial; + @Nullable + private String renameAliasPattern; + @Nullable + private String renameAliasReplacement; + @Nullable + private String renamePattern; + @Nullable + private String renameReplacement; + private String repository; + private String snapshot; + @Nullable + private String sourceRemoteStoreRepository; + @Nullable + private String storageType; + @Nullable + private Boolean waitForCompletion; + + public Builder() {} + + private Builder(RestoreRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.ignoreIndexSettings = _listCopy(o.ignoreIndexSettings); + this.ignoreUnavailable = o.ignoreUnavailable; + this.includeAliases = o.includeAliases; + this.includeGlobalState = o.includeGlobalState; + this.indexSettings = o.indexSettings; + this.indices = _listCopy(o.indices); + this.masterTimeout = o.masterTimeout; + this.partial = o.partial; + this.renameAliasPattern = o.renameAliasPattern; + this.renameAliasReplacement = o.renameAliasReplacement; + this.renamePattern = o.renamePattern; + this.renameReplacement = o.renameReplacement; + this.repository = o.repository; + this.snapshot = o.snapshot; + this.sourceRemoteStoreRepository = o.sourceRemoteStoreRepository; + this.storageType = o.storageType; + this.waitForCompletion = o.waitForCompletion; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.ignoreIndexSettings = _listCopy(o.ignoreIndexSettings); + this.ignoreUnavailable = o.ignoreUnavailable; + this.includeAliases = o.includeAliases; + this.includeGlobalState = o.includeGlobalState; + this.indexSettings = o.indexSettings; + this.indices = _listCopy(o.indices); + this.masterTimeout = o.masterTimeout; + this.partial = o.partial; + this.renameAliasPattern = o.renameAliasPattern; + this.renameAliasReplacement = o.renameAliasReplacement; + this.renamePattern = o.renamePattern; + this.renameReplacement = o.renameReplacement; + this.repository = o.repository; + this.snapshot = o.snapshot; + this.sourceRemoteStoreRepository = o.sourceRemoteStoreRepository; + this.storageType = o.storageType; + this.waitForCompletion = o.waitForCompletion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * A comma-delimited list of index settings that you don't want to restore from a snapshot. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder ignoreIndexSettings(List list) { + this.ignoreIndexSettings = _listAddAll(this.ignoreIndexSettings, list); + return this; + } + + /** + * A comma-delimited list of index settings that you don't want to restore from a snapshot. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder ignoreIndexSettings(String value, String... values) { + this.ignoreIndexSettings = _listAdd(this.ignoreIndexSettings, value, values); + return this; + } + + /** + * How to handle data streams or indexes that are missing or closed. If false, the request returns an error for any + * data stream or index that is missing or closed. If true, the request ignores data streams and indexes in indexes + * that are missing or closed. Defaults to false. + *

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

+ */ + @Nonnull + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; + } + + /** + * How to handle index aliases from the original snapshot. If true, index aliases from the original snapshot are + * restored. If false, aliases along with associated indexes are not restored. Defaults to true. + *

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

+ */ + @Nonnull + public final Builder includeAliases(@Nullable Boolean value) { + this.includeAliases = value; + return this; + } + + /** + * Whether to restore the current cluster state. If false, the cluster state is not restored. If true, the current + * cluster state is restored. Defaults to false. + *

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

+ */ + @Nonnull + public final Builder includeGlobalState(@Nullable Boolean value) { + this.includeGlobalState = value; + return this; + } + + /** + * A comma-delimited list of settings to add or change in all restored indexes. Use this parameter to override index settings during + * snapshot restoration. For data streams, these index settings are applied to the restored backing indexes. + *

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

+ */ + @Nonnull + public final Builder indexSettings(@Nullable IndexSettings value) { + this.indexSettings = value; + return this; + } + + /** + * A comma-delimited list of settings to add or change in all restored indexes. Use this parameter to override index settings during + * snapshot restoration. For data streams, these index settings are applied to the restored backing indexes. + *

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

+ */ + @Nonnull + public final Builder indexSettings(Function> fn) { + return indexSettings(fn.apply(new IndexSettings.Builder()).build()); + } + + /** + * A comma-delimited list of data streams and indexes to restore from the snapshot. Multi-index syntax is supported. By default, a + * restore operation includes all data streams and indexes in the snapshot. If this argument is provided, the restore operation only + * includes the data streams and indexes that you specify. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder indices(List list) { + this.indices = _listAddAll(this.indices, list); + return this; + } + + /** + * A comma-delimited list of data streams and indexes to restore from the snapshot. Multi-index syntax is supported. By default, a + * restore operation includes all data streams and indexes in the snapshot. If this argument is provided, the restore operation only + * includes the data streams and indexes that you specify. + *

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

+ * + *

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

+ */ + @Nonnull + public final Builder indices(String value, String... values) { + this.indices = _listAdd(this.indices, value, values); + return this; + } + + /** + * Explicit operation timeout for connection to cluster-manager node + *

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

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

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

+ */ + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * How the restore operation will behave if indexes in the snapshot do not have all primary shards available. If false, + * the entire restore operation fails if any indexes in the snapshot do not have all primary shards available. If true, + * allows the restoration of a partial snapshot of indexes with unavailable shards. Only shards that were successfully included in + * the snapshot are restored. All missing shards are recreated as empty. By default, the entire restore operation fails if one or + * more indexes included in the snapshot do not have all primary shards available. To change this behavior, set partial + * to true. Defaults to false. + *

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

+ */ + @Nonnull + public final Builder partial(@Nullable Boolean value) { + this.partial = value; + return this; + } + + /** + * The pattern to apply to the restored aliases. Aliases matching the rename pattern will be renamed according to the + * rename_alias_replacement setting. The rename pattern is applied as defined by the regular expression that supports + * referencing the original text. If two or more aliases are renamed into the same name, these aliases will be merged into one. + *

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

+ */ + @Nonnull + public final Builder renameAliasPattern(@Nullable String value) { + this.renameAliasPattern = value; + return this; + } + + /** + * The rename replacement string for aliases. + *

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

+ */ + @Nonnull + public final Builder renameAliasReplacement(@Nullable String value) { + this.renameAliasReplacement = value; + return this; + } + + /** + * The pattern to apply to the restored data streams and indexes. Data streams and indexes matching the rename pattern will be + * renamed according to the rename_replacement setting. The rename pattern is applied as defined by the regular + * expression that supports referencing the original text. The request fails if two or more data streams or indexes are renamed into + * the same name. If you rename a restored data stream, its backing indexes are also renamed. For example, if you rename the logs + * data stream to recovered-logs, the backing index .ds-logs-1 is renamed to + * .ds-recovered-logs-1. If you rename a restored stream, ensure an index template matches the new stream name. If + * there are no matching index template names, the stream cannot roll over and new backing indexes are not created. + *

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

+ */ + @Nonnull + public final Builder renamePattern(@Nullable String value) { + this.renamePattern = value; + return this; + } + + /** + * The rename replacement string. + *

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

+ */ + @Nonnull + public final Builder renameReplacement(@Nullable String value) { + this.renameReplacement = value; + return this; + } + + /** + * Required - A repository name + *

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

+ */ + @Nonnull + public final Builder repository(String value) { + this.repository = value; + return this; + } + + /** + * Required - A snapshot name + *

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

+ */ + @Nonnull + public final Builder snapshot(String value) { + this.snapshot = value; + return this; + } + + /** + * The name of the remote store repository of the source index being restored. If not provided, the Snapshot Restore API will use + * the repository that was registered when the snapshot was created. + *

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

+ */ + @Nonnull + public final Builder sourceRemoteStoreRepository(@Nullable String value) { + this.sourceRemoteStoreRepository = value; + return this; + } + + /** + * Where will be the authoritative store of the restored indexes' data. A value of local indicates that all snapshot + * metadata and index data will be downloaded to local storage. A value of remote_snapshot indicates that snapshot + * metadata will be downloaded to the cluster, but the remote repository will remain the authoritative store of the index data. Data + * will be downloaded and cached as necessary to service queries. At least one node in the cluster must be configured with the + * search role in order to restore a snapshot using the type remote_snapshot. Defaults to local. + *

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

+ */ + @Nonnull + public final Builder storageType(@Nullable String value) { + this.storageType = value; + return this; + } + + /** + * Should this request wait until the operation has completed before returning + *

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

+ */ + @Nonnull + public final Builder waitForCompletion(@Nullable Boolean value) { + this.waitForCompletion = value; + return this; + } + + /** + * Builds a {@link RestoreRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public RestoreRequest build() { + _checkSingleUse(); + + return new RestoreRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RestoreRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RestoreRequest::setupRestoreRequestDeserializer + ); + + protected static void setupRestoreRequestDeserializer(ObjectDeserializer op) { + op.add( + Builder::ignoreIndexSettings, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "ignore_index_settings" + ); + op.add(Builder::ignoreUnavailable, JsonpDeserializer.booleanDeserializer(), "ignore_unavailable"); + op.add(Builder::includeAliases, JsonpDeserializer.booleanDeserializer(), "include_aliases"); + op.add(Builder::includeGlobalState, JsonpDeserializer.booleanDeserializer(), "include_global_state"); + op.add(Builder::indexSettings, IndexSettings._DESERIALIZER, "index_settings"); + op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "indices"); + op.add(Builder::partial, JsonpDeserializer.booleanDeserializer(), "partial"); + op.add(Builder::renameAliasPattern, JsonpDeserializer.stringDeserializer(), "rename_alias_pattern"); + op.add(Builder::renameAliasReplacement, JsonpDeserializer.stringDeserializer(), "rename_alias_replacement"); + op.add(Builder::renamePattern, JsonpDeserializer.stringDeserializer(), "rename_pattern"); + op.add(Builder::renameReplacement, JsonpDeserializer.stringDeserializer(), "rename_replacement"); + op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); + op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); + op.add(Builder::sourceRemoteStoreRepository, JsonpDeserializer.stringDeserializer(), "source_remote_store_repository"); + op.add(Builder::storageType, JsonpDeserializer.stringDeserializer(), "storage_type"); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code snapshot.restore}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "POST", + // Request path + request -> { + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.snapshot, buf); + buf.append("/_restore"); + return buf.toString(); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.waitForCompletion != null) { + params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); + } + return params; + }, + SimpleEndpoint.emptyMap(), + true, + RestoreResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.ignoreIndexSettings); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.includeAliases); + result = 31 * result + Objects.hashCode(this.includeGlobalState); + result = 31 * result + Objects.hashCode(this.indexSettings); + result = 31 * result + Objects.hashCode(this.indices); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.partial); + result = 31 * result + Objects.hashCode(this.renameAliasPattern); + result = 31 * result + Objects.hashCode(this.renameAliasReplacement); + result = 31 * result + Objects.hashCode(this.renamePattern); + result = 31 * result + Objects.hashCode(this.renameReplacement); + result = 31 * result + this.repository.hashCode(); + result = 31 * result + this.snapshot.hashCode(); + result = 31 * result + Objects.hashCode(this.sourceRemoteStoreRepository); + result = 31 * result + Objects.hashCode(this.storageType); + result = 31 * result + Objects.hashCode(this.waitForCompletion); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RestoreRequest other = (RestoreRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.ignoreIndexSettings, other.ignoreIndexSettings) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.includeAliases, other.includeAliases) + && Objects.equals(this.includeGlobalState, other.includeGlobalState) + && Objects.equals(this.indexSettings, other.indexSettings) + && Objects.equals(this.indices, other.indices) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.partial, other.partial) + && Objects.equals(this.renameAliasPattern, other.renameAliasPattern) + && Objects.equals(this.renameAliasReplacement, other.renameAliasReplacement) + && Objects.equals(this.renamePattern, other.renamePattern) + && Objects.equals(this.renameReplacement, other.renameReplacement) + && this.repository.equals(other.repository) + && this.snapshot.equals(other.snapshot) + && Objects.equals(this.sourceRemoteStoreRepository, other.sourceRemoteStoreRepository) + && Objects.equals(this.storageType, other.storageType) + && Objects.equals(this.waitForCompletion, other.waitForCompletion); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java index 2791c31793..8f3e802aed 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreResponse.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -41,31 +49,50 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch.snapshot.restore.SnapshotRestore; -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: snapshot.restore.Response @JsonpDeserializable -public class RestoreResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RestoreResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Boolean accepted; + + @Nullable private final SnapshotRestore snapshot; // --------------------------------------------------------------------------------------------- private RestoreResponse(Builder builder) { - - this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); - + this.accepted = builder.accepted; + this.snapshot = builder.snapshot; } - public static RestoreResponse of(Function> fn) { + public static RestoreResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code snapshot} + * Returns true if the restore was accepted. Present when the request had wait_for_completion set to + * false. + *

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

+ */ + @Nullable + public final Boolean accepted() { + return this.accepted; + } + + /** + * API name: {@code snapshot} */ + @Nullable public final SnapshotRestore snapshot() { return this.snapshot; } @@ -73,6 +100,7 @@ public final SnapshotRestore snapshot() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,42 +108,94 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.accepted != null) { + generator.writeKey("accepted"); + generator.write(this.accepted); + } - generator.writeKey("snapshot"); - this.snapshot.serialize(generator, mapper); - + if (this.snapshot != null) { + generator.writeKey("snapshot"); + this.snapshot.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RestoreResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean accepted; + @Nullable private SnapshotRestore snapshot; + public Builder() {} + + private Builder(RestoreResponse o) { + this.accepted = o.accepted; + this.snapshot = o.snapshot; + } + + private Builder(Builder o) { + this.accepted = o.accepted; + this.snapshot = o.snapshot; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code snapshot} + * Returns true if the restore was accepted. Present when the request had wait_for_completion set to + * false. + *

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

*/ - public final Builder snapshot(SnapshotRestore value) { + @Nonnull + public final Builder accepted(@Nullable Boolean value) { + this.accepted = value; + return this; + } + + /** + * API name: {@code snapshot} + */ + @Nonnull + public final Builder snapshot(@Nullable SnapshotRestore value) { this.snapshot = value; return this; } /** - * Required - API name: {@code snapshot} + * API name: {@code snapshot} */ + @Nonnull public final Builder snapshot(Function> fn) { - return this.snapshot(fn.apply(new SnapshotRestore.Builder()).build()); + return snapshot(fn.apply(new SnapshotRestore.Builder()).build()); } /** * Builds a {@link RestoreResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RestoreResponse build() { _checkSingleUse(); @@ -134,9 +214,23 @@ public RestoreResponse build() { ); protected static void setupRestoreResponseDeserializer(ObjectDeserializer op) { - + op.add(Builder::accepted, JsonpDeserializer.booleanDeserializer(), "accepted"); op.add(Builder::snapshot, SnapshotRestore._DESERIALIZER, "snapshot"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.accepted); + result = 31 * result + Objects.hashCode(this.snapshot); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RestoreResponse other = (RestoreResponse) o; + return Objects.equals(this.accepted, other.accepted) && Objects.equals(this.snapshot, other.snapshot); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java index 1082b64f68..7a3ccd696e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -41,13 +47,17 @@ 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: snapshot._types.ShardsStats +// typedef: snapshot.ShardsStats @JsonpDeserializable -public class ShardsStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardsStats implements PlainJsonSerializable, ToCopyableBuilder { + private final long done; private final long failed; @@ -63,17 +73,15 @@ public class ShardsStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ShardsStats(Builder builder) { - this.done = ApiTypeHelper.requireNonNull(builder.done, this, "done"); this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); this.finalizing = ApiTypeHelper.requireNonNull(builder.finalizing, this, "finalizing"); this.initializing = ApiTypeHelper.requireNonNull(builder.initializing, this, "initializing"); this.started = ApiTypeHelper.requireNonNull(builder.started, this, "started"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - } - public static ShardsStats of(Function> fn) { + public static ShardsStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -122,6 +130,7 @@ public final long total() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,7 +138,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("done"); generator.write(this.done); @@ -147,31 +155,62 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total"); generator.write(this.total); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardsStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long done; - private Long failed; - private Long finalizing; - private Long initializing; - private Long started; - private Long total; + public Builder() {} + + private Builder(ShardsStats o) { + this.done = o.done; + this.failed = o.failed; + this.finalizing = o.finalizing; + this.initializing = o.initializing; + this.started = o.started; + this.total = o.total; + } + + private Builder(Builder o) { + this.done = o.done; + this.failed = o.failed; + this.finalizing = o.finalizing; + this.initializing = o.initializing; + this.started = o.started; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code done} */ + @Nonnull public final Builder done(long value) { this.done = value; return this; @@ -180,6 +219,7 @@ public final Builder done(long value) { /** * Required - API name: {@code failed} */ + @Nonnull public final Builder failed(long value) { this.failed = value; return this; @@ -188,6 +228,7 @@ public final Builder failed(long value) { /** * Required - API name: {@code finalizing} */ + @Nonnull public final Builder finalizing(long value) { this.finalizing = value; return this; @@ -196,6 +237,7 @@ public final Builder finalizing(long value) { /** * Required - API name: {@code initializing} */ + @Nonnull public final Builder initializing(long value) { this.initializing = value; return this; @@ -204,6 +246,7 @@ public final Builder initializing(long value) { /** * Required - API name: {@code started} */ + @Nonnull public final Builder started(long value) { this.started = value; return this; @@ -212,6 +255,7 @@ public final Builder started(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(long value) { this.total = value; return this; @@ -220,9 +264,10 @@ public final Builder total(long value) { /** * Builds a {@link ShardsStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardsStats build() { _checkSingleUse(); @@ -241,14 +286,36 @@ public ShardsStats build() { ); protected static void setupShardsStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::done, JsonpDeserializer.longDeserializer(), "done"); op.add(Builder::failed, JsonpDeserializer.longDeserializer(), "failed"); op.add(Builder::finalizing, JsonpDeserializer.longDeserializer(), "finalizing"); op.add(Builder::initializing, JsonpDeserializer.longDeserializer(), "initializing"); op.add(Builder::started, JsonpDeserializer.longDeserializer(), "started"); op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.done); + result = 31 * result + Long.hashCode(this.failed); + result = 31 * result + Long.hashCode(this.finalizing); + result = 31 * result + Long.hashCode(this.initializing); + result = 31 * result + Long.hashCode(this.started); + result = 31 * result + Long.hashCode(this.total); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardsStats other = (ShardsStats) o; + return this.done == other.done + && this.failed == other.failed + && this.finalizing == other.finalizing + && this.initializing == other.initializing + && this.started == other.started + && this.total == other.total; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java index 22033a7ddf..eefcad0768 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java @@ -30,44 +30,45 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: snapshot.ShardsStatsStage + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum ShardsStatsStage implements JsonEnum { /** - * Number of shards in the snapshot that were successfully stored in the - * repository. + * Number of shards in the snapshot that were successfully stored in the repository. */ Done("DONE"), /** - * Number of shards in the snapshot that were not successfully stored in the - * repository. + * Number of shards in the snapshot that were not successfully stored in the repository. */ Failure("FAILURE"), /** - * Number of shards in the snapshot that are in the finalizing stage of being - * stored in the repository. + * Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. */ Finalize("FINALIZE"), /** - * Number of shards in the snapshot that are in the initializing stage of being - * stored in the repository. + * Number of shards in the snapshot that are in the initializing stage of being stored in the repository. */ Init("INIT"), /** - * Number of shards in the snapshot that are in the started stage of being - * stored in the repository. + * Number of shards in the snapshot that are in the started stage of being stored in the repository. */ - Started("STARTED"), - - ; + Started("STARTED"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java index 1ed6c2deb7..1fad0eace1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java @@ -30,66 +30,85 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; 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: snapshot._types.ShardsStatsSummary +// typedef: snapshot.ShardsStatsSummary @JsonpDeserializable -public class ShardsStatsSummary implements PlainJsonSerializable { - private final ShardsStatsSummaryItem incremental; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardsStatsSummary implements PlainJsonSerializable, ToCopyableBuilder { - private final ShardsStatsSummaryItem total; + @Nonnull + private final ShardsStatsSummaryItem incremental; private final long startTimeInMillis; + @Nullable + private final Time time; + private final long timeInMillis; + @Nonnull + private final ShardsStatsSummaryItem total; + // --------------------------------------------------------------------------------------------- private ShardsStatsSummary(Builder builder) { - this.incremental = ApiTypeHelper.requireNonNull(builder.incremental, this, "incremental"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); - + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); } - public static ShardsStatsSummary of(Function> fn) { + public static ShardsStatsSummary of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code incremental} */ + @Nonnull public final ShardsStatsSummaryItem incremental() { return this.incremental; } /** - * Required - API name: {@code total} + * Required - API name: {@code start_time_in_millis} */ - public final ShardsStatsSummaryItem total() { - return this.total; + public final long startTimeInMillis() { + return this.startTimeInMillis; } /** - * Required - API name: {@code start_time_in_millis} + * API name: {@code time} */ - public final long startTimeInMillis() { - return this.startTimeInMillis; + @Nullable + public final Time time() { + return this.time; } /** @@ -99,9 +118,18 @@ public final long timeInMillis() { return this.timeInMillis; } + /** + * Required - API name: {@code total} + */ + @Nonnull + public final ShardsStatsSummaryItem total() { + return this.total; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,39 +137,76 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("incremental"); this.incremental.serialize(generator, mapper); - generator.writeKey("total"); - this.total.serialize(generator, mapper); - generator.writeKey("start_time_in_millis"); generator.write(this.startTimeInMillis); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } + generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); + generator.writeKey("total"); + this.total.serialize(generator, mapper); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardsStatsSummary}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private ShardsStatsSummaryItem incremental; - + private Long startTimeInMillis; + @Nullable + private Time time; + private Long timeInMillis; private ShardsStatsSummaryItem total; - private Long startTimeInMillis; + public Builder() {} - private Long timeInMillis; + private Builder(ShardsStatsSummary o) { + this.incremental = o.incremental; + this.startTimeInMillis = o.startTimeInMillis; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + private Builder(Builder o) { + this.incremental = o.incremental; + this.startTimeInMillis = o.startTimeInMillis; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code incremental} */ + @Nonnull public final Builder incremental(ShardsStatsSummaryItem value) { this.incremental = value; return this; @@ -150,47 +215,70 @@ public final Builder incremental(ShardsStatsSummaryItem value) { /** * Required - API name: {@code incremental} */ + @Nonnull public final Builder incremental(Function> fn) { - return this.incremental(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); + return incremental(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); } /** - * Required - API name: {@code total} + * Required - API name: {@code start_time_in_millis} */ - public final Builder total(ShardsStatsSummaryItem value) { - this.total = value; + @Nonnull + public final Builder startTimeInMillis(long value) { + this.startTimeInMillis = value; return this; } /** - * Required - API name: {@code total} + * API name: {@code time} */ - public final Builder total(Function> fn) { - return this.total(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); + @Nonnull + public final Builder time(@Nullable Time value) { + this.time = value; + return this; } /** - * Required - API name: {@code start_time_in_millis} + * API name: {@code time} */ - public final Builder startTimeInMillis(long value) { - this.startTimeInMillis = value; - return this; + @Nonnull + public final Builder time(Function> fn) { + return time(fn.apply(new Time.Builder()).build()); } /** * Required - API name: {@code time_in_millis} */ + @Nonnull public final Builder timeInMillis(long value) { this.timeInMillis = value; return this; } + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(ShardsStatsSummaryItem value) { + this.total = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(Function> fn) { + return total(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); + } + /** * Builds a {@link ShardsStatsSummary}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardsStatsSummary build() { _checkSingleUse(); @@ -209,12 +297,33 @@ public ShardsStatsSummary build() { ); protected static void setupShardsStatsSummaryDeserializer(ObjectDeserializer op) { - op.add(Builder::incremental, ShardsStatsSummaryItem._DESERIALIZER, "incremental"); - op.add(Builder::total, ShardsStatsSummaryItem._DESERIALIZER, "total"); op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); + op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + op.add(Builder::total, ShardsStatsSummaryItem._DESERIALIZER, "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.incremental.hashCode(); + result = 31 * result + Long.hashCode(this.startTimeInMillis); + result = 31 * result + Objects.hashCode(this.time); + result = 31 * result + Long.hashCode(this.timeInMillis); + result = 31 * result + this.total.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardsStatsSummary other = (ShardsStatsSummary) o; + return this.incremental.equals(other.incremental) + && this.startTimeInMillis == other.startTimeInMillis + && Objects.equals(this.time, other.time) + && this.timeInMillis == other.timeInMillis + && this.total.equals(other.total); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java index 6c4ef63a6e..a2f99be6e5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -41,13 +47,20 @@ 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: snapshot._types.ShardsStatsSummaryItem +// typedef: snapshot.ShardsStatsSummaryItem @JsonpDeserializable -public class ShardsStatsSummaryItem implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ShardsStatsSummaryItem + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final long fileCount; private final long sizeInBytes; @@ -55,13 +68,11 @@ public class ShardsStatsSummaryItem implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ShardsStatsSummaryItem(Builder builder) { - this.fileCount = ApiTypeHelper.requireNonNull(builder.fileCount, this, "fileCount"); this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - } - public static ShardsStatsSummaryItem of(Function> fn) { + public static ShardsStatsSummaryItem of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -82,6 +93,7 @@ public final long sizeInBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +101,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("file_count"); generator.write(this.fileCount); generator.writeKey("size_in_bytes"); generator.write(this.sizeInBytes); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardsStatsSummaryItem}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long fileCount; - private Long sizeInBytes; + public Builder() {} + + private Builder(ShardsStatsSummaryItem o) { + this.fileCount = o.fileCount; + this.sizeInBytes = o.sizeInBytes; + } + + private Builder(Builder o) { + this.fileCount = o.fileCount; + this.sizeInBytes = o.sizeInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code file_count} */ + @Nonnull public final Builder fileCount(long value) { this.fileCount = value; return this; @@ -120,6 +158,7 @@ public final Builder fileCount(long value) { /** * Required - API name: {@code size_in_bytes} */ + @Nonnull public final Builder sizeInBytes(long value) { this.sizeInBytes = value; return this; @@ -128,9 +167,10 @@ public final Builder sizeInBytes(long value) { /** * Builds a {@link ShardsStatsSummaryItem}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardsStatsSummaryItem build() { _checkSingleUse(); @@ -149,10 +189,23 @@ public ShardsStatsSummaryItem build() { ); protected static void setupShardsStatsSummaryItemDeserializer(ObjectDeserializer op) { - op.add(Builder::fileCount, JsonpDeserializer.longDeserializer(), "file_count"); op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.fileCount); + result = 31 * result + Long.hashCode(this.sizeInBytes); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardsStatsSummaryItem other = (ShardsStatsSummaryItem) o; + return this.fileCount == other.fileCount && this.sizeInBytes == other.sizeInBytes; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java index 52ca17a410..04623f1628 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; 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; @@ -42,36 +48,42 @@ 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: snapshot._types.SnapshotIndexStats +// typedef: snapshot.SnapshotIndexStats @JsonpDeserializable -public class SnapshotIndexStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotIndexStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map shards; + @Nonnull private final ShardsStats shardsStats; + @Nonnull private final SnapshotStats stats; // --------------------------------------------------------------------------------------------- private SnapshotIndexStats(Builder builder) { - this.shards = ApiTypeHelper.unmodifiableRequired(builder.shards, this, "shards"); this.shardsStats = ApiTypeHelper.requireNonNull(builder.shardsStats, this, "shardsStats"); this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats"); - } - public static SnapshotIndexStats of(Function> fn) { + public static SnapshotIndexStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code shards} */ + @Nonnull public final Map shards() { return this.shards; } @@ -79,6 +91,7 @@ public final Map shards() { /** * Required - API name: {@code shards_stats} */ + @Nonnull public final ShardsStats shardsStats() { return this.shardsStats; } @@ -86,6 +99,7 @@ public final ShardsStats shardsStats() { /** * Required - API name: {@code stats} */ + @Nonnull public final SnapshotStats stats() { return this.stats; } @@ -93,6 +107,7 @@ public final SnapshotStats stats() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -100,44 +115,70 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("shards"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shards.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("shards"); + generator.writeStartObject(); + for (Map.Entry item0 : this.shards.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("shards_stats"); this.shardsStats.serialize(generator, mapper); generator.writeKey("stats"); this.stats.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SnapshotIndexStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map shards; - private ShardsStats shardsStats; - private SnapshotStats stats; + public Builder() {} + + private Builder(SnapshotIndexStats o) { + this.shards = _mapCopy(o.shards); + this.shardsStats = o.shardsStats; + this.stats = o.stats; + } + + private Builder(Builder o) { + this.shards = _mapCopy(o.shards); + this.shardsStats = o.shardsStats; + this.stats = o.stats; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ + @Nonnull public final Builder shards(Map map) { this.shards = _mapPutAll(this.shards, map); return this; @@ -145,9 +186,12 @@ public final Builder shards(Map map) { /** * Required - API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ + @Nonnull public final Builder shards(String key, SnapshotShardsStatus value) { this.shards = _mapPut(this.shards, key, value); return this; @@ -155,9 +199,12 @@ public final Builder shards(String key, SnapshotShardsStatus value) { /** * Required - API name: {@code shards} + * *

- * Adds an entry to shards using a builder lambda. + * Adds a value to shards using a builder lambda. + *

*/ + @Nonnull public final Builder shards(String key, Function> fn) { return shards(key, fn.apply(new SnapshotShardsStatus.Builder()).build()); } @@ -165,6 +212,7 @@ public final Builder shards(String key, Function> fn) { - return this.shardsStats(fn.apply(new ShardsStats.Builder()).build()); + return shardsStats(fn.apply(new ShardsStats.Builder()).build()); } /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(SnapshotStats value) { this.stats = value; return this; @@ -188,16 +238,18 @@ public final Builder stats(SnapshotStats value) { /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(Function> fn) { - return this.stats(fn.apply(new SnapshotStats.Builder()).build()); + return stats(fn.apply(new SnapshotStats.Builder()).build()); } /** * Builds a {@link SnapshotIndexStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotIndexStats build() { _checkSingleUse(); @@ -216,11 +268,25 @@ public SnapshotIndexStats build() { ); protected static void setupSnapshotIndexStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(SnapshotShardsStatus._DESERIALIZER), "shards"); op.add(Builder::shardsStats, ShardsStats._DESERIALIZER, "shards_stats"); op.add(Builder::stats, SnapshotStats._DESERIALIZER, "stats"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.shards.hashCode(); + result = 31 * result + this.shardsStats.hashCode(); + result = 31 * result + this.stats.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotIndexStats other = (SnapshotIndexStats) o; + return this.shards.equals(other.shards) && this.shardsStats.equals(other.shardsStats) && this.stats.equals(other.stats); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java index 21ffa324b4..3795c1e8cf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; 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; @@ -41,33 +47,38 @@ 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: snapshot._types.SnapshotShardsStatus +// typedef: snapshot.SnapshotShardsStatus @JsonpDeserializable -public class SnapshotShardsStatus implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotShardsStatus implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final ShardsStatsStage stage; + @Nonnull private final ShardsStatsSummary stats; // --------------------------------------------------------------------------------------------- private SnapshotShardsStatus(Builder builder) { - this.stage = ApiTypeHelper.requireNonNull(builder.stage, this, "stage"); this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats"); - } - public static SnapshotShardsStatus of(Function> fn) { + public static SnapshotShardsStatus of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code stage} */ + @Nonnull public final ShardsStatsStage stage() { return this.stage; } @@ -75,6 +86,7 @@ public final ShardsStatsStage stage() { /** * Required - API name: {@code stats} */ + @Nonnull public final ShardsStatsSummary stats() { return this.stats; } @@ -82,6 +94,7 @@ public final ShardsStatsSummary stats() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,28 +102,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("stage"); this.stage.serialize(generator, mapper); + generator.writeKey("stats"); this.stats.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SnapshotShardsStatus}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private ShardsStatsStage stage; - private ShardsStatsSummary stats; + public Builder() {} + + private Builder(SnapshotShardsStatus o) { + this.stage = o.stage; + this.stats = o.stats; + } + + private Builder(Builder o) { + this.stage = o.stage; + this.stats = o.stats; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code stage} */ + @Nonnull public final Builder stage(ShardsStatsStage value) { this.stage = value; return this; @@ -119,6 +159,7 @@ public final Builder stage(ShardsStatsStage value) { /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(ShardsStatsSummary value) { this.stats = value; return this; @@ -127,16 +168,18 @@ public final Builder stats(ShardsStatsSummary value) { /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(Function> fn) { - return this.stats(fn.apply(new ShardsStatsSummary.Builder()).build()); + return stats(fn.apply(new ShardsStatsSummary.Builder()).build()); } /** * Builds a {@link SnapshotShardsStatus}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotShardsStatus build() { _checkSingleUse(); @@ -155,10 +198,23 @@ public SnapshotShardsStatus build() { ); protected static void setupSnapshotShardsStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::stage, ShardsStatsStage._DESERIALIZER, "stage"); op.add(Builder::stats, ShardsStatsSummary._DESERIALIZER, "stats"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.stage.hashCode(); + result = 31 * result + this.stats.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotShardsStatus other = (SnapshotShardsStatus) o; + return this.stage.equals(other.stage) && this.stats.equals(other.stats); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java index bb2b44eb3f..a0cf8ff105 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java @@ -30,50 +30,68 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch._types.Time; 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: snapshot._types.SnapshotStats +// typedef: snapshot.SnapshotStats @JsonpDeserializable -public class SnapshotStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final FileCountSnapshotStats incremental; private final long startTimeInMillis; + @Nullable + private final Time time; + private final long timeInMillis; + @Nonnull private final FileCountSnapshotStats total; // --------------------------------------------------------------------------------------------- private SnapshotStats(Builder builder) { - this.incremental = ApiTypeHelper.requireNonNull(builder.incremental, this, "incremental"); this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - } - public static SnapshotStats of(Function> fn) { + public static SnapshotStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code incremental} */ + @Nonnull public final FileCountSnapshotStats incremental() { return this.incremental; } @@ -85,6 +103,14 @@ public final long startTimeInMillis() { return this.startTimeInMillis; } + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - API name: {@code time_in_millis} */ @@ -95,6 +121,7 @@ public final long timeInMillis() { /** * Required - API name: {@code total} */ + @Nonnull public final FileCountSnapshotStats total() { return this.total; } @@ -102,6 +129,7 @@ public final FileCountSnapshotStats total() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,39 +137,76 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("incremental"); this.incremental.serialize(generator, mapper); generator.writeKey("start_time_in_millis"); generator.write(this.startTimeInMillis); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } + generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); generator.writeKey("total"); this.total.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SnapshotStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private FileCountSnapshotStats incremental; - private Long startTimeInMillis; - + @Nullable + private Time time; private Long timeInMillis; - private FileCountSnapshotStats total; + public Builder() {} + + private Builder(SnapshotStats o) { + this.incremental = o.incremental; + this.startTimeInMillis = o.startTimeInMillis; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + private Builder(Builder o) { + this.incremental = o.incremental; + this.startTimeInMillis = o.startTimeInMillis; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code incremental} */ + @Nonnull public final Builder incremental(FileCountSnapshotStats value) { this.incremental = value; return this; @@ -150,21 +215,41 @@ public final Builder incremental(FileCountSnapshotStats value) { /** * Required - API name: {@code incremental} */ + @Nonnull public final Builder incremental(Function> fn) { - return this.incremental(fn.apply(new FileCountSnapshotStats.Builder()).build()); + return incremental(fn.apply(new FileCountSnapshotStats.Builder()).build()); } /** * Required - API name: {@code start_time_in_millis} */ + @Nonnull public final Builder startTimeInMillis(long value) { this.startTimeInMillis = value; return this; } + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(Function> fn) { + return time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ + @Nonnull public final Builder timeInMillis(long value) { this.timeInMillis = value; return this; @@ -173,6 +258,7 @@ public final Builder timeInMillis(long value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(FileCountSnapshotStats value) { this.total = value; return this; @@ -181,16 +267,18 @@ public final Builder total(FileCountSnapshotStats value) { /** * Required - API name: {@code total} */ + @Nonnull public final Builder total(Function> fn) { - return this.total(fn.apply(new FileCountSnapshotStats.Builder()).build()); + return total(fn.apply(new FileCountSnapshotStats.Builder()).build()); } /** * Builds a {@link SnapshotStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotStats build() { _checkSingleUse(); @@ -209,12 +297,33 @@ public SnapshotStats build() { ); protected static void setupSnapshotStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::incremental, FileCountSnapshotStats._DESERIALIZER, "incremental"); op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); + op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); op.add(Builder::total, FileCountSnapshotStats._DESERIALIZER, "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.incremental.hashCode(); + result = 31 * result + Long.hashCode(this.startTimeInMillis); + result = 31 * result + Objects.hashCode(this.time); + result = 31 * result + Long.hashCode(this.timeInMillis); + result = 31 * result + this.total.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotStats other = (SnapshotStats) o; + return this.incremental.equals(other.incremental) + && this.startTimeInMillis == other.startTimeInMillis + && Objects.equals(this.time, other.time) + && this.timeInMillis == other.timeInMillis + && this.total.equals(other.total); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java index 1e0a59dfe1..9de668e4ac 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +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; @@ -44,17 +50,22 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.status.Request /** * Returns information about the status of a snapshot. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotStatusRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class SnapshotStatusRequest extends RequestBase { @Nullable private final Boolean ignoreUnavailable; @@ -62,66 +73,65 @@ public class SnapshotStatusRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final String repository; + @Nonnull private final List snapshot; // --------------------------------------------------------------------------------------------- private SnapshotStatusRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.ignoreUnavailable = builder.ignoreUnavailable; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.repository = builder.repository; this.snapshot = ApiTypeHelper.unmodifiable(builder.snapshot); - } - public static SnapshotStatusRequest of(Function> fn) { + public static SnapshotStatusRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore unavailable snapshots, defaults to false which means a - * SnapshotMissingException is thrown + * Operation timeout for connection to cluster-manager node. *

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

*/ @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to master node + * Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown *

- * API name: {@code master_timeout} + * API name: {@code ignore_unavailable} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; } /** * Explicit operation timeout for connection to cluster-manager node *

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * A repository name *

* API name: {@code repository} + *

*/ @Nullable public final String repository() { @@ -132,90 +142,132 @@ public final String repository() { * A comma-separated list of snapshot names *

* API name: {@code snapshot} + *

*/ + @Nonnull public final List snapshot() { return this.snapshot; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SnapshotStatusRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean ignoreUnavailable; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private String repository; - @Nullable private List snapshot; + public Builder() {} + + private Builder(SnapshotStatusRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.ignoreUnavailable = o.ignoreUnavailable; + this.masterTimeout = o.masterTimeout; + this.repository = o.repository; + this.snapshot = _listCopy(o.snapshot); + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.ignoreUnavailable = o.ignoreUnavailable; + this.masterTimeout = o.masterTimeout; + this.repository = o.repository; + this.snapshot = _listCopy(o.snapshot); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore unavailable snapshots, defaults to false which means a - * SnapshotMissingException is thrown + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to master node + * Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown *

- * API name: {@code master_timeout} + * API name: {@code ignore_unavailable} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; } /** * Explicit operation timeout for connection to cluster-manager node *

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

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

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * A repository name *

* API name: {@code repository} + *

*/ + @Nonnull public final Builder repository(@Nullable String value) { this.repository = value; return this; @@ -225,9 +277,13 @@ public final Builder repository(@Nullable String value) { * A comma-separated list of snapshot names *

* API name: {@code snapshot} + *

+ * *

* Adds all elements of list to snapshot. + *

*/ + @Nonnull public final Builder snapshot(List list) { this.snapshot = _listAddAll(this.snapshot, list); return this; @@ -237,9 +293,13 @@ public final Builder snapshot(List list) { * A comma-separated list of snapshot names *

* API name: {@code snapshot} + *

+ * *

* Adds one or more values to snapshot. + *

*/ + @Nonnull public final Builder snapshot(String value, String... values) { this.snapshot = _listAdd(this.snapshot, value, values); return this; @@ -248,9 +308,10 @@ public final Builder snapshot(String value, String... values) { /** * Builds a {@link SnapshotStatusRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotStatusRequest build() { _checkSingleUse(); @@ -264,13 +325,8 @@ public SnapshotStatusRequest build() { * Endpoint "{@code snapshot.status}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _repository = 1 << 0; @@ -282,50 +338,66 @@ public SnapshotStatusRequest build() { if (ApiTypeHelper.isDefined(request.snapshot())) propsSet |= _snapshot; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/_status"); - return buf.toString(); + return "/_snapshot/_status"; } if (propsSet == (_repository)) { StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); + buf.append("/_snapshot/"); SimpleEndpoint.pathEncode(request.repository, buf); buf.append("/_status"); return buf.toString(); } if (propsSet == (_repository | _snapshot)) { StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); + buf.append("/_snapshot/"); SimpleEndpoint.pathEncode(request.repository, buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.snapshot.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.snapshot), buf); buf.append("/_status"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, SnapshotStatusResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.repository); + result = 31 * result + Objects.hashCode(this.snapshot); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotStatusRequest other = (SnapshotStatusRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.repository, other.repository) + && Objects.equals(this.snapshot, other.snapshot); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java index e97f02540d..0a45bfdb0d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,37 @@ 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: snapshot.status.Response @JsonpDeserializable -public class SnapshotStatusResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotStatusResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final List snapshots; // --------------------------------------------------------------------------------------------- private SnapshotStatusResponse(Builder builder) { - this.snapshots = ApiTypeHelper.unmodifiableRequired(builder.snapshots, this, "snapshots"); - } - public static SnapshotStatusResponse of(Function> fn) { + public static SnapshotStatusResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code snapshots} */ + @Nonnull public final List snapshots() { return this.snapshots; } @@ -73,6 +86,7 @@ public final List snapshots() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,34 +94,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.snapshots)) { - generator.writeKey("snapshots"); - generator.writeStartArray(); - for (Status item0 : this.snapshots) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("snapshots"); + generator.writeStartArray(); + for (Status item0 : this.snapshots) { + 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 SnapshotStatusResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List snapshots; + public Builder() {} + + private Builder(SnapshotStatusResponse o) { + this.snapshots = _listCopy(o.snapshots); + } + + private Builder(Builder o) { + this.snapshots = _listCopy(o.snapshots); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code snapshots} + * *

* Adds all elements of list to snapshots. + *

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

* Adds one or more values to snapshots. + *

*/ + @Nonnull public final Builder snapshots(Status value, Status... values) { this.snapshots = _listAdd(this.snapshots, value, values); return this; @@ -125,9 +165,12 @@ public final Builder snapshots(Status value, Status... values) { /** * Required - API name: {@code snapshots} + * *

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

*/ + @Nonnull public final Builder snapshots(Function> fn) { return snapshots(fn.apply(new Status.Builder()).build()); } @@ -135,9 +178,10 @@ public final Builder snapshots(Function> f /** * Builds a {@link SnapshotStatusResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotStatusResponse build() { _checkSingleUse(); @@ -156,9 +200,21 @@ public SnapshotStatusResponse build() { ); protected static void setupSnapshotStatusResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::snapshots, JsonpDeserializer.arrayDeserializer(Status._DESERIALIZER), "snapshots"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.snapshots.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotStatusResponse other = (SnapshotStatusResponse) o; + return this.snapshots.equals(other.snapshots); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Status.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Status.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Status.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Status.java index 03992f5175..d9eeccfc3d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/Status.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/Status.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot; import jakarta.json.stream.JsonGenerator; 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; @@ -42,33 +48,43 @@ 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: snapshot._types.Status +// typedef: snapshot.Status @JsonpDeserializable -public class Status implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Status implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean includeGlobalState; + @Nonnull private final Map indices; + @Nonnull private final String repository; + @Nonnull private final ShardsStats shardsStats; + @Nonnull private final String snapshot; + @Nonnull private final String state; + @Nonnull private final SnapshotStats stats; + @Nonnull private final String uuid; // --------------------------------------------------------------------------------------------- private Status(Builder builder) { - this.includeGlobalState = ApiTypeHelper.requireNonNull(builder.includeGlobalState, this, "includeGlobalState"); this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); @@ -77,10 +93,9 @@ private Status(Builder builder) { this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats"); this.uuid = ApiTypeHelper.requireNonNull(builder.uuid, this, "uuid"); - } - public static Status of(Function> fn) { + public static Status of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -94,6 +109,7 @@ public final boolean includeGlobalState() { /** * Required - API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -101,6 +117,7 @@ public final Map indices() { /** * Required - API name: {@code repository} */ + @Nonnull public final String repository() { return this.repository; } @@ -108,6 +125,7 @@ public final String repository() { /** * Required - API name: {@code shards_stats} */ + @Nonnull public final ShardsStats shardsStats() { return this.shardsStats; } @@ -115,6 +133,7 @@ public final ShardsStats shardsStats() { /** * Required - API name: {@code snapshot} */ + @Nonnull public final String snapshot() { return this.snapshot; } @@ -122,6 +141,7 @@ public final String snapshot() { /** * Required - API name: {@code state} */ + @Nonnull public final String state() { return this.state; } @@ -129,6 +149,7 @@ public final String state() { /** * Required - API name: {@code stats} */ + @Nonnull public final SnapshotStats stats() { return this.stats; } @@ -136,6 +157,7 @@ public final SnapshotStats stats() { /** * Required - API name: {@code uuid} */ + @Nonnull public final String uuid() { return this.uuid; } @@ -143,6 +165,7 @@ public final String uuid() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -150,21 +173,17 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("include_global_state"); generator.write(this.includeGlobalState); - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartObject(); - for (Map.Entry item0 : this.indices.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("repository"); generator.write(this.repository); @@ -182,35 +201,68 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("uuid"); generator.write(this.uuid); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Status}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean includeGlobalState; - private Map indices; - private String repository; - private ShardsStats shardsStats; - private String snapshot; - private String state; - private SnapshotStats stats; - private String uuid; + public Builder() {} + + private Builder(Status o) { + this.includeGlobalState = o.includeGlobalState; + this.indices = _mapCopy(o.indices); + this.repository = o.repository; + this.shardsStats = o.shardsStats; + this.snapshot = o.snapshot; + this.state = o.state; + this.stats = o.stats; + this.uuid = o.uuid; + } + + private Builder(Builder o) { + this.includeGlobalState = o.includeGlobalState; + this.indices = _mapCopy(o.indices); + this.repository = o.repository; + this.shardsStats = o.shardsStats; + this.snapshot = o.snapshot; + this.state = o.state; + this.stats = o.stats; + this.uuid = o.uuid; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code include_global_state} */ + @Nonnull public final Builder includeGlobalState(boolean value) { this.includeGlobalState = value; return this; @@ -218,9 +270,12 @@ public final Builder includeGlobalState(boolean value) { /** * Required - API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -228,9 +283,12 @@ public final Builder indices(Map map) { /** * Required - API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, SnapshotIndexStats value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -238,9 +296,12 @@ public final Builder indices(String key, SnapshotIndexStats value) { /** * Required - API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new SnapshotIndexStats.Builder()).build()); } @@ -248,6 +309,7 @@ public final Builder indices(String key, Function> fn) { - return this.shardsStats(fn.apply(new ShardsStats.Builder()).build()); + return shardsStats(fn.apply(new ShardsStats.Builder()).build()); } /** * Required - API name: {@code snapshot} */ + @Nonnull public final Builder snapshot(String value) { this.snapshot = value; return this; @@ -279,6 +344,7 @@ public final Builder snapshot(String value) { /** * Required - API name: {@code state} */ + @Nonnull public final Builder state(String value) { this.state = value; return this; @@ -287,6 +353,7 @@ public final Builder state(String value) { /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(SnapshotStats value) { this.stats = value; return this; @@ -295,13 +362,15 @@ public final Builder stats(SnapshotStats value) { /** * Required - API name: {@code stats} */ + @Nonnull public final Builder stats(Function> fn) { - return this.stats(fn.apply(new SnapshotStats.Builder()).build()); + return stats(fn.apply(new SnapshotStats.Builder()).build()); } /** * Required - API name: {@code uuid} */ + @Nonnull public final Builder uuid(String value) { this.uuid = value; return this; @@ -310,9 +379,10 @@ public final Builder uuid(String value) { /** * Builds a {@link Status}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Status build() { _checkSingleUse(); @@ -331,7 +401,6 @@ public Status build() { ); protected static void setupStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::includeGlobalState, JsonpDeserializer.booleanDeserializer(), "include_global_state"); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(SnapshotIndexStats._DESERIALIZER), "indices"); op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); @@ -340,7 +409,34 @@ protected static void setupStatusDeserializer(ObjectDeserializer op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); op.add(Builder::stats, SnapshotStats._DESERIALIZER, "stats"); op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.includeGlobalState); + result = 31 * result + this.indices.hashCode(); + result = 31 * result + this.repository.hashCode(); + result = 31 * result + this.shardsStats.hashCode(); + result = 31 * result + this.snapshot.hashCode(); + result = 31 * result + this.state.hashCode(); + result = 31 * result + this.stats.hashCode(); + result = 31 * result + this.uuid.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Status other = (Status) o; + return this.includeGlobalState == other.includeGlobalState + && this.indices.equals(other.indices) + && this.repository.equals(other.repository) + && this.shardsStats.equals(other.shardsStats) + && this.snapshot.equals(other.snapshot) + && this.state.equals(other.state) + && this.stats.equals(other.stats) + && this.uuid.equals(other.uuid); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java index 26a6982644..b0828e1555 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/restore/SnapshotRestore.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot.restore; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,57 +49,66 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ShardStatistics; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: snapshot.restore.SnapshotRestore @JsonpDeserializable -public class SnapshotRestore implements PlainJsonSerializable { - private final List indices; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SnapshotRestore implements PlainJsonSerializable, ToCopyableBuilder { - private final String snapshot; + @Nonnull + private final List indices; + @Nonnull private final ShardStatistics shards; + @Nonnull + private final String snapshot; + // --------------------------------------------------------------------------------------------- private SnapshotRestore(Builder builder) { - this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); - this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - + this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); } - public static SnapshotRestore of(Function> fn) { + public static SnapshotRestore of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code indices} */ + @Nonnull public final List indices() { return this.indices; } /** - * Required - API name: {@code snapshot} + * Required - API name: {@code shards} */ - public final String snapshot() { - return this.snapshot; + @Nonnull + public final ShardStatistics shards() { + return this.shards; } /** - * Required - API name: {@code shards} + * Required - API name: {@code snapshot} */ - public final ShardStatistics shards() { - return this.shards; + @Nonnull + public final String snapshot() { + return this.snapshot; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -101,43 +116,69 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (String item0 : this.indices) { - generator.write(item0); - - } - generator.writeEnd(); - + generator.writeKey("indices"); + generator.writeStartArray(); + for (String item0 : this.indices) { + generator.write(item0); } - generator.writeKey("snapshot"); - generator.write(this.snapshot); + generator.writeEnd(); generator.writeKey("shards"); this.shards.serialize(generator, mapper); + generator.writeKey("snapshot"); + generator.write(this.snapshot); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SnapshotRestore}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List indices; - + private ShardStatistics shards; private String snapshot; - private ShardStatistics shards; + public Builder() {} + + private Builder(SnapshotRestore o) { + this.indices = _listCopy(o.indices); + this.shards = o.shards; + this.snapshot = o.snapshot; + } + + private Builder(Builder o) { + this.indices = _listCopy(o.indices); + this.shards = o.shards; + this.snapshot = o.snapshot; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code indices} + * *

* Adds all elements of list to indices. + *

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

* Adds one or more values to indices. + *

*/ + @Nonnull public final Builder indices(String value, String... values) { this.indices = _listAdd(this.indices, value, values); return this; } - /** - * Required - API name: {@code snapshot} - */ - public final Builder snapshot(String value) { - this.snapshot = value; - return this; - } - /** * Required - API name: {@code shards} */ + @Nonnull public final Builder shards(ShardStatistics value) { this.shards = value; return this; @@ -172,16 +209,27 @@ public final Builder shards(ShardStatistics value) { /** * Required - API name: {@code shards} */ + @Nonnull public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); + } + + /** + * Required - API name: {@code snapshot} + */ + @Nonnull + public final Builder snapshot(String value) { + this.snapshot = value; + return this; } /** * Builds a {@link SnapshotRestore}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SnapshotRestore build() { _checkSingleUse(); @@ -200,11 +248,25 @@ public SnapshotRestore build() { ); protected static void setupSnapshotRestoreDeserializer(ObjectDeserializer op) { - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "indices"); - op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); op.add(Builder::shards, ShardStatistics._DESERIALIZER, "shards"); + op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.indices.hashCode(); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + this.snapshot.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SnapshotRestore other = (SnapshotRestore) o; + return this.indices.equals(other.indices) && this.shards.equals(other.shards) && this.snapshot.equals(other.snapshot); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java deleted file mode 100644 index d73e7d5c97..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.snapshot; - -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; -import org.opensearch.client.transport.OpenSearchTransport; -import org.opensearch.client.transport.TransportOptions; -import org.opensearch.client.util.ObjectBuilder; - -/** - * Client for the snapshot namespace. - */ -public class OpenSearchSnapshotAsyncClient extends OpenSearchSnapshotAsyncClientBase { - - public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchSnapshotAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchSnapshotAsyncClient(this.transport, transportOptions); - } - - // ----- Endpoint: snapshot.create - - /** - * Creates a snapshot in a repository. - * - * - */ - - public CompletableFuture create(CreateSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CreateSnapshotRequest, - CreateSnapshotResponse, - ErrorResponse>) CreateSnapshotRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - // ----- Endpoint: snapshot.delete - - /** - * Deletes a snapshot. - * - * - */ - - public CompletableFuture delete(DeleteSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteSnapshotRequest, - DeleteSnapshotResponse, - ErrorResponse>) DeleteSnapshotRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteSnapshotRequest} - * - */ - - public final CompletableFuture delete( - Function> fn - ) throws IOException, OpenSearchException { - return delete(fn.apply(new DeleteSnapshotRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.restore - - /** - * Restores a snapshot. - * - * - */ - - public CompletableFuture restore(RestoreRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RestoreRequest, - RestoreResponse, - ErrorResponse>) RestoreRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Restores a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link RestoreRequest} - * - */ - - public final CompletableFuture restore(Function> fn) - throws IOException, OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.status - - /** - * Returns information about the status of a snapshot. - * - * - */ - - public CompletableFuture status(SnapshotStatusRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SnapshotStatusRequest, - SnapshotStatusResponse, - ErrorResponse>) SnapshotStatusRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Returns information about the status of a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link SnapshotStatusRequest} - * - */ - - public final CompletableFuture status( - Function> fn - ) throws IOException, OpenSearchException { - return status(fn.apply(new SnapshotStatusRequest.Builder()).build()); - } - - /** - * Returns information about the status of a snapshot. - * - * - */ - - public CompletableFuture status() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new SnapshotStatusRequest.Builder().build(), - SnapshotStatusRequest._ENDPOINT, - this.transportOptions - ); - } -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java deleted file mode 100644 index dda8c56e95..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.snapshot; - -import java.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; -import org.opensearch.client.transport.OpenSearchTransport; -import org.opensearch.client.transport.TransportOptions; -import org.opensearch.client.util.ObjectBuilder; - -/** - * Client for the snapshot namespace. - */ -public class OpenSearchSnapshotClient extends OpenSearchSnapshotClientBase { - - public OpenSearchSnapshotClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchSnapshotClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchSnapshotClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchSnapshotClient(this.transport, transportOptions); - } - - // ----- Endpoint: snapshot.create - - /** - * Creates a snapshot in a repository. - * - * - */ - - public CreateSnapshotResponse create(CreateSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CreateSnapshotRequest, - CreateSnapshotResponse, - ErrorResponse>) CreateSnapshotRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - // ----- Endpoint: snapshot.delete - - /** - * Deletes a snapshot. - * - * - */ - - public DeleteSnapshotResponse delete(DeleteSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteSnapshotRequest, - DeleteSnapshotResponse, - ErrorResponse>) DeleteSnapshotRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteSnapshotRequest} - * - */ - - public final DeleteSnapshotResponse delete(Function> fn) - throws IOException, OpenSearchException { - return delete(fn.apply(new DeleteSnapshotRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.restore - - /** - * Restores a snapshot. - * - * - */ - - public RestoreResponse restore(RestoreRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RestoreRequest, - RestoreResponse, - ErrorResponse>) RestoreRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Restores a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link RestoreRequest} - * - */ - - public final RestoreResponse restore(Function> fn) throws IOException, - OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.status - - /** - * Returns information about the status of a snapshot. - * - * - */ - - public SnapshotStatusResponse status(SnapshotStatusRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - SnapshotStatusRequest, - SnapshotStatusResponse, - ErrorResponse>) SnapshotStatusRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns information about the status of a snapshot. - * - * @param fn - * a function that initializes a builder to create the - * {@link SnapshotStatusRequest} - * - */ - - public final SnapshotStatusResponse status(Function> fn) - throws IOException, OpenSearchException { - return status(fn.apply(new SnapshotStatusRequest.Builder()).build()); - } - - /** - * Returns information about the status of a snapshot. - * - * - */ - - public SnapshotStatusResponse status() throws IOException, OpenSearchException { - return this.transport.performRequest( - new SnapshotStatusRequest.Builder().build(), - SnapshotStatusRequest._ENDPOINT, - this.transportOptions - ); - } -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java deleted file mode 100644 index 1e6754e8aa..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java +++ /dev/null @@ -1,634 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.snapshot; - -import jakarta.json.stream.JsonGenerator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; -import org.opensearch.client.json.JsonpDeserializable; -import org.opensearch.client.json.JsonpDeserializer; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectBuilderDeserializer; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.json.PlainJsonSerializable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.opensearch.indices.PutIndicesSettingsRequest; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: snapshot.restore.Request - -/** - * Restores a snapshot. - */ -@JsonpDeserializable -public class RestoreRequest extends RequestBase implements PlainJsonSerializable { - private final List ignoreIndexSettings; - - @Nullable - private final Boolean ignoreUnavailable; - - @Nullable - private final Boolean includeAliases; - - @Nullable - private final Boolean includeGlobalState; - - @Nullable - private final PutIndicesSettingsRequest indexSettings; - - private final List indices; - - @Deprecated - @Nullable - private final Time masterTimeout; - - @Nullable - private final Time clusterManagerTimeout; - - @Nullable - private final Boolean partial; - - @Nullable - private final String renamePattern; - - @Nullable - private final String renameReplacement; - - private final String repository; - - private final String snapshot; - - @Nullable - private final Boolean waitForCompletion; - - // --------------------------------------------------------------------------------------------- - - private RestoreRequest(Builder builder) { - - this.ignoreIndexSettings = ApiTypeHelper.unmodifiable(builder.ignoreIndexSettings); - this.ignoreUnavailable = builder.ignoreUnavailable; - this.includeAliases = builder.includeAliases; - this.includeGlobalState = builder.includeGlobalState; - this.indexSettings = builder.indexSettings; - this.indices = ApiTypeHelper.unmodifiable(builder.indices); - this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.partial = builder.partial; - this.renamePattern = builder.renamePattern; - this.renameReplacement = builder.renameReplacement; - this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); - this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); - this.waitForCompletion = builder.waitForCompletion; - - } - - public static RestoreRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code ignore_index_settings} - */ - public final List ignoreIndexSettings() { - return this.ignoreIndexSettings; - } - - /** - * API name: {@code ignore_unavailable} - */ - @Nullable - public final Boolean ignoreUnavailable() { - return this.ignoreUnavailable; - } - - /** - * API name: {@code include_aliases} - */ - @Nullable - public final Boolean includeAliases() { - return this.includeAliases; - } - - /** - * API name: {@code include_global_state} - */ - @Nullable - public final Boolean includeGlobalState() { - return this.includeGlobalState; - } - - /** - * API name: {@code index_settings} - */ - @Nullable - public final PutIndicesSettingsRequest indexSettings() { - return this.indexSettings; - } - - /** - * API name: {@code indices} - */ - public final List indices() { - return this.indices; - } - - /** - * Explicit operation timeout for connection to master node - *

- * API name: {@code master_timeout} - */ - @Deprecated - @Nullable - public final Time masterTimeout() { - return this.masterTimeout; - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * API name: {@code partial} - */ - @Nullable - public final Boolean partial() { - return this.partial; - } - - /** - * API name: {@code rename_pattern} - */ - @Nullable - public final String renamePattern() { - return this.renamePattern; - } - - /** - * API name: {@code rename_replacement} - */ - @Nullable - public final String renameReplacement() { - return this.renameReplacement; - } - - /** - * Required - A repository name - *

- * API name: {@code repository} - */ - public final String repository() { - return this.repository; - } - - /** - * Required - A snapshot name - *

- * API name: {@code snapshot} - */ - public final String snapshot() { - return this.snapshot; - } - - /** - * Should this request wait until the operation has completed before returning - *

- * API name: {@code wait_for_completion} - */ - @Nullable - public final Boolean waitForCompletion() { - return this.waitForCompletion; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.ignoreIndexSettings)) { - generator.writeKey("ignore_index_settings"); - generator.writeStartArray(); - for (String item0 : this.ignoreIndexSettings) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.ignoreUnavailable != null) { - generator.writeKey("ignore_unavailable"); - generator.write(this.ignoreUnavailable); - - } - if (this.includeAliases != null) { - generator.writeKey("include_aliases"); - generator.write(this.includeAliases); - - } - if (this.includeGlobalState != null) { - generator.writeKey("include_global_state"); - generator.write(this.includeGlobalState); - - } - if (this.indexSettings != null) { - generator.writeKey("index_settings"); - this.indexSettings.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.indices)) { - generator.writeKey("indices"); - generator.writeStartArray(); - for (String item0 : this.indices) { - generator.write(item0); - - } - generator.writeEnd(); - - } - if (this.partial != null) { - generator.writeKey("partial"); - generator.write(this.partial); - - } - if (this.renamePattern != null) { - generator.writeKey("rename_pattern"); - generator.write(this.renamePattern); - - } - if (this.renameReplacement != null) { - generator.writeKey("rename_replacement"); - generator.write(this.renameReplacement); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RestoreRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private List ignoreIndexSettings; - - @Nullable - private Boolean ignoreUnavailable; - - @Nullable - private Boolean includeAliases; - - @Nullable - private Boolean includeGlobalState; - - @Nullable - private PutIndicesSettingsRequest indexSettings; - - @Nullable - private List indices; - - @Deprecated - @Nullable - private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - - @Nullable - private Boolean partial; - - @Nullable - private String renamePattern; - - @Nullable - private String renameReplacement; - - private String repository; - - private String snapshot; - - @Nullable - private Boolean waitForCompletion; - - /** - * API name: {@code ignore_index_settings} - *

- * Adds all elements of list to ignoreIndexSettings. - */ - public final Builder ignoreIndexSettings(List list) { - this.ignoreIndexSettings = _listAddAll(this.ignoreIndexSettings, list); - return this; - } - - /** - * API name: {@code ignore_index_settings} - *

- * Adds one or more values to ignoreIndexSettings. - */ - public final Builder ignoreIndexSettings(String value, String... values) { - this.ignoreIndexSettings = _listAdd(this.ignoreIndexSettings, value, values); - return this; - } - - /** - * API name: {@code ignore_unavailable} - */ - public final Builder ignoreUnavailable(@Nullable Boolean value) { - this.ignoreUnavailable = value; - return this; - } - - /** - * API name: {@code include_aliases} - */ - public final Builder includeAliases(@Nullable Boolean value) { - this.includeAliases = value; - return this; - } - - /** - * API name: {@code include_global_state} - */ - public final Builder includeGlobalState(@Nullable Boolean value) { - this.includeGlobalState = value; - return this; - } - - /** - * API name: {@code index_settings} - */ - public final Builder indexSettings(@Nullable PutIndicesSettingsRequest value) { - this.indexSettings = value; - return this; - } - - /** - * API name: {@code index_settings} - */ - public final Builder indexSettings(Function> fn) { - return this.indexSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); - } - - /** - * API name: {@code indices} - *

- * Adds all elements of list to indices. - */ - public final Builder indices(List list) { - this.indices = _listAddAll(this.indices, list); - return this; - } - - /** - * API name: {@code indices} - *

- * Adds one or more values to indices. - */ - public final Builder indices(String value, String... values) { - this.indices = _listAdd(this.indices, value, values); - return this; - } - - /** - * Explicit operation timeout for connection to master node - *

- * API name: {@code master_timeout} - */ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; - } - - /** - * Explicit operation timeout for connection to master node - *

- * API name: {@code master_timeout} - */ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * API name: {@code partial} - */ - public final Builder partial(@Nullable Boolean value) { - this.partial = value; - return this; - } - - /** - * API name: {@code rename_pattern} - */ - public final Builder renamePattern(@Nullable String value) { - this.renamePattern = value; - return this; - } - - /** - * API name: {@code rename_replacement} - */ - public final Builder renameReplacement(@Nullable String value) { - this.renameReplacement = value; - return this; - } - - /** - * Required - A repository name - *

- * API name: {@code repository} - */ - public final Builder repository(String value) { - this.repository = value; - return this; - } - - /** - * Required - A snapshot name - *

- * API name: {@code snapshot} - */ - public final Builder snapshot(String value) { - this.snapshot = value; - return this; - } - - /** - * Should this request wait until the operation has completed before returning - *

- * API name: {@code wait_for_completion} - */ - public final Builder waitForCompletion(@Nullable Boolean value) { - this.waitForCompletion = value; - return this; - } - - /** - * Builds a {@link RestoreRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RestoreRequest build() { - _checkSingleUse(); - - return new RestoreRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RestoreRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - RestoreRequest::setupRestoreRequestDeserializer - ); - - protected static void setupRestoreRequestDeserializer(ObjectDeserializer op) { - - op.add( - Builder::ignoreIndexSettings, - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "ignore_index_settings" - ); - op.add(Builder::ignoreUnavailable, JsonpDeserializer.booleanDeserializer(), "ignore_unavailable"); - op.add(Builder::includeAliases, JsonpDeserializer.booleanDeserializer(), "include_aliases"); - op.add(Builder::includeGlobalState, JsonpDeserializer.booleanDeserializer(), "include_global_state"); - op.add(Builder::indexSettings, PutIndicesSettingsRequest._DESERIALIZER, "index_settings"); - op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "indices"); - op.add(Builder::partial, JsonpDeserializer.booleanDeserializer(), "partial"); - op.add(Builder::renamePattern, JsonpDeserializer.stringDeserializer(), "rename_pattern"); - op.add(Builder::renameReplacement, JsonpDeserializer.stringDeserializer(), "rename_replacement"); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code snapshot.restore}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "POST"; - - }, - - // Request path - request -> { - final int _repository = 1 << 0; - final int _snapshot = 1 << 1; - - int propsSet = 0; - - propsSet |= _repository; - propsSet |= _snapshot; - - if (propsSet == (_repository | _snapshot)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.repository, buf); - buf.append("/"); - SimpleEndpoint.pathEncode(request.snapshot, buf); - buf.append("/_restore"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } - if (request.clusterManagerTimeout != null) { - params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); - } - if (request.waitForCompletion != null) { - params.put("wait_for_completion", String.valueOf(request.waitForCompletion)); - } - return params; - - }, - SimpleEndpoint.emptyMap(), - true, - RestoreResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/get/SnapshotResponseItem.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/get/SnapshotResponseItem.java deleted file mode 100644 index c8e91b9cf6..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/get/SnapshotResponseItem.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.snapshot.get; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -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.ErrorCause; -import org.opensearch.client.opensearch.snapshot.SnapshotInfo; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: snapshot.get.SnapshotResponseItem - -@JsonpDeserializable -public class SnapshotResponseItem implements PlainJsonSerializable { - private final String repository; - - private final List snapshots; - - @Nullable - private final ErrorCause error; - - // --------------------------------------------------------------------------------------------- - - private SnapshotResponseItem(Builder builder) { - - this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); - this.snapshots = ApiTypeHelper.unmodifiable(builder.snapshots); - this.error = builder.error; - - } - - public static SnapshotResponseItem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code repository} - */ - public final String repository() { - return this.repository; - } - - /** - * API name: {@code snapshots} - */ - public final List snapshots() { - return this.snapshots; - } - - /** - * API name: {@code error} - */ - @Nullable - public final ErrorCause error() { - return this.error; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("repository"); - generator.write(this.repository); - - if (ApiTypeHelper.isDefined(this.snapshots)) { - generator.writeKey("snapshots"); - generator.writeStartArray(); - for (SnapshotInfo item0 : this.snapshots) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.error != null) { - generator.writeKey("error"); - this.error.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link SnapshotResponseItem}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String repository; - - @Nullable - private List snapshots; - - @Nullable - private ErrorCause error; - - /** - * Required - API name: {@code repository} - */ - public final Builder repository(String value) { - this.repository = value; - return this; - } - - /** - * API name: {@code snapshots} - *

- * Adds all elements of list to snapshots. - */ - public final Builder snapshots(List list) { - this.snapshots = _listAddAll(this.snapshots, list); - return this; - } - - /** - * API name: {@code snapshots} - *

- * Adds one or more values to snapshots. - */ - public final Builder snapshots(SnapshotInfo value, SnapshotInfo... values) { - this.snapshots = _listAdd(this.snapshots, value, values); - return this; - } - - /** - * API name: {@code snapshots} - *

- * Adds a value to snapshots using a builder lambda. - */ - public final Builder snapshots(Function> fn) { - return snapshots(fn.apply(new SnapshotInfo.Builder()).build()); - } - - /** - * API name: {@code error} - */ - public final Builder error(@Nullable ErrorCause value) { - this.error = value; - return this; - } - - /** - * API name: {@code error} - */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Builds a {@link SnapshotResponseItem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public SnapshotResponseItem build() { - _checkSingleUse(); - - return new SnapshotResponseItem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link SnapshotResponseItem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - SnapshotResponseItem::setupSnapshotResponseItemDeserializer - ); - - protected static void setupSnapshotResponseItemDeserializer(ObjectDeserializer op) { - - op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); - op.add(Builder::snapshots, JsonpDeserializer.arrayDeserializer(SnapshotInfo._DESERIALIZER), "snapshots"); - op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); - - } - -} diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 64b87dc3bd..d5baf4eed0 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -15206,63 +15206,63 @@ components: cat.aliases___query.expand_wildcards: in: query name: expand_wildcards - description: Whether to expand wildcard expression to concrete indexes that are open, closed or both. + description: Expands wildcard expressions to concrete indexes. Combine multiple values with commas. Supported values are `all`, `open`, `closed`, `hidden`, and `none`. schema: $ref: '#/components/schemas/_common___ExpandWildcards' style: form cat.aliases___query.format: name: format in: query - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the `Accept` header, such as `json` or `yaml`. schema: type: string - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the `Accept` header, such as `json` or `yaml`. cat.aliases___query.h: name: h in: query - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. style: form schema: type: array items: type: string - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. explode: true cat.aliases___query.help: name: help in: query - description: Return help information. + description: Returns help information. schema: - description: Return help information. + description: Returns help information. type: boolean default: false cat.aliases___query.local: name: local in: query - description: Return local information, do not retrieve the state from cluster-manager node. + description: Whether to return information from the local node only instead of from the cluster manager node. schema: type: boolean default: false - description: Return local information, do not retrieve the state from cluster-manager node. + description: Whether to return information from the local node only instead of from the cluster manager node. cat.aliases___query.s: name: s in: query - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. style: form schema: type: array items: type: string - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. explode: true cat.aliases___query.v: name: v in: query - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. schema: type: boolean default: false - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. cat.all_pit_segments___query.bytes: name: bytes in: query @@ -15317,7 +15317,7 @@ components: cat.allocation___path.node_id: in: path name: node_id - description: Comma-separated list of node identifiers or names used to limit the returned information. + description: A comma-separated list of node IDs or names used to limit the returned information. required: true schema: $ref: '#/components/schemas/_common___NodeIds' @@ -15325,55 +15325,55 @@ components: cat.allocation___query.bytes: in: query name: bytes - description: The unit used to display byte values. + description: The units used to display byte values. schema: $ref: '#/components/schemas/_common___ByteUnit' style: form cat.allocation___query.cluster_manager_timeout: name: cluster_manager_timeout in: query - description: Operation timeout for connection to cluster-manager node. + description: A timeout for connection to the cluster manager node. schema: $ref: '#/components/schemas/_common___Duration' x-version-added: '2.0' cat.allocation___query.format: name: format in: query - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the HTTP `Accept` header, such as `json` or `yaml`. schema: type: string - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the HTTP `Accept` header, such as `json` or `yaml`. cat.allocation___query.h: name: h in: query - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. style: form schema: type: array items: type: string - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. explode: true cat.allocation___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.allocation___query.local: name: local in: query - description: Return local information, do not retrieve the state from cluster-manager node. + description: Returns local information but does not retrieve the state from cluster-manager node. schema: type: boolean default: false - description: Return local information, do not retrieve the state from cluster-manager node. + description: Returns local information but does not retrieve the state from cluster-manager node. cat.allocation___query.master_timeout: name: master_timeout in: query - description: Operation timeout for connection to cluster-manager node. + description: A timeout for connection to the cluster manager node. schema: $ref: '#/components/schemas/_common___Duration' x-version-deprecated: '2.0' @@ -15382,46 +15382,46 @@ components: cat.allocation___query.s: name: s in: query - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. style: form schema: type: array items: type: string - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. explode: true cat.allocation___query.v: name: v in: query - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. schema: type: boolean default: false - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. cat.cluster_manager___query.cluster_manager_timeout: name: cluster_manager_timeout in: query - description: Operation timeout for connection to cluster-manager node. + description: A timeout for connection to the cluster manager node. schema: $ref: '#/components/schemas/_common___Duration' x-version-added: '2.0' cat.cluster_manager___query.format: name: format in: query - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the HTTP `Accept` header, such as `json` or `yaml`. schema: type: string - description: A short version of the Accept header (for example, `json`, `yaml`). + description: A short version of the HTTP `Accept` header, such as `json` or `yaml`. cat.cluster_manager___query.h: name: h in: query - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. style: form schema: type: array items: type: string - description: Comma-separated list of column names to display. + description: A comma-separated list of column names to display. explode: true cat.cluster_manager___query.help: name: help @@ -15442,7 +15442,7 @@ components: cat.cluster_manager___query.master_timeout: name: master_timeout in: query - description: Operation timeout for connection to cluster-manager node. + description: A timeout for connection to the cluster manager node. schema: $ref: '#/components/schemas/_common___Duration' x-version-deprecated: '2.0' @@ -15451,22 +15451,22 @@ components: cat.cluster_manager___query.s: name: s in: query - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. style: form schema: type: array items: type: string - description: Comma-separated list of column names or column aliases to sort by. + description: A comma-separated list of column names or column aliases to sort by. explode: true cat.cluster_manager___query.v: name: v in: query - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. schema: type: boolean default: false - description: Verbose mode. Display column headers. + description: Enables verbose mode, which displays column headers. cat.count___path.index: in: path name: index @@ -27374,16 +27374,15 @@ components: schema: type: object properties: - file: - type: string + id: + $ref: '#/components/schemas/_common___Id' params: description: |- Key-value pairs used to replace Mustache variables in the template. The key is the variable name. The value is the variable value. type: object - additionalProperties: - type: object + additionalProperties: true source: description: |- An inline search template. @@ -58596,7 +58595,8 @@ components: type: object properties: file_count: - type: number + type: integer + format: int32 size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' required: @@ -58633,17 +58633,23 @@ components: type: object properties: done: - type: number + type: integer + format: int64 failed: - type: number + type: integer + format: int64 finalizing: - type: number + type: integer + format: int64 initializing: - type: number + type: integer + format: int64 started: - type: number + type: integer + format: int64 total: - type: number + type: integer + format: int64 required: - done - failed @@ -58652,13 +58658,22 @@ components: - started - total snapshot._common___ShardsStatsStage: - type: string - enum: - - DONE - - FAILURE - - FINALIZE - - INIT - - STARTED + oneOf: + - type: string + const: DONE + description: Number of shards in the snapshot that were successfully stored in the repository. + - type: string + const: FAILURE + description: Number of shards in the snapshot that were not successfully stored in the repository. + - type: string + const: FINALIZE + description: Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. + - type: string + const: INIT + description: Number of shards in the snapshot that are in the initializing stage of being stored in the repository. + - type: string + const: STARTED + description: Number of shards in the snapshot that are in the started stage of being stored in the repository. snapshot._common___ShardsStatsSummary: type: object properties: @@ -58681,7 +58696,8 @@ components: type: object properties: file_count: - type: number + type: integer + format: int64 size_in_bytes: $ref: '#/components/schemas/_common___ByteCount' required: 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 beaaea57a0..b1d377ea34 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 @@ -68,8 +68,8 @@ public class CodeGenerator { isNot("search_models") ) ), - and(namespace(is("snapshot")), name(or(contains("repository"), isOneOf("clone", "create", "get")))), - and(namespace(is("tasks"))) + namespace(is("snapshot")), + namespace(is("tasks")) ); public static void main(String[] args) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index 1416a707d4..1e2d186b5a 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -24,7 +24,7 @@ import org.opensearch.client.codegen.utils.Strings; public class Namespace { - private static final Set PARTIAL_NAMESPACES = Set.of("", "snapshot", "indices"); + private static final Set PARTIAL_NAMESPACES = Set.of("", "indices"); private final Namespace parent; private final String name; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 8e750f8fec..cda34076ef 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -240,8 +240,12 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { return "CloneSnapshot"; case "snapshot.create": return "CreateSnapshot"; + case "snapshot.delete": + return "DeleteSnapshot"; case "snapshot.get": return "GetSnapshot"; + case "snapshot.status": + return "SnapshotStatus"; case "tasks.get": return "GetTasks"; default: From 5291ad246d830628a23e6edf0831779c55537970 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 13 Dec 2024 16:44:28 +1300 Subject: [PATCH 3/4] Rename restore request Signed-off-by: Thomas Farr --- UPGRADING.md | 3 +- .../OpenSearchSnapshotAsyncClient.java | 13 +++---- .../snapshot/OpenSearchSnapshotClient.java | 12 +++---- ...quest.java => RestoreSnapshotRequest.java} | 34 +++++++++---------- ...onse.java => RestoreSnapshotResponse.java} | 31 +++++++++-------- .../client/codegen/model/RequestShape.java | 2 ++ 6 files changed, 51 insertions(+), 44 deletions(-) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{RestoreRequest.java => RestoreSnapshotRequest.java} (96%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{RestoreResponse.java => RestoreSnapshotResponse.java} (85%) diff --git a/UPGRADING.md b/UPGRADING.md index 90b6a8e0d9..35fb0e396f 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -165,5 +165,6 @@ After: ### RepositorySettings - The `concurrentStreams` property is now of type `Integer` instead of `String`. -### snapshot.RestoreRequest +### snapshot.RestoreRequest renamed to snapshot.RestoreSnapshotRequest +- The `snapshot.RestoreRequest` class has been renamed to `snapshot.RestoreSnapshotRequest`. - The `indexSettings` property has been corrected to be of type `IndexSettings` instead of `PutIndicesSettingsRequest`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index b77f2f22a3..cf4f5be9c6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -239,18 +239,19 @@ public final CompletableFuture getRepository() throws IOE /** * Restores a snapshot. */ - public CompletableFuture restore(RestoreRequest request) throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, RestoreRequest._ENDPOINT, this.transportOptions); + public CompletableFuture restore(RestoreSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RestoreSnapshotRequest._ENDPOINT, this.transportOptions); } /** * Restores a snapshot. * - * @param fn a function that initializes a builder to create the {@link RestoreRequest} + * @param fn a function that initializes a builder to create the {@link RestoreSnapshotRequest} */ - public final CompletableFuture restore(Function> fn) - throws IOException, OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); + public final CompletableFuture restore( + Function> fn + ) throws IOException, OpenSearchException { + return restore(fn.apply(new RestoreSnapshotRequest.Builder()).build()); } // ----- Endpoint: snapshot.status diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index 4e6d872b32..31e2215416 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -231,18 +231,18 @@ public final GetRepositoryResponse getRepository() throws IOException, OpenSearc /** * Restores a snapshot. */ - public RestoreResponse restore(RestoreRequest request) throws IOException, OpenSearchException { - return this.transport.performRequest(request, RestoreRequest._ENDPOINT, this.transportOptions); + public RestoreSnapshotResponse restore(RestoreSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RestoreSnapshotRequest._ENDPOINT, this.transportOptions); } /** * Restores a snapshot. * - * @param fn a function that initializes a builder to create the {@link RestoreRequest} + * @param fn a function that initializes a builder to create the {@link RestoreSnapshotRequest} */ - public final RestoreResponse restore(Function> fn) throws IOException, - OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); + public final RestoreSnapshotResponse restore(Function> fn) + throws IOException, OpenSearchException { + return restore(fn.apply(new RestoreSnapshotRequest.Builder()).build()); } // ----- Endpoint: snapshot.status diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java similarity index 96% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java index ca9892e124..c781559bee 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java @@ -70,10 +70,10 @@ */ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class RestoreRequest extends RequestBase +public class RestoreSnapshotRequest extends RequestBase implements PlainJsonSerializable, - ToCopyableBuilder { + ToCopyableBuilder { @Nullable private final Time clusterManagerTimeout; @@ -132,7 +132,7 @@ public class RestoreRequest extends RequestBase // --------------------------------------------------------------------------------------------- - private RestoreRequest(Builder builder) { + private RestoreSnapshotRequest(Builder builder) { this.clusterManagerTimeout = builder.clusterManagerTimeout; this.ignoreIndexSettings = ApiTypeHelper.unmodifiable(builder.ignoreIndexSettings); this.ignoreUnavailable = builder.ignoreUnavailable; @@ -153,7 +153,7 @@ private RestoreRequest(Builder builder) { this.waitForCompletion = builder.waitForCompletion; } - public static RestoreRequest of(Function> fn) { + public static RestoreSnapshotRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -479,9 +479,9 @@ public static Builder builder() { } /** - * Builder for {@link RestoreRequest}. + * Builder for {@link RestoreSnapshotRequest}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; @Nullable @@ -519,7 +519,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(RestoreRequest o) { + private Builder(RestoreSnapshotRequest o) { this.clusterManagerTimeout = o.clusterManagerTimeout; this.ignoreIndexSettings = _listCopy(o.ignoreIndexSettings); this.ignoreUnavailable = o.ignoreUnavailable; @@ -887,30 +887,30 @@ public final Builder waitForCompletion(@Nullable Boolean value) { } /** - * Builds a {@link RestoreRequest}. + * Builds a {@link RestoreSnapshotRequest}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public RestoreRequest build() { + public RestoreSnapshotRequest build() { _checkSingleUse(); - return new RestoreRequest(this); + return new RestoreSnapshotRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link RestoreRequest} + * Json deserializer for {@link RestoreSnapshotRequest} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - RestoreRequest::setupRestoreRequestDeserializer + RestoreSnapshotRequest::setupRestoreSnapshotRequestDeserializer ); - protected static void setupRestoreRequestDeserializer(ObjectDeserializer op) { + protected static void setupRestoreSnapshotRequestDeserializer(ObjectDeserializer op) { op.add( Builder::ignoreIndexSettings, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), @@ -937,7 +937,7 @@ protected static void setupRestoreRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> "POST", // Request path @@ -966,7 +966,7 @@ protected static void setupRestoreRequestDeserializer(ObjectDeserializer { +public class RestoreSnapshotResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Boolean accepted; @@ -68,12 +71,12 @@ public class RestoreResponse implements PlainJsonSerializable, ToCopyableBuilder // --------------------------------------------------------------------------------------------- - private RestoreResponse(Builder builder) { + private RestoreSnapshotResponse(Builder builder) { this.accepted = builder.accepted; this.snapshot = builder.snapshot; } - public static RestoreResponse of(Function> fn) { + public static RestoreSnapshotResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -133,9 +136,9 @@ public static Builder builder() { } /** - * Builder for {@link RestoreResponse}. + * Builder for {@link RestoreSnapshotResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean accepted; @Nullable @@ -143,7 +146,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(RestoreResponse o) { + private Builder(RestoreSnapshotResponse o) { this.accepted = o.accepted; this.snapshot = o.snapshot; } @@ -190,30 +193,30 @@ public final Builder snapshot(Function _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - RestoreResponse::setupRestoreResponseDeserializer + RestoreSnapshotResponse::setupRestoreSnapshotResponseDeserializer ); - protected static void setupRestoreResponseDeserializer(ObjectDeserializer op) { + protected static void setupRestoreSnapshotResponseDeserializer(ObjectDeserializer op) { op.add(Builder::accepted, JsonpDeserializer.booleanDeserializer(), "accepted"); op.add(Builder::snapshot, SnapshotRestore._DESERIALIZER, "snapshot"); } @@ -230,7 +233,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - RestoreResponse other = (RestoreResponse) o; + RestoreSnapshotResponse other = (RestoreSnapshotResponse) o; return Objects.equals(this.accepted, other.accepted) && Objects.equals(this.snapshot, other.snapshot); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index cda34076ef..f8c39d37cd 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -244,6 +244,8 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { return "DeleteSnapshot"; case "snapshot.get": return "GetSnapshot"; + case "snapshot.restore": + return "RestoreSnapshot"; case "snapshot.status": return "SnapshotStatus"; case "tasks.get": From 01a2cd9b79fc154adad53a7106914de3972d075e Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 13 Dec 2024 17:06:59 +1300 Subject: [PATCH 4/4] Disambiguate class names Signed-off-by: Thomas Farr --- UPGRADING.md | 26 ++- .../snapshot/SnapshotIndexStats.java | 14 +- ...rdsStats.java => SnapshotShardsStats.java} | 30 ++-- ...age.java => SnapshotShardsStatsStage.java} | 10 +- ...y.java => SnapshotShardsStatsSummary.java} | 106 ++++++++--- ...va => SnapshotShardsStatsSummaryItem.java} | 34 ++-- .../snapshot/SnapshotShardsStatus.java | 95 ++++++++-- .../opensearch/snapshot/SnapshotStats.java | 41 +++++ .../{Status.java => SnapshotStatus.java} | 71 ++++---- .../snapshot/SnapshotStatusResponse.java | 18 +- java-codegen/opensearch-openapi.yaml | 169 +++++++++--------- 11 files changed, 407 insertions(+), 207 deletions(-) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{ShardsStats.java => SnapshotShardsStats.java} (89%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{ShardsStatsStage.java => SnapshotShardsStatsStage.java} (88%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{ShardsStatsSummary.java => SnapshotShardsStatsSummary.java} (69%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{ShardsStatsSummaryItem.java => SnapshotShardsStatsSummaryItem.java} (81%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{Status.java => SnapshotStatus.java} (84%) diff --git a/UPGRADING.md b/UPGRADING.md index 35fb0e396f..1a782f2d94 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -167,4 +167,28 @@ After: ### snapshot.RestoreRequest renamed to snapshot.RestoreSnapshotRequest - The `snapshot.RestoreRequest` class has been renamed to `snapshot.RestoreSnapshotRequest`. -- The `indexSettings` property has been corrected to be of type `IndexSettings` instead of `PutIndicesSettingsRequest`. \ No newline at end of file +- The `indexSettings` property has been corrected to be of type `IndexSettings` instead of `PutIndicesSettingsRequest`. + +### snapshot.RestoreResponse renamed to snapshot.RestoreSnapshotResponse +- The `snapshot.RestoreResponse` class has been renamed to `snapshot.RestoreSnapshotResponse`. + +### snapshot.Status renamed to snapshot.SnapshotStatus +- The `snapshot.Status` class has been renamed to `snapshot.SnapshotStatus`, this affects: + - `snapshot.SnapshotStatusResponse`'s `snapshots` field. + +### snapshot.ShardStats renamed to snapshot.SnapshotShardStats +- The `snapshot.ShardStats` class has been renamed to `snapshot.SnapshotShardStats`, this affects: + - `snapshot.SnapshotStatus`'s (previous `snapshot.Status`) `shardsStats` field. + - `snapshot.SnapshotIndexStats`'s `shardsStats` field. + +### snapshot.ShardsStatsStage renamed to snapshot.SnapshotShardsStatsStage +- The `snapshot.ShardsStatsStage` class has been renamed to `snapshot.SnapshotShardsStatsStage`, this affects: + - `snapshot.SnapshotShardsStatus`'s `stage` field. + +### snapshot.ShardsStatsSummary renamed to snapshot.SnapshotShardsStatsSummary +- The `snapshot.ShardsStatsSummary` class has been renamed to `snapshot.SnapshotShardsStatsSummary`, this affects: + - `snapshot.SnapshotShardsStatus`'s `summary` field. + +### snapshot.ShardsStatsSummaryItem renamed to snapshot.SnapshotShardsStatsSummaryItem +- The `snapshot.ShardsStatsSummaryItem` class has been renamed to `snapshot.SnapshotShardsStatsSummaryItem`, this affects: + - `snapshot.SnapshotShardsStatsSummary`'s (previously `snapshot.ShardsStatsSummary`) `incremental` and `total` fields. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java index 04623f1628..8baa468509 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotIndexStats.java @@ -63,7 +63,7 @@ public class SnapshotIndexStats implements PlainJsonSerializable, ToCopyableBuil private final Map shards; @Nonnull - private final ShardsStats shardsStats; + private final SnapshotShardsStats shardsStats; @Nonnull private final SnapshotStats stats; @@ -92,7 +92,7 @@ public final Map shards() { * Required - API name: {@code shards_stats} */ @Nonnull - public final ShardsStats shardsStats() { + public final SnapshotShardsStats shardsStats() { return this.shardsStats; } @@ -148,7 +148,7 @@ public static Builder builder() { */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map shards; - private ShardsStats shardsStats; + private SnapshotShardsStats shardsStats; private SnapshotStats stats; public Builder() {} @@ -213,7 +213,7 @@ public final Builder shards(String key, Function> fn) { - return shardsStats(fn.apply(new ShardsStats.Builder()).build()); + public final Builder shardsStats(Function> fn) { + return shardsStats(fn.apply(new SnapshotShardsStats.Builder()).build()); } /** @@ -269,7 +269,7 @@ public SnapshotIndexStats build() { protected static void setupSnapshotIndexStatsDeserializer(ObjectDeserializer op) { op.add(Builder::shards, JsonpDeserializer.stringMapDeserializer(SnapshotShardsStatus._DESERIALIZER), "shards"); - op.add(Builder::shardsStats, ShardsStats._DESERIALIZER, "shards_stats"); + op.add(Builder::shardsStats, SnapshotShardsStats._DESERIALIZER, "shards_stats"); op.add(Builder::stats, SnapshotStats._DESERIALIZER, "stats"); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStats.java similarity index 89% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStats.java index 7a3ccd696e..baa3b74d8d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStats.java @@ -52,11 +52,11 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.ToCopyableBuilder; -// typedef: snapshot.ShardsStats +// typedef: snapshot.SnapshotShardsStats @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class ShardsStats implements PlainJsonSerializable, ToCopyableBuilder { +public class SnapshotShardsStats implements PlainJsonSerializable, ToCopyableBuilder { private final long done; @@ -72,7 +72,7 @@ public class ShardsStats implements PlainJsonSerializable, ToCopyableBuilder> fn) { + public static SnapshotShardsStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -171,9 +171,9 @@ public static Builder builder() { } /** - * Builder for {@link ShardsStats}. + * Builder for {@link SnapshotShardsStats}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long done; private Long failed; private Long finalizing; @@ -183,7 +183,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(ShardsStats o) { + private Builder(SnapshotShardsStats o) { this.done = o.done; this.failed = o.failed; this.finalizing = o.finalizing; @@ -262,30 +262,30 @@ public final Builder total(long value) { } /** - * Builds a {@link ShardsStats}. + * Builds a {@link SnapshotShardsStats}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public ShardsStats build() { + public SnapshotShardsStats build() { _checkSingleUse(); - return new ShardsStats(this); + return new SnapshotShardsStats(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ShardsStats} + * Json deserializer for {@link SnapshotShardsStats} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - ShardsStats::setupShardsStatsDeserializer + SnapshotShardsStats::setupSnapshotShardsStatsDeserializer ); - protected static void setupShardsStatsDeserializer(ObjectDeserializer op) { + protected static void setupSnapshotShardsStatsDeserializer(ObjectDeserializer op) { op.add(Builder::done, JsonpDeserializer.longDeserializer(), "done"); op.add(Builder::failed, JsonpDeserializer.longDeserializer(), "failed"); op.add(Builder::finalizing, JsonpDeserializer.longDeserializer(), "finalizing"); @@ -310,7 +310,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - ShardsStats other = (ShardsStats) o; + SnapshotShardsStats other = (SnapshotShardsStats) o; return this.done == other.done && this.failed == other.failed && this.finalizing == other.finalizing diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsStage.java similarity index 88% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsStage.java index eefcad0768..78cee56d66 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsStage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsStage.java @@ -40,11 +40,11 @@ import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; -// typedef: snapshot.ShardsStatsStage +// typedef: snapshot.SnapshotShardsStatsStage @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public enum ShardsStatsStage implements JsonEnum { +public enum SnapshotShardsStatsStage implements JsonEnum { /** * Number of shards in the snapshot that were successfully stored in the repository. */ @@ -72,7 +72,7 @@ public enum ShardsStatsStage implements JsonEnum { private final String jsonValue; - ShardsStatsStage(String jsonValue) { + SnapshotShardsStatsStage(String jsonValue) { this.jsonValue = jsonValue; } @@ -80,5 +80,7 @@ public String jsonValue() { return this.jsonValue; } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ShardsStatsStage.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + SnapshotShardsStatsStage.values() + ); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummary.java similarity index 69% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummary.java index 1fad0eace1..5ba14a343a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummary.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummary.java @@ -55,14 +55,20 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.ToCopyableBuilder; -// typedef: snapshot.ShardsStatsSummary +// typedef: snapshot.SnapshotShardsStatsSummary @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class ShardsStatsSummary implements PlainJsonSerializable, ToCopyableBuilder { +public class SnapshotShardsStatsSummary + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nonnull - private final ShardsStatsSummaryItem incremental; + private final SnapshotShardsStatsSummaryItem incremental; + + @Nullable + private final SnapshotShardsStatsSummaryItem processed; private final long startTimeInMillis; @@ -72,19 +78,22 @@ public class ShardsStatsSummary implements PlainJsonSerializable, ToCopyableBuil private final long timeInMillis; @Nonnull - private final ShardsStatsSummaryItem total; + private final SnapshotShardsStatsSummaryItem total; // --------------------------------------------------------------------------------------------- - private ShardsStatsSummary(Builder builder) { + private SnapshotShardsStatsSummary(Builder builder) { this.incremental = ApiTypeHelper.requireNonNull(builder.incremental, this, "incremental"); + this.processed = builder.processed; this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis"); this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); } - public static ShardsStatsSummary of(Function> fn) { + public static SnapshotShardsStatsSummary of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -92,10 +101,18 @@ public static ShardsStatsSummary of(Function { - private ShardsStatsSummaryItem incremental; + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private SnapshotShardsStatsSummaryItem incremental; + @Nullable + private SnapshotShardsStatsSummaryItem processed; private Long startTimeInMillis; @Nullable private Time time; private Long timeInMillis; - private ShardsStatsSummaryItem total; + private SnapshotShardsStatsSummaryItem total; public Builder() {} - private Builder(ShardsStatsSummary o) { + private Builder(SnapshotShardsStatsSummary o) { this.incremental = o.incremental; + this.processed = o.processed; this.startTimeInMillis = o.startTimeInMillis; this.time = o.time; this.timeInMillis = o.timeInMillis; @@ -191,6 +216,7 @@ private Builder(ShardsStatsSummary o) { private Builder(Builder o) { this.incremental = o.incremental; + this.processed = o.processed; this.startTimeInMillis = o.startTimeInMillis; this.time = o.time; this.timeInMillis = o.timeInMillis; @@ -207,7 +233,7 @@ public Builder copy() { * Required - API name: {@code incremental} */ @Nonnull - public final Builder incremental(ShardsStatsSummaryItem value) { + public final Builder incremental(SnapshotShardsStatsSummaryItem value) { this.incremental = value; return this; } @@ -216,8 +242,27 @@ public final Builder incremental(ShardsStatsSummaryItem value) { * Required - API name: {@code incremental} */ @Nonnull - public final Builder incremental(Function> fn) { - return incremental(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); + public final Builder incremental( + Function> fn + ) { + return incremental(fn.apply(new SnapshotShardsStatsSummaryItem.Builder()).build()); + } + + /** + * API name: {@code processed} + */ + @Nonnull + public final Builder processed(@Nullable SnapshotShardsStatsSummaryItem value) { + this.processed = value; + return this; + } + + /** + * API name: {@code processed} + */ + @Nonnull + public final Builder processed(Function> fn) { + return processed(fn.apply(new SnapshotShardsStatsSummaryItem.Builder()).build()); } /** @@ -259,7 +304,7 @@ public final Builder timeInMillis(long value) { * Required - API name: {@code total} */ @Nonnull - public final Builder total(ShardsStatsSummaryItem value) { + public final Builder total(SnapshotShardsStatsSummaryItem value) { this.total = value; return this; } @@ -268,46 +313,48 @@ public final Builder total(ShardsStatsSummaryItem value) { * Required - API name: {@code total} */ @Nonnull - public final Builder total(Function> fn) { - return total(fn.apply(new ShardsStatsSummaryItem.Builder()).build()); + public final Builder total(Function> fn) { + return total(fn.apply(new SnapshotShardsStatsSummaryItem.Builder()).build()); } /** - * Builds a {@link ShardsStatsSummary}. + * Builds a {@link SnapshotShardsStatsSummary}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public ShardsStatsSummary build() { + public SnapshotShardsStatsSummary build() { _checkSingleUse(); - return new ShardsStatsSummary(this); + return new SnapshotShardsStatsSummary(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ShardsStatsSummary} + * Json deserializer for {@link SnapshotShardsStatsSummary} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - ShardsStatsSummary::setupShardsStatsSummaryDeserializer + SnapshotShardsStatsSummary::setupSnapshotShardsStatsSummaryDeserializer ); - protected static void setupShardsStatsSummaryDeserializer(ObjectDeserializer op) { - op.add(Builder::incremental, ShardsStatsSummaryItem._DESERIALIZER, "incremental"); + protected static void setupSnapshotShardsStatsSummaryDeserializer(ObjectDeserializer op) { + op.add(Builder::incremental, SnapshotShardsStatsSummaryItem._DESERIALIZER, "incremental"); + op.add(Builder::processed, SnapshotShardsStatsSummaryItem._DESERIALIZER, "processed"); op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); - op.add(Builder::total, ShardsStatsSummaryItem._DESERIALIZER, "total"); + op.add(Builder::total, SnapshotShardsStatsSummaryItem._DESERIALIZER, "total"); } @Override public int hashCode() { int result = 17; result = 31 * result + this.incremental.hashCode(); + result = 31 * result + Objects.hashCode(this.processed); result = 31 * result + Long.hashCode(this.startTimeInMillis); result = 31 * result + Objects.hashCode(this.time); result = 31 * result + Long.hashCode(this.timeInMillis); @@ -319,8 +366,9 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - ShardsStatsSummary other = (ShardsStatsSummary) o; + SnapshotShardsStatsSummary other = (SnapshotShardsStatsSummary) o; return this.incremental.equals(other.incremental) + && Objects.equals(this.processed, other.processed) && this.startTimeInMillis == other.startTimeInMillis && Objects.equals(this.time, other.time) && this.timeInMillis == other.timeInMillis diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummaryItem.java similarity index 81% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummaryItem.java index a2f99be6e5..a8db86f255 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/ShardsStatsSummaryItem.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatsSummaryItem.java @@ -52,14 +52,14 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.ToCopyableBuilder; -// typedef: snapshot.ShardsStatsSummaryItem +// typedef: snapshot.SnapshotShardsStatsSummaryItem @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class ShardsStatsSummaryItem +public class SnapshotShardsStatsSummaryItem implements PlainJsonSerializable, - ToCopyableBuilder { + ToCopyableBuilder { private final long fileCount; @@ -67,12 +67,14 @@ public class ShardsStatsSummaryItem // --------------------------------------------------------------------------------------------- - private ShardsStatsSummaryItem(Builder builder) { + private SnapshotShardsStatsSummaryItem(Builder builder) { this.fileCount = ApiTypeHelper.requireNonNull(builder.fileCount, this, "fileCount"); this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); } - public static ShardsStatsSummaryItem of(Function> fn) { + public static SnapshotShardsStatsSummaryItem of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -122,15 +124,15 @@ public static Builder builder() { } /** - * Builder for {@link ShardsStatsSummaryItem}. + * Builder for {@link SnapshotShardsStatsSummaryItem}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long fileCount; private Long sizeInBytes; public Builder() {} - private Builder(ShardsStatsSummaryItem o) { + private Builder(SnapshotShardsStatsSummaryItem o) { this.fileCount = o.fileCount; this.sizeInBytes = o.sizeInBytes; } @@ -165,30 +167,30 @@ public final Builder sizeInBytes(long value) { } /** - * Builds a {@link ShardsStatsSummaryItem}. + * Builds a {@link SnapshotShardsStatsSummaryItem}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public ShardsStatsSummaryItem build() { + public SnapshotShardsStatsSummaryItem build() { _checkSingleUse(); - return new ShardsStatsSummaryItem(this); + return new SnapshotShardsStatsSummaryItem(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ShardsStatsSummaryItem} + * Json deserializer for {@link SnapshotShardsStatsSummaryItem} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - ShardsStatsSummaryItem::setupShardsStatsSummaryItemDeserializer + SnapshotShardsStatsSummaryItem::setupSnapshotShardsStatsSummaryItemDeserializer ); - protected static void setupShardsStatsSummaryItemDeserializer(ObjectDeserializer op) { + protected static void setupSnapshotShardsStatsSummaryItemDeserializer(ObjectDeserializer op) { op.add(Builder::fileCount, JsonpDeserializer.longDeserializer(), "file_count"); op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); } @@ -205,7 +207,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - ShardsStatsSummaryItem other = (ShardsStatsSummaryItem) o; + SnapshotShardsStatsSummaryItem other = (SnapshotShardsStatsSummaryItem) o; return this.fileCount == other.fileCount && this.sizeInBytes == other.sizeInBytes; } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java index 3795c1e8cf..0bdf890f1a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotShardsStatus.java @@ -37,9 +37,11 @@ package org.opensearch.client.opensearch.snapshot; 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; @@ -58,15 +60,23 @@ @Generated("org.opensearch.client.codegen.CodeGenerator") public class SnapshotShardsStatus implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable + private final String node; + + @Nullable + private final String reason; + @Nonnull - private final ShardsStatsStage stage; + private final SnapshotShardsStatsStage stage; @Nonnull - private final ShardsStatsSummary stats; + private final SnapshotShardsStatsSummary stats; // --------------------------------------------------------------------------------------------- private SnapshotShardsStatus(Builder builder) { + this.node = builder.node; + this.reason = builder.reason; this.stage = ApiTypeHelper.requireNonNull(builder.stage, this, "stage"); this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats"); } @@ -75,11 +85,27 @@ public static SnapshotShardsStatus of(Function { - private ShardsStatsStage stage; - private ShardsStatsSummary stats; + @Nullable + private String node; + @Nullable + private String reason; + private SnapshotShardsStatsStage stage; + private SnapshotShardsStatsSummary stats; public Builder() {} private Builder(SnapshotShardsStatus o) { + this.node = o.node; + this.reason = o.reason; this.stage = o.stage; this.stats = o.stats; } private Builder(Builder o) { + this.node = o.node; + this.reason = o.reason; this.stage = o.stage; this.stats = o.stats; } @@ -147,11 +191,29 @@ public Builder copy() { return new Builder(this); } + /** + * API name: {@code node} + */ + @Nonnull + public final Builder node(@Nullable String value) { + this.node = value; + return this; + } + + /** + * API name: {@code reason} + */ + @Nonnull + public final Builder reason(@Nullable String value) { + this.reason = value; + return this; + } + /** * Required - API name: {@code stage} */ @Nonnull - public final Builder stage(ShardsStatsStage value) { + public final Builder stage(SnapshotShardsStatsStage value) { this.stage = value; return this; } @@ -160,7 +222,7 @@ public final Builder stage(ShardsStatsStage value) { * Required - API name: {@code stats} */ @Nonnull - public final Builder stats(ShardsStatsSummary value) { + public final Builder stats(SnapshotShardsStatsSummary value) { this.stats = value; return this; } @@ -169,8 +231,8 @@ public final Builder stats(ShardsStatsSummary value) { * Required - API name: {@code stats} */ @Nonnull - public final Builder stats(Function> fn) { - return stats(fn.apply(new ShardsStatsSummary.Builder()).build()); + public final Builder stats(Function> fn) { + return stats(fn.apply(new SnapshotShardsStatsSummary.Builder()).build()); } /** @@ -198,13 +260,17 @@ public SnapshotShardsStatus build() { ); protected static void setupSnapshotShardsStatusDeserializer(ObjectDeserializer op) { - op.add(Builder::stage, ShardsStatsStage._DESERIALIZER, "stage"); - op.add(Builder::stats, ShardsStatsSummary._DESERIALIZER, "stats"); + op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + op.add(Builder::stage, SnapshotShardsStatsStage._DESERIALIZER, "stage"); + op.add(Builder::stats, SnapshotShardsStatsSummary._DESERIALIZER, "stats"); } @Override public int hashCode() { int result = 17; + result = 31 * result + Objects.hashCode(this.node); + result = 31 * result + Objects.hashCode(this.reason); result = 31 * result + this.stage.hashCode(); result = 31 * result + this.stats.hashCode(); return result; @@ -215,6 +281,9 @@ public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; SnapshotShardsStatus other = (SnapshotShardsStatus) o; - return this.stage.equals(other.stage) && this.stats.equals(other.stats); + return Objects.equals(this.node, other.node) + && Objects.equals(this.reason, other.reason) + && this.stage.equals(other.stage) + && this.stats.equals(other.stats); } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java index a0cf8ff105..a3b0f92572 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStats.java @@ -64,6 +64,9 @@ public class SnapshotStats implements PlainJsonSerializable, ToCopyableBuilder { private FileCountSnapshotStats incremental; + @Nullable + private FileCountSnapshotStats processed; private Long startTimeInMillis; @Nullable private Time time; @@ -183,6 +202,7 @@ public Builder() {} private Builder(SnapshotStats o) { this.incremental = o.incremental; + this.processed = o.processed; this.startTimeInMillis = o.startTimeInMillis; this.time = o.time; this.timeInMillis = o.timeInMillis; @@ -191,6 +211,7 @@ private Builder(SnapshotStats o) { private Builder(Builder o) { this.incremental = o.incremental; + this.processed = o.processed; this.startTimeInMillis = o.startTimeInMillis; this.time = o.time; this.timeInMillis = o.timeInMillis; @@ -220,6 +241,23 @@ public final Builder incremental(Function> fn) { + return processed(fn.apply(new FileCountSnapshotStats.Builder()).build()); + } + /** * Required - API name: {@code start_time_in_millis} */ @@ -298,6 +336,7 @@ public SnapshotStats build() { protected static void setupSnapshotStatsDeserializer(ObjectDeserializer op) { op.add(Builder::incremental, FileCountSnapshotStats._DESERIALIZER, "incremental"); + op.add(Builder::processed, FileCountSnapshotStats._DESERIALIZER, "processed"); op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis"); op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); @@ -308,6 +347,7 @@ protected static void setupSnapshotStatsDeserializer(ObjectDeserializer { +public class SnapshotStatus implements PlainJsonSerializable, ToCopyableBuilder { - private final boolean includeGlobalState; + @Nullable + private final Boolean includeGlobalState; @Nonnull private final Map indices; @@ -68,7 +71,7 @@ public class Status implements PlainJsonSerializable, ToCopyableBuilder> fn) { + public static SnapshotStatus of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code include_global_state} + * API name: {@code include_global_state} */ - public final boolean includeGlobalState() { + @Nullable + public final Boolean includeGlobalState() { return this.includeGlobalState; } @@ -126,7 +130,7 @@ public final String repository() { * Required - API name: {@code shards_stats} */ @Nonnull - public final ShardsStats shardsStats() { + public final SnapshotShardsStats shardsStats() { return this.shardsStats; } @@ -173,8 +177,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("include_global_state"); - generator.write(this.includeGlobalState); + if (this.includeGlobalState != null) { + generator.writeKey("include_global_state"); + generator.write(this.includeGlobalState); + } generator.writeKey("indices"); generator.writeStartObject(); @@ -217,13 +223,14 @@ public static Builder builder() { } /** - * Builder for {@link Status}. + * Builder for {@link SnapshotStatus}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable private Boolean includeGlobalState; private Map indices; private String repository; - private ShardsStats shardsStats; + private SnapshotShardsStats shardsStats; private String snapshot; private String state; private SnapshotStats stats; @@ -231,7 +238,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(Status o) { + private Builder(SnapshotStatus o) { this.includeGlobalState = o.includeGlobalState; this.indices = _mapCopy(o.indices); this.repository = o.repository; @@ -260,10 +267,10 @@ public Builder copy() { } /** - * Required - API name: {@code include_global_state} + * API name: {@code include_global_state} */ @Nonnull - public final Builder includeGlobalState(boolean value) { + public final Builder includeGlobalState(@Nullable Boolean value) { this.includeGlobalState = value; return this; } @@ -319,7 +326,7 @@ public final Builder repository(String value) { * Required - API name: {@code shards_stats} */ @Nonnull - public final Builder shardsStats(ShardsStats value) { + public final Builder shardsStats(SnapshotShardsStats value) { this.shardsStats = value; return this; } @@ -328,8 +335,8 @@ public final Builder shardsStats(ShardsStats value) { * Required - API name: {@code shards_stats} */ @Nonnull - public final Builder shardsStats(Function> fn) { - return shardsStats(fn.apply(new ShardsStats.Builder()).build()); + public final Builder shardsStats(Function> fn) { + return shardsStats(fn.apply(new SnapshotShardsStats.Builder()).build()); } /** @@ -377,34 +384,34 @@ public final Builder uuid(String value) { } /** - * Builds a {@link Status}. + * Builds a {@link SnapshotStatus}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public Status build() { + public SnapshotStatus build() { _checkSingleUse(); - return new Status(this); + return new SnapshotStatus(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Status} + * Json deserializer for {@link SnapshotStatus} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - Status::setupStatusDeserializer + SnapshotStatus::setupSnapshotStatusDeserializer ); - protected static void setupStatusDeserializer(ObjectDeserializer op) { + protected static void setupSnapshotStatusDeserializer(ObjectDeserializer op) { op.add(Builder::includeGlobalState, JsonpDeserializer.booleanDeserializer(), "include_global_state"); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(SnapshotIndexStats._DESERIALIZER), "indices"); op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); - op.add(Builder::shardsStats, ShardsStats._DESERIALIZER, "shards_stats"); + op.add(Builder::shardsStats, SnapshotShardsStats._DESERIALIZER, "shards_stats"); op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); op.add(Builder::stats, SnapshotStats._DESERIALIZER, "stats"); @@ -414,7 +421,7 @@ protected static void setupStatusDeserializer(ObjectDeserializer @Override public int hashCode() { int result = 17; - result = 31 * result + Boolean.hashCode(this.includeGlobalState); + result = 31 * result + Objects.hashCode(this.includeGlobalState); result = 31 * result + this.indices.hashCode(); result = 31 * result + this.repository.hashCode(); result = 31 * result + this.shardsStats.hashCode(); @@ -429,8 +436,8 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - Status other = (Status) o; - return this.includeGlobalState == other.includeGlobalState + SnapshotStatus other = (SnapshotStatus) o; + return Objects.equals(this.includeGlobalState, other.includeGlobalState) && this.indices.equals(other.indices) && this.repository.equals(other.repository) && this.shardsStats.equals(other.shardsStats) diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java index 0a45bfdb0d..6be7b25971 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/SnapshotStatusResponse.java @@ -63,7 +63,7 @@ public class SnapshotStatusResponse ToCopyableBuilder { @Nonnull - private final List snapshots; + private final List snapshots; // --------------------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ public static SnapshotStatusResponse of(Function snapshots() { + public final List snapshots() { return this.snapshots; } @@ -96,7 +96,7 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("snapshots"); generator.writeStartArray(); - for (Status item0 : this.snapshots) { + for (SnapshotStatus item0 : this.snapshots) { item0.serialize(generator, mapper); } generator.writeEnd(); @@ -119,7 +119,7 @@ public static Builder builder() { * Builder for {@link SnapshotStatusResponse}. */ public static class Builder extends ObjectBuilderBase implements CopyableBuilder { - private List snapshots; + private List snapshots; public Builder() {} @@ -145,7 +145,7 @@ public Builder copy() { *

*/ @Nonnull - public final Builder snapshots(List list) { + public final Builder snapshots(List list) { this.snapshots = _listAddAll(this.snapshots, list); return this; } @@ -158,7 +158,7 @@ public final Builder snapshots(List list) { *

*/ @Nonnull - public final Builder snapshots(Status value, Status... values) { + public final Builder snapshots(SnapshotStatus value, SnapshotStatus... values) { this.snapshots = _listAdd(this.snapshots, value, values); return this; } @@ -171,8 +171,8 @@ public final Builder snapshots(Status value, Status... values) { *

*/ @Nonnull - public final Builder snapshots(Function> fn) { - return snapshots(fn.apply(new Status.Builder()).build()); + public final Builder snapshots(Function> fn) { + return snapshots(fn.apply(new SnapshotStatus.Builder()).build()); } /** @@ -200,7 +200,7 @@ public SnapshotStatusResponse build() { ); protected static void setupSnapshotStatusResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::snapshots, JsonpDeserializer.arrayDeserializer(Status._DESERIALIZER), "snapshots"); + op.add(Builder::snapshots, JsonpDeserializer.arrayDeserializer(SnapshotStatus._DESERIALIZER), "snapshots"); } @Override diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index d5baf4eed0..27ce083408 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -31851,7 +31851,7 @@ components: snapshots: type: array items: - $ref: '#/components/schemas/snapshot._common___Status' + $ref: '#/components/schemas/snapshot._common___SnapshotStatus' required: - snapshots description: '' @@ -58629,80 +58629,6 @@ components: $ref: '#/components/schemas/_common___StringifiedBoolean' required: - location - snapshot._common___ShardsStats: - type: object - properties: - done: - type: integer - format: int64 - failed: - type: integer - format: int64 - finalizing: - type: integer - format: int64 - initializing: - type: integer - format: int64 - started: - type: integer - format: int64 - total: - type: integer - format: int64 - required: - - done - - failed - - finalizing - - initializing - - started - - total - snapshot._common___ShardsStatsStage: - oneOf: - - type: string - const: DONE - description: Number of shards in the snapshot that were successfully stored in the repository. - - type: string - const: FAILURE - description: Number of shards in the snapshot that were not successfully stored in the repository. - - type: string - const: FINALIZE - description: Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. - - type: string - const: INIT - description: Number of shards in the snapshot that are in the initializing stage of being stored in the repository. - - type: string - const: STARTED - description: Number of shards in the snapshot that are in the started stage of being stored in the repository. - snapshot._common___ShardsStatsSummary: - type: object - properties: - incremental: - $ref: '#/components/schemas/snapshot._common___ShardsStatsSummaryItem' - total: - $ref: '#/components/schemas/snapshot._common___ShardsStatsSummaryItem' - start_time_in_millis: - $ref: '#/components/schemas/_common___EpochTimeUnitMillis' - time: - $ref: '#/components/schemas/_common___Duration' - time_in_millis: - $ref: '#/components/schemas/_common___DurationValueUnitMillis' - required: - - incremental - - start_time_in_millis - - time_in_millis - - total - snapshot._common___ShardsStatsSummaryItem: - type: object - properties: - file_count: - type: integer - format: int64 - size_in_bytes: - $ref: '#/components/schemas/_common___ByteCount' - required: - - file_count - - size_in_bytes snapshot._common___SnapshotIndexStats: type: object properties: @@ -58711,7 +58637,7 @@ components: additionalProperties: $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatus' shards_stats: - $ref: '#/components/schemas/snapshot._common___ShardsStats' + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStats' stats: $ref: '#/components/schemas/snapshot._common___SnapshotStats' required: @@ -58789,13 +58715,93 @@ components: - reason - shard_id - status + snapshot._common___SnapshotShardsStats: + type: object + properties: + done: + type: integer + format: int64 + failed: + type: integer + format: int64 + finalizing: + type: integer + format: int64 + initializing: + type: integer + format: int64 + started: + type: integer + format: int64 + total: + type: integer + format: int64 + required: + - done + - failed + - finalizing + - initializing + - started + - total + snapshot._common___SnapshotShardsStatsStage: + oneOf: + - type: string + const: DONE + description: Number of shards in the snapshot that were successfully stored in the repository. + - type: string + const: FAILURE + description: Number of shards in the snapshot that were not successfully stored in the repository. + - type: string + const: FINALIZE + description: Number of shards in the snapshot that are in the finalizing stage of being stored in the repository. + - type: string + const: INIT + description: Number of shards in the snapshot that are in the initializing stage of being stored in the repository. + - type: string + const: STARTED + description: Number of shards in the snapshot that are in the started stage of being stored in the repository. + snapshot._common___SnapshotShardsStatsSummary: + type: object + properties: + incremental: + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatsSummaryItem' + processed: + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatsSummaryItem' + total: + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatsSummaryItem' + start_time_in_millis: + $ref: '#/components/schemas/_common___EpochTimeUnitMillis' + time: + $ref: '#/components/schemas/_common___Duration' + time_in_millis: + $ref: '#/components/schemas/_common___DurationValueUnitMillis' + required: + - incremental + - start_time_in_millis + - time_in_millis + - total + snapshot._common___SnapshotShardsStatsSummaryItem: + type: object + properties: + file_count: + type: integer + format: int64 + size_in_bytes: + $ref: '#/components/schemas/_common___ByteCount' + required: + - file_count + - size_in_bytes snapshot._common___SnapshotShardsStatus: type: object properties: + node: + $ref: '#/components/schemas/_common___NodeId' + reason: + type: string stage: - $ref: '#/components/schemas/snapshot._common___ShardsStatsStage' + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatsStage' stats: - $ref: '#/components/schemas/snapshot._common___ShardsStatsSummary' + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStatsSummary' required: - stage - stats @@ -58804,6 +58810,8 @@ components: properties: incremental: $ref: '#/components/schemas/snapshot._common___FileCountSnapshotStats' + processed: + $ref: '#/components/schemas/snapshot._common___FileCountSnapshotStats' start_time_in_millis: $ref: '#/components/schemas/_common___EpochTimeUnitMillis' time: @@ -58817,7 +58825,7 @@ components: - start_time_in_millis - time_in_millis - total - snapshot._common___Status: + snapshot._common___SnapshotStatus: type: object properties: include_global_state: @@ -58829,7 +58837,7 @@ components: repository: type: string shards_stats: - $ref: '#/components/schemas/snapshot._common___ShardsStats' + $ref: '#/components/schemas/snapshot._common___SnapshotShardsStats' snapshot: type: string state: @@ -58839,7 +58847,6 @@ components: uuid: $ref: '#/components/schemas/_common___Uuid' required: - - include_global_state - indices - repository - shards_stats