/// <summary>Snippet for SearchAllIamPoliciesAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task SearchAllIamPoliciesRequestObjectAsync() { // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) SearchAllIamPoliciesRequest request = new SearchAllIamPoliciesRequest { Scope = "", Query = "", AssetTypes = { "", }, OrderBy = "", }; // Make the request PagedAsyncEnumerable <SearchAllIamPoliciesResponse, IamPolicySearchResult> response = assetServiceClient.SearchAllIamPoliciesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((IamPolicySearchResult 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((SearchAllIamPoliciesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (IamPolicySearchResult 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 <IamPolicySearchResult> 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 (IamPolicySearchResult 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; }
/// <summary>Snippet for SearchAllIamPolicies</summary> public void SearchAllIamPoliciesRequestObject() { // Snippet: SearchAllIamPolicies(SearchAllIamPoliciesRequest, CallSettings) // Create client AssetServiceClient assetServiceClient = AssetServiceClient.Create(); // Initialize request argument(s) SearchAllIamPoliciesRequest request = new SearchAllIamPoliciesRequest { Scope = "", Query = "", }; // Make the request PagedEnumerable <SearchAllIamPoliciesResponse, IamPolicySearchResult> response = assetServiceClient.SearchAllIamPolicies(request); // Iterate over all response items, lazily performing RPCs as required foreach (IamPolicySearchResult 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 (SearchAllIamPoliciesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (IamPolicySearchResult 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 <IamPolicySearchResult> 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 (IamPolicySearchResult 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 }
public SearchAllIamPoliciesResponse SearchAllIamPolicies(string scope, string query) { // Create the client. AssetServiceClient client = AssetServiceClient.Create(); // Build the request. SearchAllIamPoliciesRequest request = new SearchAllIamPoliciesRequest { Scope = scope, Query = query, }; // Call the API. PagedEnumerable <SearchAllIamPoliciesResponse, IamPolicySearchResult> response = client.SearchAllIamPolicies(request); // Return the first page. IEnumerable <SearchAllIamPoliciesResponse> byPages = response.AsRawResponses(); return(byPages.First()); }
/// <summary> /// Searches all the IAM policies under a given accessible CRM scope /// (project/folder/organization). This RPC gives callers /// especially admins the ability to search all the IAM policies under a scope, /// even if they don't have .getIamPolicy permission of all the IAM policies. /// Callers should have cloud.assets.SearchAllIamPolicies permission on the /// requested scope, otherwise it will be rejected. /// </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="IamPolicySearchResult"/> resources.</returns> public override gax::PagedAsyncEnumerable <SearchAllIamPoliciesResponse, IamPolicySearchResult> SearchAllIamPoliciesAsync(SearchAllIamPoliciesRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_SearchAllIamPoliciesRequest(ref request, ref callSettings); return(new gaxgrpc::GrpcPagedAsyncEnumerable <SearchAllIamPoliciesRequest, SearchAllIamPoliciesResponse, IamPolicySearchResult>(_callSearchAllIamPolicies, request, callSettings)); }
partial void Modify_SearchAllIamPoliciesRequest(ref SearchAllIamPoliciesRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Searches all the IAM policies under a given accessible CRM scope /// (project/folder/organization). This RPC gives callers /// especially admins the ability to search all the IAM policies under a scope, /// even if they don't have .getIamPolicy permission of all the IAM policies. /// Callers should have cloud.assets.SearchAllIamPolicies permission on the /// requested scope, otherwise it will be rejected. /// </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="IamPolicySearchResult"/> resources.</returns> public virtual gax::PagedAsyncEnumerable <SearchAllIamPoliciesResponse, IamPolicySearchResult> SearchAllIamPoliciesAsync(SearchAllIamPoliciesRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();