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