// [END monitoring_get_resource] public static object ListGroups(string projectId) { GroupServiceClient client = GroupServiceClient.Create(); ProjectName projectName = new ProjectName(projectId); ListGroupsRequest request = new ListGroupsRequest { Name = projectName.ToString() }; PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(request); foreach (Group group in groups.Take(10)) { Console.WriteLine($"{group.Name}: {group.DisplayName}"); } return(0); }
public void ListMetricDescriptors() { string projectId = _fixture.ProjectId; // Sample: ListMetricDescriptors // Additional: ListMetricDescriptors(*,*,*,*) MetricServiceClient client = MetricServiceClient.Create(); ProjectName projectName = new ProjectName(projectId); PagedEnumerable <ListMetricDescriptorsResponse, MetricDescriptor> metrics = client.ListMetricDescriptors(projectName); foreach (MetricDescriptor metric in metrics.Take(10)) { Console.WriteLine($"{metric.Name}: {metric.DisplayName}"); } // End sample }
public void ListGroups() { string projectId = _fixture.ProjectId; // Sample: ListGroups // Additional: ListGroups(*,*) GroupServiceClient client = GroupServiceClient.Create(); ProjectName projectName = ProjectName.FromProject(projectId); PagedEnumerable <ListGroupsResponse, Group> groups = client.ListGroups(projectName); foreach (Group group in groups.Take(10)) { Console.WriteLine($"{group.Name}: {group.DisplayName}"); } // End sample }
public void ListTraces() { string projectId = _fixture.ProjectId; // Sample: ListTraces // Additional: ListTraces(*,*,*,*) TraceServiceClient client = TraceServiceClient.Create(); PagedEnumerable <ListTracesResponse, Trace> traces = client.ListTraces(projectId); foreach (Trace trace in traces.Take(10)) { Console.WriteLine($"{trace.TraceId}:"); foreach (TraceSpan span in trace.Spans) { Console.WriteLine($" {span.StartTime}-{span.EndTime}: {span.Kind}"); } } // End sample }
// [END monitoring_read_timeseries_reduce] // [START monitoring_list_resources] public static object ListMonitoredResources(string projectId) { Console.WriteLine("Starting to List Monitored Resources..."); MetricServiceClient client = MetricServiceClient.Create(); ProjectName projectName = new ProjectName(projectId); PagedEnumerable <ListMonitoredResourceDescriptorsResponse, MonitoredResourceDescriptor> resources = client.ListMonitoredResourceDescriptors(projectName); if (resources != null) { foreach (MonitoredResourceDescriptor resource in resources.Take(10)) { Console.WriteLine($"{resource.Name}: {resource.DisplayName}"); } } else { Console.WriteLine("No resources found."); } return(0); }
public void BrowseTable( string projectId = "your-project-id" ) { BigQueryClient client = BigQueryClient.Create(projectId); TableReference tableReference = new TableReference() { TableId = "shakespeare", DatasetId = "samples", ProjectId = "bigquery-public-data" }; // Load all rows from a table PagedEnumerable <TableDataList, BigQueryRow> result = client.ListRows( tableReference: tableReference, schema: null ); // Print the first 10 rows foreach (BigQueryRow row in result.Take(10)) { Console.WriteLine($"{row["corpus"]}: {row["word_count"]}"); } }