46
46
* <p>This class provides the ability to make remote calls to the backing service through method
47
47
* calls that map to API methods. Sample code to get started:
48
48
*
49
+ * <pre>{@code
50
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
51
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
52
+ * for (MigratableResource element :
53
+ * migrationServiceClient.searchMigratableResources(parent).iterateAll()) {
54
+ * // doThingsWith(element);
55
+ * }
56
+ * }
57
+ * }</pre>
58
+ *
49
59
* <p>Note: close() needs to be called on the MigrationServiceClient object to clean up resources
50
60
* such as threads. In the example above, try-with-resources is used, which automatically calls
51
61
* close().
@@ -164,6 +174,18 @@ public final OperationsClient getOperationsClient() {
164
174
* Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and
165
175
* ml.googleapis.com that can be migrated to AI Platform's given location.
166
176
*
177
+ * <p>Sample code:
178
+ *
179
+ * <pre>{@code
180
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
181
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
182
+ * for (MigratableResource element :
183
+ * migrationServiceClient.searchMigratableResources(parent).iterateAll()) {
184
+ * // doThingsWith(element);
185
+ * }
186
+ * }
187
+ * }</pre>
188
+ *
167
189
* @param parent Required. The location that the migratable resources should be searched from.
168
190
* It's the AI Platform location that the resources can be migrated to, not the resources'
169
191
* original location. Format: `projects/{project}/locations/{location}`
@@ -183,6 +205,18 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
183
205
* Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and
184
206
* ml.googleapis.com that can be migrated to AI Platform's given location.
185
207
*
208
+ * <p>Sample code:
209
+ *
210
+ * <pre>{@code
211
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
212
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
213
+ * for (MigratableResource element :
214
+ * migrationServiceClient.searchMigratableResources(parent).iterateAll()) {
215
+ * // doThingsWith(element);
216
+ * }
217
+ * }
218
+ * }</pre>
219
+ *
186
220
* @param parent Required. The location that the migratable resources should be searched from.
187
221
* It's the AI Platform location that the resources can be migrated to, not the resources'
188
222
* original location. Format: `projects/{project}/locations/{location}`
@@ -199,6 +233,24 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(St
199
233
* Searches all of the resources in automl.googleapis.com, datalabeling.googleapis.com and
200
234
* ml.googleapis.com that can be migrated to AI Platform's given location.
201
235
*
236
+ * <p>Sample code:
237
+ *
238
+ * <pre>{@code
239
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
240
+ * SearchMigratableResourcesRequest request =
241
+ * SearchMigratableResourcesRequest.newBuilder()
242
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
243
+ * .setPageSize(883849137)
244
+ * .setPageToken("pageToken873572522")
245
+ * .setFilter("filter-1274492040")
246
+ * .build();
247
+ * for (MigratableResource element :
248
+ * migrationServiceClient.searchMigratableResources(request).iterateAll()) {
249
+ * // doThingsWith(element);
250
+ * }
251
+ * }
252
+ * }</pre>
253
+ *
202
254
* @param request The request object containing all of the parameters for the API call.
203
255
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
204
256
*/
@@ -213,6 +265,24 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
213
265
* ml.googleapis.com that can be migrated to AI Platform's given location.
214
266
*
215
267
* <p>Sample code:
268
+ *
269
+ * <pre>{@code
270
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
271
+ * SearchMigratableResourcesRequest request =
272
+ * SearchMigratableResourcesRequest.newBuilder()
273
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
274
+ * .setPageSize(883849137)
275
+ * .setPageToken("pageToken873572522")
276
+ * .setFilter("filter-1274492040")
277
+ * .build();
278
+ * ApiFuture<MigratableResource> future =
279
+ * migrationServiceClient.searchMigratableResourcesPagedCallable().futureCall(request);
280
+ * // Do something.
281
+ * for (MigratableResource element : future.get().iterateAll()) {
282
+ * // doThingsWith(element);
283
+ * }
284
+ * }
285
+ * }</pre>
216
286
*/
217
287
public final UnaryCallable <
218
288
SearchMigratableResourcesRequest , SearchMigratableResourcesPagedResponse >
@@ -226,6 +296,24 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
226
296
* ml.googleapis.com that can be migrated to AI Platform's given location.
227
297
*
228
298
* <p>Sample code:
299
+ *
300
+ * <pre>{@code
301
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
302
+ * while (true) {
303
+ * SearchMigratableResourcesResponse response =
304
+ * migrationServiceClient.searchMigratableResourcesCallable().call(request);
305
+ * for (MigratableResource element : response.getResponsesList()) {
306
+ * // doThingsWith(element);
307
+ * }
308
+ * String nextPageToken = response.getNextPageToken();
309
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
310
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
311
+ * } else {
312
+ * break;
313
+ * }
314
+ * }
315
+ * }
316
+ * }</pre>
229
317
*/
230
318
public final UnaryCallable <SearchMigratableResourcesRequest , SearchMigratableResourcesResponse >
231
319
searchMigratableResourcesCallable () {
@@ -237,6 +325,17 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
237
325
* Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and
238
326
* datalabeling.googleapis.com to AI Platform (Unified).
239
327
*
328
+ * <p>Sample code:
329
+ *
330
+ * <pre>{@code
331
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
332
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
333
+ * List<MigrateResourceRequest> migrateResourceRequests = new ArrayList<>();
334
+ * BatchMigrateResourcesResponse response =
335
+ * migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get();
336
+ * }
337
+ * }</pre>
338
+ *
240
339
* @param parent Required. The location of the migrated resource will live in. Format:
241
340
* `projects/{project}/locations/{location}`
242
341
* @param migrateResourceRequests Required. The request messages specifying the resources to
@@ -261,6 +360,17 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
261
360
* Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and
262
361
* datalabeling.googleapis.com to AI Platform (Unified).
263
362
*
363
+ * <p>Sample code:
364
+ *
365
+ * <pre>{@code
366
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
367
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
368
+ * List<MigrateResourceRequest> migrateResourceRequests = new ArrayList<>();
369
+ * BatchMigrateResourcesResponse response =
370
+ * migrationServiceClient.batchMigrateResourcesAsync(parent, migrateResourceRequests).get();
371
+ * }
372
+ * }</pre>
373
+ *
264
374
* @param parent Required. The location of the migrated resource will live in. Format:
265
375
* `projects/{project}/locations/{location}`
266
376
* @param migrateResourceRequests Required. The request messages specifying the resources to
@@ -285,6 +395,20 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
285
395
* Batch migrates resources from ml.googleapis.com, automl.googleapis.com, and
286
396
* datalabeling.googleapis.com to AI Platform (Unified).
287
397
*
398
+ * <p>Sample code:
399
+ *
400
+ * <pre>{@code
401
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
402
+ * BatchMigrateResourcesRequest request =
403
+ * BatchMigrateResourcesRequest.newBuilder()
404
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
405
+ * .addAllMigrateResourceRequests(new ArrayList<MigrateResourceRequest>())
406
+ * .build();
407
+ * BatchMigrateResourcesResponse response =
408
+ * migrationServiceClient.batchMigrateResourcesAsync(request).get();
409
+ * }
410
+ * }</pre>
411
+ *
288
412
* @param request The request object containing all of the parameters for the API call.
289
413
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
290
414
*/
@@ -300,6 +424,21 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
300
424
* datalabeling.googleapis.com to AI Platform (Unified).
301
425
*
302
426
* <p>Sample code:
427
+ *
428
+ * <pre>{@code
429
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
430
+ * BatchMigrateResourcesRequest request =
431
+ * BatchMigrateResourcesRequest.newBuilder()
432
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
433
+ * .addAllMigrateResourceRequests(new ArrayList<MigrateResourceRequest>())
434
+ * .build();
435
+ * OperationFuture<BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata>
436
+ * future =
437
+ * migrationServiceClient.batchMigrateResourcesOperationCallable().futureCall(request);
438
+ * // Do something.
439
+ * BatchMigrateResourcesResponse response = future.get();
440
+ * }
441
+ * }</pre>
303
442
*/
304
443
public final OperationCallable <
305
444
BatchMigrateResourcesRequest ,
@@ -315,6 +454,20 @@ public final SearchMigratableResourcesPagedResponse searchMigratableResources(
315
454
* datalabeling.googleapis.com to AI Platform (Unified).
316
455
*
317
456
* <p>Sample code:
457
+ *
458
+ * <pre>{@code
459
+ * try (MigrationServiceClient migrationServiceClient = MigrationServiceClient.create()) {
460
+ * BatchMigrateResourcesRequest request =
461
+ * BatchMigrateResourcesRequest.newBuilder()
462
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
463
+ * .addAllMigrateResourceRequests(new ArrayList<MigrateResourceRequest>())
464
+ * .build();
465
+ * ApiFuture<Operation> future =
466
+ * migrationServiceClient.batchMigrateResourcesCallable().futureCall(request);
467
+ * // Do something.
468
+ * Operation response = future.get();
469
+ * }
470
+ * }</pre>
318
471
*/
319
472
public final UnaryCallable <BatchMigrateResourcesRequest , Operation >
320
473
batchMigrateResourcesCallable () {
0 commit comments