/// <summary>Snippet for CreateBatch</summary> public void CreateBatchRequestObject() { // Snippet: CreateBatch(CreateBatchRequest, CallSettings) // Create client BatchControllerClient batchControllerClient = BatchControllerClient.Create(); // Initialize request argument(s) CreateBatchRequest request = new CreateBatchRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), Batch = new Batch(), BatchId = "", RequestId = "", }; // Make the request Operation <Batch, BatchOperationMetadata> response = batchControllerClient.CreateBatch(request); // Poll until the returned long-running operation is complete Operation <Batch, BatchOperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Batch 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 <Batch, BatchOperationMetadata> retrievedResponse = batchControllerClient.PollOnceCreateBatch(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Batch retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CreateBatch</summary> public void CreateBatch() { // Snippet: CreateBatch(string, Batch, string, CallSettings) // Create client BatchControllerClient batchControllerClient = BatchControllerClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; Batch batch = new Batch(); string batchId = ""; // Make the request Operation <Batch, BatchOperationMetadata> response = batchControllerClient.CreateBatch(parent, batch, batchId); // Poll until the returned long-running operation is complete Operation <Batch, BatchOperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Batch 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 <Batch, BatchOperationMetadata> retrievedResponse = batchControllerClient.PollOnceCreateBatch(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Batch retrievedResult = retrievedResponse.Result; } // End snippet }