Esempio n. 1
0
        /// <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
        }
Esempio n. 2
0
        /// <summary>Snippet for SubmitJobAsOperation</summary>
        public void SubmitJobAsOperationRequestObject()
        {
            // Snippet: SubmitJobAsOperation(SubmitJobRequest, CallSettings)
            // Create client
            JobControllerClient jobControllerClient = JobControllerClient.Create();
            // Initialize request argument(s)
            SubmitJobRequest request = new SubmitJobRequest
            {
                ProjectId = "",
                Job       = new Job(),
                Region    = "",
                RequestId = "",
            };
            // Make the request
            Operation <Job, JobMetadata> response = jobControllerClient.SubmitJobAsOperation(request);

            // 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
        }
Esempio n. 3
0
        /// <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
        }
Esempio n. 4
0
 /// <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
 }
Esempio n. 5
0
 /// <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
 }
Esempio n. 6
0
        /// <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
        }
Esempio n. 7
0
        /// <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
        }
Esempio n. 8
0
 /// <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 ListJobs</summary>
        public void ListJobs_RequestObject()
        {
            // Snippet: ListJobs(ListJobsRequest,CallSettings)
            // Create client
            JobControllerClient jobControllerClient = JobControllerClient.Create();
            // Initialize request argument(s)
            ListJobsRequest request = new ListJobsRequest
            {
                ProjectId = "",
                Region    = "",
            };
            // 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)
                {
                    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)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Esempio n. 11
0
        /// <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
        }
Esempio n. 12
0
 /// <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
 }
        /// <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 CancelJobAsync_RequestObject()
        {
            // Snippet: CancelJobAsync(CancelJobRequest,CallSettings)
            // Create client
            JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();

            // Initialize request argument(s)
            CancelJobRequest request = new CancelJobRequest
            {
                ProjectId = "",
                Region    = "",
                JobId     = "",
            };
            // Make the request
            Job response = await jobControllerClient.CancelJobAsync(request);

            // End snippet
        }
Esempio n. 15
0
        /// <summary>Snippet for GetJobAsync</summary>
        public async Task GetJobRequestObjectAsync()
        {
            // Snippet: GetJobAsync(GetJobRequest, CallSettings)
            // Additional: GetJobAsync(GetJobRequest, CancellationToken)
            // Create client
            JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();

            // Initialize request argument(s)
            GetJobRequest request = new GetJobRequest
            {
                ProjectId = "",
                JobId     = "",
                Region    = "",
            };
            // Make the request
            Job response = await jobControllerClient.GetJobAsync(request);

            // End snippet
        }
Esempio n. 16
0
        /// <summary>Snippet for UpdateJobAsync</summary>
        public async Task UpdateJobRequestObjectAsync()
        {
            // Snippet: UpdateJobAsync(UpdateJobRequest, CallSettings)
            // Additional: UpdateJobAsync(UpdateJobRequest, CancellationToken)
            // 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
        }