/// <summary>Snippet for SubmitJobAsOperationAsync</summary> public async Task SubmitJobAsOperationAsync() { // Snippet: SubmitJobAsOperationAsync(string, string, Job, CallSettings) // Additional: SubmitJobAsOperationAsync(string, string, Job, CancellationToken) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) string projectId = ""; string region = ""; Job job = new Job(); // Make the request Operation <Job, JobMetadata> response = await jobControllerClient.SubmitJobAsOperationAsync(projectId, region, job); // Poll until the returned long-running operation is complete Operation <Job, JobMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Job 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 <Job, JobMetadata> retrievedResponse = await jobControllerClient.PollOnceSubmitJobAsOperationAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Job retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ListJobsAsync</summary> public async Task ListJobsRequestObjectAsync() { // Snippet: ListJobsAsync(ListJobsRequest, CallSettings) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) ListJobsRequest request = new ListJobsRequest { ProjectId = "", ClusterName = "", JobStateMatcher = ListJobsRequest.Types.JobStateMatcher.All, Region = "", Filter = "", }; // Make the request PagedAsyncEnumerable <ListJobsResponse, Job> response = jobControllerClient.ListJobsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Job item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListJobsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Job item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Job> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Job item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for SubmitJobAsync</summary> public async Task SubmitJobAsync() { // Snippet: SubmitJobAsync(string, string, Job, CallSettings) // Additional: SubmitJobAsync(string, string, Job, CancellationToken) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) string projectId = ""; string region = ""; Job job = new Job(); // Make the request Job response = await jobControllerClient.SubmitJobAsync(projectId, region, job); // End snippet }
/// <summary>Snippet for DeleteJobAsync</summary> public async Task DeleteJobAsync() { // Snippet: DeleteJobAsync(string, string, string, CallSettings) // Additional: DeleteJobAsync(string, string, string, CancellationToken) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) string projectId = ""; string region = ""; string jobId = ""; // Make the request await jobControllerClient.DeleteJobAsync(projectId, region, jobId); // End snippet }
/// <summary>Snippet for SubmitJobAsync</summary> public async Task SubmitJobAsync_RequestObject() { // Snippet: SubmitJobAsync(SubmitJobRequest,CallSettings) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) SubmitJobRequest request = new SubmitJobRequest { ProjectId = "", Region = "", Job = new Job(), }; // Make the request Job response = await jobControllerClient.SubmitJobAsync(request); // End snippet }
/// <summary>Snippet for DeleteJobAsync</summary> public async Task DeleteJobAsync_RequestObject() { // Snippet: DeleteJobAsync(DeleteJobRequest,CallSettings) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) DeleteJobRequest request = new DeleteJobRequest { ProjectId = "", Region = "", JobId = "", }; // Make the request await jobControllerClient.DeleteJobAsync(request); // End snippet }
/// <summary>Snippet for CancelJobAsync</summary> public async Task CancelJobRequestObjectAsync() { // Snippet: CancelJobAsync(CancelJobRequest, CallSettings) // Additional: CancelJobAsync(CancelJobRequest, CancellationToken) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) CancelJobRequest request = new CancelJobRequest { ProjectId = "", JobId = "", Region = "", }; // Make the request Job response = await jobControllerClient.CancelJobAsync(request); // End snippet }
/// <summary>Snippet for UpdateJobAsync</summary> public async Task UpdateJobAsync_RequestObject() { // Snippet: UpdateJobAsync(UpdateJobRequest,CallSettings) // Create client JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync(); // Initialize request argument(s) UpdateJobRequest request = new UpdateJobRequest { ProjectId = "", Region = "", JobId = "", Job = new Job(), UpdateMask = new FieldMask(), }; // Make the request Job response = await jobControllerClient.UpdateJobAsync(request); // End snippet }