/// <summary>Snippet for BatchCreateJobsAsync</summary> public async Task BatchCreateJobsAsync() { // Snippet: BatchCreateJobsAsync(string,IEnumerable<Job>,CallSettings) // Additional: BatchCreateJobsAsync(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.BatchCreateJobsAsync(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.PollOnceBatchCreateJobsAsync(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 BatchCreateJobsAsync</summary> public async Task BatchCreateJobsAsync_RequestObject() { // Snippet: BatchCreateJobsAsync(BatchCreateJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) BatchCreateJobsRequest request = new BatchCreateJobsRequest { Parent = new TenantName("[PROJECT]", "[TENANT]").ToString(), Jobs = { }, }; // Make the request Operation <JobOperationResult, BatchOperationMetadata> response = await jobServiceClient.BatchCreateJobsAsync(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.PollOnceBatchCreateJobsAsync(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 }