/// <summary>Snippet for SubmitJobAsOperation</summary> public void SubmitJobAsOperation() { // Snippet: SubmitJobAsOperation(string, string, Job, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) string projectId = ""; string region = ""; Job job = new Job(); // Make the request Operation <Job, JobMetadata> response = jobControllerClient.SubmitJobAsOperation(projectId, region, job); // Poll until the returned long-running operation is complete Operation <Job, JobMetadata> completedResponse = response.PollUntilCompleted(); // 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 = jobControllerClient.PollOnceSubmitJobAsOperation(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 SubmitJob</summary> public void SubmitJob() { // Snippet: SubmitJob(string, string, Job, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) string projectId = ""; string region = ""; Job job = new Job(); // Make the request Job response = jobControllerClient.SubmitJob(projectId, region, job); // End snippet }
/// <summary>Snippet for CancelJob</summary> public void CancelJob() { // Snippet: CancelJob(string, string, string, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) string projectId = ""; string region = ""; string jobId = ""; // Make the request Job response = jobControllerClient.CancelJob(projectId, region, jobId); // End snippet }
/// <summary>Snippet for ListJobs</summary> public void ListJobsRequestObject() { // Snippet: ListJobs(ListJobsRequest, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) ListJobsRequest request = new ListJobsRequest { ProjectId = "", ClusterName = "", JobStateMatcher = ListJobsRequest.Types.JobStateMatcher.All, Region = "", Filter = "", }; // Make the request PagedEnumerable <ListJobsResponse, Job> response = jobControllerClient.ListJobs(request); // Iterate over all response items, lazily performing RPCs as required foreach (Job item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListJobsResponse page in response.AsRawResponses()) { // 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 = response.ReadPage(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 CancelJob</summary> public void CancelJobRequestObject() { // Snippet: CancelJob(CancelJobRequest, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) CancelJobRequest request = new CancelJobRequest { ProjectId = "", JobId = "", Region = "", }; // Make the request Job response = jobControllerClient.CancelJob(request); // End snippet }
/// <summary>Snippet for SubmitJob</summary> public void SubmitJob_RequestObject() { // Snippet: SubmitJob(SubmitJobRequest,CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) SubmitJobRequest request = new SubmitJobRequest { ProjectId = "", Region = "", Job = new Job(), }; // Make the request Job response = jobControllerClient.SubmitJob(request); // End snippet }
/// <summary>Snippet for DeleteJob</summary> public void DeleteJobRequestObject() { // Snippet: DeleteJob(DeleteJobRequest, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) DeleteJobRequest request = new DeleteJobRequest { ProjectId = "", JobId = "", Region = "", }; // Make the request jobControllerClient.DeleteJob(request); // End snippet }
/// <summary>Snippet for UpdateJob</summary> public void UpdateJobRequestObject() { // Snippet: UpdateJob(UpdateJobRequest, CallSettings) // Create client JobControllerClient jobControllerClient = JobControllerClient.Create(); // Initialize request argument(s) UpdateJobRequest request = new UpdateJobRequest { ProjectId = "", Region = "", JobId = "", Job = new Job(), UpdateMask = new FieldMask(), }; // Make the request Job response = jobControllerClient.UpdateJob(request); // End snippet }