/// <summary>Snippet for DeleteLogMetricAsync</summary> public async Task DeleteLogMetricAsync() { // Snippet: DeleteLogMetricAsync(MetricNameOneof,CallSettings) // Additional: DeleteLogMetricAsync(MetricNameOneof,CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) MetricNameOneof metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")); // Make the request await metricsServiceV2Client.DeleteLogMetricAsync(metricName); // End snippet }
/// <summary>Snippet for DeleteLogMetricAsync</summary> public async Task DeleteLogMetricAsync() { // Snippet: DeleteLogMetricAsync(string, CallSettings) // Additional: DeleteLogMetricAsync(string, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) string metricName = "projects/[PROJECT]/metrics/[METRIC]"; // Make the request await metricsServiceV2Client.DeleteLogMetricAsync(metricName); // End snippet }
/// <summary>Snippet for DeleteLogMetricAsync</summary> public async Task DeleteLogMetricResourceNamesAsync() { // Snippet: DeleteLogMetricAsync(LogMetricName, CallSettings) // Additional: DeleteLogMetricAsync(LogMetricName, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"); // Make the request await metricsServiceV2Client.DeleteLogMetricAsync(metricName); // End snippet }
/// <summary>Snippet for UpdateLogMetricAsync</summary> public async Task UpdateLogMetricAsync() { // Snippet: UpdateLogMetricAsync(MetricNameOneof,LogMetric,CallSettings) // Additional: UpdateLogMetricAsync(MetricNameOneof,LogMetric,CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) MetricNameOneof metricName = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")); LogMetric metric = new LogMetric(); // Make the request LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric); // End snippet }
/// <summary>Snippet for CreateLogMetricAsync</summary> public async Task CreateLogMetricAsync() { // Snippet: CreateLogMetricAsync(ParentNameOneof,LogMetric,CallSettings) // Additional: CreateLogMetricAsync(ParentNameOneof,LogMetric,CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) ParentNameOneof parent = ParentNameOneof.From(new ProjectName("[PROJECT]")); LogMetric metric = new LogMetric(); // Make the request LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric); // End snippet }
/// <summary>Snippet for UpdateLogMetricAsync</summary> public async Task UpdateLogMetricAsync() { // Snippet: UpdateLogMetricAsync(string, LogMetric, CallSettings) // Additional: UpdateLogMetricAsync(string, LogMetric, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) string metricName = "projects/[PROJECT]/metrics/[METRIC]"; LogMetric metric = new LogMetric(); // Make the request LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(metricName, metric); // End snippet }
/// <summary>Snippet for CreateLogMetricAsync</summary> public async Task CreateLogMetricResourceNamesAsync() { // Snippet: CreateLogMetricAsync(MetricName, LogMetric, CallSettings) // Additional: CreateLogMetricAsync(MetricName, LogMetric, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) MetricName parent = MetricName.FromProjectMetric("[PROJECT]", "[METRIC]"); LogMetric metric = new LogMetric(); // Make the request LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(parent, metric); // End snippet }
/// <summary>Snippet for ListLogMetricsAsync</summary> public async Task ListLogMetricsRequestObjectAsync() { // Snippet: ListLogMetricsAsync(ListLogMetricsRequest, CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) ListLogMetricsRequest request = new ListLogMetricsRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), }; // Make the request PagedAsyncEnumerable <ListLogMetricsResponse, LogMetric> response = metricsServiceV2Client.ListLogMetricsAsync(request); // 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 pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListLogMetricsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (LogMetric 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 <LogMetric> 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 (LogMetric 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 async Task DeleteLogMetricAsync_RequestObject() { // Snippet: DeleteLogMetricAsync(DeleteLogMetricRequest,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")), }; // Make the request await metricsServiceV2Client.DeleteLogMetricAsync(request); // End snippet }
/// <summary>Snippet for GetLogMetricAsync</summary> public async Task GetLogMetricAsync_RequestObject() { // Snippet: GetLogMetricAsync(GetLogMetricRequest,CallSettings) // Additional: GetLogMetricAsync(GetLogMetricRequest,CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) GetLogMetricRequest request = new GetLogMetricRequest { MetricNameAsMetricNameOneof = MetricNameOneof.From(new MetricName("[PROJECT]", "[METRIC]")), }; // Make the request LogMetric response = await metricsServiceV2Client.GetLogMetricAsync(request); // End snippet }
/// <summary>Snippet for DeleteLogMetricAsync</summary> public async Task DeleteLogMetricRequestObjectAsync() { // Snippet: DeleteLogMetricAsync(DeleteLogMetricRequest, CallSettings) // Additional: DeleteLogMetricAsync(DeleteLogMetricRequest, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; // Make the request await metricsServiceV2Client.DeleteLogMetricAsync(request); // End snippet }
public async Task CreateLogMetricAsync_RequestObject() { // Snippet: CreateLogMetricAsync(CreateLogMetricRequest,CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) CreateLogMetricRequest request = new CreateLogMetricRequest { ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")), Metric = new LogMetric(), }; // Make the request LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request); // End snippet }
/// <summary>Snippet for CreateLogMetricAsync</summary> public async Task CreateLogMetricRequestObjectAsync() { // Snippet: CreateLogMetricAsync(CreateLogMetricRequest, CallSettings) // Additional: CreateLogMetricAsync(CreateLogMetricRequest, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) CreateLogMetricRequest request = new CreateLogMetricRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), Metric = new LogMetric(), }; // Make the request LogMetric response = await metricsServiceV2Client.CreateLogMetricAsync(request); // End snippet }
/// <summary>Snippet for UpdateLogMetricAsync</summary> public async Task UpdateLogMetricRequestObjectAsync() { // Snippet: UpdateLogMetricAsync(UpdateLogMetricRequest, CallSettings) // Additional: UpdateLogMetricAsync(UpdateLogMetricRequest, CancellationToken) // Create client MetricsServiceV2Client metricsServiceV2Client = await MetricsServiceV2Client.CreateAsync(); // Initialize request argument(s) UpdateLogMetricRequest request = new UpdateLogMetricRequest { MetricNameAsMetricName = MetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), Metric = new LogMetric(), }; // Make the request LogMetric response = await metricsServiceV2Client.UpdateLogMetricAsync(request); // End snippet }