/// <summary>Snippet for BatchUpdateJobsAsync</summary>
        public async Task BatchUpdateJobsAsync()
        {
            // Snippet: BatchUpdateJobsAsync(string,IEnumerable<Job>,CallSettings)
            // Additional: BatchUpdateJobsAsync(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.BatchUpdateJobsAsync(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.PollOnceBatchUpdateJobsAsync(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
        }
Exemplo n.º 2
0
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync()
        {
            // Snippet: DeleteJobAsync(JobNameOneof,CallSettings)
            // Additional: DeleteJobAsync(JobNameOneof,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            JobNameOneof name = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]"));
            // Make the request
            await jobServiceClient.DeleteJobAsync(name);

            // End snippet
        }
Exemplo n.º 3
0
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync()
        {
            // Snippet: DeleteJobAsync(string,CallSettings)
            // Additional: DeleteJobAsync(string,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new JobName("[PROJECT]", "[JOB]").ToString();
            // Make the request
            await jobServiceClient.DeleteJobAsync(formattedName);

            // End snippet
        }
        /// <summary>Snippet for GetJobAsync</summary>
        public async Task GetJobAsync()
        {
            // Snippet: GetJobAsync(JobName,CallSettings)
            // Additional: GetJobAsync(JobName,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            JobName name = new JobName("[PROJECT]", "[JOBS]");
            // Make the request
            Job response = await jobServiceClient.GetJobAsync(name);

            // End snippet
        }
Exemplo n.º 5
0
        /// <summary>Snippet for UpdateJobAsync</summary>
        public async Task UpdateJobAsync()
        {
            // Snippet: UpdateJobAsync(Job,CallSettings)
            // Additional: UpdateJobAsync(Job,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            Job job = new Job();
            // Make the request
            Job response = await jobServiceClient.UpdateJobAsync(job);

            // End snippet
        }
Exemplo n.º 6
0
        /// <summary>Snippet for CreateJobAsync</summary>
        public async Task CreateJobAsync()
        {
            // Snippet: CreateJobAsync(TenantOrProjectNameOneof,Job,CallSettings)
            // Additional: CreateJobAsync(TenantOrProjectNameOneof,Job,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
            Job job = new Job();
            // Make the request
            Job response = await jobServiceClient.CreateJobAsync(parent, job);

            // End snippet
        }
        /// <summary>Snippet for BatchDeleteJobsAsync</summary>
        public async Task BatchDeleteJobsAsync()
        {
            // Snippet: BatchDeleteJobsAsync(ProjectName,string,CallSettings)
            // Additional: BatchDeleteJobsAsync(ProjectName,string,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = new ProjectName("[PROJECT]");
            string      filter = "";
            // Make the request
            await jobServiceClient.BatchDeleteJobsAsync(parent, filter);

            // End snippet
        }
        /// <summary>Snippet for CreateJobAsync</summary>
        public async Task CreateJobAsync()
        {
            // Snippet: CreateJobAsync(ProjectName,Job,CallSettings)
            // Additional: CreateJobAsync(ProjectName,Job,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            ProjectName parent = new ProjectName("[PROJECT]");
            Job         job    = new Job();
            // Make the request
            Job response = await jobServiceClient.CreateJobAsync(parent, job);

            // End snippet
        }
Exemplo n.º 9
0
        /// <summary>Snippet for BatchDeleteJobsAsync</summary>
        public async Task BatchDeleteJobsAsync()
        {
            // Snippet: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CallSettings)
            // Additional: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]"));
            string filter = "";
            // Make the request
            await jobServiceClient.BatchDeleteJobsAsync(parent, filter);

            // End snippet
        }
        /// <summary>Snippet for ListJobsAsync</summary>
        public async Task ListJobsAsync_RequestObject()
        {
            // Snippet: ListJobsAsync(ListJobsRequest,CallSettings)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListJobsRequest request = new ListJobsRequest
            {
                ParentAsProjectName = new ProjectName("[PROJECT]"),
                Filter = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListJobsResponse, Job> response =
                jobServiceClient.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)
                {
                    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)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Exemplo n.º 11
0
        /// <summary>Snippet for SearchJobsForAlertAsync</summary>
        public async Task SearchJobsForAlertAsync_RequestObject()
        {
            // Snippet: SearchJobsForAlertAsync(SearchJobsRequest,CallSettings)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            SearchJobsRequest request = new SearchJobsRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                RequestMetadata = new RequestMetadata(),
            };
            // Make the request
            PagedAsyncEnumerable <SearchJobsResponse, MatchingJob> response =
                jobServiceClient.SearchJobsForAlertAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((SearchJobsResponse.Types.MatchingJob 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((SearchJobsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (SearchJobsResponse.Types.MatchingJob 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 <SearchJobsResponse.Types.MatchingJob> 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 (SearchJobsResponse.Types.MatchingJob item in singlePage)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Exemplo n.º 12
0
        /// <summary>Snippet for DeleteJobAsync</summary>
        public async Task DeleteJobAsync_RequestObject()
        {
            // Snippet: DeleteJobAsync(DeleteJobRequest,CallSettings)
            // Additional: DeleteJobAsync(DeleteJobRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            DeleteJobRequest request = new DeleteJobRequest
            {
                JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")),
            };
            // Make the request
            await jobServiceClient.DeleteJobAsync(request);

            // End snippet
        }
Exemplo n.º 13
0
        /// <summary>Snippet for UpdateJobAsync</summary>
        public async Task UpdateJobAsync_RequestObject()
        {
            // Snippet: UpdateJobAsync(UpdateJobRequest,CallSettings)
            // Additional: UpdateJobAsync(UpdateJobRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateJobRequest request = new UpdateJobRequest
            {
                Job = new Job(),
            };
            // Make the request
            Job response = await jobServiceClient.UpdateJobAsync(request);

            // End snippet
        }
Exemplo n.º 14
0
        /// <summary>Snippet for GetJobAsync</summary>
        public async Task GetJobAsync_RequestObject()
        {
            // Snippet: GetJobAsync(GetJobRequest,CallSettings)
            // Additional: GetJobAsync(GetJobRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetJobRequest request = new GetJobRequest
            {
                Name = new JobName("[PROJECT]", "[JOB]").ToString(),
            };
            // Make the request
            Job response = await jobServiceClient.GetJobAsync(request);

            // End snippet
        }
Exemplo n.º 15
0
        /// <summary>Snippet for CreateJobAsync</summary>
        public async Task CreateJobAsync_RequestObject()
        {
            // Snippet: CreateJobAsync(CreateJobRequest,CallSettings)
            // Additional: CreateJobAsync(CreateJobRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateJobRequest request = new CreateJobRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                Job = new Job(),
            };
            // Make the request
            Job response = await jobServiceClient.CreateJobAsync(request);

            // End snippet
        }
Exemplo n.º 16
0
        /// <summary>Snippet for BatchDeleteJobsAsync</summary>
        public async Task BatchDeleteJobsAsync_RequestObject()
        {
            // Snippet: BatchDeleteJobsAsync(BatchDeleteJobsRequest,CallSettings)
            // Additional: BatchDeleteJobsAsync(BatchDeleteJobsRequest,CancellationToken)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchDeleteJobsRequest request = new BatchDeleteJobsRequest
            {
                ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")),
                Filter = "",
            };
            // Make the request
            await jobServiceClient.BatchDeleteJobsAsync(request);

            // End snippet
        }
        /// <summary>Snippet for BatchUpdateJobsAsync</summary>
        public async Task BatchUpdateJobsAsync_RequestObject()
        {
            // Snippet: BatchUpdateJobsAsync(BatchUpdateJobsRequest,CallSettings)
            // Create client
            JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync();

            // Initialize request argument(s)
            BatchUpdateJobsRequest request = new BatchUpdateJobsRequest
            {
                Parent = new TenantName("[PROJECT]", "[TENANT]").ToString(),
                Jobs   = { },
            };
            // Make the request
            Operation <JobOperationResult, BatchOperationMetadata> response =
                await jobServiceClient.BatchUpdateJobsAsync(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.PollOnceBatchUpdateJobsAsync(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
        }