From fb48675c6d228a992dcd4e7f7eca405f412bcb60 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 12 Dec 2024 16:36:07 +1300 Subject: [PATCH] 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: