/// <summary>Snippet for BatchUpdateJobsAsync</summary> public async Task BatchUpdateJobsAsync() { // Snippet: BatchUpdateJobsAsync(string,IEnumerable<Job>,CallSettings) // Additional: BatchUpdateJobsAsync(string,IEnumerable<Job>,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) string formattedParent = new TenantName("[PROJECT]", "[TENANT]").ToString(); IEnumerable <Job> jobs = new List <Job>(); // Make the request Operation <JobOperationResult, BatchOperationMetadata> response = await jobServiceClient.BatchUpdateJobsAsync(formattedParent, jobs); // Poll until the returned long-running operation is complete Operation <JobOperationResult, BatchOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result JobOperationResult 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 <JobOperationResult, BatchOperationMetadata> retrievedResponse = await jobServiceClient.PollOnceBatchUpdateJobsAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result JobOperationResult retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for BatchUpdateJobsAsync</summary> public async Task BatchUpdateJobsAsync_RequestObject() { // Snippet: BatchUpdateJobsAsync(BatchUpdateJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) BatchUpdateJobsRequest request = new BatchUpdateJobsRequest { Parent = new TenantName("[PROJECT]", "[TENANT]").ToString(), Jobs = { }, }; // Make the request Operation <JobOperationResult, BatchOperationMetadata> response = await jobServiceClient.BatchUpdateJobsAsync(request); // Poll until the returned long-running operation is complete Operation <JobOperationResult, BatchOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result JobOperationResult 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 <JobOperationResult, BatchOperationMetadata> retrievedResponse = await jobServiceClient.PollOnceBatchUpdateJobsAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result JobOperationResult retrievedResult = retrievedResponse.Result; } // End snippet }