diff --git a/UPGRADING.md b/UPGRADING.md index e59cba1254..4556772bea 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -42,4 +42,13 @@ After: - The `tasks` field is now a `TaskInfos` union type instead of a `Map` to correctly handle `groupBy` parents or none. ### GetTasksResponse response type -- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`. \ No newline at end of file +- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`. + +### VerifyRepositoryRequest property naming +- The `name` field, getter and builder method have been renamed to `repository`. + +### CleanupRepositoryRequest property naming +- The `name` field, getter and builder method have been renamed to `repository`. + +### CloneSnapshotRequest timeout removal +- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index cc9296ed41..cbe9d63a80 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -46,6 +46,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient; +import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -69,6 +70,10 @@ public OpenSearchMlAsyncClient ml() { return new OpenSearchMlAsyncClient(this.transport, this.transportOptions); } + public OpenSearchSnapshotAsyncClient snapshot() { + return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions); + } + public OpenSearchTasksAsyncClient tasks() { return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index 7e09f00916..36f4a912b6 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -45,6 +45,7 @@ import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.opensearch.ml.OpenSearchMlClient; +import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient; import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; @@ -68,6 +69,10 @@ public OpenSearchMlClient ml() { return new OpenSearchMlClient(this.transport, this.transportOptions); } + public OpenSearchSnapshotClient snapshot() { + return new OpenSearchSnapshotClient(this.transport, this.transportOptions); + } + public OpenSearchTasksClient tasks() { return new OpenSearchTasksClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java index 1d262d386a..3c30cc3dd5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java @@ -30,11 +30,16 @@ * 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.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -49,18 +54,18 @@ /** * Removes stale data from repository. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryRequest extends RequestBase { - @Deprecated - @Nullable - private final Time masterTimeout; @Nullable private final Time clusterManagerTimeout; - private final String name; + @Deprecated + @Nullable + private final Time masterTimeout; + + private final String repository; @Nullable private final Time timeout; @@ -68,52 +73,54 @@ public class CleanupRepositoryRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private CleanupRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.masterTimeout = builder.masterTimeout; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.timeout = builder.timeout; - } - public static CleanupRepositoryRequest of(Function> fn) { + public static CleanupRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to cluster-manager node + * Period to wait for a connection to the master 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 + * Required - Snapshot repository to clean up. *

* API name: {@code repository} + *

*/ - public final String name() { - return this.name; + public final String repository() { + return this.repository; } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -125,74 +132,75 @@ public final Time timeout() { /** * Builder for {@link CleanupRepositoryRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - @Nullable private Time clusterManagerTimeout; - - private String name; - + @Nullable + private Time masterTimeout; + private String repository; @Nullable private Time timeout; /** - * 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; + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to cluster-manager node + * Period to wait for a connection to the master 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 + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - A repository name + * Required - Snapshot repository to clean up. *

* API name: {@code repository} + *

*/ - public final Builder name(String value) { - this.name = value; + public final Builder repository(String value) { + this.repository = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -200,19 +208,19 @@ public final Builder timeout(@Nullable Time value) { } /** - * Explicit operation timeout + * Period to wait for a response. *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link CleanupRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryRequest build() { _checkSingleUse(); @@ -227,47 +235,29 @@ public CleanupRepositoryRequest build() { * Endpoint "{@code snapshot.cleanup_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_cleanup"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/_cleanup"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java similarity index 88% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java index 40ed5d13b7..30dacbf36d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryResponse.java @@ -30,10 +30,15 @@ * 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 org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -48,18 +53,18 @@ // typedef: snapshot.cleanup_repository.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryResponse implements PlainJsonSerializable { + private final CleanupRepositoryResults results; // --------------------------------------------------------------------------------------------- private CleanupRepositoryResponse(Builder builder) { - this.results = ApiTypeHelper.requireNonNull(builder.results, this, "results"); - } - public static CleanupRepositoryResponse of(Function> fn) { + public static CleanupRepositoryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -73,6 +78,7 @@ public final CleanupRepositoryResults results() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,10 +86,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("results"); this.results.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- @@ -91,7 +95,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CleanupRepositoryResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private CleanupRepositoryResults results; @@ -107,14 +110,13 @@ public final Builder results(CleanupRepositoryResults value) { * Required - API name: {@code results} */ public final Builder results(Function> fn) { - return this.results(fn.apply(new CleanupRepositoryResults.Builder()).build()); + return results(fn.apply(new CleanupRepositoryResults.Builder()).build()); } /** * Builds a {@link CleanupRepositoryResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryResponse build() { _checkSingleUse(); @@ -134,9 +136,6 @@ public CleanupRepositoryResponse build() { ); protected static void setupCleanupRepositoryResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::results, CleanupRepositoryResults._DESERIALIZER, "results"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java similarity index 79% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java index b6e03de864..464881269c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java @@ -30,12 +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.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -55,47 +60,53 @@ // typedef: snapshot.clone.Request /** - * Clones indices from one snapshot into another snapshot in the same - * repository. + * Clones indices from one snapshot into another snapshot in the same repository. */ @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CloneSnapshotRequest extends RequestBase implements PlainJsonSerializable { + + @Nullable + private final Time clusterManagerTimeout; + private final String indices; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - private final String repository; private final String snapshot; private final String targetSnapshot; - @Nullable - private final Time timeout; - // --------------------------------------------------------------------------------------------- private CloneSnapshotRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot"); this.targetSnapshot = ApiTypeHelper.requireNonNull(builder.targetSnapshot, this, "targetSnapshot"); - this.timeout = builder.timeout; - } - public static CloneSnapshotRequest of(Function> fn) { + public static CloneSnapshotRequest of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * Required - API name: {@code indices} */ @@ -107,26 +118,19 @@ public final String 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; - } - /** * Required - A repository name *

* API name: {@code repository} + *

*/ public final String repository() { return this.repository; @@ -136,6 +140,7 @@ public final String repository() { * Required - The name of the snapshot to clone from *

* API name: {@code snapshot} + *

*/ public final String snapshot() { return this.snapshot; @@ -145,22 +150,16 @@ public final String snapshot() { * Required - The name of the cloned snapshot to create *

* API name: {@code target_snapshot} + *

*/ public final String targetSnapshot() { return this.targetSnapshot; } - /** - * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -168,36 +167,44 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("indices"); generator.write(this.indices); - } - // --------------------------------------------------------------------------------------------- /** * Builder for {@link CloneSnapshotRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Time clusterManagerTimeout; private String indices; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - private String repository; - private String snapshot; - private String targetSnapshot; - @Nullable - private Time timeout; + /** + * 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; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } /** * Required - API name: {@code indices} @@ -211,6 +218,7 @@ public final Builder indices(String value) { * Explicit operation timeout for connection to master node *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(@Nullable Time value) { @@ -222,35 +230,18 @@ public final Builder masterTimeout(@Nullable Time value) { * 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()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ public final Builder repository(String value) { this.repository = value; @@ -261,6 +252,7 @@ public final Builder repository(String value) { * Required - The name of the snapshot to clone from *

* API name: {@code snapshot} + *

*/ public final Builder snapshot(String value) { this.snapshot = value; @@ -271,32 +263,17 @@ public final Builder snapshot(String value) { * Required - The name of the cloned snapshot to create *

* API name: {@code target_snapshot} + *

*/ public final Builder targetSnapshot(String value) { this.targetSnapshot = value; return this; } - /** - * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - /** * Builds a {@link CloneSnapshotRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CloneSnapshotRequest build() { _checkSingleUse(); @@ -316,9 +293,7 @@ public CloneSnapshotRequest build() { ); protected static void setupCloneSnapshotRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::indices, JsonpDeserializer.stringDeserializer(), "indices"); - } // --------------------------------------------------------------------------------------------- @@ -327,55 +302,29 @@ protected static void setupCloneSnapshotRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _targetSnapshot = 1 << 0; - final int _repository = 1 << 1; - final int _snapshot = 1 << 2; - - int propsSet = 0; - - propsSet |= _targetSnapshot; - propsSet |= _repository; - propsSet |= _snapshot; - - if (propsSet == (_repository | _snapshot | _targetSnapshot)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.repository, buf); - buf.append("/"); - SimpleEndpoint.pathEncode(request.snapshot, buf); - buf.append("/_clone"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.targetSnapshot, 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); + buf.append("/_clone/"); + SimpleEndpoint.pathEncode(request.targetSnapshot, 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.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java similarity index 87% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java index b41d071c45..237dc0fe9c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotResponse.java @@ -30,9 +30,14 @@ * 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 org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +48,16 @@ // typedef: snapshot.clone.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CloneSnapshotResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- private CloneSnapshotResponse(Builder builder) { super(builder); - } - public static CloneSnapshotResponse of(Function> fn) { + public static CloneSnapshotResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,7 +66,6 @@ public static CloneSnapshotResponse of(Function implements ObjectBuilder { @Override protected Builder self() { @@ -70,8 +75,7 @@ protected Builder self() { /** * Builds a {@link CloneSnapshotResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CloneSnapshotResponse build() { _checkSingleUse(); @@ -92,7 +96,5 @@ public CloneSnapshotResponse build() { protected static void setupCloneSnapshotResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java new file mode 100644 index 0000000000..5ee841e825 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClientBase.java @@ -0,0 +1,122 @@ +/* + * 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 java.io.IOException; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the snapshot namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class OpenSearchSnapshotAsyncClientBase> extends ApiClient< + OpenSearchTransport, + Self> { + public OpenSearchSnapshotAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + // ----- Endpoint: snapshot.cleanup_repository + + /** + * Removes stale data from repository. + */ + public CompletableFuture cleanupRepository(CleanupRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, CleanupRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Removes stale data from repository. + * + * @param fn a function that initializes a builder to create the {@link CleanupRepositoryRequest} + */ + public final CompletableFuture cleanupRepository( + Function> fn + ) throws IOException, OpenSearchException { + return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.clone + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + */ + public CompletableFuture clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, CloneSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + * + * @param fn a function that initializes a builder to create the {@link CloneSnapshotRequest} + */ + public final CompletableFuture clone( + Function> fn + ) throws IOException, OpenSearchException { + return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.verify_repository + + /** + * Verifies a repository. + */ + public CompletableFuture verifyRepository(VerifyRepositoryRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, VerifyRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Verifies a repository. + * + * @param fn a function that initializes a builder to create the {@link VerifyRepositoryRequest} + */ + public final CompletableFuture verifyRepository( + Function> fn + ) throws IOException, OpenSearchException { + return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java new file mode 100644 index 0000000000..27a5c47915 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClientBase.java @@ -0,0 +1,118 @@ +/* + * 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 java.io.IOException; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nullable; +import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.transport.OpenSearchTransport; +import org.opensearch.client.transport.TransportOptions; +import org.opensearch.client.util.ObjectBuilder; + +/** + * Client for the snapshot namespace. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public abstract class OpenSearchSnapshotClientBase> extends ApiClient< + OpenSearchTransport, + Self> { + public OpenSearchSnapshotClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + // ----- Endpoint: snapshot.cleanup_repository + + /** + * Removes stale data from repository. + */ + public CleanupRepositoryResponse cleanupRepository(CleanupRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CleanupRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Removes stale data from repository. + * + * @param fn a function that initializes a builder to create the {@link CleanupRepositoryRequest} + */ + public final CleanupRepositoryResponse cleanupRepository( + Function> fn + ) throws IOException, OpenSearchException { + return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.clone + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + */ + public CloneSnapshotResponse clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, CloneSnapshotRequest._ENDPOINT, this.transportOptions); + } + + /** + * Clones indices from one snapshot into another snapshot in the same repository. + * + * @param fn a function that initializes a builder to create the {@link CloneSnapshotRequest} + */ + public final CloneSnapshotResponse clone(Function> fn) + throws IOException, OpenSearchException { + return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); + } + + // ----- Endpoint: snapshot.verify_repository + + /** + * Verifies a repository. + */ + public VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, VerifyRepositoryRequest._ENDPOINT, this.transportOptions); + } + + /** + * Verifies a repository. + * + * @param fn a function that initializes a builder to create the {@link VerifyRepositoryRequest} + */ + public final VerifyRepositoryResponse verifyRepository( + Function> fn + ) throws IOException, OpenSearchException { + return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java similarity index 80% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java index 5df9766364..6d7efc4332 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryRequest.java @@ -30,11 +30,16 @@ * 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.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -50,16 +55,17 @@ /** * Verifies a repository. */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class VerifyRepositoryRequest extends RequestBase { - @Deprecated - @Nullable - private final Time masterTimeout; @Nullable private final Time clusterManagerTimeout; - private final String name; + @Deprecated + @Nullable + private final Time masterTimeout; + + private final String repository; @Nullable private final Time timeout; @@ -67,52 +73,54 @@ public class VerifyRepositoryRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private VerifyRepositoryRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.masterTimeout = builder.masterTimeout; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); this.timeout = builder.timeout; - } - public static VerifyRepositoryRequest of(Function> fn) { + public static VerifyRepositoryRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to cluster-manager node + * Explicit operation timeout for connection to master 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} + *

*/ - public final String name() { - return this.name; + public final String repository() { + return this.repository; } /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -124,67 +132,67 @@ public final Time timeout() { /** * Builder for {@link VerifyRepositoryRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - @Nullable private Time clusterManagerTimeout; - - private String name; - + @Nullable + private Time masterTimeout; + private String repository; @Nullable private Time timeout; /** - * 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; + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to cluster-manager node + * Explicit operation timeout for connection to master 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 + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - A repository name *

* API name: {@code repository} + *

*/ - public final Builder name(String value) { - this.name = value; + public final Builder repository(String value) { + this.repository = value; return this; } @@ -192,6 +200,7 @@ public final Builder name(String value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -202,16 +211,16 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link VerifyRepositoryRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public VerifyRepositoryRequest build() { _checkSingleUse(); @@ -226,47 +235,29 @@ public VerifyRepositoryRequest build() { * Endpoint "{@code snapshot.verify_repository}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_snapshot"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - buf.append("/_verify"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_snapshot/"); + SimpleEndpoint.pathEncode(request.repository, buf); + buf.append("/_verify"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java similarity index 82% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java index 4efe8e604e..5a40b49c69 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/VerifyRepositoryResponse.java @@ -30,11 +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.Map; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -49,18 +54,18 @@ // typedef: snapshot.verify_repository.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class VerifyRepositoryResponse implements PlainJsonSerializable { + private final Map nodes; // --------------------------------------------------------------------------------------------- private VerifyRepositoryResponse(Builder builder) { - this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); - } - public static VerifyRepositoryResponse of(Function> fn) { + public static VerifyRepositoryResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -74,6 +79,7 @@ public final Map nodes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,19 +87,13 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.nodes)) { - generator.writeKey("nodes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.nodes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- @@ -101,14 +101,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link VerifyRepositoryResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Map nodes; /** * Required - API name: {@code nodes} + * *

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

*/ public final Builder nodes(Map map) { this.nodes = _mapPutAll(this.nodes, map); @@ -117,8 +118,10 @@ public final Builder nodes(Map map) { /** * Required - API name: {@code nodes} + * *

* Adds an entry to nodes. + *

*/ public final Builder nodes(String key, CompactNodeInfo value) { this.nodes = _mapPut(this.nodes, key, value); @@ -127,8 +130,10 @@ public final Builder nodes(String key, CompactNodeInfo value) { /** * Required - API name: {@code nodes} + * *

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

*/ public final Builder nodes(String key, Function> fn) { return nodes(key, fn.apply(new CompactNodeInfo.Builder()).build()); @@ -137,8 +142,7 @@ public final Builder nodes(String key, Function op) { - op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(CompactNodeInfo._DESERIALIZER), "nodes"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java similarity index 81% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java index 8b674ec955..4fb8fb8b92 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/cleanup_repository/CleanupRepositoryResults.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot.cleanup_repository; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,7 +52,9 @@ // typedef: snapshot.cleanup_repository.CleanupRepositoryResults @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CleanupRepositoryResults implements PlainJsonSerializable { + private final long deletedBlobs; private final long deletedBytes; @@ -55,25 +62,29 @@ public class CleanupRepositoryResults implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private CleanupRepositoryResults(Builder builder) { - this.deletedBlobs = ApiTypeHelper.requireNonNull(builder.deletedBlobs, this, "deletedBlobs"); this.deletedBytes = ApiTypeHelper.requireNonNull(builder.deletedBytes, this, "deletedBytes"); - } - public static CleanupRepositoryResults of(Function> fn) { + public static CleanupRepositoryResults of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code deleted_blobs} + * Required - Number of binary large objects (blobs) removed during cleanup. + *

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

*/ public final long deletedBlobs() { return this.deletedBlobs; } /** - * Required - API name: {@code deleted_bytes} + * Required - Number of bytes freed by cleanup operations. + *

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

*/ public final long deletedBytes() { return this.deletedBytes; @@ -82,6 +93,7 @@ public final long deletedBytes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,13 +101,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("deleted_blobs"); generator.write(this.deletedBlobs); generator.writeKey("deleted_bytes"); generator.write(this.deletedBytes); - } // --------------------------------------------------------------------------------------------- @@ -103,14 +113,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CleanupRepositoryResults}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Long deletedBlobs; - private Long deletedBytes; /** - * Required - API name: {@code deleted_blobs} + * Required - Number of binary large objects (blobs) removed during cleanup. + *

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

*/ public final Builder deletedBlobs(long value) { this.deletedBlobs = value; @@ -118,7 +129,10 @@ public final Builder deletedBlobs(long value) { } /** - * Required - API name: {@code deleted_bytes} + * Required - Number of bytes freed by cleanup operations. + *

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

*/ public final Builder deletedBytes(long value) { this.deletedBytes = value; @@ -128,8 +142,7 @@ public final Builder deletedBytes(long value) { /** * Builds a {@link CleanupRepositoryResults}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CleanupRepositoryResults build() { _checkSingleUse(); @@ -149,10 +162,7 @@ public CleanupRepositoryResults build() { ); protected static void setupCleanupRepositoryResultsDeserializer(ObjectDeserializer op) { - op.add(Builder::deletedBlobs, JsonpDeserializer.longDeserializer(), "deleted_blobs"); op.add(Builder::deletedBytes, JsonpDeserializer.longDeserializer(), "deleted_bytes"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java similarity index 89% rename from java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java index 1ee49f758e..8d9bad177a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/verify_repository/CompactNodeInfo.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.snapshot.verify_repository; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -47,18 +52,18 @@ // typedef: snapshot.verify_repository.CompactNodeInfo @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class CompactNodeInfo implements PlainJsonSerializable { + private final String name; // --------------------------------------------------------------------------------------------- private CompactNodeInfo(Builder builder) { - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - } - public static CompactNodeInfo of(Function> fn) { + public static CompactNodeInfo of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -72,6 +77,7 @@ public final String name() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,10 +85,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("name"); generator.write(this.name); - } // --------------------------------------------------------------------------------------------- @@ -90,7 +94,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link CompactNodeInfo}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private String name; @@ -105,8 +108,7 @@ public final Builder name(String value) { /** * Builds a {@link CompactNodeInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public CompactNodeInfo build() { _checkSingleUse(); @@ -126,9 +128,6 @@ public CompactNodeInfo build() { ); protected static void setupCompactNodeInfoDeserializer(ObjectDeserializer op) { - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java index 002845d767..6e7e3997c9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotAsyncClient.java @@ -36,7 +36,6 @@ import java.util.concurrent.CompletableFuture; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.transport.JsonEndpoint; @@ -47,7 +46,7 @@ /** * Client for the snapshot namespace. */ -public class OpenSearchSnapshotAsyncClient extends ApiClient { +public class OpenSearchSnapshotAsyncClient extends OpenSearchSnapshotAsyncClientBase { public OpenSearchSnapshotAsyncClient(OpenSearchTransport transport) { super(transport, null); @@ -62,75 +61,6 @@ public OpenSearchSnapshotAsyncClient withTransportOptions(@Nullable TransportOpt return new OpenSearchSnapshotAsyncClient(this.transport, transportOptions); } - // ----- Endpoint: snapshot.cleanup_repository - - /** - * Removes stale data from repository. - * - * - */ - - public CompletableFuture cleanupRepository(CleanupRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CleanupRepositoryRequest, - CleanupRepositoryResponse, - ErrorResponse>) CleanupRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Removes stale data from repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CleanupRepositoryRequest} - * - */ - - public final CompletableFuture cleanupRepository( - Function> fn - ) throws IOException, OpenSearchException { - return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.clone - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * - */ - - public CompletableFuture clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneSnapshotRequest, - CloneSnapshotResponse, - ErrorResponse>) CloneSnapshotRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneSnapshotRequest} - * - */ - - public final CompletableFuture clone( - Function> fn - ) throws IOException, OpenSearchException { - return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.create /** @@ -422,39 +352,4 @@ public CompletableFuture status() throws IOException, Op this.transportOptions ); } - - // ----- Endpoint: snapshot.verify_repository - - /** - * Verifies a repository. - * - * - */ - - public CompletableFuture verifyRepository(VerifyRepositoryRequest request) throws IOException, - OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - VerifyRepositoryRequest, - VerifyRepositoryResponse, - ErrorResponse>) VerifyRepositoryRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Verifies a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link VerifyRepositoryRequest} - * - */ - - public final CompletableFuture verifyRepository( - Function> fn - ) throws IOException, OpenSearchException { - return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java index be2081adeb..29103dd89f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/OpenSearchSnapshotClient.java @@ -35,7 +35,6 @@ import java.io.IOException; import java.util.function.Function; import javax.annotation.Nullable; -import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.transport.JsonEndpoint; @@ -46,7 +45,7 @@ /** * Client for the snapshot namespace. */ -public class OpenSearchSnapshotClient extends ApiClient { +public class OpenSearchSnapshotClient extends OpenSearchSnapshotClientBase { public OpenSearchSnapshotClient(OpenSearchTransport transport) { super(transport, null); @@ -61,73 +60,6 @@ public OpenSearchSnapshotClient withTransportOptions(@Nullable TransportOptions return new OpenSearchSnapshotClient(this.transport, transportOptions); } - // ----- Endpoint: snapshot.cleanup_repository - - /** - * Removes stale data from repository. - * - * - */ - - public CleanupRepositoryResponse cleanupRepository(CleanupRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CleanupRepositoryRequest, - CleanupRepositoryResponse, - ErrorResponse>) CleanupRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Removes stale data from repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CleanupRepositoryRequest} - * - */ - - public final CleanupRepositoryResponse cleanupRepository( - Function> fn - ) throws IOException, OpenSearchException { - return cleanupRepository(fn.apply(new CleanupRepositoryRequest.Builder()).build()); - } - - // ----- Endpoint: snapshot.clone - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * - */ - - public CloneSnapshotResponse clone(CloneSnapshotRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - CloneSnapshotRequest, - CloneSnapshotResponse, - ErrorResponse>) CloneSnapshotRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Clones indices from one snapshot into another snapshot in the same - * repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link CloneSnapshotRequest} - * - */ - - public final CloneSnapshotResponse clone(Function> fn) - throws IOException, OpenSearchException { - return clone(fn.apply(new CloneSnapshotRequest.Builder()).build()); - } - // ----- Endpoint: snapshot.create /** @@ -413,38 +345,4 @@ public SnapshotStatusResponse status() throws IOException, OpenSearchException { this.transportOptions ); } - - // ----- Endpoint: snapshot.verify_repository - - /** - * Verifies a repository. - * - * - */ - - public VerifyRepositoryResponse verifyRepository(VerifyRepositoryRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - VerifyRepositoryRequest, - VerifyRepositoryResponse, - ErrorResponse>) VerifyRepositoryRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Verifies a repository. - * - * @param fn - * a function that initializes a builder to create the - * {@link VerifyRepositoryRequest} - * - */ - - public final VerifyRepositoryResponse verifyRepository( - Function> fn - ) throws IOException, OpenSearchException { - return verifyRepository(fn.apply(new VerifyRepositoryRequest.Builder()).build()); - } - } diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index e9e4e42740..d0a8b5d22a 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -54849,10 +54849,12 @@ components: properties: deleted_blobs: description: Number of binary large objects (blobs) removed during cleanup. - type: number + type: integer + format: int64 deleted_bytes: description: Number of bytes freed by cleanup operations. - type: number + type: integer + format: int64 required: - deleted_blobs - deleted_bytes 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 b1eaa8d06b..70d12db927 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 @@ -44,6 +44,7 @@ public class CodeGenerator { and(namespace(""), named("info")), namespace("dangling_indices"), and(namespace("ml"), not(named("search_models"))), // TODO: search_models is complex and ideally should re-use the search structures + and(namespace("snapshot"), named("cleanup_repository", "clone", "verify_repository")), and(namespace("tasks")) ); 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 e0e3861bcc..7c2f4ebd88 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 @@ -23,7 +23,7 @@ import org.opensearch.client.codegen.utils.Strings; public class Namespace { - private static final Set PARTIAL_NAMESPACES = Set.of(""); + private static final Set PARTIAL_NAMESPACES = Set.of("", "snapshot"); 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 18facfd53e..b0d93dcea8 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 @@ -169,6 +169,8 @@ private static String responseClassName(@Nonnull OperationGroup operationGroup) private static String classBaseName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); switch (operationGroup.toString()) { + case "snapshot.clone": + return "CloneSnapshot"; case "tasks.get": return "GetTasks"; default: