From 5291ad246d830628a23e6edf0831779c55537970 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 13 Dec 2024 16:44:28 +1300 Subject: [PATCH] Rename restore request Signed-off-by: Thomas Farr --- UPGRADING.md | 3 +- .../OpenSearchSnapshotAsyncClient.java | 13 +++---- .../snapshot/OpenSearchSnapshotClient.java | 12 +++---- ...quest.java => RestoreSnapshotRequest.java} | 34 +++++++++---------- ...onse.java => RestoreSnapshotResponse.java} | 31 +++++++++-------- .../client/codegen/model/RequestShape.java | 2 ++ 6 files changed, 51 insertions(+), 44 deletions(-) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{RestoreRequest.java => RestoreSnapshotRequest.java} (96%) rename java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/{RestoreResponse.java => RestoreSnapshotResponse.java} (85%) diff --git a/UPGRADING.md b/UPGRADING.md index 90b6a8e0d..35fb0e396 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -165,5 +165,6 @@ After: ### RepositorySettings - The `concurrentStreams` property is now of type `Integer` instead of `String`. -### snapshot.RestoreRequest +### snapshot.RestoreRequest renamed to snapshot.RestoreSnapshotRequest +- The `snapshot.RestoreRequest` class has been renamed to `snapshot.RestoreSnapshotRequest`. - The `indexSettings` property has been corrected to be of type `IndexSettings` instead of `PutIndicesSettingsRequest`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index b77f2f22a..cf4f5be9c 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -239,18 +239,19 @@ public final CompletableFuture getRepository() throws IOE /** * Restores a snapshot. */ - public CompletableFuture restore(RestoreRequest request) throws IOException, OpenSearchException { - return this.transport.performRequestAsync(request, RestoreRequest._ENDPOINT, this.transportOptions); + public CompletableFuture restore(RestoreSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, RestoreSnapshotRequest._ENDPOINT, this.transportOptions); } /** * Restores a snapshot. * - * @param fn a function that initializes a builder to create the {@link RestoreRequest} + * @param fn a function that initializes a builder to create the {@link RestoreSnapshotRequest} */ - public final CompletableFuture restore(Function> fn) - throws IOException, OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); + public final CompletableFuture restore( + Function> fn + ) throws IOException, OpenSearchException { + return restore(fn.apply(new RestoreSnapshotRequest.Builder()).build()); } // ----- Endpoint: snapshot.status diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index 4e6d872b3..31e221541 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -231,18 +231,18 @@ public final GetRepositoryResponse getRepository() throws IOException, OpenSearc /** * Restores a snapshot. */ - public RestoreResponse restore(RestoreRequest request) throws IOException, OpenSearchException { - return this.transport.performRequest(request, RestoreRequest._ENDPOINT, this.transportOptions); + public RestoreSnapshotResponse restore(RestoreSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, RestoreSnapshotRequest._ENDPOINT, this.transportOptions); } /** * Restores a snapshot. * - * @param fn a function that initializes a builder to create the {@link RestoreRequest} + * @param fn a function that initializes a builder to create the {@link RestoreSnapshotRequest} */ - public final RestoreResponse restore(Function> fn) throws IOException, - OpenSearchException { - return restore(fn.apply(new RestoreRequest.Builder()).build()); + public final RestoreSnapshotResponse restore(Function> fn) + throws IOException, OpenSearchException { + return restore(fn.apply(new RestoreSnapshotRequest.Builder()).build()); } // ----- Endpoint: snapshot.status diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java similarity index 96% rename from java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java index ca9892e12..c781559be 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/RestoreSnapshotRequest.java @@ -70,10 +70,10 @@ */ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class RestoreRequest extends RequestBase +public class RestoreSnapshotRequest extends RequestBase implements PlainJsonSerializable, - ToCopyableBuilder { + ToCopyableBuilder { @Nullable private final Time clusterManagerTimeout; @@ -132,7 +132,7 @@ public class RestoreRequest extends RequestBase // --------------------------------------------------------------------------------------------- - private RestoreRequest(Builder builder) { + private RestoreSnapshotRequest(Builder builder) { this.clusterManagerTimeout = builder.clusterManagerTimeout; this.ignoreIndexSettings = ApiTypeHelper.unmodifiable(builder.ignoreIndexSettings); this.ignoreUnavailable = builder.ignoreUnavailable; @@ -153,7 +153,7 @@ private RestoreRequest(Builder builder) { this.waitForCompletion = builder.waitForCompletion; } - public static RestoreRequest of(Function> fn) { + public static RestoreSnapshotRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -479,9 +479,9 @@ public static Builder builder() { } /** - * Builder for {@link RestoreRequest}. + * Builder for {@link RestoreSnapshotRequest}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; @Nullable @@ -519,7 +519,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(RestoreRequest o) { + private Builder(RestoreSnapshotRequest o) { this.clusterManagerTimeout = o.clusterManagerTimeout; this.ignoreIndexSettings = _listCopy(o.ignoreIndexSettings); this.ignoreUnavailable = o.ignoreUnavailable; @@ -887,30 +887,30 @@ public final Builder waitForCompletion(@Nullable Boolean value) { } /** - * Builds a {@link RestoreRequest}. + * Builds a {@link RestoreSnapshotRequest}. * * @throws NullPointerException if some of the required fields are null. */ @Override @Nonnull - public RestoreRequest build() { + public RestoreSnapshotRequest build() { _checkSingleUse(); - return new RestoreRequest(this); + return new RestoreSnapshotRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link RestoreRequest} + * Json deserializer for {@link RestoreSnapshotRequest} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - RestoreRequest::setupRestoreRequestDeserializer + RestoreSnapshotRequest::setupRestoreSnapshotRequestDeserializer ); - protected static void setupRestoreRequestDeserializer(ObjectDeserializer op) { + protected static void setupRestoreSnapshotRequestDeserializer(ObjectDeserializer op) { op.add( Builder::ignoreIndexSettings, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), @@ -937,7 +937,7 @@ protected static void setupRestoreRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> "POST", // Request path @@ -966,7 +966,7 @@ protected static void setupRestoreRequestDeserializer(ObjectDeserializer { +public class RestoreSnapshotResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nullable private final Boolean accepted; @@ -68,12 +71,12 @@ public class RestoreResponse implements PlainJsonSerializable, ToCopyableBuilder // --------------------------------------------------------------------------------------------- - private RestoreResponse(Builder builder) { + private RestoreSnapshotResponse(Builder builder) { this.accepted = builder.accepted; this.snapshot = builder.snapshot; } - public static RestoreResponse of(Function> fn) { + public static RestoreSnapshotResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -133,9 +136,9 @@ public static Builder builder() { } /** - * Builder for {@link RestoreResponse}. + * Builder for {@link RestoreSnapshotResponse}. */ - public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean accepted; @Nullable @@ -143,7 +146,7 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder public Builder() {} - private Builder(RestoreResponse o) { + private Builder(RestoreSnapshotResponse o) { this.accepted = o.accepted; this.snapshot = o.snapshot; } @@ -190,30 +193,30 @@ public final Builder snapshot(Function _DESERIALIZER = ObjectBuilderDeserializer.lazy( + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( Builder::new, - RestoreResponse::setupRestoreResponseDeserializer + RestoreSnapshotResponse::setupRestoreSnapshotResponseDeserializer ); - protected static void setupRestoreResponseDeserializer(ObjectDeserializer op) { + protected static void setupRestoreSnapshotResponseDeserializer(ObjectDeserializer op) { op.add(Builder::accepted, JsonpDeserializer.booleanDeserializer(), "accepted"); op.add(Builder::snapshot, SnapshotRestore._DESERIALIZER, "snapshot"); } @@ -230,7 +233,7 @@ public int hashCode() { public boolean equals(Object o) { if (this == o) return true; if (o == null || this.getClass() != o.getClass()) return false; - RestoreResponse other = (RestoreResponse) o; + RestoreSnapshotResponse other = (RestoreSnapshotResponse) o; return Objects.equals(this.accepted, other.accepted) && Objects.equals(this.snapshot, other.snapshot); } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index cda34076e..f8c39d37c 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -244,6 +244,8 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { return "DeleteSnapshot"; case "snapshot.get": return "GetSnapshot"; + case "snapshot.restore": + return "RestoreSnapshot"; case "snapshot.status": return "SnapshotStatus"; case "tasks.get":