public void ListLogMetrics() { // Snippet: ListLogMetrics(string,string,int?,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) string formattedParent = MetricsServiceV2Client.FormatParentName("[PROJECT]"); // Make the request IPagedEnumerable <ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetrics(formattedParent); // Iterate over all response items, lazily performing RPCs as required foreach (LogMetric item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over fixed-sized pages, lazily performing RPCs as required int pageSize = 10; foreach (FixedSizePage <LogMetric> page in response.AsPages().WithFixedSize(pageSize)) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (LogMetric item in page) { Console.WriteLine(item); } } // End snippet }
public void CreateLogMetric() { // Snippet: CreateLogMetric(string,LogMetric,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) string formattedParent = MetricsServiceV2Client.FormatParentName("[PROJECT]"); LogMetric metric = new LogMetric(); // Make the request LogMetric response = metricsServiceV2Client.CreateLogMetric(formattedParent, metric); // End snippet }
public async Task CreateLogMetricAsync() { // Snippet: CreateLogMetricAsync(string,LogMetric,CallSettings) // Additional: CreateLogMetricAsync(string,LogMetric,CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) string formattedParent = MetricsServiceV2Client.FormatParentName("[PROJECT]"); LogMetric metric = new LogMetric(); // Make the request LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(formattedParent, metric); // End snippet }