public async Task ListOperationsAsync() { // Snippet: ListOperationsAsync(string,string,string,int?,CallSettings) // Create client OperationsClient operationsClient = OperationsClient.Create(); // Initialize request argument(s) string name = ""; string filter = ""; // Make the request IPagedAsyncEnumerable <ListOperationsResponse, Operation> response = operationsClient.ListOperationsAsync(name, filter); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Operation item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <Operation> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <Operation> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Operation item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListTracesAsync() { // Snippet: ListTracesAsync(string,string,int?,CallSettings) // Create client TraceServiceClient traceServiceClient = TraceServiceClient.Create(); // Initialize request argument(s) string projectId = ""; // Make the request IPagedAsyncEnumerable <ListTracesResponse, Trace> response = traceServiceClient.ListTracesAsync(projectId); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Trace item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <Trace> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <Trace> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Trace item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListLogEntriesAsync() { // Snippet: ListLogEntriesAsync(IEnumerable<string>,string,string,string,int?,CallSettings) // Create client LoggingServiceV2Client loggingServiceV2Client = LoggingServiceV2Client.Create(); // Initialize request argument(s) IEnumerable <string> projectIds = new List <string>(); string filter = ""; string orderBy = ""; // Make the request IPagedAsyncEnumerable <ListLogEntriesResponse, LogEntry> response = loggingServiceV2Client.ListLogEntriesAsync(projectIds, filter, orderBy); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((LogEntry item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <LogEntry> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <LogEntry> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (LogEntry item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListLogMetricsAsync() { // Snippet: ListLogMetricsAsync(string,string,int?,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) string formattedParent = MetricsServiceV2Client.FormatParentName("[PROJECT]"); // Make the request IPagedAsyncEnumerable <ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(formattedParent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((LogMetric item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <LogMetric> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <LogMetric> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (LogMetric item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListGroupMembersAsync() { // Snippet: ListGroupMembersAsync(string,string,int?,CallSettings) // Create client GroupServiceClient groupServiceClient = GroupServiceClient.Create(); // Initialize request argument(s) string formattedName = GroupServiceClient.FormatGroupName("[PROJECT]", "[GROUP]"); // Make the request IPagedAsyncEnumerable <ListGroupMembersResponse, MonitoredResource> response = groupServiceClient.ListGroupMembersAsync(formattedName); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((MonitoredResource item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <MonitoredResource> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <MonitoredResource> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (MonitoredResource item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListGroupStatsAsync() { // Snippet: ListGroupStatsAsync(string,QueryTimeRange,string,int?,CallSettings) // Create client ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.Create(); // Initialize request argument(s) string formattedProjectName = ErrorStatsServiceClient.FormatProjectName("[PROJECT]"); QueryTimeRange timeRange = new QueryTimeRange(); // Make the request IPagedAsyncEnumerable <ListGroupStatsResponse, ErrorGroupStats> response = errorStatsServiceClient.ListGroupStatsAsync(formattedProjectName, timeRange); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((ErrorGroupStats item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <ErrorGroupStats> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <ErrorGroupStats> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (ErrorGroupStats item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListTopicSubscriptionsAsync() { // Snippet: ListTopicSubscriptionsAsync(string,string,int?,CallSettings) // Create client PublisherClient publisherClient = PublisherClient.Create(); // Initialize request argument(s) string formattedTopic = PublisherClient.FormatTopicName("[PROJECT]", "[TOPIC]"); // Make the request IPagedAsyncEnumerable <ListTopicSubscriptionsResponse, string> response = publisherClient.ListTopicSubscriptionsAsync(formattedTopic); // 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 fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <string> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <string> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (string item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListTimeSeriesAsync() { // Snippet: ListTimeSeriesAsync(string,string,TimeInterval,ListTimeSeriesRequest.Types.TimeSeriesView,string,int?,CallSettings) // Create client MetricServiceClient metricServiceClient = MetricServiceClient.Create(); // Initialize request argument(s) string formattedName = MetricServiceClient.FormatProjectName("[PROJECT]"); string filter = ""; TimeInterval interval = new TimeInterval(); ListTimeSeriesRequest.Types.TimeSeriesView view = ListTimeSeriesRequest.Types.TimeSeriesView.Full; // Make the request IPagedAsyncEnumerable <ListTimeSeriesResponse, TimeSeries> response = metricServiceClient.ListTimeSeriesAsync(formattedName, filter, interval, view); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((TimeSeries item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; IAsyncEnumerable <FixedSizePage <TimeSeries> > fixedSizePages = response.AsPages().WithFixedSize(pageSize); await fixedSizePages.ForEachAsync((FixedSizePage <TimeSeries> page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (TimeSeries item in page) { Console.WriteLine(item); } }); // End snippet }
public async Task ListRowsAsync() { string projectId = _fixture.ProjectId; string datasetId = _fixture.GameDatasetId; string tableId = _fixture.HistoryTableId; // Snippet: ListRowsAsync BigqueryClient client = BigqueryClient.Create(projectId); BigqueryTable table = client.GetTable(datasetId, tableId); IPagedAsyncEnumerable <TableDataList, BigqueryRow> result = table.ListRowsAsync(); await result.ForEachAsync(row => { DateTime timestamp = (DateTime)row["game_started"]; long level = (long)row["level"]; long score = (long)row["score"]; string player = (string)row["player"]; Console.WriteLine($"{player}: {level}/{score} ({timestamp:yyyy-MM-dd HH:mm:ss})"); }); // End snippet // We set up 7 results in the fixture. Other tests may add more. Assert.True(await result.Count() >= 7); }