Пример #1
0
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListTargetPoolsRequest, CallSettings)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            ListTargetPoolsRequest request = new ListTargetPoolsRequest
            {
                Region  = "",
                OrderBy = "",
                Project = "",
                Filter  = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            PagedAsyncEnumerable <TargetPoolList, TargetPool> response = targetPoolsClient.ListAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((TargetPool 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((TargetPoolList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (TargetPool 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 <TargetPool> 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 (TargetPool 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 AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, CallSettings)
            // Additional: AggregatedListAsync(string, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            TargetPoolAggregatedList response = await targetPoolsClient.AggregatedListAsync(project);

            // End snippet
        }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertAsync()
        {
            // Snippet: InsertAsync(string, string, TargetPool, CallSettings)
            // Additional: InsertAsync(string, string, TargetPool, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string     project            = "";
            string     region             = "";
            TargetPool targetPoolResource = new TargetPool();
            // Make the request
            Operation response = await targetPoolsClient.InsertAsync(project, region, targetPoolResource);

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

            // Initialize request argument(s)
            string project    = "";
            string region     = "";
            string targetPool = "";
            // Make the request
            TargetPool response = await targetPoolsClient.GetAsync(project, region, targetPool);

            // End snippet
        }
        /// <summary>Snippet for RemoveHealthCheckAsync</summary>
        public async Task RemoveHealthCheckAsync()
        {
            // Snippet: RemoveHealthCheckAsync(string, string, string, TargetPoolsRemoveHealthCheckRequest, CallSettings)
            // Additional: RemoveHealthCheckAsync(string, string, string, TargetPoolsRemoveHealthCheckRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string project    = "";
            string region     = "";
            string targetPool = "";
            TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = new TargetPoolsRemoveHealthCheckRequest();
            // Make the request
            Operation response = await targetPoolsClient.RemoveHealthCheckAsync(project, region, targetPool, targetPoolsRemoveHealthCheckRequestResource);

            // End snippet
        }
        /// <summary>Snippet for GetHealthAsync</summary>
        public async Task GetHealthAsync()
        {
            // Snippet: GetHealthAsync(string, string, string, InstanceReference, CallSettings)
            // Additional: GetHealthAsync(string, string, string, InstanceReference, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string            project    = "";
            string            region     = "";
            string            targetPool = "";
            InstanceReference instanceReferenceResource = new InstanceReference();
            // Make the request
            TargetPoolInstanceHealth response = await targetPoolsClient.GetHealthAsync(project, region, targetPool, instanceReferenceResource);

            // End snippet
        }
Пример #7
0
        /// <summary>Snippet for AggregatedListAsync</summary>
        public async Task AggregatedListAsync()
        {
            // Snippet: AggregatedListAsync(string, string, int?, CallSettings)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            string project = "";
            // Make the request
            PagedAsyncEnumerable <TargetPoolAggregatedList, KeyValuePair <string, TargetPoolsScopedList> > response = targetPoolsClient.AggregatedListAsync(project);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((KeyValuePair <string, TargetPoolsScopedList> 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((TargetPoolAggregatedList page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (KeyValuePair <string, TargetPoolsScopedList> 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 <KeyValuePair <string, TargetPoolsScopedList> > 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 (KeyValuePair <string, TargetPoolsScopedList> 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 GetAsync</summary>
        public async Task GetRequestObjectAsync()
        {
            // Snippet: GetAsync(GetTargetPoolRequest, CallSettings)
            // Additional: GetAsync(GetTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            GetTargetPoolRequest request = new GetTargetPoolRequest
            {
                TargetPool = "",
                Region     = "",
                Project    = "",
            };
            // Make the request
            TargetPool response = await targetPoolsClient.GetAsync(request);

            // End snippet
        }
        /// <summary>Snippet for InsertAsync</summary>
        public async Task InsertRequestObjectAsync()
        {
            // Snippet: InsertAsync(InsertTargetPoolRequest, CallSettings)
            // Additional: InsertAsync(InsertTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            InsertTargetPoolRequest request = new InsertTargetPoolRequest
            {
                RequestId          = "",
                TargetPoolResource = new TargetPool(),
                Region             = "",
                Project            = "",
            };
            // Make the request
            Operation response = await targetPoolsClient.InsertAsync(request);

            // End snippet
        }
        /// <summary>Snippet for DeleteAsync</summary>
        public async Task DeleteRequestObjectAsync()
        {
            // Snippet: DeleteAsync(DeleteTargetPoolRequest, CallSettings)
            // Additional: DeleteAsync(DeleteTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            DeleteTargetPoolRequest request = new DeleteTargetPoolRequest
            {
                RequestId  = "",
                TargetPool = "",
                Region     = "",
                Project    = "",
            };
            // Make the request
            Operation response = await targetPoolsClient.DeleteAsync(request);

            // End snippet
        }
        /// <summary>Snippet for RemoveInstanceAsync</summary>
        public async Task RemoveInstanceRequestObjectAsync()
        {
            // Snippet: RemoveInstanceAsync(RemoveInstanceTargetPoolRequest, CallSettings)
            // Additional: RemoveInstanceAsync(RemoveInstanceTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            RemoveInstanceTargetPoolRequest request = new RemoveInstanceTargetPoolRequest
            {
                TargetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(),
                RequestId  = "",
                TargetPool = "",
                Region     = "",
                Project    = "",
            };
            // Make the request
            Operation response = await targetPoolsClient.RemoveInstanceAsync(request);

            // End snippet
        }
        /// <summary>Snippet for AddHealthCheckAsync</summary>
        public async Task AddHealthCheckRequestObjectAsync()
        {
            // Snippet: AddHealthCheckAsync(AddHealthCheckTargetPoolRequest, CallSettings)
            // Additional: AddHealthCheckAsync(AddHealthCheckTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            AddHealthCheckTargetPoolRequest request = new AddHealthCheckTargetPoolRequest
            {
                RequestId  = "",
                TargetPool = "",
                Region     = "",
                Project    = "",
                TargetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest(),
            };
            // Make the request
            Operation response = await targetPoolsClient.AddHealthCheckAsync(request);

            // End snippet
        }
        /// <summary>Snippet for SetBackupAsync</summary>
        public async Task SetBackupRequestObjectAsync()
        {
            // Snippet: SetBackupAsync(SetBackupTargetPoolRequest, CallSettings)
            // Additional: SetBackupAsync(SetBackupTargetPoolRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            SetBackupTargetPoolRequest request = new SetBackupTargetPoolRequest
            {
                RequestId               = "",
                TargetPool              = "",
                Region                  = "",
                FailoverRatio           = 0F,
                Project                 = "",
                TargetReferenceResource = new TargetReference(),
            };
            // Make the request
            Operation response = await targetPoolsClient.SetBackupAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListAsync</summary>
        public async Task ListRequestObjectAsync()
        {
            // Snippet: ListAsync(ListTargetPoolsRequest, CallSettings)
            // Additional: ListAsync(ListTargetPoolsRequest, CancellationToken)
            // Create client
            TargetPoolsClient targetPoolsClient = await TargetPoolsClient.CreateAsync();

            // Initialize request argument(s)
            ListTargetPoolsRequest request = new ListTargetPoolsRequest
            {
                PageToken            = "",
                MaxResults           = 0U,
                Region               = "",
                OrderBy              = "",
                Project              = "",
                Filter               = "",
                ReturnPartialSuccess = false,
            };
            // Make the request
            TargetPoolList response = await targetPoolsClient.ListAsync(request);

            // End snippet
        }