/// <summary>Snippet for ListProjectBillingInfoAsync</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 ListProjectBillingInfoResourceNamesAsync() { // Create client CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync(); // Initialize request argument(s) BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"); // Make the request PagedAsyncEnumerable <ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfoAsync(name); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((ProjectBillingInfo 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((ListProjectBillingInfoResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (ProjectBillingInfo 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 <ProjectBillingInfo> 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 (ProjectBillingInfo 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 ListConnectionsAsync</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 ListConnectionsResourceNamesAsync() { // Create client ConnectionServiceClient connectionServiceClient = await ConnectionServiceClient.CreateAsync(); // Initialize request argument(s) EndpointName parent = EndpointName.FromProjectEndpoint("[PROJECT]", "[ENDPOINT]"); // Make the request PagedAsyncEnumerable <ListConnectionsResponse, Connection> response = connectionServiceClient.ListConnectionsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Connection 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((ListConnectionsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Connection 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 <Connection> 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 (Connection 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 ListAssetsAsync</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 ListAssetsResourceNamesAsync() { // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) IResourceName parent = new UnparsedResourceName("a/wildcard/resource"); // Make the request PagedAsyncEnumerable <ListAssetsResponse, Asset> response = assetServiceClient.ListAssetsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Asset 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((ListAssetsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Asset 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 <Asset> 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 (Asset 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 SearchGoogleAdsFieldsAsync</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 SearchGoogleAdsFieldsAsync() { // Create client GoogleAdsFieldServiceClient googleAdsFieldServiceClient = await GoogleAdsFieldServiceClient.CreateAsync(); // Initialize request argument(s) string query = ""; // Make the request PagedAsyncEnumerable <SearchGoogleAdsFieldsResponse, GoogleAdsField> response = googleAdsFieldServiceClient.SearchGoogleAdsFieldsAsync(query); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((GoogleAdsField 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((SearchGoogleAdsFieldsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (GoogleAdsField 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 <GoogleAdsField> 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 (GoogleAdsField 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 ListMeasurementProtocolSecretsAsync</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 ListMeasurementProtocolSecretsAsync() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = await AnalyticsAdminServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "properties/[PROPERTY]/webDataStreams/[WEB_DATA_STREAM]"; // Make the request PagedAsyncEnumerable <ListMeasurementProtocolSecretsResponse, MeasurementProtocolSecret> response = analyticsAdminServiceClient.ListMeasurementProtocolSecretsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((MeasurementProtocolSecret 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((ListMeasurementProtocolSecretsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (MeasurementProtocolSecret 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 <MeasurementProtocolSecret> 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 (MeasurementProtocolSecret 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 ListAndroidAppDataStreamsAsync</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 ListAndroidAppDataStreamsResourceNamesAsync() { // Create client AnalyticsAdminServiceClient analyticsAdminServiceClient = await AnalyticsAdminServiceClient.CreateAsync(); // Initialize request argument(s) PropertyName parent = PropertyName.FromProperty("[PROPERTY]"); // Make the request PagedAsyncEnumerable <ListAndroidAppDataStreamsResponse, AndroidAppDataStream> response = analyticsAdminServiceClient.ListAndroidAppDataStreamsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((AndroidAppDataStream 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((ListAndroidAppDataStreamsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (AndroidAppDataStream 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 <AndroidAppDataStream> 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 (AndroidAppDataStream 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 ListBatchJobResultsAsync</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 ListBatchJobResultsAsync() { // Create client BatchJobServiceClient batchJobServiceClient = await BatchJobServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER_ID]/batchJobs/[BATCH_JOB_ID]"; // Make the request PagedAsyncEnumerable <ListBatchJobResultsResponse, BatchJobResult> response = batchJobServiceClient.ListBatchJobResultsAsync(resourceName); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((BatchJobResult 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((ListBatchJobResultsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (BatchJobResult 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 <BatchJobResult> 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 (BatchJobResult 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 ListTableSpecsAsync</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 ListTableSpecsResourceNamesAsync() { // Create client AutoMlClient autoMlClient = await AutoMlClient.CreateAsync(); // Initialize request argument(s) DatasetName parent = DatasetName.FromProjectLocationDataset("[PROJECT]", "[LOCATION]", "[DATASET]"); // Make the request PagedAsyncEnumerable <ListTableSpecsResponse, TableSpec> response = autoMlClient.ListTableSpecsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TableSpec 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((ListTableSpecsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TableSpec 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 <TableSpec> 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 (TableSpec 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 ListSkusAsync</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 ListSkusResourceNamesAsync() { // Create client CloudCatalogClient cloudCatalogClient = await CloudCatalogClient.CreateAsync(); // Initialize request argument(s) ServiceName parent = ServiceName.FromService("[SERVICE]"); // Make the request PagedAsyncEnumerable <ListSkusResponse, Sku> response = cloudCatalogClient.ListSkusAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Sku 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((ListSkusResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Sku 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 <Sku> 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 (Sku 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 ListWorkloadsAsync</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 ListWorkloadsAsync() { // Create client AssuredWorkloadsServiceClient assuredWorkloadsServiceClient = await AssuredWorkloadsServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "organizations/[ORGANIZATION]/locations/[LOCATION]"; // Make the request PagedAsyncEnumerable <ListWorkloadsResponse, Workload> response = assuredWorkloadsServiceClient.ListWorkloadsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Workload 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((ListWorkloadsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Workload 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 <Workload> 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 (Workload 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 ListPhraseMatchersAsync</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 ListPhraseMatchersAsync() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = await ContactCenterInsightsClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; // Make the request PagedAsyncEnumerable <ListPhraseMatchersResponse, PhraseMatcher> response = contactCenterInsightsClient.ListPhraseMatchersAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((PhraseMatcher 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((ListPhraseMatchersResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (PhraseMatcher 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 <PhraseMatcher> 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 (PhraseMatcher 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 ListBuildsAsync</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 ListBuildsResourceNamesAsync() { // Create client BuildServiceClient buildServiceClient = await BuildServiceClient.CreateAsync(); // Initialize request argument(s) ModelName parent = ModelName.FromBuildTargetModel("[BUILD_TARGET]", "[MODEL]"); // Make the request PagedAsyncEnumerable <ListBuildsResponse, Build> response = buildServiceClient.ListBuildsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Build 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((ListBuildsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Build 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 <Build> 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 (Build 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 ListCampaignExperimentAsyncErrorsAsync</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 ListCampaignExperimentAsyncErrorsAsync() { // Create client CampaignExperimentServiceClient campaignExperimentServiceClient = await CampaignExperimentServiceClient.CreateAsync(); // Initialize request argument(s) string resourceName = "customers/[CUSTOMER]/campaignExperiments/[CAMPAIGN_EXPERIMENT]"; // Make the request PagedAsyncEnumerable <ListCampaignExperimentAsyncErrorsResponse, Status> response = campaignExperimentServiceClient.ListCampaignExperimentAsyncErrorsAsync(resourceName); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Status 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((ListCampaignExperimentAsyncErrorsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Status 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 <Status> 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 (Status 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 async Task SearchAllIamPoliciesRequestObjectAsync() { // Snippet: SearchAllIamPoliciesAsync(SearchAllIamPoliciesRequest, CallSettings) // Create client AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync(); // Initialize request argument(s) SearchAllIamPoliciesRequest request = new SearchAllIamPoliciesRequest { Scope = "", Query = "", }; // 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; // End snippet }
/// <summary>Snippet for ListTransferLogsAsync</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 ListTransferLogsResourceNamesAsync() { // Create client DataTransferServiceClient dataTransferServiceClient = await DataTransferServiceClient.CreateAsync(); // Initialize request argument(s) RunName parent = RunName.FromProjectTransferConfigRun("[PROJECT]", "[TRANSFER_CONFIG]", "[RUN]"); // Make the request PagedAsyncEnumerable <ListTransferLogsResponse, TransferMessage> response = dataTransferServiceClient.ListTransferLogsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TransferMessage 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((ListTransferLogsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TransferMessage 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 <TransferMessage> 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 (TransferMessage 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 ResourcedMethodAsync</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 ResourcedMethod1Async() { // Create client PaginatedClient paginatedClient = await PaginatedClient.CreateAsync(); // Initialize request argument(s) string name = "items/[ITEM_ID]"; // Make the request PagedAsyncEnumerable <ResourceResponse, string> response = paginatedClient.ResourcedMethodAsync(name); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((string 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((ResourceResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (string 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 <string> 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 (string 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 ListBudgetsAsync</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 ListBudgetsAsync() { // Create client BudgetServiceClient budgetServiceClient = await BudgetServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "billingAccounts/[BILLING_ACCOUNT]"; // Make the request PagedAsyncEnumerable <ListBudgetsResponse, Budget> response = budgetServiceClient.ListBudgetsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Budget 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((ListBudgetsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Budget 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 <Budget> 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 (Budget 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 SignatureMethodAsync</summary> public async Task SignatureMethod3Async() { // Snippet: SignatureMethodAsync(string, int?, CallSettings) // Create client PaginatedClient paginatedClient = await PaginatedClient.CreateAsync(); // Make the request PagedAsyncEnumerable <Response, Response.Types.NestedResult> response = paginatedClient.SignatureMethodAsync(); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Response.Types.NestedResult 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((Response page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Response.Types.NestedResult 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 <Response.Types.NestedResult> 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 (Response.Types.NestedResult 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 ListBackupsAsync</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 ListBackupsAsync() { // Create client BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/instances/[INSTANCE]/clusters/[CLUSTER]"; // Make the request PagedAsyncEnumerable <ListBackupsResponse, Backup> response = bigtableTableAdminClient.ListBackupsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Backup 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((ListBackupsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Backup 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 <Backup> 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 (Backup 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 ListInstancesAsync</summary> public async Task ListInstancesAsync() { // Snippet: ListInstancesAsync(LocationName,string,int?,CallSettings) // Create client CloudRedisClient cloudRedisClient = await CloudRedisClient.CreateAsync(); // Initialize request argument(s) LocationName parent = new LocationName("[PROJECT]", "[LOCATION]"); // Make the request PagedAsyncEnumerable<ListInstancesResponse, Instance> response = cloudRedisClient.ListInstancesAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Instance 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((ListInstancesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Instance 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<Instance> 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 (Instance item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for RunReport</summary> public async Task RunReportRequestObjectAsync() { // Snippet: RunReportAsync(RunReportRequest, CallSettings) // Create client BetaAnalyticsDataClient betaAnalyticsDataClient = await BetaAnalyticsDataClient.CreateAsync(); // Initialize request argument(s) RunReportRequest request = new RunReportRequest { Property = "", Dimensions = { new Dimension(), }, Metrics = { new Metric(), }, DateRanges = { new DateRange(), }, DimensionFilter = new FilterExpression(), MetricFilter = new FilterExpression(), MetricAggregations = { MetricAggregation.Unspecified, }, OrderBys = { new OrderBy(), }, CurrencyCode = "", CohortSpec = new CohortSpec(), KeepEmptyRows = false, ReturnPropertyQuota = false, }; // Make the request PagedAsyncEnumerable <RunReportResponse, DimensionHeader> response = betaAnalyticsDataClient.RunReportAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((DimensionHeader 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((RunReportResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (DimensionHeader 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 <DimensionHeader> 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 (DimensionHeader 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 SearchAsync</summary> public async Task SearchRequestObjectAsync() { // Snippet: SearchAsync(SearchRequest, CallSettings) // Create client SearchServiceClient searchServiceClient = await SearchServiceClient.CreateAsync(); // Initialize request argument(s) SearchRequest request = new SearchRequest { Placement = "", BranchAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"), Query = "", VisitorId = "", UserInfo = new UserInfo(), Offset = 0, Filter = "", OrderBy = "", FacetSpecs = { new SearchRequest.Types.FacetSpec(), }, BoostSpec = new SearchRequest.Types.BoostSpec(), QueryExpansionSpec = new SearchRequest.Types.QueryExpansionSpec(), VariantRollupKeys = { "", }, DynamicFacetSpec = new SearchRequest.Types.DynamicFacetSpec(), PageCategories = { "", }, CanonicalFilter = "", }; // Make the request PagedAsyncEnumerable <SearchResponse, SearchResponse.Types.SearchResult> response = searchServiceClient.SearchAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((SearchResponse.Types.SearchResult 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((SearchResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (SearchResponse.Types.SearchResult 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 <SearchResponse.Types.SearchResult> 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 (SearchResponse.Types.SearchResult 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 }