1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.cloud.clouddms.v1; 18 19 import com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.gax.core.BackgroundResource; 22 import com.google.api.gax.longrunning.OperationFuture; 23 import com.google.api.gax.paging.AbstractFixedSizeCollection; 24 import com.google.api.gax.paging.AbstractPage; 25 import com.google.api.gax.paging.AbstractPagedListResponse; 26 import com.google.api.gax.rpc.OperationCallable; 27 import com.google.api.gax.rpc.PageContext; 28 import com.google.api.gax.rpc.UnaryCallable; 29 import com.google.cloud.clouddms.v1.stub.DataMigrationServiceStub; 30 import com.google.cloud.clouddms.v1.stub.DataMigrationServiceStubSettings; 31 import com.google.common.util.concurrent.MoreExecutors; 32 import com.google.longrunning.Operation; 33 import com.google.longrunning.OperationsClient; 34 import com.google.protobuf.Empty; 35 import com.google.protobuf.FieldMask; 36 import java.io.IOException; 37 import java.util.List; 38 import java.util.concurrent.TimeUnit; 39 import javax.annotation.Generated; 40 41 // AUTO-GENERATED DOCUMENTATION AND CLASS. 42 /** 43 * Service Description: Database Migration service 44 * 45 * <p>This class provides the ability to make remote calls to the backing service through method 46 * calls that map to API methods. Sample code to get started: 47 * 48 * <pre>{@code 49 * // This snippet has been automatically generated and should be regarded as a code template only. 50 * // It will require modifications to work: 51 * // - It may require correct/in-range values for request initialization. 52 * // - It may require specifying regional endpoints when creating the service client as shown in 53 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 54 * try (DataMigrationServiceClient dataMigrationServiceClient = 55 * DataMigrationServiceClient.create()) { 56 * MigrationJobName name = MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"); 57 * MigrationJob response = dataMigrationServiceClient.getMigrationJob(name); 58 * } 59 * }</pre> 60 * 61 * <p>Note: close() needs to be called on the DataMigrationServiceClient object to clean up 62 * resources such as threads. In the example above, try-with-resources is used, which automatically 63 * calls close(). 64 * 65 * <p>The surface of this class includes several types of Java methods for each of the API's 66 * methods: 67 * 68 * <ol> 69 * <li>A "flattened" method. With this type of method, the fields of the request type have been 70 * converted into function parameters. It may be the case that not all fields are available as 71 * parameters, and not every API method will have a flattened method entry point. 72 * <li>A "request object" method. This type of method only takes one parameter, a request object, 73 * which must be constructed before the call. Not every API method will have a request object 74 * method. 75 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 76 * callable object, which can be used to initiate calls to the service. 77 * </ol> 78 * 79 * <p>See the individual methods for example code. 80 * 81 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 82 * these names, this class includes a format method for each type of name, and additionally a parse 83 * method to extract the individual identifiers contained within names that are returned. 84 * 85 * <p>This class can be customized by passing in a custom instance of DataMigrationServiceSettings 86 * to create(). For example: 87 * 88 * <p>To customize credentials: 89 * 90 * <pre>{@code 91 * // This snippet has been automatically generated and should be regarded as a code template only. 92 * // It will require modifications to work: 93 * // - It may require correct/in-range values for request initialization. 94 * // - It may require specifying regional endpoints when creating the service client as shown in 95 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 96 * DataMigrationServiceSettings dataMigrationServiceSettings = 97 * DataMigrationServiceSettings.newBuilder() 98 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 99 * .build(); 100 * DataMigrationServiceClient dataMigrationServiceClient = 101 * DataMigrationServiceClient.create(dataMigrationServiceSettings); 102 * }</pre> 103 * 104 * <p>To customize the endpoint: 105 * 106 * <pre>{@code 107 * // This snippet has been automatically generated and should be regarded as a code template only. 108 * // It will require modifications to work: 109 * // - It may require correct/in-range values for request initialization. 110 * // - It may require specifying regional endpoints when creating the service client as shown in 111 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 112 * DataMigrationServiceSettings dataMigrationServiceSettings = 113 * DataMigrationServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); 114 * DataMigrationServiceClient dataMigrationServiceClient = 115 * DataMigrationServiceClient.create(dataMigrationServiceSettings); 116 * }</pre> 117 * 118 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 119 */ 120 @Generated("by gapic-generator-java") 121 public class DataMigrationServiceClient implements BackgroundResource { 122 private final DataMigrationServiceSettings settings; 123 private final DataMigrationServiceStub stub; 124 private final OperationsClient operationsClient; 125 126 /** Constructs an instance of DataMigrationServiceClient with default settings. */ create()127 public static final DataMigrationServiceClient create() throws IOException { 128 return create(DataMigrationServiceSettings.newBuilder().build()); 129 } 130 131 /** 132 * Constructs an instance of DataMigrationServiceClient, using the given settings. The channels 133 * are created based on the settings passed in, or defaults for any settings that are not set. 134 */ create(DataMigrationServiceSettings settings)135 public static final DataMigrationServiceClient create(DataMigrationServiceSettings settings) 136 throws IOException { 137 return new DataMigrationServiceClient(settings); 138 } 139 140 /** 141 * Constructs an instance of DataMigrationServiceClient, using the given stub for making calls. 142 * This is for advanced usage - prefer using create(DataMigrationServiceSettings). 143 */ create(DataMigrationServiceStub stub)144 public static final DataMigrationServiceClient create(DataMigrationServiceStub stub) { 145 return new DataMigrationServiceClient(stub); 146 } 147 148 /** 149 * Constructs an instance of DataMigrationServiceClient, using the given settings. This is 150 * protected so that it is easy to make a subclass, but otherwise, the static factory methods 151 * should be preferred. 152 */ DataMigrationServiceClient(DataMigrationServiceSettings settings)153 protected DataMigrationServiceClient(DataMigrationServiceSettings settings) throws IOException { 154 this.settings = settings; 155 this.stub = ((DataMigrationServiceStubSettings) settings.getStubSettings()).createStub(); 156 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 157 } 158 DataMigrationServiceClient(DataMigrationServiceStub stub)159 protected DataMigrationServiceClient(DataMigrationServiceStub stub) { 160 this.settings = null; 161 this.stub = stub; 162 this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); 163 } 164 getSettings()165 public final DataMigrationServiceSettings getSettings() { 166 return settings; 167 } 168 getStub()169 public DataMigrationServiceStub getStub() { 170 return stub; 171 } 172 173 /** 174 * Returns the OperationsClient that can be used to query the status of a long-running operation 175 * returned by another API method call. 176 */ getOperationsClient()177 public final OperationsClient getOperationsClient() { 178 return operationsClient; 179 } 180 181 // AUTO-GENERATED DOCUMENTATION AND METHOD. 182 /** 183 * Lists migration jobs in a given project and location. 184 * 185 * <p>Sample code: 186 * 187 * <pre>{@code 188 * // This snippet has been automatically generated and should be regarded as a code template only. 189 * // It will require modifications to work: 190 * // - It may require correct/in-range values for request initialization. 191 * // - It may require specifying regional endpoints when creating the service client as shown in 192 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 193 * try (DataMigrationServiceClient dataMigrationServiceClient = 194 * DataMigrationServiceClient.create()) { 195 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 196 * for (MigrationJob element : 197 * dataMigrationServiceClient.listMigrationJobs(parent).iterateAll()) { 198 * // doThingsWith(element); 199 * } 200 * } 201 * }</pre> 202 * 203 * @param parent Required. The parent, which owns this collection of migrationJobs. 204 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 205 */ listMigrationJobs(LocationName parent)206 public final ListMigrationJobsPagedResponse listMigrationJobs(LocationName parent) { 207 ListMigrationJobsRequest request = 208 ListMigrationJobsRequest.newBuilder() 209 .setParent(parent == null ? null : parent.toString()) 210 .build(); 211 return listMigrationJobs(request); 212 } 213 214 // AUTO-GENERATED DOCUMENTATION AND METHOD. 215 /** 216 * Lists migration jobs in a given project and location. 217 * 218 * <p>Sample code: 219 * 220 * <pre>{@code 221 * // This snippet has been automatically generated and should be regarded as a code template only. 222 * // It will require modifications to work: 223 * // - It may require correct/in-range values for request initialization. 224 * // - It may require specifying regional endpoints when creating the service client as shown in 225 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 226 * try (DataMigrationServiceClient dataMigrationServiceClient = 227 * DataMigrationServiceClient.create()) { 228 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 229 * for (MigrationJob element : 230 * dataMigrationServiceClient.listMigrationJobs(parent).iterateAll()) { 231 * // doThingsWith(element); 232 * } 233 * } 234 * }</pre> 235 * 236 * @param parent Required. The parent, which owns this collection of migrationJobs. 237 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 238 */ listMigrationJobs(String parent)239 public final ListMigrationJobsPagedResponse listMigrationJobs(String parent) { 240 ListMigrationJobsRequest request = 241 ListMigrationJobsRequest.newBuilder().setParent(parent).build(); 242 return listMigrationJobs(request); 243 } 244 245 // AUTO-GENERATED DOCUMENTATION AND METHOD. 246 /** 247 * Lists migration jobs in a given project and location. 248 * 249 * <p>Sample code: 250 * 251 * <pre>{@code 252 * // This snippet has been automatically generated and should be regarded as a code template only. 253 * // It will require modifications to work: 254 * // - It may require correct/in-range values for request initialization. 255 * // - It may require specifying regional endpoints when creating the service client as shown in 256 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 257 * try (DataMigrationServiceClient dataMigrationServiceClient = 258 * DataMigrationServiceClient.create()) { 259 * ListMigrationJobsRequest request = 260 * ListMigrationJobsRequest.newBuilder() 261 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 262 * .setPageSize(883849137) 263 * .setPageToken("pageToken873572522") 264 * .setFilter("filter-1274492040") 265 * .setOrderBy("orderBy-1207110587") 266 * .build(); 267 * for (MigrationJob element : 268 * dataMigrationServiceClient.listMigrationJobs(request).iterateAll()) { 269 * // doThingsWith(element); 270 * } 271 * } 272 * }</pre> 273 * 274 * @param request The request object containing all of the parameters for the API call. 275 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 276 */ listMigrationJobs(ListMigrationJobsRequest request)277 public final ListMigrationJobsPagedResponse listMigrationJobs(ListMigrationJobsRequest request) { 278 return listMigrationJobsPagedCallable().call(request); 279 } 280 281 // AUTO-GENERATED DOCUMENTATION AND METHOD. 282 /** 283 * Lists migration jobs in a given project and location. 284 * 285 * <p>Sample code: 286 * 287 * <pre>{@code 288 * // This snippet has been automatically generated and should be regarded as a code template only. 289 * // It will require modifications to work: 290 * // - It may require correct/in-range values for request initialization. 291 * // - It may require specifying regional endpoints when creating the service client as shown in 292 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 293 * try (DataMigrationServiceClient dataMigrationServiceClient = 294 * DataMigrationServiceClient.create()) { 295 * ListMigrationJobsRequest request = 296 * ListMigrationJobsRequest.newBuilder() 297 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 298 * .setPageSize(883849137) 299 * .setPageToken("pageToken873572522") 300 * .setFilter("filter-1274492040") 301 * .setOrderBy("orderBy-1207110587") 302 * .build(); 303 * ApiFuture<MigrationJob> future = 304 * dataMigrationServiceClient.listMigrationJobsPagedCallable().futureCall(request); 305 * // Do something. 306 * for (MigrationJob element : future.get().iterateAll()) { 307 * // doThingsWith(element); 308 * } 309 * } 310 * }</pre> 311 */ 312 public final UnaryCallable<ListMigrationJobsRequest, ListMigrationJobsPagedResponse> listMigrationJobsPagedCallable()313 listMigrationJobsPagedCallable() { 314 return stub.listMigrationJobsPagedCallable(); 315 } 316 317 // AUTO-GENERATED DOCUMENTATION AND METHOD. 318 /** 319 * Lists migration jobs in a given project and location. 320 * 321 * <p>Sample code: 322 * 323 * <pre>{@code 324 * // This snippet has been automatically generated and should be regarded as a code template only. 325 * // It will require modifications to work: 326 * // - It may require correct/in-range values for request initialization. 327 * // - It may require specifying regional endpoints when creating the service client as shown in 328 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 329 * try (DataMigrationServiceClient dataMigrationServiceClient = 330 * DataMigrationServiceClient.create()) { 331 * ListMigrationJobsRequest request = 332 * ListMigrationJobsRequest.newBuilder() 333 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 334 * .setPageSize(883849137) 335 * .setPageToken("pageToken873572522") 336 * .setFilter("filter-1274492040") 337 * .setOrderBy("orderBy-1207110587") 338 * .build(); 339 * while (true) { 340 * ListMigrationJobsResponse response = 341 * dataMigrationServiceClient.listMigrationJobsCallable().call(request); 342 * for (MigrationJob element : response.getMigrationJobsList()) { 343 * // doThingsWith(element); 344 * } 345 * String nextPageToken = response.getNextPageToken(); 346 * if (!Strings.isNullOrEmpty(nextPageToken)) { 347 * request = request.toBuilder().setPageToken(nextPageToken).build(); 348 * } else { 349 * break; 350 * } 351 * } 352 * } 353 * }</pre> 354 */ 355 public final UnaryCallable<ListMigrationJobsRequest, ListMigrationJobsResponse> listMigrationJobsCallable()356 listMigrationJobsCallable() { 357 return stub.listMigrationJobsCallable(); 358 } 359 360 // AUTO-GENERATED DOCUMENTATION AND METHOD. 361 /** 362 * Gets details of a single migration job. 363 * 364 * <p>Sample code: 365 * 366 * <pre>{@code 367 * // This snippet has been automatically generated and should be regarded as a code template only. 368 * // It will require modifications to work: 369 * // - It may require correct/in-range values for request initialization. 370 * // - It may require specifying regional endpoints when creating the service client as shown in 371 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 372 * try (DataMigrationServiceClient dataMigrationServiceClient = 373 * DataMigrationServiceClient.create()) { 374 * MigrationJobName name = MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"); 375 * MigrationJob response = dataMigrationServiceClient.getMigrationJob(name); 376 * } 377 * }</pre> 378 * 379 * @param name Required. Name of the migration job resource to get. 380 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 381 */ getMigrationJob(MigrationJobName name)382 public final MigrationJob getMigrationJob(MigrationJobName name) { 383 GetMigrationJobRequest request = 384 GetMigrationJobRequest.newBuilder().setName(name == null ? null : name.toString()).build(); 385 return getMigrationJob(request); 386 } 387 388 // AUTO-GENERATED DOCUMENTATION AND METHOD. 389 /** 390 * Gets details of a single migration job. 391 * 392 * <p>Sample code: 393 * 394 * <pre>{@code 395 * // This snippet has been automatically generated and should be regarded as a code template only. 396 * // It will require modifications to work: 397 * // - It may require correct/in-range values for request initialization. 398 * // - It may require specifying regional endpoints when creating the service client as shown in 399 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 400 * try (DataMigrationServiceClient dataMigrationServiceClient = 401 * DataMigrationServiceClient.create()) { 402 * String name = MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString(); 403 * MigrationJob response = dataMigrationServiceClient.getMigrationJob(name); 404 * } 405 * }</pre> 406 * 407 * @param name Required. Name of the migration job resource to get. 408 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 409 */ getMigrationJob(String name)410 public final MigrationJob getMigrationJob(String name) { 411 GetMigrationJobRequest request = GetMigrationJobRequest.newBuilder().setName(name).build(); 412 return getMigrationJob(request); 413 } 414 415 // AUTO-GENERATED DOCUMENTATION AND METHOD. 416 /** 417 * Gets details of a single migration job. 418 * 419 * <p>Sample code: 420 * 421 * <pre>{@code 422 * // This snippet has been automatically generated and should be regarded as a code template only. 423 * // It will require modifications to work: 424 * // - It may require correct/in-range values for request initialization. 425 * // - It may require specifying regional endpoints when creating the service client as shown in 426 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 427 * try (DataMigrationServiceClient dataMigrationServiceClient = 428 * DataMigrationServiceClient.create()) { 429 * GetMigrationJobRequest request = 430 * GetMigrationJobRequest.newBuilder() 431 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 432 * .build(); 433 * MigrationJob response = dataMigrationServiceClient.getMigrationJob(request); 434 * } 435 * }</pre> 436 * 437 * @param request The request object containing all of the parameters for the API call. 438 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 439 */ getMigrationJob(GetMigrationJobRequest request)440 public final MigrationJob getMigrationJob(GetMigrationJobRequest request) { 441 return getMigrationJobCallable().call(request); 442 } 443 444 // AUTO-GENERATED DOCUMENTATION AND METHOD. 445 /** 446 * Gets details of a single migration job. 447 * 448 * <p>Sample code: 449 * 450 * <pre>{@code 451 * // This snippet has been automatically generated and should be regarded as a code template only. 452 * // It will require modifications to work: 453 * // - It may require correct/in-range values for request initialization. 454 * // - It may require specifying regional endpoints when creating the service client as shown in 455 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 456 * try (DataMigrationServiceClient dataMigrationServiceClient = 457 * DataMigrationServiceClient.create()) { 458 * GetMigrationJobRequest request = 459 * GetMigrationJobRequest.newBuilder() 460 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 461 * .build(); 462 * ApiFuture<MigrationJob> future = 463 * dataMigrationServiceClient.getMigrationJobCallable().futureCall(request); 464 * // Do something. 465 * MigrationJob response = future.get(); 466 * } 467 * }</pre> 468 */ getMigrationJobCallable()469 public final UnaryCallable<GetMigrationJobRequest, MigrationJob> getMigrationJobCallable() { 470 return stub.getMigrationJobCallable(); 471 } 472 473 // AUTO-GENERATED DOCUMENTATION AND METHOD. 474 /** 475 * Creates a new migration job in a given project and location. 476 * 477 * <p>Sample code: 478 * 479 * <pre>{@code 480 * // This snippet has been automatically generated and should be regarded as a code template only. 481 * // It will require modifications to work: 482 * // - It may require correct/in-range values for request initialization. 483 * // - It may require specifying regional endpoints when creating the service client as shown in 484 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 485 * try (DataMigrationServiceClient dataMigrationServiceClient = 486 * DataMigrationServiceClient.create()) { 487 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 488 * MigrationJob migrationJob = MigrationJob.newBuilder().build(); 489 * String migrationJobId = "migrationJobId1870575242"; 490 * MigrationJob response = 491 * dataMigrationServiceClient 492 * .createMigrationJobAsync(parent, migrationJob, migrationJobId) 493 * .get(); 494 * } 495 * }</pre> 496 * 497 * @param parent Required. The parent, which owns this collection of migration jobs. 498 * @param migrationJob Required. Represents a [migration 499 * job](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs) 500 * object. 501 * @param migrationJobId Required. The ID of the instance to create. 502 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 503 */ createMigrationJobAsync( LocationName parent, MigrationJob migrationJob, String migrationJobId)504 public final OperationFuture<MigrationJob, OperationMetadata> createMigrationJobAsync( 505 LocationName parent, MigrationJob migrationJob, String migrationJobId) { 506 CreateMigrationJobRequest request = 507 CreateMigrationJobRequest.newBuilder() 508 .setParent(parent == null ? null : parent.toString()) 509 .setMigrationJob(migrationJob) 510 .setMigrationJobId(migrationJobId) 511 .build(); 512 return createMigrationJobAsync(request); 513 } 514 515 // AUTO-GENERATED DOCUMENTATION AND METHOD. 516 /** 517 * Creates a new migration job in a given project and location. 518 * 519 * <p>Sample code: 520 * 521 * <pre>{@code 522 * // This snippet has been automatically generated and should be regarded as a code template only. 523 * // It will require modifications to work: 524 * // - It may require correct/in-range values for request initialization. 525 * // - It may require specifying regional endpoints when creating the service client as shown in 526 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 527 * try (DataMigrationServiceClient dataMigrationServiceClient = 528 * DataMigrationServiceClient.create()) { 529 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 530 * MigrationJob migrationJob = MigrationJob.newBuilder().build(); 531 * String migrationJobId = "migrationJobId1870575242"; 532 * MigrationJob response = 533 * dataMigrationServiceClient 534 * .createMigrationJobAsync(parent, migrationJob, migrationJobId) 535 * .get(); 536 * } 537 * }</pre> 538 * 539 * @param parent Required. The parent, which owns this collection of migration jobs. 540 * @param migrationJob Required. Represents a [migration 541 * job](https://cloud.google.com/database-migration/docs/reference/rest/v1/projects.locations.migrationJobs) 542 * object. 543 * @param migrationJobId Required. The ID of the instance to create. 544 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 545 */ createMigrationJobAsync( String parent, MigrationJob migrationJob, String migrationJobId)546 public final OperationFuture<MigrationJob, OperationMetadata> createMigrationJobAsync( 547 String parent, MigrationJob migrationJob, String migrationJobId) { 548 CreateMigrationJobRequest request = 549 CreateMigrationJobRequest.newBuilder() 550 .setParent(parent) 551 .setMigrationJob(migrationJob) 552 .setMigrationJobId(migrationJobId) 553 .build(); 554 return createMigrationJobAsync(request); 555 } 556 557 // AUTO-GENERATED DOCUMENTATION AND METHOD. 558 /** 559 * Creates a new migration job in a given project and location. 560 * 561 * <p>Sample code: 562 * 563 * <pre>{@code 564 * // This snippet has been automatically generated and should be regarded as a code template only. 565 * // It will require modifications to work: 566 * // - It may require correct/in-range values for request initialization. 567 * // - It may require specifying regional endpoints when creating the service client as shown in 568 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 569 * try (DataMigrationServiceClient dataMigrationServiceClient = 570 * DataMigrationServiceClient.create()) { 571 * CreateMigrationJobRequest request = 572 * CreateMigrationJobRequest.newBuilder() 573 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 574 * .setMigrationJobId("migrationJobId1870575242") 575 * .setMigrationJob(MigrationJob.newBuilder().build()) 576 * .setRequestId("requestId693933066") 577 * .build(); 578 * MigrationJob response = dataMigrationServiceClient.createMigrationJobAsync(request).get(); 579 * } 580 * }</pre> 581 * 582 * @param request The request object containing all of the parameters for the API call. 583 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 584 */ createMigrationJobAsync( CreateMigrationJobRequest request)585 public final OperationFuture<MigrationJob, OperationMetadata> createMigrationJobAsync( 586 CreateMigrationJobRequest request) { 587 return createMigrationJobOperationCallable().futureCall(request); 588 } 589 590 // AUTO-GENERATED DOCUMENTATION AND METHOD. 591 /** 592 * Creates a new migration job in a given project and location. 593 * 594 * <p>Sample code: 595 * 596 * <pre>{@code 597 * // This snippet has been automatically generated and should be regarded as a code template only. 598 * // It will require modifications to work: 599 * // - It may require correct/in-range values for request initialization. 600 * // - It may require specifying regional endpoints when creating the service client as shown in 601 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 602 * try (DataMigrationServiceClient dataMigrationServiceClient = 603 * DataMigrationServiceClient.create()) { 604 * CreateMigrationJobRequest request = 605 * CreateMigrationJobRequest.newBuilder() 606 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 607 * .setMigrationJobId("migrationJobId1870575242") 608 * .setMigrationJob(MigrationJob.newBuilder().build()) 609 * .setRequestId("requestId693933066") 610 * .build(); 611 * OperationFuture<MigrationJob, OperationMetadata> future = 612 * dataMigrationServiceClient.createMigrationJobOperationCallable().futureCall(request); 613 * // Do something. 614 * MigrationJob response = future.get(); 615 * } 616 * }</pre> 617 */ 618 public final OperationCallable<CreateMigrationJobRequest, MigrationJob, OperationMetadata> createMigrationJobOperationCallable()619 createMigrationJobOperationCallable() { 620 return stub.createMigrationJobOperationCallable(); 621 } 622 623 // AUTO-GENERATED DOCUMENTATION AND METHOD. 624 /** 625 * Creates a new migration job in a given project and location. 626 * 627 * <p>Sample code: 628 * 629 * <pre>{@code 630 * // This snippet has been automatically generated and should be regarded as a code template only. 631 * // It will require modifications to work: 632 * // - It may require correct/in-range values for request initialization. 633 * // - It may require specifying regional endpoints when creating the service client as shown in 634 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 635 * try (DataMigrationServiceClient dataMigrationServiceClient = 636 * DataMigrationServiceClient.create()) { 637 * CreateMigrationJobRequest request = 638 * CreateMigrationJobRequest.newBuilder() 639 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 640 * .setMigrationJobId("migrationJobId1870575242") 641 * .setMigrationJob(MigrationJob.newBuilder().build()) 642 * .setRequestId("requestId693933066") 643 * .build(); 644 * ApiFuture<Operation> future = 645 * dataMigrationServiceClient.createMigrationJobCallable().futureCall(request); 646 * // Do something. 647 * Operation response = future.get(); 648 * } 649 * }</pre> 650 */ createMigrationJobCallable()651 public final UnaryCallable<CreateMigrationJobRequest, Operation> createMigrationJobCallable() { 652 return stub.createMigrationJobCallable(); 653 } 654 655 // AUTO-GENERATED DOCUMENTATION AND METHOD. 656 /** 657 * Updates the parameters of a single migration job. 658 * 659 * <p>Sample code: 660 * 661 * <pre>{@code 662 * // This snippet has been automatically generated and should be regarded as a code template only. 663 * // It will require modifications to work: 664 * // - It may require correct/in-range values for request initialization. 665 * // - It may require specifying regional endpoints when creating the service client as shown in 666 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 667 * try (DataMigrationServiceClient dataMigrationServiceClient = 668 * DataMigrationServiceClient.create()) { 669 * MigrationJob migrationJob = MigrationJob.newBuilder().build(); 670 * FieldMask updateMask = FieldMask.newBuilder().build(); 671 * MigrationJob response = 672 * dataMigrationServiceClient.updateMigrationJobAsync(migrationJob, updateMask).get(); 673 * } 674 * }</pre> 675 * 676 * @param migrationJob Required. The migration job parameters to update. 677 * @param updateMask Required. Field mask is used to specify the fields to be overwritten in the 678 * migration job resource by the update. 679 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 680 */ updateMigrationJobAsync( MigrationJob migrationJob, FieldMask updateMask)681 public final OperationFuture<MigrationJob, OperationMetadata> updateMigrationJobAsync( 682 MigrationJob migrationJob, FieldMask updateMask) { 683 UpdateMigrationJobRequest request = 684 UpdateMigrationJobRequest.newBuilder() 685 .setMigrationJob(migrationJob) 686 .setUpdateMask(updateMask) 687 .build(); 688 return updateMigrationJobAsync(request); 689 } 690 691 // AUTO-GENERATED DOCUMENTATION AND METHOD. 692 /** 693 * Updates the parameters of a single migration job. 694 * 695 * <p>Sample code: 696 * 697 * <pre>{@code 698 * // This snippet has been automatically generated and should be regarded as a code template only. 699 * // It will require modifications to work: 700 * // - It may require correct/in-range values for request initialization. 701 * // - It may require specifying regional endpoints when creating the service client as shown in 702 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 703 * try (DataMigrationServiceClient dataMigrationServiceClient = 704 * DataMigrationServiceClient.create()) { 705 * UpdateMigrationJobRequest request = 706 * UpdateMigrationJobRequest.newBuilder() 707 * .setUpdateMask(FieldMask.newBuilder().build()) 708 * .setMigrationJob(MigrationJob.newBuilder().build()) 709 * .setRequestId("requestId693933066") 710 * .build(); 711 * MigrationJob response = dataMigrationServiceClient.updateMigrationJobAsync(request).get(); 712 * } 713 * }</pre> 714 * 715 * @param request The request object containing all of the parameters for the API call. 716 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 717 */ updateMigrationJobAsync( UpdateMigrationJobRequest request)718 public final OperationFuture<MigrationJob, OperationMetadata> updateMigrationJobAsync( 719 UpdateMigrationJobRequest request) { 720 return updateMigrationJobOperationCallable().futureCall(request); 721 } 722 723 // AUTO-GENERATED DOCUMENTATION AND METHOD. 724 /** 725 * Updates the parameters of a single migration job. 726 * 727 * <p>Sample code: 728 * 729 * <pre>{@code 730 * // This snippet has been automatically generated and should be regarded as a code template only. 731 * // It will require modifications to work: 732 * // - It may require correct/in-range values for request initialization. 733 * // - It may require specifying regional endpoints when creating the service client as shown in 734 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 735 * try (DataMigrationServiceClient dataMigrationServiceClient = 736 * DataMigrationServiceClient.create()) { 737 * UpdateMigrationJobRequest request = 738 * UpdateMigrationJobRequest.newBuilder() 739 * .setUpdateMask(FieldMask.newBuilder().build()) 740 * .setMigrationJob(MigrationJob.newBuilder().build()) 741 * .setRequestId("requestId693933066") 742 * .build(); 743 * OperationFuture<MigrationJob, OperationMetadata> future = 744 * dataMigrationServiceClient.updateMigrationJobOperationCallable().futureCall(request); 745 * // Do something. 746 * MigrationJob response = future.get(); 747 * } 748 * }</pre> 749 */ 750 public final OperationCallable<UpdateMigrationJobRequest, MigrationJob, OperationMetadata> updateMigrationJobOperationCallable()751 updateMigrationJobOperationCallable() { 752 return stub.updateMigrationJobOperationCallable(); 753 } 754 755 // AUTO-GENERATED DOCUMENTATION AND METHOD. 756 /** 757 * Updates the parameters of a single migration job. 758 * 759 * <p>Sample code: 760 * 761 * <pre>{@code 762 * // This snippet has been automatically generated and should be regarded as a code template only. 763 * // It will require modifications to work: 764 * // - It may require correct/in-range values for request initialization. 765 * // - It may require specifying regional endpoints when creating the service client as shown in 766 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 767 * try (DataMigrationServiceClient dataMigrationServiceClient = 768 * DataMigrationServiceClient.create()) { 769 * UpdateMigrationJobRequest request = 770 * UpdateMigrationJobRequest.newBuilder() 771 * .setUpdateMask(FieldMask.newBuilder().build()) 772 * .setMigrationJob(MigrationJob.newBuilder().build()) 773 * .setRequestId("requestId693933066") 774 * .build(); 775 * ApiFuture<Operation> future = 776 * dataMigrationServiceClient.updateMigrationJobCallable().futureCall(request); 777 * // Do something. 778 * Operation response = future.get(); 779 * } 780 * }</pre> 781 */ updateMigrationJobCallable()782 public final UnaryCallable<UpdateMigrationJobRequest, Operation> updateMigrationJobCallable() { 783 return stub.updateMigrationJobCallable(); 784 } 785 786 // AUTO-GENERATED DOCUMENTATION AND METHOD. 787 /** 788 * Deletes a single migration job. 789 * 790 * <p>Sample code: 791 * 792 * <pre>{@code 793 * // This snippet has been automatically generated and should be regarded as a code template only. 794 * // It will require modifications to work: 795 * // - It may require correct/in-range values for request initialization. 796 * // - It may require specifying regional endpoints when creating the service client as shown in 797 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 798 * try (DataMigrationServiceClient dataMigrationServiceClient = 799 * DataMigrationServiceClient.create()) { 800 * MigrationJobName name = MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]"); 801 * dataMigrationServiceClient.deleteMigrationJobAsync(name).get(); 802 * } 803 * }</pre> 804 * 805 * @param name Required. Name of the migration job resource to delete. 806 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 807 */ deleteMigrationJobAsync( MigrationJobName name)808 public final OperationFuture<Empty, OperationMetadata> deleteMigrationJobAsync( 809 MigrationJobName name) { 810 DeleteMigrationJobRequest request = 811 DeleteMigrationJobRequest.newBuilder() 812 .setName(name == null ? null : name.toString()) 813 .build(); 814 return deleteMigrationJobAsync(request); 815 } 816 817 // AUTO-GENERATED DOCUMENTATION AND METHOD. 818 /** 819 * Deletes a single migration job. 820 * 821 * <p>Sample code: 822 * 823 * <pre>{@code 824 * // This snippet has been automatically generated and should be regarded as a code template only. 825 * // It will require modifications to work: 826 * // - It may require correct/in-range values for request initialization. 827 * // - It may require specifying regional endpoints when creating the service client as shown in 828 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 829 * try (DataMigrationServiceClient dataMigrationServiceClient = 830 * DataMigrationServiceClient.create()) { 831 * String name = MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString(); 832 * dataMigrationServiceClient.deleteMigrationJobAsync(name).get(); 833 * } 834 * }</pre> 835 * 836 * @param name Required. Name of the migration job resource to delete. 837 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 838 */ deleteMigrationJobAsync(String name)839 public final OperationFuture<Empty, OperationMetadata> deleteMigrationJobAsync(String name) { 840 DeleteMigrationJobRequest request = 841 DeleteMigrationJobRequest.newBuilder().setName(name).build(); 842 return deleteMigrationJobAsync(request); 843 } 844 845 // AUTO-GENERATED DOCUMENTATION AND METHOD. 846 /** 847 * Deletes a single migration job. 848 * 849 * <p>Sample code: 850 * 851 * <pre>{@code 852 * // This snippet has been automatically generated and should be regarded as a code template only. 853 * // It will require modifications to work: 854 * // - It may require correct/in-range values for request initialization. 855 * // - It may require specifying regional endpoints when creating the service client as shown in 856 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 857 * try (DataMigrationServiceClient dataMigrationServiceClient = 858 * DataMigrationServiceClient.create()) { 859 * DeleteMigrationJobRequest request = 860 * DeleteMigrationJobRequest.newBuilder() 861 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 862 * .setRequestId("requestId693933066") 863 * .setForce(true) 864 * .build(); 865 * dataMigrationServiceClient.deleteMigrationJobAsync(request).get(); 866 * } 867 * }</pre> 868 * 869 * @param request The request object containing all of the parameters for the API call. 870 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 871 */ deleteMigrationJobAsync( DeleteMigrationJobRequest request)872 public final OperationFuture<Empty, OperationMetadata> deleteMigrationJobAsync( 873 DeleteMigrationJobRequest request) { 874 return deleteMigrationJobOperationCallable().futureCall(request); 875 } 876 877 // AUTO-GENERATED DOCUMENTATION AND METHOD. 878 /** 879 * Deletes a single migration job. 880 * 881 * <p>Sample code: 882 * 883 * <pre>{@code 884 * // This snippet has been automatically generated and should be regarded as a code template only. 885 * // It will require modifications to work: 886 * // - It may require correct/in-range values for request initialization. 887 * // - It may require specifying regional endpoints when creating the service client as shown in 888 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 889 * try (DataMigrationServiceClient dataMigrationServiceClient = 890 * DataMigrationServiceClient.create()) { 891 * DeleteMigrationJobRequest request = 892 * DeleteMigrationJobRequest.newBuilder() 893 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 894 * .setRequestId("requestId693933066") 895 * .setForce(true) 896 * .build(); 897 * OperationFuture<Empty, OperationMetadata> future = 898 * dataMigrationServiceClient.deleteMigrationJobOperationCallable().futureCall(request); 899 * // Do something. 900 * future.get(); 901 * } 902 * }</pre> 903 */ 904 public final OperationCallable<DeleteMigrationJobRequest, Empty, OperationMetadata> deleteMigrationJobOperationCallable()905 deleteMigrationJobOperationCallable() { 906 return stub.deleteMigrationJobOperationCallable(); 907 } 908 909 // AUTO-GENERATED DOCUMENTATION AND METHOD. 910 /** 911 * Deletes a single migration job. 912 * 913 * <p>Sample code: 914 * 915 * <pre>{@code 916 * // This snippet has been automatically generated and should be regarded as a code template only. 917 * // It will require modifications to work: 918 * // - It may require correct/in-range values for request initialization. 919 * // - It may require specifying regional endpoints when creating the service client as shown in 920 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 921 * try (DataMigrationServiceClient dataMigrationServiceClient = 922 * DataMigrationServiceClient.create()) { 923 * DeleteMigrationJobRequest request = 924 * DeleteMigrationJobRequest.newBuilder() 925 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 926 * .setRequestId("requestId693933066") 927 * .setForce(true) 928 * .build(); 929 * ApiFuture<Operation> future = 930 * dataMigrationServiceClient.deleteMigrationJobCallable().futureCall(request); 931 * // Do something. 932 * future.get(); 933 * } 934 * }</pre> 935 */ deleteMigrationJobCallable()936 public final UnaryCallable<DeleteMigrationJobRequest, Operation> deleteMigrationJobCallable() { 937 return stub.deleteMigrationJobCallable(); 938 } 939 940 // AUTO-GENERATED DOCUMENTATION AND METHOD. 941 /** 942 * Start an already created migration job. 943 * 944 * <p>Sample code: 945 * 946 * <pre>{@code 947 * // This snippet has been automatically generated and should be regarded as a code template only. 948 * // It will require modifications to work: 949 * // - It may require correct/in-range values for request initialization. 950 * // - It may require specifying regional endpoints when creating the service client as shown in 951 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 952 * try (DataMigrationServiceClient dataMigrationServiceClient = 953 * DataMigrationServiceClient.create()) { 954 * StartMigrationJobRequest request = 955 * StartMigrationJobRequest.newBuilder() 956 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 957 * .build(); 958 * MigrationJob response = dataMigrationServiceClient.startMigrationJobAsync(request).get(); 959 * } 960 * }</pre> 961 * 962 * @param request The request object containing all of the parameters for the API call. 963 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 964 */ startMigrationJobAsync( StartMigrationJobRequest request)965 public final OperationFuture<MigrationJob, OperationMetadata> startMigrationJobAsync( 966 StartMigrationJobRequest request) { 967 return startMigrationJobOperationCallable().futureCall(request); 968 } 969 970 // AUTO-GENERATED DOCUMENTATION AND METHOD. 971 /** 972 * Start an already created migration job. 973 * 974 * <p>Sample code: 975 * 976 * <pre>{@code 977 * // This snippet has been automatically generated and should be regarded as a code template only. 978 * // It will require modifications to work: 979 * // - It may require correct/in-range values for request initialization. 980 * // - It may require specifying regional endpoints when creating the service client as shown in 981 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 982 * try (DataMigrationServiceClient dataMigrationServiceClient = 983 * DataMigrationServiceClient.create()) { 984 * StartMigrationJobRequest request = 985 * StartMigrationJobRequest.newBuilder() 986 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 987 * .build(); 988 * OperationFuture<MigrationJob, OperationMetadata> future = 989 * dataMigrationServiceClient.startMigrationJobOperationCallable().futureCall(request); 990 * // Do something. 991 * MigrationJob response = future.get(); 992 * } 993 * }</pre> 994 */ 995 public final OperationCallable<StartMigrationJobRequest, MigrationJob, OperationMetadata> startMigrationJobOperationCallable()996 startMigrationJobOperationCallable() { 997 return stub.startMigrationJobOperationCallable(); 998 } 999 1000 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1001 /** 1002 * Start an already created migration job. 1003 * 1004 * <p>Sample code: 1005 * 1006 * <pre>{@code 1007 * // This snippet has been automatically generated and should be regarded as a code template only. 1008 * // It will require modifications to work: 1009 * // - It may require correct/in-range values for request initialization. 1010 * // - It may require specifying regional endpoints when creating the service client as shown in 1011 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1012 * try (DataMigrationServiceClient dataMigrationServiceClient = 1013 * DataMigrationServiceClient.create()) { 1014 * StartMigrationJobRequest request = 1015 * StartMigrationJobRequest.newBuilder() 1016 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1017 * .build(); 1018 * ApiFuture<Operation> future = 1019 * dataMigrationServiceClient.startMigrationJobCallable().futureCall(request); 1020 * // Do something. 1021 * Operation response = future.get(); 1022 * } 1023 * }</pre> 1024 */ startMigrationJobCallable()1025 public final UnaryCallable<StartMigrationJobRequest, Operation> startMigrationJobCallable() { 1026 return stub.startMigrationJobCallable(); 1027 } 1028 1029 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1030 /** 1031 * Stops a running migration job. 1032 * 1033 * <p>Sample code: 1034 * 1035 * <pre>{@code 1036 * // This snippet has been automatically generated and should be regarded as a code template only. 1037 * // It will require modifications to work: 1038 * // - It may require correct/in-range values for request initialization. 1039 * // - It may require specifying regional endpoints when creating the service client as shown in 1040 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1041 * try (DataMigrationServiceClient dataMigrationServiceClient = 1042 * DataMigrationServiceClient.create()) { 1043 * StopMigrationJobRequest request = 1044 * StopMigrationJobRequest.newBuilder() 1045 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1046 * .build(); 1047 * MigrationJob response = dataMigrationServiceClient.stopMigrationJobAsync(request).get(); 1048 * } 1049 * }</pre> 1050 * 1051 * @param request The request object containing all of the parameters for the API call. 1052 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1053 */ stopMigrationJobAsync( StopMigrationJobRequest request)1054 public final OperationFuture<MigrationJob, OperationMetadata> stopMigrationJobAsync( 1055 StopMigrationJobRequest request) { 1056 return stopMigrationJobOperationCallable().futureCall(request); 1057 } 1058 1059 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1060 /** 1061 * Stops a running migration job. 1062 * 1063 * <p>Sample code: 1064 * 1065 * <pre>{@code 1066 * // This snippet has been automatically generated and should be regarded as a code template only. 1067 * // It will require modifications to work: 1068 * // - It may require correct/in-range values for request initialization. 1069 * // - It may require specifying regional endpoints when creating the service client as shown in 1070 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1071 * try (DataMigrationServiceClient dataMigrationServiceClient = 1072 * DataMigrationServiceClient.create()) { 1073 * StopMigrationJobRequest request = 1074 * StopMigrationJobRequest.newBuilder() 1075 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1076 * .build(); 1077 * OperationFuture<MigrationJob, OperationMetadata> future = 1078 * dataMigrationServiceClient.stopMigrationJobOperationCallable().futureCall(request); 1079 * // Do something. 1080 * MigrationJob response = future.get(); 1081 * } 1082 * }</pre> 1083 */ 1084 public final OperationCallable<StopMigrationJobRequest, MigrationJob, OperationMetadata> stopMigrationJobOperationCallable()1085 stopMigrationJobOperationCallable() { 1086 return stub.stopMigrationJobOperationCallable(); 1087 } 1088 1089 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1090 /** 1091 * Stops a running migration job. 1092 * 1093 * <p>Sample code: 1094 * 1095 * <pre>{@code 1096 * // This snippet has been automatically generated and should be regarded as a code template only. 1097 * // It will require modifications to work: 1098 * // - It may require correct/in-range values for request initialization. 1099 * // - It may require specifying regional endpoints when creating the service client as shown in 1100 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1101 * try (DataMigrationServiceClient dataMigrationServiceClient = 1102 * DataMigrationServiceClient.create()) { 1103 * StopMigrationJobRequest request = 1104 * StopMigrationJobRequest.newBuilder() 1105 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1106 * .build(); 1107 * ApiFuture<Operation> future = 1108 * dataMigrationServiceClient.stopMigrationJobCallable().futureCall(request); 1109 * // Do something. 1110 * Operation response = future.get(); 1111 * } 1112 * }</pre> 1113 */ stopMigrationJobCallable()1114 public final UnaryCallable<StopMigrationJobRequest, Operation> stopMigrationJobCallable() { 1115 return stub.stopMigrationJobCallable(); 1116 } 1117 1118 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1119 /** 1120 * Resume a migration job that is currently stopped and is resumable (was stopped during CDC 1121 * phase). 1122 * 1123 * <p>Sample code: 1124 * 1125 * <pre>{@code 1126 * // This snippet has been automatically generated and should be regarded as a code template only. 1127 * // It will require modifications to work: 1128 * // - It may require correct/in-range values for request initialization. 1129 * // - It may require specifying regional endpoints when creating the service client as shown in 1130 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1131 * try (DataMigrationServiceClient dataMigrationServiceClient = 1132 * DataMigrationServiceClient.create()) { 1133 * ResumeMigrationJobRequest request = 1134 * ResumeMigrationJobRequest.newBuilder() 1135 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1136 * .build(); 1137 * MigrationJob response = dataMigrationServiceClient.resumeMigrationJobAsync(request).get(); 1138 * } 1139 * }</pre> 1140 * 1141 * @param request The request object containing all of the parameters for the API call. 1142 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1143 */ resumeMigrationJobAsync( ResumeMigrationJobRequest request)1144 public final OperationFuture<MigrationJob, OperationMetadata> resumeMigrationJobAsync( 1145 ResumeMigrationJobRequest request) { 1146 return resumeMigrationJobOperationCallable().futureCall(request); 1147 } 1148 1149 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1150 /** 1151 * Resume a migration job that is currently stopped and is resumable (was stopped during CDC 1152 * phase). 1153 * 1154 * <p>Sample code: 1155 * 1156 * <pre>{@code 1157 * // This snippet has been automatically generated and should be regarded as a code template only. 1158 * // It will require modifications to work: 1159 * // - It may require correct/in-range values for request initialization. 1160 * // - It may require specifying regional endpoints when creating the service client as shown in 1161 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1162 * try (DataMigrationServiceClient dataMigrationServiceClient = 1163 * DataMigrationServiceClient.create()) { 1164 * ResumeMigrationJobRequest request = 1165 * ResumeMigrationJobRequest.newBuilder() 1166 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1167 * .build(); 1168 * OperationFuture<MigrationJob, OperationMetadata> future = 1169 * dataMigrationServiceClient.resumeMigrationJobOperationCallable().futureCall(request); 1170 * // Do something. 1171 * MigrationJob response = future.get(); 1172 * } 1173 * }</pre> 1174 */ 1175 public final OperationCallable<ResumeMigrationJobRequest, MigrationJob, OperationMetadata> resumeMigrationJobOperationCallable()1176 resumeMigrationJobOperationCallable() { 1177 return stub.resumeMigrationJobOperationCallable(); 1178 } 1179 1180 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1181 /** 1182 * Resume a migration job that is currently stopped and is resumable (was stopped during CDC 1183 * phase). 1184 * 1185 * <p>Sample code: 1186 * 1187 * <pre>{@code 1188 * // This snippet has been automatically generated and should be regarded as a code template only. 1189 * // It will require modifications to work: 1190 * // - It may require correct/in-range values for request initialization. 1191 * // - It may require specifying regional endpoints when creating the service client as shown in 1192 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1193 * try (DataMigrationServiceClient dataMigrationServiceClient = 1194 * DataMigrationServiceClient.create()) { 1195 * ResumeMigrationJobRequest request = 1196 * ResumeMigrationJobRequest.newBuilder() 1197 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1198 * .build(); 1199 * ApiFuture<Operation> future = 1200 * dataMigrationServiceClient.resumeMigrationJobCallable().futureCall(request); 1201 * // Do something. 1202 * Operation response = future.get(); 1203 * } 1204 * }</pre> 1205 */ resumeMigrationJobCallable()1206 public final UnaryCallable<ResumeMigrationJobRequest, Operation> resumeMigrationJobCallable() { 1207 return stub.resumeMigrationJobCallable(); 1208 } 1209 1210 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1211 /** 1212 * Promote a migration job, stopping replication to the destination and promoting the destination 1213 * to be a standalone database. 1214 * 1215 * <p>Sample code: 1216 * 1217 * <pre>{@code 1218 * // This snippet has been automatically generated and should be regarded as a code template only. 1219 * // It will require modifications to work: 1220 * // - It may require correct/in-range values for request initialization. 1221 * // - It may require specifying regional endpoints when creating the service client as shown in 1222 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1223 * try (DataMigrationServiceClient dataMigrationServiceClient = 1224 * DataMigrationServiceClient.create()) { 1225 * PromoteMigrationJobRequest request = 1226 * PromoteMigrationJobRequest.newBuilder() 1227 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1228 * .build(); 1229 * MigrationJob response = dataMigrationServiceClient.promoteMigrationJobAsync(request).get(); 1230 * } 1231 * }</pre> 1232 * 1233 * @param request The request object containing all of the parameters for the API call. 1234 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1235 */ promoteMigrationJobAsync( PromoteMigrationJobRequest request)1236 public final OperationFuture<MigrationJob, OperationMetadata> promoteMigrationJobAsync( 1237 PromoteMigrationJobRequest request) { 1238 return promoteMigrationJobOperationCallable().futureCall(request); 1239 } 1240 1241 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1242 /** 1243 * Promote a migration job, stopping replication to the destination and promoting the destination 1244 * to be a standalone database. 1245 * 1246 * <p>Sample code: 1247 * 1248 * <pre>{@code 1249 * // This snippet has been automatically generated and should be regarded as a code template only. 1250 * // It will require modifications to work: 1251 * // - It may require correct/in-range values for request initialization. 1252 * // - It may require specifying regional endpoints when creating the service client as shown in 1253 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1254 * try (DataMigrationServiceClient dataMigrationServiceClient = 1255 * DataMigrationServiceClient.create()) { 1256 * PromoteMigrationJobRequest request = 1257 * PromoteMigrationJobRequest.newBuilder() 1258 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1259 * .build(); 1260 * OperationFuture<MigrationJob, OperationMetadata> future = 1261 * dataMigrationServiceClient.promoteMigrationJobOperationCallable().futureCall(request); 1262 * // Do something. 1263 * MigrationJob response = future.get(); 1264 * } 1265 * }</pre> 1266 */ 1267 public final OperationCallable<PromoteMigrationJobRequest, MigrationJob, OperationMetadata> promoteMigrationJobOperationCallable()1268 promoteMigrationJobOperationCallable() { 1269 return stub.promoteMigrationJobOperationCallable(); 1270 } 1271 1272 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1273 /** 1274 * Promote a migration job, stopping replication to the destination and promoting the destination 1275 * to be a standalone database. 1276 * 1277 * <p>Sample code: 1278 * 1279 * <pre>{@code 1280 * // This snippet has been automatically generated and should be regarded as a code template only. 1281 * // It will require modifications to work: 1282 * // - It may require correct/in-range values for request initialization. 1283 * // - It may require specifying regional endpoints when creating the service client as shown in 1284 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1285 * try (DataMigrationServiceClient dataMigrationServiceClient = 1286 * DataMigrationServiceClient.create()) { 1287 * PromoteMigrationJobRequest request = 1288 * PromoteMigrationJobRequest.newBuilder() 1289 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1290 * .build(); 1291 * ApiFuture<Operation> future = 1292 * dataMigrationServiceClient.promoteMigrationJobCallable().futureCall(request); 1293 * // Do something. 1294 * Operation response = future.get(); 1295 * } 1296 * }</pre> 1297 */ promoteMigrationJobCallable()1298 public final UnaryCallable<PromoteMigrationJobRequest, Operation> promoteMigrationJobCallable() { 1299 return stub.promoteMigrationJobCallable(); 1300 } 1301 1302 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1303 /** 1304 * Verify a migration job, making sure the destination can reach the source and that all 1305 * configuration and prerequisites are met. 1306 * 1307 * <p>Sample code: 1308 * 1309 * <pre>{@code 1310 * // This snippet has been automatically generated and should be regarded as a code template only. 1311 * // It will require modifications to work: 1312 * // - It may require correct/in-range values for request initialization. 1313 * // - It may require specifying regional endpoints when creating the service client as shown in 1314 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1315 * try (DataMigrationServiceClient dataMigrationServiceClient = 1316 * DataMigrationServiceClient.create()) { 1317 * VerifyMigrationJobRequest request = 1318 * VerifyMigrationJobRequest.newBuilder() 1319 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1320 * .build(); 1321 * MigrationJob response = dataMigrationServiceClient.verifyMigrationJobAsync(request).get(); 1322 * } 1323 * }</pre> 1324 * 1325 * @param request The request object containing all of the parameters for the API call. 1326 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1327 */ verifyMigrationJobAsync( VerifyMigrationJobRequest request)1328 public final OperationFuture<MigrationJob, OperationMetadata> verifyMigrationJobAsync( 1329 VerifyMigrationJobRequest request) { 1330 return verifyMigrationJobOperationCallable().futureCall(request); 1331 } 1332 1333 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1334 /** 1335 * Verify a migration job, making sure the destination can reach the source and that all 1336 * configuration and prerequisites are met. 1337 * 1338 * <p>Sample code: 1339 * 1340 * <pre>{@code 1341 * // This snippet has been automatically generated and should be regarded as a code template only. 1342 * // It will require modifications to work: 1343 * // - It may require correct/in-range values for request initialization. 1344 * // - It may require specifying regional endpoints when creating the service client as shown in 1345 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1346 * try (DataMigrationServiceClient dataMigrationServiceClient = 1347 * DataMigrationServiceClient.create()) { 1348 * VerifyMigrationJobRequest request = 1349 * VerifyMigrationJobRequest.newBuilder() 1350 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1351 * .build(); 1352 * OperationFuture<MigrationJob, OperationMetadata> future = 1353 * dataMigrationServiceClient.verifyMigrationJobOperationCallable().futureCall(request); 1354 * // Do something. 1355 * MigrationJob response = future.get(); 1356 * } 1357 * }</pre> 1358 */ 1359 public final OperationCallable<VerifyMigrationJobRequest, MigrationJob, OperationMetadata> verifyMigrationJobOperationCallable()1360 verifyMigrationJobOperationCallable() { 1361 return stub.verifyMigrationJobOperationCallable(); 1362 } 1363 1364 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1365 /** 1366 * Verify a migration job, making sure the destination can reach the source and that all 1367 * configuration and prerequisites are met. 1368 * 1369 * <p>Sample code: 1370 * 1371 * <pre>{@code 1372 * // This snippet has been automatically generated and should be regarded as a code template only. 1373 * // It will require modifications to work: 1374 * // - It may require correct/in-range values for request initialization. 1375 * // - It may require specifying regional endpoints when creating the service client as shown in 1376 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1377 * try (DataMigrationServiceClient dataMigrationServiceClient = 1378 * DataMigrationServiceClient.create()) { 1379 * VerifyMigrationJobRequest request = 1380 * VerifyMigrationJobRequest.newBuilder() 1381 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1382 * .build(); 1383 * ApiFuture<Operation> future = 1384 * dataMigrationServiceClient.verifyMigrationJobCallable().futureCall(request); 1385 * // Do something. 1386 * Operation response = future.get(); 1387 * } 1388 * }</pre> 1389 */ verifyMigrationJobCallable()1390 public final UnaryCallable<VerifyMigrationJobRequest, Operation> verifyMigrationJobCallable() { 1391 return stub.verifyMigrationJobCallable(); 1392 } 1393 1394 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1395 /** 1396 * Restart a stopped or failed migration job, resetting the destination instance to its original 1397 * state and starting the migration process from scratch. 1398 * 1399 * <p>Sample code: 1400 * 1401 * <pre>{@code 1402 * // This snippet has been automatically generated and should be regarded as a code template only. 1403 * // It will require modifications to work: 1404 * // - It may require correct/in-range values for request initialization. 1405 * // - It may require specifying regional endpoints when creating the service client as shown in 1406 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1407 * try (DataMigrationServiceClient dataMigrationServiceClient = 1408 * DataMigrationServiceClient.create()) { 1409 * RestartMigrationJobRequest request = 1410 * RestartMigrationJobRequest.newBuilder() 1411 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1412 * .build(); 1413 * MigrationJob response = dataMigrationServiceClient.restartMigrationJobAsync(request).get(); 1414 * } 1415 * }</pre> 1416 * 1417 * @param request The request object containing all of the parameters for the API call. 1418 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1419 */ restartMigrationJobAsync( RestartMigrationJobRequest request)1420 public final OperationFuture<MigrationJob, OperationMetadata> restartMigrationJobAsync( 1421 RestartMigrationJobRequest request) { 1422 return restartMigrationJobOperationCallable().futureCall(request); 1423 } 1424 1425 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1426 /** 1427 * Restart a stopped or failed migration job, resetting the destination instance to its original 1428 * state and starting the migration process from scratch. 1429 * 1430 * <p>Sample code: 1431 * 1432 * <pre>{@code 1433 * // This snippet has been automatically generated and should be regarded as a code template only. 1434 * // It will require modifications to work: 1435 * // - It may require correct/in-range values for request initialization. 1436 * // - It may require specifying regional endpoints when creating the service client as shown in 1437 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1438 * try (DataMigrationServiceClient dataMigrationServiceClient = 1439 * DataMigrationServiceClient.create()) { 1440 * RestartMigrationJobRequest request = 1441 * RestartMigrationJobRequest.newBuilder() 1442 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1443 * .build(); 1444 * OperationFuture<MigrationJob, OperationMetadata> future = 1445 * dataMigrationServiceClient.restartMigrationJobOperationCallable().futureCall(request); 1446 * // Do something. 1447 * MigrationJob response = future.get(); 1448 * } 1449 * }</pre> 1450 */ 1451 public final OperationCallable<RestartMigrationJobRequest, MigrationJob, OperationMetadata> restartMigrationJobOperationCallable()1452 restartMigrationJobOperationCallable() { 1453 return stub.restartMigrationJobOperationCallable(); 1454 } 1455 1456 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1457 /** 1458 * Restart a stopped or failed migration job, resetting the destination instance to its original 1459 * state and starting the migration process from scratch. 1460 * 1461 * <p>Sample code: 1462 * 1463 * <pre>{@code 1464 * // This snippet has been automatically generated and should be regarded as a code template only. 1465 * // It will require modifications to work: 1466 * // - It may require correct/in-range values for request initialization. 1467 * // - It may require specifying regional endpoints when creating the service client as shown in 1468 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1469 * try (DataMigrationServiceClient dataMigrationServiceClient = 1470 * DataMigrationServiceClient.create()) { 1471 * RestartMigrationJobRequest request = 1472 * RestartMigrationJobRequest.newBuilder() 1473 * .setName(MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1474 * .build(); 1475 * ApiFuture<Operation> future = 1476 * dataMigrationServiceClient.restartMigrationJobCallable().futureCall(request); 1477 * // Do something. 1478 * Operation response = future.get(); 1479 * } 1480 * }</pre> 1481 */ restartMigrationJobCallable()1482 public final UnaryCallable<RestartMigrationJobRequest, Operation> restartMigrationJobCallable() { 1483 return stub.restartMigrationJobCallable(); 1484 } 1485 1486 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1487 /** 1488 * Generate a SSH configuration script to configure the reverse SSH connectivity. 1489 * 1490 * <p>Sample code: 1491 * 1492 * <pre>{@code 1493 * // This snippet has been automatically generated and should be regarded as a code template only. 1494 * // It will require modifications to work: 1495 * // - It may require correct/in-range values for request initialization. 1496 * // - It may require specifying regional endpoints when creating the service client as shown in 1497 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1498 * try (DataMigrationServiceClient dataMigrationServiceClient = 1499 * DataMigrationServiceClient.create()) { 1500 * GenerateSshScriptRequest request = 1501 * GenerateSshScriptRequest.newBuilder() 1502 * .setMigrationJob( 1503 * MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1504 * .setVm("vm3767") 1505 * .setVmPort(563010825) 1506 * .build(); 1507 * SshScript response = dataMigrationServiceClient.generateSshScript(request); 1508 * } 1509 * }</pre> 1510 * 1511 * @param request The request object containing all of the parameters for the API call. 1512 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1513 */ generateSshScript(GenerateSshScriptRequest request)1514 public final SshScript generateSshScript(GenerateSshScriptRequest request) { 1515 return generateSshScriptCallable().call(request); 1516 } 1517 1518 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1519 /** 1520 * Generate a SSH configuration script to configure the reverse SSH connectivity. 1521 * 1522 * <p>Sample code: 1523 * 1524 * <pre>{@code 1525 * // This snippet has been automatically generated and should be regarded as a code template only. 1526 * // It will require modifications to work: 1527 * // - It may require correct/in-range values for request initialization. 1528 * // - It may require specifying regional endpoints when creating the service client as shown in 1529 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1530 * try (DataMigrationServiceClient dataMigrationServiceClient = 1531 * DataMigrationServiceClient.create()) { 1532 * GenerateSshScriptRequest request = 1533 * GenerateSshScriptRequest.newBuilder() 1534 * .setMigrationJob( 1535 * MigrationJobName.of("[PROJECT]", "[LOCATION]", "[MIGRATION_JOB]").toString()) 1536 * .setVm("vm3767") 1537 * .setVmPort(563010825) 1538 * .build(); 1539 * ApiFuture<SshScript> future = 1540 * dataMigrationServiceClient.generateSshScriptCallable().futureCall(request); 1541 * // Do something. 1542 * SshScript response = future.get(); 1543 * } 1544 * }</pre> 1545 */ generateSshScriptCallable()1546 public final UnaryCallable<GenerateSshScriptRequest, SshScript> generateSshScriptCallable() { 1547 return stub.generateSshScriptCallable(); 1548 } 1549 1550 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1551 /** 1552 * Retrieve a list of all connection profiles in a given project and location. 1553 * 1554 * <p>Sample code: 1555 * 1556 * <pre>{@code 1557 * // This snippet has been automatically generated and should be regarded as a code template only. 1558 * // It will require modifications to work: 1559 * // - It may require correct/in-range values for request initialization. 1560 * // - It may require specifying regional endpoints when creating the service client as shown in 1561 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1562 * try (DataMigrationServiceClient dataMigrationServiceClient = 1563 * DataMigrationServiceClient.create()) { 1564 * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); 1565 * for (ConnectionProfile element : 1566 * dataMigrationServiceClient.listConnectionProfiles(parent).iterateAll()) { 1567 * // doThingsWith(element); 1568 * } 1569 * } 1570 * }</pre> 1571 * 1572 * @param parent Required. The parent, which owns this collection of connection profiles. 1573 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1574 */ listConnectionProfiles(LocationName parent)1575 public final ListConnectionProfilesPagedResponse listConnectionProfiles(LocationName parent) { 1576 ListConnectionProfilesRequest request = 1577 ListConnectionProfilesRequest.newBuilder() 1578 .setParent(parent == null ? null : parent.toString()) 1579 .build(); 1580 return listConnectionProfiles(request); 1581 } 1582 1583 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1584 /** 1585 * Retrieve a list of all connection profiles in a given project and location. 1586 * 1587 * <p>Sample code: 1588 * 1589 * <pre>{@code 1590 * // This snippet has been automatically generated and should be regarded as a code template only. 1591 * // It will require modifications to work: 1592 * // - It may require correct/in-range values for request initialization. 1593 * // - It may require specifying regional endpoints when creating the service client as shown in 1594 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1595 * try (DataMigrationServiceClient dataMigrationServiceClient = 1596 * DataMigrationServiceClient.create()) { 1597 * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); 1598 * for (ConnectionProfile element : 1599 * dataMigrationServiceClient.listConnectionProfiles(parent).iterateAll()) { 1600 * // doThingsWith(element); 1601 * } 1602 * } 1603 * }</pre> 1604 * 1605 * @param parent Required. The parent, which owns this collection of connection profiles. 1606 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1607 */ listConnectionProfiles(String parent)1608 public final ListConnectionProfilesPagedResponse listConnectionProfiles(String parent) { 1609 ListConnectionProfilesRequest request = 1610 ListConnectionProfilesRequest.newBuilder().setParent(parent).build(); 1611 return listConnectionProfiles(request); 1612 } 1613 1614 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1615 /** 1616 * Retrieve a list of all connection profiles in a given project and location. 1617 * 1618 * <p>Sample code: 1619 * 1620 * <pre>{@code 1621 * // This snippet has been automatically generated and should be regarded as a code template only. 1622 * // It will require modifications to work: 1623 * // - It may require correct/in-range values for request initialization. 1624 * // - It may require specifying regional endpoints when creating the service client as shown in 1625 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1626 * try (DataMigrationServiceClient dataMigrationServiceClient = 1627 * DataMigrationServiceClient.create()) { 1628 * ListConnectionProfilesRequest request = 1629 * ListConnectionProfilesRequest.newBuilder() 1630 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1631 * .setPageSize(883849137) 1632 * .setPageToken("pageToken873572522") 1633 * .setFilter("filter-1274492040") 1634 * .setOrderBy("orderBy-1207110587") 1635 * .build(); 1636 * for (ConnectionProfile element : 1637 * dataMigrationServiceClient.listConnectionProfiles(request).iterateAll()) { 1638 * // doThingsWith(element); 1639 * } 1640 * } 1641 * }</pre> 1642 * 1643 * @param request The request object containing all of the parameters for the API call. 1644 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1645 */ listConnectionProfiles( ListConnectionProfilesRequest request)1646 public final ListConnectionProfilesPagedResponse listConnectionProfiles( 1647 ListConnectionProfilesRequest request) { 1648 return listConnectionProfilesPagedCallable().call(request); 1649 } 1650 1651 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1652 /** 1653 * Retrieve a list of all connection profiles in a given project and location. 1654 * 1655 * <p>Sample code: 1656 * 1657 * <pre>{@code 1658 * // This snippet has been automatically generated and should be regarded as a code template only. 1659 * // It will require modifications to work: 1660 * // - It may require correct/in-range values for request initialization. 1661 * // - It may require specifying regional endpoints when creating the service client as shown in 1662 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1663 * try (DataMigrationServiceClient dataMigrationServiceClient = 1664 * DataMigrationServiceClient.create()) { 1665 * ListConnectionProfilesRequest request = 1666 * ListConnectionProfilesRequest.newBuilder() 1667 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1668 * .setPageSize(883849137) 1669 * .setPageToken("pageToken873572522") 1670 * .setFilter("filter-1274492040") 1671 * .setOrderBy("orderBy-1207110587") 1672 * .build(); 1673 * ApiFuture<ConnectionProfile> future = 1674 * dataMigrationServiceClient.listConnectionProfilesPagedCallable().futureCall(request); 1675 * // Do something. 1676 * for (ConnectionProfile element : future.get().iterateAll()) { 1677 * // doThingsWith(element); 1678 * } 1679 * } 1680 * }</pre> 1681 */ 1682 public final UnaryCallable<ListConnectionProfilesRequest, ListConnectionProfilesPagedResponse> listConnectionProfilesPagedCallable()1683 listConnectionProfilesPagedCallable() { 1684 return stub.listConnectionProfilesPagedCallable(); 1685 } 1686 1687 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1688 /** 1689 * Retrieve a list of all connection profiles in a given project and location. 1690 * 1691 * <p>Sample code: 1692 * 1693 * <pre>{@code 1694 * // This snippet has been automatically generated and should be regarded as a code template only. 1695 * // It will require modifications to work: 1696 * // - It may require correct/in-range values for request initialization. 1697 * // - It may require specifying regional endpoints when creating the service client as shown in 1698 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1699 * try (DataMigrationServiceClient dataMigrationServiceClient = 1700 * DataMigrationServiceClient.create()) { 1701 * ListConnectionProfilesRequest request = 1702 * ListConnectionProfilesRequest.newBuilder() 1703 * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) 1704 * .setPageSize(883849137) 1705 * .setPageToken("pageToken873572522") 1706 * .setFilter("filter-1274492040") 1707 * .setOrderBy("orderBy-1207110587") 1708 * .build(); 1709 * while (true) { 1710 * ListConnectionProfilesResponse response = 1711 * dataMigrationServiceClient.listConnectionProfilesCallable().call(request); 1712 * for (ConnectionProfile element : response.getConnectionProfilesList()) { 1713 * // doThingsWith(element); 1714 * } 1715 * String nextPageToken = response.getNextPageToken(); 1716 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1717 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1718 * } else { 1719 * break; 1720 * } 1721 * } 1722 * } 1723 * }</pre> 1724 */ 1725 public final UnaryCallable<ListConnectionProfilesRequest, ListConnectionProfilesResponse> listConnectionProfilesCallable()1726 listConnectionProfilesCallable() { 1727 return stub.listConnectionProfilesCallable(); 1728 } 1729 1730 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1731 /** 1732 * Gets details of a single connection profile. 1733 * 1734 * <p>Sample code: 1735 * 1736 * <pre>{@code 1737 * // This snippet has been automatically generated and should be regarded as a code template only. 1738 * // It will require modifications to work: 1739 * // - It may require correct/in-range values for request initialization. 1740 * // - It may require specifying regional endpoints when creating the service client as shown in 1741 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1742 * try (DataMigrationServiceClient dataMigrationServiceClient = 1743 * DataMigrationServiceClient.create()) { 1744 * ConnectionProfileName name = 1745 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); 1746 * ConnectionProfile response = dataMigrationServiceClient.getConnectionProfile(name); 1747 * } 1748 * }</pre> 1749 * 1750 * @param name Required. Name of the connection profile resource to get. 1751 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1752 */ getConnectionProfile(ConnectionProfileName name)1753 public final ConnectionProfile getConnectionProfile(ConnectionProfileName name) { 1754 GetConnectionProfileRequest request = 1755 GetConnectionProfileRequest.newBuilder() 1756 .setName(name == null ? null : name.toString()) 1757 .build(); 1758 return getConnectionProfile(request); 1759 } 1760 1761 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1762 /** 1763 * Gets details of a single connection profile. 1764 * 1765 * <p>Sample code: 1766 * 1767 * <pre>{@code 1768 * // This snippet has been automatically generated and should be regarded as a code template only. 1769 * // It will require modifications to work: 1770 * // - It may require correct/in-range values for request initialization. 1771 * // - It may require specifying regional endpoints when creating the service client as shown in 1772 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1773 * try (DataMigrationServiceClient dataMigrationServiceClient = 1774 * DataMigrationServiceClient.create()) { 1775 * String name = 1776 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); 1777 * ConnectionProfile response = dataMigrationServiceClient.getConnectionProfile(name); 1778 * } 1779 * }</pre> 1780 * 1781 * @param name Required. Name of the connection profile resource to get. 1782 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1783 */ getConnectionProfile(String name)1784 public final ConnectionProfile getConnectionProfile(String name) { 1785 GetConnectionProfileRequest request = 1786 GetConnectionProfileRequest.newBuilder().setName(name).build(); 1787 return getConnectionProfile(request); 1788 } 1789 1790 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1791 /** 1792 * Gets details of a single connection profile. 1793 * 1794 * <p>Sample code: 1795 * 1796 * <pre>{@code 1797 * // This snippet has been automatically generated and should be regarded as a code template only. 1798 * // It will require modifications to work: 1799 * // - It may require correct/in-range values for request initialization. 1800 * // - It may require specifying regional endpoints when creating the service client as shown in 1801 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1802 * try (DataMigrationServiceClient dataMigrationServiceClient = 1803 * DataMigrationServiceClient.create()) { 1804 * GetConnectionProfileRequest request = 1805 * GetConnectionProfileRequest.newBuilder() 1806 * .setName( 1807 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 1808 * .toString()) 1809 * .build(); 1810 * ConnectionProfile response = dataMigrationServiceClient.getConnectionProfile(request); 1811 * } 1812 * }</pre> 1813 * 1814 * @param request The request object containing all of the parameters for the API call. 1815 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1816 */ getConnectionProfile(GetConnectionProfileRequest request)1817 public final ConnectionProfile getConnectionProfile(GetConnectionProfileRequest request) { 1818 return getConnectionProfileCallable().call(request); 1819 } 1820 1821 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1822 /** 1823 * Gets details of a single connection profile. 1824 * 1825 * <p>Sample code: 1826 * 1827 * <pre>{@code 1828 * // This snippet has been automatically generated and should be regarded as a code template only. 1829 * // It will require modifications to work: 1830 * // - It may require correct/in-range values for request initialization. 1831 * // - It may require specifying regional endpoints when creating the service client as shown in 1832 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1833 * try (DataMigrationServiceClient dataMigrationServiceClient = 1834 * DataMigrationServiceClient.create()) { 1835 * GetConnectionProfileRequest request = 1836 * GetConnectionProfileRequest.newBuilder() 1837 * .setName( 1838 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 1839 * .toString()) 1840 * .build(); 1841 * ApiFuture<ConnectionProfile> future = 1842 * dataMigrationServiceClient.getConnectionProfileCallable().futureCall(request); 1843 * // Do something. 1844 * ConnectionProfile response = future.get(); 1845 * } 1846 * }</pre> 1847 */ 1848 public final UnaryCallable<GetConnectionProfileRequest, ConnectionProfile> getConnectionProfileCallable()1849 getConnectionProfileCallable() { 1850 return stub.getConnectionProfileCallable(); 1851 } 1852 1853 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1854 /** 1855 * Creates a new connection profile in a given project and location. 1856 * 1857 * <p>Sample code: 1858 * 1859 * <pre>{@code 1860 * // This snippet has been automatically generated and should be regarded as a code template only. 1861 * // It will require modifications to work: 1862 * // - It may require correct/in-range values for request initialization. 1863 * // - It may require specifying regional endpoints when creating the service client as shown in 1864 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1865 * try (DataMigrationServiceClient dataMigrationServiceClient = 1866 * DataMigrationServiceClient.create()) { 1867 * ConnectionProfileName parent = 1868 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); 1869 * ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); 1870 * String connectionProfileId = "connectionProfileId597575526"; 1871 * ConnectionProfile response = 1872 * dataMigrationServiceClient 1873 * .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) 1874 * .get(); 1875 * } 1876 * }</pre> 1877 * 1878 * @param parent Required. The parent, which owns this collection of connection profiles. 1879 * @param connectionProfile Required. The create request body including the connection profile 1880 * data 1881 * @param connectionProfileId Required. The connection profile identifier. 1882 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1883 */ createConnectionProfileAsync( ConnectionProfileName parent, ConnectionProfile connectionProfile, String connectionProfileId)1884 public final OperationFuture<ConnectionProfile, OperationMetadata> createConnectionProfileAsync( 1885 ConnectionProfileName parent, 1886 ConnectionProfile connectionProfile, 1887 String connectionProfileId) { 1888 CreateConnectionProfileRequest request = 1889 CreateConnectionProfileRequest.newBuilder() 1890 .setParent(parent == null ? null : parent.toString()) 1891 .setConnectionProfile(connectionProfile) 1892 .setConnectionProfileId(connectionProfileId) 1893 .build(); 1894 return createConnectionProfileAsync(request); 1895 } 1896 1897 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1898 /** 1899 * Creates a new connection profile in a given project and location. 1900 * 1901 * <p>Sample code: 1902 * 1903 * <pre>{@code 1904 * // This snippet has been automatically generated and should be regarded as a code template only. 1905 * // It will require modifications to work: 1906 * // - It may require correct/in-range values for request initialization. 1907 * // - It may require specifying regional endpoints when creating the service client as shown in 1908 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1909 * try (DataMigrationServiceClient dataMigrationServiceClient = 1910 * DataMigrationServiceClient.create()) { 1911 * String parent = 1912 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); 1913 * ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); 1914 * String connectionProfileId = "connectionProfileId597575526"; 1915 * ConnectionProfile response = 1916 * dataMigrationServiceClient 1917 * .createConnectionProfileAsync(parent, connectionProfile, connectionProfileId) 1918 * .get(); 1919 * } 1920 * }</pre> 1921 * 1922 * @param parent Required. The parent, which owns this collection of connection profiles. 1923 * @param connectionProfile Required. The create request body including the connection profile 1924 * data 1925 * @param connectionProfileId Required. The connection profile identifier. 1926 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1927 */ createConnectionProfileAsync( String parent, ConnectionProfile connectionProfile, String connectionProfileId)1928 public final OperationFuture<ConnectionProfile, OperationMetadata> createConnectionProfileAsync( 1929 String parent, ConnectionProfile connectionProfile, String connectionProfileId) { 1930 CreateConnectionProfileRequest request = 1931 CreateConnectionProfileRequest.newBuilder() 1932 .setParent(parent) 1933 .setConnectionProfile(connectionProfile) 1934 .setConnectionProfileId(connectionProfileId) 1935 .build(); 1936 return createConnectionProfileAsync(request); 1937 } 1938 1939 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1940 /** 1941 * Creates a new connection profile in a given project and location. 1942 * 1943 * <p>Sample code: 1944 * 1945 * <pre>{@code 1946 * // This snippet has been automatically generated and should be regarded as a code template only. 1947 * // It will require modifications to work: 1948 * // - It may require correct/in-range values for request initialization. 1949 * // - It may require specifying regional endpoints when creating the service client as shown in 1950 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1951 * try (DataMigrationServiceClient dataMigrationServiceClient = 1952 * DataMigrationServiceClient.create()) { 1953 * CreateConnectionProfileRequest request = 1954 * CreateConnectionProfileRequest.newBuilder() 1955 * .setParent( 1956 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 1957 * .toString()) 1958 * .setConnectionProfileId("connectionProfileId597575526") 1959 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 1960 * .setRequestId("requestId693933066") 1961 * .build(); 1962 * ConnectionProfile response = 1963 * dataMigrationServiceClient.createConnectionProfileAsync(request).get(); 1964 * } 1965 * }</pre> 1966 * 1967 * @param request The request object containing all of the parameters for the API call. 1968 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1969 */ createConnectionProfileAsync( CreateConnectionProfileRequest request)1970 public final OperationFuture<ConnectionProfile, OperationMetadata> createConnectionProfileAsync( 1971 CreateConnectionProfileRequest request) { 1972 return createConnectionProfileOperationCallable().futureCall(request); 1973 } 1974 1975 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1976 /** 1977 * Creates a new connection profile in a given project and location. 1978 * 1979 * <p>Sample code: 1980 * 1981 * <pre>{@code 1982 * // This snippet has been automatically generated and should be regarded as a code template only. 1983 * // It will require modifications to work: 1984 * // - It may require correct/in-range values for request initialization. 1985 * // - It may require specifying regional endpoints when creating the service client as shown in 1986 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1987 * try (DataMigrationServiceClient dataMigrationServiceClient = 1988 * DataMigrationServiceClient.create()) { 1989 * CreateConnectionProfileRequest request = 1990 * CreateConnectionProfileRequest.newBuilder() 1991 * .setParent( 1992 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 1993 * .toString()) 1994 * .setConnectionProfileId("connectionProfileId597575526") 1995 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 1996 * .setRequestId("requestId693933066") 1997 * .build(); 1998 * OperationFuture<ConnectionProfile, OperationMetadata> future = 1999 * dataMigrationServiceClient.createConnectionProfileOperationCallable().futureCall(request); 2000 * // Do something. 2001 * ConnectionProfile response = future.get(); 2002 * } 2003 * }</pre> 2004 */ 2005 public final OperationCallable< 2006 CreateConnectionProfileRequest, ConnectionProfile, OperationMetadata> createConnectionProfileOperationCallable()2007 createConnectionProfileOperationCallable() { 2008 return stub.createConnectionProfileOperationCallable(); 2009 } 2010 2011 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2012 /** 2013 * Creates a new connection profile in a given project and location. 2014 * 2015 * <p>Sample code: 2016 * 2017 * <pre>{@code 2018 * // This snippet has been automatically generated and should be regarded as a code template only. 2019 * // It will require modifications to work: 2020 * // - It may require correct/in-range values for request initialization. 2021 * // - It may require specifying regional endpoints when creating the service client as shown in 2022 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2023 * try (DataMigrationServiceClient dataMigrationServiceClient = 2024 * DataMigrationServiceClient.create()) { 2025 * CreateConnectionProfileRequest request = 2026 * CreateConnectionProfileRequest.newBuilder() 2027 * .setParent( 2028 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 2029 * .toString()) 2030 * .setConnectionProfileId("connectionProfileId597575526") 2031 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 2032 * .setRequestId("requestId693933066") 2033 * .build(); 2034 * ApiFuture<Operation> future = 2035 * dataMigrationServiceClient.createConnectionProfileCallable().futureCall(request); 2036 * // Do something. 2037 * Operation response = future.get(); 2038 * } 2039 * }</pre> 2040 */ 2041 public final UnaryCallable<CreateConnectionProfileRequest, Operation> createConnectionProfileCallable()2042 createConnectionProfileCallable() { 2043 return stub.createConnectionProfileCallable(); 2044 } 2045 2046 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2047 /** 2048 * Update the configuration of a single connection profile. 2049 * 2050 * <p>Sample code: 2051 * 2052 * <pre>{@code 2053 * // This snippet has been automatically generated and should be regarded as a code template only. 2054 * // It will require modifications to work: 2055 * // - It may require correct/in-range values for request initialization. 2056 * // - It may require specifying regional endpoints when creating the service client as shown in 2057 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2058 * try (DataMigrationServiceClient dataMigrationServiceClient = 2059 * DataMigrationServiceClient.create()) { 2060 * ConnectionProfile connectionProfile = ConnectionProfile.newBuilder().build(); 2061 * FieldMask updateMask = FieldMask.newBuilder().build(); 2062 * ConnectionProfile response = 2063 * dataMigrationServiceClient 2064 * .updateConnectionProfileAsync(connectionProfile, updateMask) 2065 * .get(); 2066 * } 2067 * }</pre> 2068 * 2069 * @param connectionProfile Required. The connection profile parameters to update. 2070 * @param updateMask Required. Field mask is used to specify the fields to be overwritten in the 2071 * connection profile resource by the update. 2072 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2073 */ updateConnectionProfileAsync( ConnectionProfile connectionProfile, FieldMask updateMask)2074 public final OperationFuture<ConnectionProfile, OperationMetadata> updateConnectionProfileAsync( 2075 ConnectionProfile connectionProfile, FieldMask updateMask) { 2076 UpdateConnectionProfileRequest request = 2077 UpdateConnectionProfileRequest.newBuilder() 2078 .setConnectionProfile(connectionProfile) 2079 .setUpdateMask(updateMask) 2080 .build(); 2081 return updateConnectionProfileAsync(request); 2082 } 2083 2084 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2085 /** 2086 * Update the configuration of a single connection profile. 2087 * 2088 * <p>Sample code: 2089 * 2090 * <pre>{@code 2091 * // This snippet has been automatically generated and should be regarded as a code template only. 2092 * // It will require modifications to work: 2093 * // - It may require correct/in-range values for request initialization. 2094 * // - It may require specifying regional endpoints when creating the service client as shown in 2095 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2096 * try (DataMigrationServiceClient dataMigrationServiceClient = 2097 * DataMigrationServiceClient.create()) { 2098 * UpdateConnectionProfileRequest request = 2099 * UpdateConnectionProfileRequest.newBuilder() 2100 * .setUpdateMask(FieldMask.newBuilder().build()) 2101 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 2102 * .setRequestId("requestId693933066") 2103 * .build(); 2104 * ConnectionProfile response = 2105 * dataMigrationServiceClient.updateConnectionProfileAsync(request).get(); 2106 * } 2107 * }</pre> 2108 * 2109 * @param request The request object containing all of the parameters for the API call. 2110 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2111 */ updateConnectionProfileAsync( UpdateConnectionProfileRequest request)2112 public final OperationFuture<ConnectionProfile, OperationMetadata> updateConnectionProfileAsync( 2113 UpdateConnectionProfileRequest request) { 2114 return updateConnectionProfileOperationCallable().futureCall(request); 2115 } 2116 2117 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2118 /** 2119 * Update the configuration of a single connection profile. 2120 * 2121 * <p>Sample code: 2122 * 2123 * <pre>{@code 2124 * // This snippet has been automatically generated and should be regarded as a code template only. 2125 * // It will require modifications to work: 2126 * // - It may require correct/in-range values for request initialization. 2127 * // - It may require specifying regional endpoints when creating the service client as shown in 2128 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2129 * try (DataMigrationServiceClient dataMigrationServiceClient = 2130 * DataMigrationServiceClient.create()) { 2131 * UpdateConnectionProfileRequest request = 2132 * UpdateConnectionProfileRequest.newBuilder() 2133 * .setUpdateMask(FieldMask.newBuilder().build()) 2134 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 2135 * .setRequestId("requestId693933066") 2136 * .build(); 2137 * OperationFuture<ConnectionProfile, OperationMetadata> future = 2138 * dataMigrationServiceClient.updateConnectionProfileOperationCallable().futureCall(request); 2139 * // Do something. 2140 * ConnectionProfile response = future.get(); 2141 * } 2142 * }</pre> 2143 */ 2144 public final OperationCallable< 2145 UpdateConnectionProfileRequest, ConnectionProfile, OperationMetadata> updateConnectionProfileOperationCallable()2146 updateConnectionProfileOperationCallable() { 2147 return stub.updateConnectionProfileOperationCallable(); 2148 } 2149 2150 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2151 /** 2152 * Update the configuration of a single connection profile. 2153 * 2154 * <p>Sample code: 2155 * 2156 * <pre>{@code 2157 * // This snippet has been automatically generated and should be regarded as a code template only. 2158 * // It will require modifications to work: 2159 * // - It may require correct/in-range values for request initialization. 2160 * // - It may require specifying regional endpoints when creating the service client as shown in 2161 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2162 * try (DataMigrationServiceClient dataMigrationServiceClient = 2163 * DataMigrationServiceClient.create()) { 2164 * UpdateConnectionProfileRequest request = 2165 * UpdateConnectionProfileRequest.newBuilder() 2166 * .setUpdateMask(FieldMask.newBuilder().build()) 2167 * .setConnectionProfile(ConnectionProfile.newBuilder().build()) 2168 * .setRequestId("requestId693933066") 2169 * .build(); 2170 * ApiFuture<Operation> future = 2171 * dataMigrationServiceClient.updateConnectionProfileCallable().futureCall(request); 2172 * // Do something. 2173 * Operation response = future.get(); 2174 * } 2175 * }</pre> 2176 */ 2177 public final UnaryCallable<UpdateConnectionProfileRequest, Operation> updateConnectionProfileCallable()2178 updateConnectionProfileCallable() { 2179 return stub.updateConnectionProfileCallable(); 2180 } 2181 2182 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2183 /** 2184 * Deletes a single Database Migration Service connection profile. A connection profile can only 2185 * be deleted if it is not in use by any active migration jobs. 2186 * 2187 * <p>Sample code: 2188 * 2189 * <pre>{@code 2190 * // This snippet has been automatically generated and should be regarded as a code template only. 2191 * // It will require modifications to work: 2192 * // - It may require correct/in-range values for request initialization. 2193 * // - It may require specifying regional endpoints when creating the service client as shown in 2194 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2195 * try (DataMigrationServiceClient dataMigrationServiceClient = 2196 * DataMigrationServiceClient.create()) { 2197 * ConnectionProfileName name = 2198 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]"); 2199 * dataMigrationServiceClient.deleteConnectionProfileAsync(name).get(); 2200 * } 2201 * }</pre> 2202 * 2203 * @param name Required. Name of the connection profile resource to delete. 2204 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2205 */ deleteConnectionProfileAsync( ConnectionProfileName name)2206 public final OperationFuture<Empty, OperationMetadata> deleteConnectionProfileAsync( 2207 ConnectionProfileName name) { 2208 DeleteConnectionProfileRequest request = 2209 DeleteConnectionProfileRequest.newBuilder() 2210 .setName(name == null ? null : name.toString()) 2211 .build(); 2212 return deleteConnectionProfileAsync(request); 2213 } 2214 2215 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2216 /** 2217 * Deletes a single Database Migration Service connection profile. A connection profile can only 2218 * be deleted if it is not in use by any active migration jobs. 2219 * 2220 * <p>Sample code: 2221 * 2222 * <pre>{@code 2223 * // This snippet has been automatically generated and should be regarded as a code template only. 2224 * // It will require modifications to work: 2225 * // - It may require correct/in-range values for request initialization. 2226 * // - It may require specifying regional endpoints when creating the service client as shown in 2227 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2228 * try (DataMigrationServiceClient dataMigrationServiceClient = 2229 * DataMigrationServiceClient.create()) { 2230 * String name = 2231 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]").toString(); 2232 * dataMigrationServiceClient.deleteConnectionProfileAsync(name).get(); 2233 * } 2234 * }</pre> 2235 * 2236 * @param name Required. Name of the connection profile resource to delete. 2237 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2238 */ deleteConnectionProfileAsync(String name)2239 public final OperationFuture<Empty, OperationMetadata> deleteConnectionProfileAsync(String name) { 2240 DeleteConnectionProfileRequest request = 2241 DeleteConnectionProfileRequest.newBuilder().setName(name).build(); 2242 return deleteConnectionProfileAsync(request); 2243 } 2244 2245 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2246 /** 2247 * Deletes a single Database Migration Service connection profile. A connection profile can only 2248 * be deleted if it is not in use by any active migration jobs. 2249 * 2250 * <p>Sample code: 2251 * 2252 * <pre>{@code 2253 * // This snippet has been automatically generated and should be regarded as a code template only. 2254 * // It will require modifications to work: 2255 * // - It may require correct/in-range values for request initialization. 2256 * // - It may require specifying regional endpoints when creating the service client as shown in 2257 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2258 * try (DataMigrationServiceClient dataMigrationServiceClient = 2259 * DataMigrationServiceClient.create()) { 2260 * DeleteConnectionProfileRequest request = 2261 * DeleteConnectionProfileRequest.newBuilder() 2262 * .setName( 2263 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 2264 * .toString()) 2265 * .setRequestId("requestId693933066") 2266 * .setForce(true) 2267 * .build(); 2268 * dataMigrationServiceClient.deleteConnectionProfileAsync(request).get(); 2269 * } 2270 * }</pre> 2271 * 2272 * @param request The request object containing all of the parameters for the API call. 2273 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2274 */ deleteConnectionProfileAsync( DeleteConnectionProfileRequest request)2275 public final OperationFuture<Empty, OperationMetadata> deleteConnectionProfileAsync( 2276 DeleteConnectionProfileRequest request) { 2277 return deleteConnectionProfileOperationCallable().futureCall(request); 2278 } 2279 2280 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2281 /** 2282 * Deletes a single Database Migration Service connection profile. A connection profile can only 2283 * be deleted if it is not in use by any active migration jobs. 2284 * 2285 * <p>Sample code: 2286 * 2287 * <pre>{@code 2288 * // This snippet has been automatically generated and should be regarded as a code template only. 2289 * // It will require modifications to work: 2290 * // - It may require correct/in-range values for request initialization. 2291 * // - It may require specifying regional endpoints when creating the service client as shown in 2292 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2293 * try (DataMigrationServiceClient dataMigrationServiceClient = 2294 * DataMigrationServiceClient.create()) { 2295 * DeleteConnectionProfileRequest request = 2296 * DeleteConnectionProfileRequest.newBuilder() 2297 * .setName( 2298 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 2299 * .toString()) 2300 * .setRequestId("requestId693933066") 2301 * .setForce(true) 2302 * .build(); 2303 * OperationFuture<Empty, OperationMetadata> future = 2304 * dataMigrationServiceClient.deleteConnectionProfileOperationCallable().futureCall(request); 2305 * // Do something. 2306 * future.get(); 2307 * } 2308 * }</pre> 2309 */ 2310 public final OperationCallable<DeleteConnectionProfileRequest, Empty, OperationMetadata> deleteConnectionProfileOperationCallable()2311 deleteConnectionProfileOperationCallable() { 2312 return stub.deleteConnectionProfileOperationCallable(); 2313 } 2314 2315 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2316 /** 2317 * Deletes a single Database Migration Service connection profile. A connection profile can only 2318 * be deleted if it is not in use by any active migration jobs. 2319 * 2320 * <p>Sample code: 2321 * 2322 * <pre>{@code 2323 * // This snippet has been automatically generated and should be regarded as a code template only. 2324 * // It will require modifications to work: 2325 * // - It may require correct/in-range values for request initialization. 2326 * // - It may require specifying regional endpoints when creating the service client as shown in 2327 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2328 * try (DataMigrationServiceClient dataMigrationServiceClient = 2329 * DataMigrationServiceClient.create()) { 2330 * DeleteConnectionProfileRequest request = 2331 * DeleteConnectionProfileRequest.newBuilder() 2332 * .setName( 2333 * ConnectionProfileName.of("[PROJECT]", "[LOCATION]", "[CONNECTION_PROFILE]") 2334 * .toString()) 2335 * .setRequestId("requestId693933066") 2336 * .setForce(true) 2337 * .build(); 2338 * ApiFuture<Operation> future = 2339 * dataMigrationServiceClient.deleteConnectionProfileCallable().futureCall(request); 2340 * // Do something. 2341 * future.get(); 2342 * } 2343 * }</pre> 2344 */ 2345 public final UnaryCallable<DeleteConnectionProfileRequest, Operation> deleteConnectionProfileCallable()2346 deleteConnectionProfileCallable() { 2347 return stub.deleteConnectionProfileCallable(); 2348 } 2349 2350 @Override close()2351 public final void close() { 2352 stub.close(); 2353 } 2354 2355 @Override shutdown()2356 public void shutdown() { 2357 stub.shutdown(); 2358 } 2359 2360 @Override isShutdown()2361 public boolean isShutdown() { 2362 return stub.isShutdown(); 2363 } 2364 2365 @Override isTerminated()2366 public boolean isTerminated() { 2367 return stub.isTerminated(); 2368 } 2369 2370 @Override shutdownNow()2371 public void shutdownNow() { 2372 stub.shutdownNow(); 2373 } 2374 2375 @Override awaitTermination(long duration, TimeUnit unit)2376 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 2377 return stub.awaitTermination(duration, unit); 2378 } 2379 2380 public static class ListMigrationJobsPagedResponse 2381 extends AbstractPagedListResponse< 2382 ListMigrationJobsRequest, 2383 ListMigrationJobsResponse, 2384 MigrationJob, 2385 ListMigrationJobsPage, 2386 ListMigrationJobsFixedSizeCollection> { 2387 createAsync( PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, ApiFuture<ListMigrationJobsResponse> futureResponse)2388 public static ApiFuture<ListMigrationJobsPagedResponse> createAsync( 2389 PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, 2390 ApiFuture<ListMigrationJobsResponse> futureResponse) { 2391 ApiFuture<ListMigrationJobsPage> futurePage = 2392 ListMigrationJobsPage.createEmptyPage().createPageAsync(context, futureResponse); 2393 return ApiFutures.transform( 2394 futurePage, 2395 input -> new ListMigrationJobsPagedResponse(input), 2396 MoreExecutors.directExecutor()); 2397 } 2398 ListMigrationJobsPagedResponse(ListMigrationJobsPage page)2399 private ListMigrationJobsPagedResponse(ListMigrationJobsPage page) { 2400 super(page, ListMigrationJobsFixedSizeCollection.createEmptyCollection()); 2401 } 2402 } 2403 2404 public static class ListMigrationJobsPage 2405 extends AbstractPage< 2406 ListMigrationJobsRequest, 2407 ListMigrationJobsResponse, 2408 MigrationJob, 2409 ListMigrationJobsPage> { 2410 ListMigrationJobsPage( PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, ListMigrationJobsResponse response)2411 private ListMigrationJobsPage( 2412 PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, 2413 ListMigrationJobsResponse response) { 2414 super(context, response); 2415 } 2416 createEmptyPage()2417 private static ListMigrationJobsPage createEmptyPage() { 2418 return new ListMigrationJobsPage(null, null); 2419 } 2420 2421 @Override createPage( PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, ListMigrationJobsResponse response)2422 protected ListMigrationJobsPage createPage( 2423 PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, 2424 ListMigrationJobsResponse response) { 2425 return new ListMigrationJobsPage(context, response); 2426 } 2427 2428 @Override createPageAsync( PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, ApiFuture<ListMigrationJobsResponse> futureResponse)2429 public ApiFuture<ListMigrationJobsPage> createPageAsync( 2430 PageContext<ListMigrationJobsRequest, ListMigrationJobsResponse, MigrationJob> context, 2431 ApiFuture<ListMigrationJobsResponse> futureResponse) { 2432 return super.createPageAsync(context, futureResponse); 2433 } 2434 } 2435 2436 public static class ListMigrationJobsFixedSizeCollection 2437 extends AbstractFixedSizeCollection< 2438 ListMigrationJobsRequest, 2439 ListMigrationJobsResponse, 2440 MigrationJob, 2441 ListMigrationJobsPage, 2442 ListMigrationJobsFixedSizeCollection> { 2443 ListMigrationJobsFixedSizeCollection( List<ListMigrationJobsPage> pages, int collectionSize)2444 private ListMigrationJobsFixedSizeCollection( 2445 List<ListMigrationJobsPage> pages, int collectionSize) { 2446 super(pages, collectionSize); 2447 } 2448 createEmptyCollection()2449 private static ListMigrationJobsFixedSizeCollection createEmptyCollection() { 2450 return new ListMigrationJobsFixedSizeCollection(null, 0); 2451 } 2452 2453 @Override createCollection( List<ListMigrationJobsPage> pages, int collectionSize)2454 protected ListMigrationJobsFixedSizeCollection createCollection( 2455 List<ListMigrationJobsPage> pages, int collectionSize) { 2456 return new ListMigrationJobsFixedSizeCollection(pages, collectionSize); 2457 } 2458 } 2459 2460 public static class ListConnectionProfilesPagedResponse 2461 extends AbstractPagedListResponse< 2462 ListConnectionProfilesRequest, 2463 ListConnectionProfilesResponse, 2464 ConnectionProfile, 2465 ListConnectionProfilesPage, 2466 ListConnectionProfilesFixedSizeCollection> { 2467 createAsync( PageContext< ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> context, ApiFuture<ListConnectionProfilesResponse> futureResponse)2468 public static ApiFuture<ListConnectionProfilesPagedResponse> createAsync( 2469 PageContext< 2470 ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> 2471 context, 2472 ApiFuture<ListConnectionProfilesResponse> futureResponse) { 2473 ApiFuture<ListConnectionProfilesPage> futurePage = 2474 ListConnectionProfilesPage.createEmptyPage().createPageAsync(context, futureResponse); 2475 return ApiFutures.transform( 2476 futurePage, 2477 input -> new ListConnectionProfilesPagedResponse(input), 2478 MoreExecutors.directExecutor()); 2479 } 2480 ListConnectionProfilesPagedResponse(ListConnectionProfilesPage page)2481 private ListConnectionProfilesPagedResponse(ListConnectionProfilesPage page) { 2482 super(page, ListConnectionProfilesFixedSizeCollection.createEmptyCollection()); 2483 } 2484 } 2485 2486 public static class ListConnectionProfilesPage 2487 extends AbstractPage< 2488 ListConnectionProfilesRequest, 2489 ListConnectionProfilesResponse, 2490 ConnectionProfile, 2491 ListConnectionProfilesPage> { 2492 ListConnectionProfilesPage( PageContext< ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> context, ListConnectionProfilesResponse response)2493 private ListConnectionProfilesPage( 2494 PageContext< 2495 ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> 2496 context, 2497 ListConnectionProfilesResponse response) { 2498 super(context, response); 2499 } 2500 createEmptyPage()2501 private static ListConnectionProfilesPage createEmptyPage() { 2502 return new ListConnectionProfilesPage(null, null); 2503 } 2504 2505 @Override createPage( PageContext< ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> context, ListConnectionProfilesResponse response)2506 protected ListConnectionProfilesPage createPage( 2507 PageContext< 2508 ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> 2509 context, 2510 ListConnectionProfilesResponse response) { 2511 return new ListConnectionProfilesPage(context, response); 2512 } 2513 2514 @Override createPageAsync( PageContext< ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> context, ApiFuture<ListConnectionProfilesResponse> futureResponse)2515 public ApiFuture<ListConnectionProfilesPage> createPageAsync( 2516 PageContext< 2517 ListConnectionProfilesRequest, ListConnectionProfilesResponse, ConnectionProfile> 2518 context, 2519 ApiFuture<ListConnectionProfilesResponse> futureResponse) { 2520 return super.createPageAsync(context, futureResponse); 2521 } 2522 } 2523 2524 public static class ListConnectionProfilesFixedSizeCollection 2525 extends AbstractFixedSizeCollection< 2526 ListConnectionProfilesRequest, 2527 ListConnectionProfilesResponse, 2528 ConnectionProfile, 2529 ListConnectionProfilesPage, 2530 ListConnectionProfilesFixedSizeCollection> { 2531 ListConnectionProfilesFixedSizeCollection( List<ListConnectionProfilesPage> pages, int collectionSize)2532 private ListConnectionProfilesFixedSizeCollection( 2533 List<ListConnectionProfilesPage> pages, int collectionSize) { 2534 super(pages, collectionSize); 2535 } 2536 createEmptyCollection()2537 private static ListConnectionProfilesFixedSizeCollection createEmptyCollection() { 2538 return new ListConnectionProfilesFixedSizeCollection(null, 0); 2539 } 2540 2541 @Override createCollection( List<ListConnectionProfilesPage> pages, int collectionSize)2542 protected ListConnectionProfilesFixedSizeCollection createCollection( 2543 List<ListConnectionProfilesPage> pages, int collectionSize) { 2544 return new ListConnectionProfilesFixedSizeCollection(pages, collectionSize); 2545 } 2546 } 2547 } 2548