Skip to content

Commit 851ab58

Browse files
authored
Begin generating snapshot namespace (#1207)
* Generate snapshot.verify_snapshot Signed-off-by: Thomas Farr <[email protected]> * Generate snapshot.cleanup_snapshot Signed-off-by: Thomas Farr <[email protected]> * Generate snapshot.clone Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]>
1 parent 6a5a8cc commit 851ab58

19 files changed

+565
-567
lines changed

UPGRADING.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,13 @@ After:
4242
- The `tasks` field is now a `TaskInfos` union type instead of a `Map<String, Info>` to correctly handle `groupBy` parents or none.
4343

4444
### GetTasksResponse response type
45-
- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`.
45+
- The type of `GetTasksResponse`'s `response` field has been changed from `tasks.Status` to `tasks.TaskResponse`.
46+
47+
### VerifyRepositoryRequest property naming
48+
- The `name` field, getter and builder method have been renamed to `repository`.
49+
50+
### CleanupRepositoryRequest property naming
51+
- The `name` field, getter and builder method have been renamed to `repository`.
52+
53+
### CloneSnapshotRequest timeout removal
54+
- The `timeout` field, getter and builder method have been removed from `CloneSnapshotRequest` as it is not supported by OpenSearch.

java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java

+5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.opensearch.client.opensearch.core.InfoResponse;
4747
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient;
4848
import org.opensearch.client.opensearch.ml.OpenSearchMlAsyncClient;
49+
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotAsyncClient;
4950
import org.opensearch.client.opensearch.tasks.OpenSearchTasksAsyncClient;
5051
import org.opensearch.client.transport.OpenSearchTransport;
5152
import org.opensearch.client.transport.TransportOptions;
@@ -69,6 +70,10 @@ public OpenSearchMlAsyncClient ml() {
6970
return new OpenSearchMlAsyncClient(this.transport, this.transportOptions);
7071
}
7172

73+
public OpenSearchSnapshotAsyncClient snapshot() {
74+
return new OpenSearchSnapshotAsyncClient(this.transport, this.transportOptions);
75+
}
76+
7277
public OpenSearchTasksAsyncClient tasks() {
7378
return new OpenSearchTasksAsyncClient(this.transport, this.transportOptions);
7479
}

java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java

+5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.opensearch.client.opensearch.core.InfoResponse;
4646
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient;
4747
import org.opensearch.client.opensearch.ml.OpenSearchMlClient;
48+
import org.opensearch.client.opensearch.snapshot.OpenSearchSnapshotClient;
4849
import org.opensearch.client.opensearch.tasks.OpenSearchTasksClient;
4950
import org.opensearch.client.transport.OpenSearchTransport;
5051
import org.opensearch.client.transport.TransportOptions;
@@ -68,6 +69,10 @@ public OpenSearchMlClient ml() {
6869
return new OpenSearchMlClient(this.transport, this.transportOptions);
6970
}
7071

72+
public OpenSearchSnapshotClient snapshot() {
73+
return new OpenSearchSnapshotClient(this.transport, this.transportOptions);
74+
}
75+
7176
public OpenSearchTasksClient tasks() {
7277
return new OpenSearchTasksClient(this.transport, this.transportOptions);
7378
}

java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java java-client/src/generated/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java

+75-85
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@
3030
* GitHub history for details.
3131
*/
3232

33+
//----------------------------------------------------
34+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
35+
//----------------------------------------------------
36+
3337
package org.opensearch.client.opensearch.snapshot;
3438

3539
import java.util.HashMap;
3640
import java.util.Map;
3741
import java.util.function.Function;
42+
import javax.annotation.Generated;
3843
import javax.annotation.Nullable;
3944
import org.opensearch.client.opensearch._types.ErrorResponse;
4045
import org.opensearch.client.opensearch._types.RequestBase;
@@ -49,71 +54,73 @@
4954

5055
/**
5156
* Removes stale data from repository.
52-
*
5357
*/
54-
58+
@Generated("org.opensearch.client.codegen.CodeGenerator")
5559
public class CleanupRepositoryRequest extends RequestBase {
56-
@Deprecated
57-
@Nullable
58-
private final Time masterTimeout;
5960

6061
@Nullable
6162
private final Time clusterManagerTimeout;
6263

63-
private final String name;
64+
@Deprecated
65+
@Nullable
66+
private final Time masterTimeout;
67+
68+
private final String repository;
6469

6570
@Nullable
6671
private final Time timeout;
6772

6873
// ---------------------------------------------------------------------------------------------
6974

7075
private CleanupRepositoryRequest(Builder builder) {
71-
72-
this.masterTimeout = builder.masterTimeout;
7376
this.clusterManagerTimeout = builder.clusterManagerTimeout;
74-
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
77+
this.masterTimeout = builder.masterTimeout;
78+
this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository");
7579
this.timeout = builder.timeout;
76-
7780
}
7881

79-
public static CleanupRepositoryRequest of(Function<Builder, ObjectBuilder<CleanupRepositoryRequest>> fn) {
82+
public static CleanupRepositoryRequest of(Function<CleanupRepositoryRequest.Builder, ObjectBuilder<CleanupRepositoryRequest>> fn) {
8083
return fn.apply(new Builder()).build();
8184
}
8285

8386
/**
84-
* Explicit operation timeout for connection to master node
87+
* Operation timeout for connection to cluster-manager node.
8588
* <p>
86-
* API name: {@code master_timeout}
89+
* API name: {@code cluster_manager_timeout}
90+
* </p>
8791
*/
88-
@Deprecated
8992
@Nullable
90-
public final Time masterTimeout() {
91-
return this.masterTimeout;
93+
public final Time clusterManagerTimeout() {
94+
return this.clusterManagerTimeout;
9295
}
9396

9497
/**
95-
* Explicit operation timeout for connection to cluster-manager node
98+
* Period to wait for a connection to the master node.
9699
* <p>
97-
* API name: {@code cluster_manager_timeout}
100+
* API name: {@code master_timeout}
101+
* </p>
98102
*/
103+
@Deprecated
99104
@Nullable
100-
public final Time clusterManagerTimeout() {
101-
return this.clusterManagerTimeout;
105+
public final Time masterTimeout() {
106+
return this.masterTimeout;
102107
}
103108

104109
/**
105-
* Required - A repository name
110+
* Required - Snapshot repository to clean up.
106111
* <p>
107112
* API name: {@code repository}
113+
* </p>
108114
*/
109-
public final String name() {
110-
return this.name;
115+
public final String repository() {
116+
return this.repository;
111117
}
112118

113119
/**
114-
* Explicit operation timeout
120+
* Period to wait for a response.
115121
* <p>
116122
* API name: {@code timeout}
123+
* </p>
117124
*/
118125
@Nullable
119126
public final Time timeout() {
@@ -125,94 +132,95 @@ public final Time timeout() {
125132
/**
126133
* Builder for {@link CleanupRepositoryRequest}.
127134
*/
128-
129135
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<CleanupRepositoryRequest> {
130-
@Deprecated
131-
@Nullable
132-
private Time masterTimeout;
133-
134136
@Nullable
135137
private Time clusterManagerTimeout;
136-
137-
private String name;
138-
138+
@Nullable
139+
private Time masterTimeout;
140+
private String repository;
139141
@Nullable
140142
private Time timeout;
141143

142144
/**
143-
* Explicit operation timeout for connection to master node
145+
* Operation timeout for connection to cluster-manager node.
144146
* <p>
145-
* API name: {@code master_timeout}
147+
* API name: {@code cluster_manager_timeout}
148+
* </p>
146149
*/
147-
@Deprecated
148-
public final Builder masterTimeout(@Nullable Time value) {
149-
this.masterTimeout = value;
150+
public final Builder clusterManagerTimeout(@Nullable Time value) {
151+
this.clusterManagerTimeout = value;
150152
return this;
151153
}
152154

153155
/**
154-
* Explicit operation timeout for connection to master node
156+
* Operation timeout for connection to cluster-manager node.
155157
* <p>
156-
* API name: {@code master_timeout}
158+
* API name: {@code cluster_manager_timeout}
159+
* </p>
157160
*/
158-
@Deprecated
159-
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
160-
return this.masterTimeout(fn.apply(new Time.Builder()).build());
161+
public final Builder clusterManagerTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
162+
return clusterManagerTimeout(fn.apply(new Time.Builder()).build());
161163
}
162164

163165
/**
164-
* Explicit operation timeout for connection to cluster-manager node
166+
* Period to wait for a connection to the master node.
165167
* <p>
166-
* API name: {@code cluster_manager_timeout}
168+
* API name: {@code master_timeout}
169+
* </p>
167170
*/
168-
public final Builder clusterManagerTimeout(@Nullable Time value) {
169-
this.clusterManagerTimeout = value;
171+
@Deprecated
172+
public final Builder masterTimeout(@Nullable Time value) {
173+
this.masterTimeout = value;
170174
return this;
171175
}
172176

173177
/**
174-
* Explicit operation timeout for connection to cluster-manager node
178+
* Period to wait for a connection to the master node.
175179
* <p>
176-
* API name: {@code cluster_manager_timeout}
180+
* API name: {@code master_timeout}
181+
* </p>
177182
*/
178-
public final Builder clusterManagerTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
179-
return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build());
183+
@Deprecated
184+
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
185+
return masterTimeout(fn.apply(new Time.Builder()).build());
180186
}
181187

182188
/**
183-
* Required - A repository name
189+
* Required - Snapshot repository to clean up.
184190
* <p>
185191
* API name: {@code repository}
192+
* </p>
186193
*/
187-
public final Builder name(String value) {
188-
this.name = value;
194+
public final Builder repository(String value) {
195+
this.repository = value;
189196
return this;
190197
}
191198

192199
/**
193-
* Explicit operation timeout
200+
* Period to wait for a response.
194201
* <p>
195202
* API name: {@code timeout}
203+
* </p>
196204
*/
197205
public final Builder timeout(@Nullable Time value) {
198206
this.timeout = value;
199207
return this;
200208
}
201209

202210
/**
203-
* Explicit operation timeout
211+
* Period to wait for a response.
204212
* <p>
205213
* API name: {@code timeout}
214+
* </p>
206215
*/
207216
public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
208-
return this.timeout(fn.apply(new Time.Builder()).build());
217+
return timeout(fn.apply(new Time.Builder()).build());
209218
}
210219

211220
/**
212221
* Builds a {@link CleanupRepositoryRequest}.
213222
*
214-
* @throws NullPointerException
215-
* if some of the required fields are null.
223+
* @throws NullPointerException if some of the required fields are null.
216224
*/
217225
public CleanupRepositoryRequest build() {
218226
_checkSingleUse();
@@ -227,47 +235,29 @@ public CleanupRepositoryRequest build() {
227235
* Endpoint "{@code snapshot.cleanup_repository}".
228236
*/
229237
public static final Endpoint<CleanupRepositoryRequest, CleanupRepositoryResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
230-
231238
// Request method
232-
request -> {
233-
return "POST";
234-
235-
},
236-
239+
request -> "POST",
237240
// Request path
238241
request -> {
239-
final int _name = 1 << 0;
240-
241-
int propsSet = 0;
242-
243-
propsSet |= _name;
244-
245-
if (propsSet == (_name)) {
246-
StringBuilder buf = new StringBuilder();
247-
buf.append("/_snapshot");
248-
buf.append("/");
249-
SimpleEndpoint.pathEncode(request.name, buf);
250-
buf.append("/_cleanup");
251-
return buf.toString();
252-
}
253-
throw SimpleEndpoint.noPathTemplateFound("path");
254-
242+
StringBuilder buf = new StringBuilder();
243+
buf.append("/_snapshot/");
244+
SimpleEndpoint.pathEncode(request.repository, buf);
245+
buf.append("/_cleanup");
246+
return buf.toString();
255247
},
256-
257248
// Request parameters
258249
request -> {
259250
Map<String, String> params = new HashMap<>();
260-
if (request.masterTimeout != null) {
261-
params.put("master_timeout", request.masterTimeout._toJsonString());
262-
}
263251
if (request.clusterManagerTimeout != null) {
264252
params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString());
265253
}
254+
if (request.masterTimeout != null) {
255+
params.put("master_timeout", request.masterTimeout._toJsonString());
256+
}
266257
if (request.timeout != null) {
267258
params.put("timeout", request.timeout._toJsonString());
268259
}
269260
return params;
270-
271261
},
272262
SimpleEndpoint.emptyMap(),
273263
false,

0 commit comments

Comments
 (0)