Exemple #1
0
        public async Task CreateServiceLevelObjectiveAsync()
        {
            Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict);
            CreateServiceLevelObjectiveRequest expectedRequest = new CreateServiceLevelObjectiveRequest
            {
                ParentAsServiceName   = new ServiceName("[PROJECT]", "[SERVICE]"),
                ServiceLevelObjective = new ServiceLevelObjective(),
            };
            ServiceLevelObjective expectedResponse = new ServiceLevelObjective
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
                DisplayName = "displayName1615086568",
                Goal        = 317825.0,
            };

            mockGrpcClient.Setup(x => x.CreateServiceLevelObjectiveAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ServiceLevelObjective>(Task.FromResult(expectedResponse), null, null, null, null));
            ServiceMonitoringServiceClient client       = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null);
            ServiceName           parent                = new ServiceName("[PROJECT]", "[SERVICE]");
            ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective();
            ServiceLevelObjective response              = await client.CreateServiceLevelObjectiveAsync(parent, serviceLevelObjective);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
 /// <summary>Snippet for UpdateServiceLevelObjective</summary>
 public void UpdateServiceLevelObjective()
 {
     // Snippet: UpdateServiceLevelObjective(ServiceLevelObjective,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective();
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.UpdateServiceLevelObjective(serviceLevelObjective);
     // End snippet
 }
Exemple #3
0
 /// <summary>Snippet for GetServiceLevelObjective</summary>
 public void GetServiceLevelObjective()
 {
     // Snippet: GetServiceLevelObjective(ServiceLevelObjectiveName,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     ServiceLevelObjectiveName name = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.GetServiceLevelObjective(name);
     // End snippet
 }
Exemple #4
0
 /// <summary>Snippet for CreateServiceLevelObjective</summary>
 public void CreateServiceLevelObjective()
 {
     // Snippet: CreateServiceLevelObjective(ServiceName,ServiceLevelObjective,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     ServiceName           parent = new ServiceName("[PROJECT]", "[SERVICE]");
     ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective();
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.CreateServiceLevelObjective(parent, serviceLevelObjective);
     // End snippet
 }
Exemple #5
0
 /// <summary>Snippet for UpdateServiceLevelObjective</summary>
 public void UpdateServiceLevelObjective_RequestObject()
 {
     // Snippet: UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     UpdateServiceLevelObjectiveRequest request = new UpdateServiceLevelObjectiveRequest
     {
         ServiceLevelObjective = new ServiceLevelObjective(),
     };
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.UpdateServiceLevelObjective(request);
     // End snippet
 }
Exemple #6
0
        /// <summary>Snippet for UpdateServiceLevelObjectiveAsync</summary>
        public async Task UpdateServiceLevelObjectiveAsync()
        {
            // Snippet: UpdateServiceLevelObjectiveAsync(ServiceLevelObjective,CallSettings)
            // Additional: UpdateServiceLevelObjectiveAsync(ServiceLevelObjective,CancellationToken)
            // Create client
            ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync();

            // Initialize request argument(s)
            ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective();
            // Make the request
            ServiceLevelObjective response = await serviceMonitoringServiceClient.UpdateServiceLevelObjectiveAsync(serviceLevelObjective);

            // End snippet
        }
Exemple #7
0
        /// <summary>Snippet for GetServiceLevelObjectiveAsync</summary>
        public async Task GetServiceLevelObjectiveAsync()
        {
            // Snippet: GetServiceLevelObjectiveAsync(ServiceLevelObjectiveName,CallSettings)
            // Additional: GetServiceLevelObjectiveAsync(ServiceLevelObjectiveName,CancellationToken)
            // Create client
            ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync();

            // Initialize request argument(s)
            ServiceLevelObjectiveName name = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
            // Make the request
            ServiceLevelObjective response = await serviceMonitoringServiceClient.GetServiceLevelObjectiveAsync(name);

            // End snippet
        }
Exemple #8
0
 /// <summary>Snippet for CreateServiceLevelObjective</summary>
 public void CreateServiceLevelObjective_RequestObject()
 {
     // Snippet: CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     CreateServiceLevelObjectiveRequest request = new CreateServiceLevelObjectiveRequest
     {
         ParentAsServiceName   = new ServiceName("[PROJECT]", "[SERVICE]"),
         ServiceLevelObjective = new ServiceLevelObjective(),
     };
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.CreateServiceLevelObjective(request);
     // End snippet
 }
Exemple #9
0
        /// <summary>Snippet for CreateServiceLevelObjectiveAsync</summary>
        public async Task CreateServiceLevelObjectiveAsync()
        {
            // Snippet: CreateServiceLevelObjectiveAsync(ServiceName,ServiceLevelObjective,CallSettings)
            // Additional: CreateServiceLevelObjectiveAsync(ServiceName,ServiceLevelObjective,CancellationToken)
            // Create client
            ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync();

            // Initialize request argument(s)
            ServiceName           parent = new ServiceName("[PROJECT]", "[SERVICE]");
            ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective();
            // Make the request
            ServiceLevelObjective response = await serviceMonitoringServiceClient.CreateServiceLevelObjectiveAsync(parent, serviceLevelObjective);

            // End snippet
        }
Exemple #10
0
        /// <summary>Snippet for CreateServiceLevelObjectiveAsync</summary>
        public async Task CreateServiceLevelObjectiveAsync_RequestObject()
        {
            // Snippet: CreateServiceLevelObjectiveAsync(CreateServiceLevelObjectiveRequest,CallSettings)
            // Additional: CreateServiceLevelObjectiveAsync(CreateServiceLevelObjectiveRequest,CancellationToken)
            // Create client
            ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateServiceLevelObjectiveRequest request = new CreateServiceLevelObjectiveRequest
            {
                ParentAsServiceName   = new ServiceName("[PROJECT]", "[SERVICE]"),
                ServiceLevelObjective = new ServiceLevelObjective(),
            };
            // Make the request
            ServiceLevelObjective response = await serviceMonitoringServiceClient.CreateServiceLevelObjectiveAsync(request);

            // End snippet
        }
Exemple #11
0
        public void UpdateServiceLevelObjective2()
        {
            Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict);
            UpdateServiceLevelObjectiveRequest request = new UpdateServiceLevelObjectiveRequest
            {
                ServiceLevelObjective = new ServiceLevelObjective(),
            };
            ServiceLevelObjective expectedResponse = new ServiceLevelObjective
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
                DisplayName = "displayName1615086568",
                Goal        = 317825.0,
            };

            mockGrpcClient.Setup(x => x.UpdateServiceLevelObjective(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ServiceMonitoringServiceClient client   = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null);
            ServiceLevelObjective          response = client.UpdateServiceLevelObjective(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }