/// <summary>Snippet for ListAutoscalingPolicies</summary> public async Task ListAutoscalingPoliciesRequestObjectAsync() { // Snippet: ListAutoscalingPoliciesAsync(ListAutoscalingPoliciesRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync(); // Initialize request argument(s) ListAutoscalingPoliciesRequest request = new ListAutoscalingPoliciesRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), }; // Make the request PagedAsyncEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> response = autoscalingPolicyServiceClient.ListAutoscalingPoliciesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((AutoscalingPolicy 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((ListAutoscalingPoliciesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (AutoscalingPolicy 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 <AutoscalingPolicy> 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 (AutoscalingPolicy 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 ListAutoscalingPolicies</summary> public void ListAutoscalingPolicies_RequestObject() { // Snippet: ListAutoscalingPolicies(ListAutoscalingPoliciesRequest,CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) ListAutoscalingPoliciesRequest request = new ListAutoscalingPoliciesRequest { Parent = new RegionName("[PROJECT]", "[REGION]").ToString(), }; // Make the request PagedEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> response = autoscalingPolicyServiceClient.ListAutoscalingPolicies(request); // Iterate over all response items, lazily performing RPCs as required foreach (AutoscalingPolicy 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 (ListAutoscalingPoliciesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (AutoscalingPolicy 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 <AutoscalingPolicy> 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 (AutoscalingPolicy item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
partial void Modify_ListAutoscalingPoliciesRequest(ref ListAutoscalingPoliciesRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Lists autoscaling policies in the project. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A pageable asynchronous sequence of <see cref="AutoscalingPolicy"/> resources.</returns> public override gax::PagedAsyncEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> ListAutoscalingPoliciesAsync(ListAutoscalingPoliciesRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_ListAutoscalingPoliciesRequest(ref request, ref callSettings); return(new gaxgrpc::GrpcPagedAsyncEnumerable <ListAutoscalingPoliciesRequest, ListAutoscalingPoliciesResponse, AutoscalingPolicy>(_callListAutoscalingPolicies, request, callSettings)); }
/// <summary> /// Lists autoscaling policies in the project. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A pageable asynchronous sequence of <see cref="AutoscalingPolicy"/> resources.</returns> public virtual gax::PagedAsyncEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> ListAutoscalingPoliciesAsync(ListAutoscalingPoliciesRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();