コード例 #1
0
        /// <summary>Snippet for BatchMigrateResources</summary>
        public void BatchMigrateResourcesResourceNames()
        {
            // Snippet: BatchMigrateResources(LocationName, IEnumerable<MigrateResourceRequest>, CallSettings)
            // Create client
            MigrationServiceClient migrationServiceClient = MigrationServiceClient.Create();
            // Initialize request argument(s)
            LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[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
        }