/// <summary>Snippet for BatchMigrateResources</summary> public void BatchMigrateResources() { // Snippet: BatchMigrateResources(string, IEnumerable<MigrateResourceRequest>, CallSettings) // Create client MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; IEnumerable <MigrateResourceRequest> migrateResourceRequests = new MigrateResourceRequest[] { new MigrateResourceRequest(), }; // Make the request Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> response = migrationServiceClient.BatchMigrateResources(parent, migrateResourceRequests); // Poll until the returned long-running operation is complete Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result BatchMigrateResourcesResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> retrievedResponse = migrationServiceClient.PollOnceBatchMigrateResources(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result BatchMigrateResourcesResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for BatchMigrateResourcesAsync</summary> public async Task BatchMigrateResourcesResourceNamesAsync() { // Snippet: BatchMigrateResourcesAsync(LocationName, IEnumerable<MigrateResourceRequest>, CallSettings) // Additional: BatchMigrateResourcesAsync(LocationName, IEnumerable<MigrateResourceRequest>, CancellationToken) // Create client MigrationServiceClient migrationServiceClient = await MigrationServiceClient.CreateAsync(); // Initialize request argument(s) LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"); IEnumerable <MigrateResourceRequest> migrateResourceRequests = new MigrateResourceRequest[] { new MigrateResourceRequest(), }; // Make the request Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> response = await migrationServiceClient.BatchMigrateResourcesAsync(parent, migrateResourceRequests); // Poll until the returned long-running operation is complete Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result BatchMigrateResourcesResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> retrievedResponse = await migrationServiceClient.PollOnceBatchMigrateResourcesAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result BatchMigrateResourcesResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for BatchMigrateResources</summary> public void BatchMigrateResourcesRequestObject() { // Snippet: BatchMigrateResources(BatchMigrateResourcesRequest, CallSettings) // Create client MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create(); // Initialize request argument(s) BatchMigrateResourcesRequest request = new BatchMigrateResourcesRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), MigrateResourceRequests = { new MigrateResourceRequest(), }, }; // Make the request Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> response = migrationServiceClient.BatchMigrateResources(request); // Poll until the returned long-running operation is complete Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result BatchMigrateResourcesResponse result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <BatchMigrateResourcesResponse, BatchMigrateResourcesOperationMetadata> retrievedResponse = migrationServiceClient.PollOnceBatchMigrateResources(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result BatchMigrateResourcesResponse retrievedResult = retrievedResponse.Result; } // End snippet }