/// <summary>Snippet for GetLogMetric</summary> public void GetLogMetricResourceNames() { // Snippet: GetLogMetric(LogMetricName, CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) LogMetricName metricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"); // Make the request LogMetric response = metricsServiceV2Client.GetLogMetric(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 GetLogMetric</summary> public void GetLogMetricRequestObject() { // Snippet: GetLogMetric(GetLogMetricRequest, CallSettings) // Create client MetricsServiceV2Client metricsServiceV2Client = MetricsServiceV2Client.Create(); // Initialize request argument(s) GetLogMetricRequest request = new GetLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; // Make the request LogMetric response = metricsServiceV2Client.GetLogMetric(request); // End snippet }
public void DeleteLogMetricResourceNames() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLogMetric(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); client.DeleteLogMetric(request.MetricNameAsLogMetricName); mockGrpcClient.VerifyAll(); }
/// <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 stt::Task DeleteLogMetricResourceNamesAsync() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); DeleteLogMetricRequest request = new DeleteLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteLogMetricAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); await client.DeleteLogMetricAsync(request.MetricNameAsLogMetricName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteLogMetricAsync(request.MetricNameAsLogMetricName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public async stt::Task UpdateLogMetricResourceNamesAsync() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); UpdateLogMetricRequest request = new UpdateLogMetricRequest { MetricNameAsLogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), Metric = new LogMetric(), }; LogMetric expectedResponse = new LogMetric { LogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), Description = "description2cf9da67", Filter = "filtere47ac9b2", #pragma warning disable CS0612 Version = LogMetric.Types.ApiVersion.V2, #pragma warning restore CS0612 MetricDescriptor = new ga::MetricDescriptor(), ValueExtractor = "value_extractor09b994a6", LabelExtractors = { { "key8a0b6e3c", "value60c16320" }, }, BucketOptions = new ga::Distribution.Types.BucketOptions(), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.UpdateLogMetricAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <LogMetric>(stt::Task.FromResult(expectedResponse), null, null, null, null)); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); LogMetric responseCallSettings = await client.UpdateLogMetricAsync(request.MetricNameAsLogMetricName, request.Metric, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); LogMetric responseCancellationToken = await client.UpdateLogMetricAsync(request.MetricNameAsLogMetricName, request.Metric, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateLogMetricResourceNames() { moq::Mock <MetricsServiceV2.MetricsServiceV2Client> mockGrpcClient = new moq::Mock <MetricsServiceV2.MetricsServiceV2Client>(moq::MockBehavior.Strict); CreateLogMetricRequest request = new CreateLogMetricRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Metric = new LogMetric(), }; LogMetric expectedResponse = new LogMetric { LogMetricName = LogMetricName.FromProjectMetric("[PROJECT]", "[METRIC]"), Description = "description2cf9da67", Filter = "filtere47ac9b2", #pragma warning disable CS0612 Version = LogMetric.Types.ApiVersion.V2, #pragma warning restore CS0612 MetricDescriptor = new ga::MetricDescriptor(), ValueExtractor = "value_extractor09b994a6", LabelExtractors = { { "key8a0b6e3c", "value60c16320" }, }, BucketOptions = new ga::Distribution.Types.BucketOptions(), CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.CreateLogMetric(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); MetricsServiceV2Client client = new MetricsServiceV2ClientImpl(mockGrpcClient.Object, null); LogMetric response = client.CreateLogMetric(request.ParentAsProjectName, request.Metric); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }