Skip to content

Commit

Permalink
Update codegen
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia committed Nov 26, 2024
1 parent d6604c6 commit b567fd2
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@
import org.opensearch.client.transport.Endpoint;
import org.opensearch.client.transport.endpoints.SimpleEndpoint;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: snapshot.get.Request

/**
* Returns information about a snapshot.
*/
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class GetSnapshotRequest extends RequestBase {
public class GetSnapshotRequest extends RequestBase implements ToCopyableBuilder<GetSnapshotRequest.Builder, GetSnapshotRequest> {

@Nullable
private final Time clusterManagerTimeout;
Expand Down Expand Up @@ -107,7 +109,7 @@ public final Time clusterManagerTimeout() {
}

/**
* If false, the request returns an error for any snapshots that are unavailable.
* If <code>false</code>, the request returns an error for any snapshots that are unavailable.
* <p>
* API name: {@code ignore_unavailable}
* </p>
Expand All @@ -118,8 +120,8 @@ public final Boolean ignoreUnavailable() {
}

/**
* Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and
* returns an error.
* Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails
* and returns an error.
* <p>
* API name: {@code master_timeout}
* </p>
Expand All @@ -144,11 +146,11 @@ public final String repository() {
/**
* Required -
* <p>
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*).
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (<code>*</code>).
* </p>
* <ul>
* <li>To get information about all snapshots in a registered repository, use a wildcard (*) or _all.</li>
* <li>To get information about any snapshots that are currently running, use _current.</li>
* <li>To get information about all snapshots in a registered repository, use a wildcard (<code>*</code>) or <code>_all</code>.</li>
* <li>To get information about any snapshots that are currently running, use <code>_current</code>.</li>
* </ul>
* <p>
* API name: {@code snapshot}
Expand All @@ -160,8 +162,8 @@ public final List<String> snapshot() {
}

/**
* If true, returns additional information about each snapshot such as the version of OpenSearch which took the snapshot, the start and
* end times of the snapshot, and the number of shards snapshotted.
* If <code>true</code>, returns additional information about each snapshot such as the version of OpenSearch which took the snapshot,
* the start and end times of the snapshot, and the number of shards snapshotted.
* <p>
* API name: {@code verbose}
* </p>
Expand All @@ -173,10 +175,21 @@ public final Boolean verbose() {

// ---------------------------------------------------------------------------------------------

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link GetSnapshotRequest}.
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<GetSnapshotRequest> {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, GetSnapshotRequest> {
@Nullable
private Time clusterManagerTimeout;
@Nullable
Expand All @@ -188,12 +201,39 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<G
@Nullable
private Boolean verbose;

public Builder() {}

private Builder(GetSnapshotRequest o) {
this.clusterManagerTimeout = o.clusterManagerTimeout;
this.ignoreUnavailable = o.ignoreUnavailable;
this.masterTimeout = o.masterTimeout;
this.repository = o.repository;
this.snapshot = _listCopy(o.snapshot);
this.verbose = o.verbose;
}

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);
this.verbose = o.verbose;
}

@Override
@Nonnull
public Builder copy() {
return new Builder(this);
}

/**
* Operation timeout for connection to cluster-manager node.
* <p>
* API name: {@code cluster_manager_timeout}
* </p>
*/
@Nonnull
public final Builder clusterManagerTimeout(@Nullable Time value) {
this.clusterManagerTimeout = value;
return this;
Expand All @@ -205,42 +245,46 @@ public final Builder clusterManagerTimeout(@Nullable Time value) {
* API name: {@code cluster_manager_timeout}
* </p>
*/
@Nonnull
public final Builder clusterManagerTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return clusterManagerTimeout(fn.apply(new Time.Builder()).build());
}

/**
* If false, the request returns an error for any snapshots that are unavailable.
* If <code>false</code>, the request returns an error for any snapshots that are unavailable.
* <p>
* API name: {@code ignore_unavailable}
* </p>
*/
@Nonnull
public final Builder ignoreUnavailable(@Nullable Boolean value) {
this.ignoreUnavailable = value;
return this;
}

/**
* Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and
* returns an error.
* Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request
* fails and returns an error.
* <p>
* API name: {@code master_timeout}
* </p>
*/
@Deprecated
@Nonnull
public final Builder masterTimeout(@Nullable Time value) {
this.masterTimeout = value;
return this;
}

/**
* Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and
* returns an error.
* Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request
* fails and returns an error.
* <p>
* API name: {@code master_timeout}
* </p>
*/
@Deprecated
@Nonnull
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return masterTimeout(fn.apply(new Time.Builder()).build());
}
Expand All @@ -251,6 +295,7 @@ public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> f
* API name: {@code repository}
* </p>
*/
@Nonnull
public final Builder repository(String value) {
this.repository = value;
return this;
Expand All @@ -259,11 +304,11 @@ public final Builder repository(String value) {
/**
* Required -
* <p>
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*).
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (<code>*</code>).
* </p>
* <ul>
* <li>To get information about all snapshots in a registered repository, use a wildcard (*) or _all.</li>
* <li>To get information about any snapshots that are currently running, use _current.</li>
* <li>To get information about all snapshots in a registered repository, use a wildcard (<code>*</code>) or <code>_all</code>.</li>
* <li>To get information about any snapshots that are currently running, use <code>_current</code>.</li>
* </ul>
* <p>
* API name: {@code snapshot}
Expand All @@ -273,6 +318,7 @@ public final Builder repository(String value) {
* Adds all elements of <code>list</code> to <code>snapshot</code>.
* </p>
*/
@Nonnull
public final Builder snapshot(List<String> list) {
this.snapshot = _listAddAll(this.snapshot, list);
return this;
Expand All @@ -281,11 +327,11 @@ public final Builder snapshot(List<String> list) {
/**
* Required -
* <p>
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*).
* Comma-separated list of snapshot names to retrieve. Also accepts wildcards (<code>*</code>).
* </p>
* <ul>
* <li>To get information about all snapshots in a registered repository, use a wildcard (*) or _all.</li>
* <li>To get information about any snapshots that are currently running, use _current.</li>
* <li>To get information about all snapshots in a registered repository, use a wildcard (<code>*</code>) or <code>_all</code>.</li>
* <li>To get information about any snapshots that are currently running, use <code>_current</code>.</li>
* </ul>
* <p>
* API name: {@code snapshot}
Expand All @@ -295,18 +341,20 @@ public final Builder snapshot(List<String> list) {
* Adds one or more values to <code>snapshot</code>.
* </p>
*/
@Nonnull
public final Builder snapshot(String value, String... values) {
this.snapshot = _listAdd(this.snapshot, value, values);
return this;
}

/**
* If true, returns additional information about each snapshot such as the version of OpenSearch which took the snapshot, the start
* and end times of the snapshot, and the number of shards snapshotted.
* If <code>true</code>, returns additional information about each snapshot such as the version of OpenSearch which took the
* snapshot, the start and end times of the snapshot, and the number of shards snapshotted.
* <p>
* API name: {@code verbose}
* </p>
*/
@Nonnull
public final Builder verbose(@Nullable Boolean value) {
this.verbose = value;
return this;
Expand All @@ -317,6 +365,8 @@ public final Builder verbose(@Nullable Boolean value) {
*
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public GetSnapshotRequest build() {
_checkSingleUse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,16 @@
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.get.Response

@JsonpDeserializable
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class GetSnapshotResponse implements PlainJsonSerializable {
public class GetSnapshotResponse implements PlainJsonSerializable, ToCopyableBuilder<GetSnapshotResponse.Builder, GetSnapshotResponse> {

@Nonnull
private final List<SnapshotInfo> snapshots;
Expand Down Expand Up @@ -99,19 +101,47 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

// ---------------------------------------------------------------------------------------------

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link GetSnapshotResponse}.
*/
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<GetSnapshotResponse> {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, GetSnapshotResponse> {
private List<SnapshotInfo> snapshots;

public Builder() {}

private Builder(GetSnapshotResponse 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}
*
* <p>
* Adds all elements of <code>list</code> to <code>snapshots</code>.
* </p>
*/
@Nonnull
public final Builder snapshots(List<SnapshotInfo> list) {
this.snapshots = _listAddAll(this.snapshots, list);
return this;
Expand All @@ -124,6 +154,7 @@ public final Builder snapshots(List<SnapshotInfo> list) {
* Adds one or more values to <code>snapshots</code>.
* </p>
*/
@Nonnull
public final Builder snapshots(SnapshotInfo value, SnapshotInfo... values) {
this.snapshots = _listAdd(this.snapshots, value, values);
return this;
Expand All @@ -136,6 +167,7 @@ public final Builder snapshots(SnapshotInfo value, SnapshotInfo... values) {
* Adds a value to <code>snapshots</code> using a builder lambda.
* </p>
*/
@Nonnull
public final Builder snapshots(Function<SnapshotInfo.Builder, ObjectBuilder<SnapshotInfo>> fn) {
return snapshots(fn.apply(new SnapshotInfo.Builder()).build());
}
Expand All @@ -145,6 +177,8 @@ public final Builder snapshots(Function<SnapshotInfo.Builder, ObjectBuilder<Snap
*
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public GetSnapshotResponse build() {
_checkSingleUse();

Expand Down
Loading

0 comments on commit b567fd2

Please sign in to comment.