public async stt::Task UpdateAutoscalingPolicyAsync()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id = "id74b70bb8",
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
                BasicAlgorithm        = new BasicAutoscalingAlgorithm(),
                WorkerConfig          = new InstanceGroupAutoscalingPolicyConfig(),
                SecondaryWorkerConfig = new InstanceGroupAutoscalingPolicyConfig(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AutoscalingPolicy>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client  = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy responseCallSettings = await client.UpdateAutoscalingPolicyAsync(request.Policy, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            AutoscalingPolicy responseCancellationToken = await client.UpdateAutoscalingPolicyAsync(request.Policy, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateAutoscalingPolicy()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id = "id74b70bb8",
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
                BasicAlgorithm        = new BasicAutoscalingAlgorithm(),
                WorkerConfig          = new InstanceGroupAutoscalingPolicyConfig(),
                SecondaryWorkerConfig = new InstanceGroupAutoscalingPolicyConfig(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
            };

            mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.UpdateAutoscalingPolicy(request.Policy);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #3
0
 /// <summary>Snippet for UpdateAutoscalingPolicy</summary>
 public void UpdateAutoscalingPolicyRequestObject()
 {
     // Snippet: UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest, CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
     {
         Policy = new AutoscalingPolicy(),
     };
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.UpdateAutoscalingPolicy(request);
     // End snippet
 }
Пример #4
0
        /// <summary>Snippet for UpdateAutoscalingPolicyAsync</summary>
        public async Task UpdateAutoscalingPolicyRequestObjectAsync()
        {
            // Snippet: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest, CallSettings)
            // Additional: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.UpdateAutoscalingPolicyAsync(request);

            // End snippet
        }
Пример #5
0
        public async Task UpdateAutoscalingPolicyAsync2()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id   = "id3355",
                Name = "name3373707",
            };

            mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AutoscalingPolicy>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = await client.UpdateAutoscalingPolicyAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #6
0
        public void UpdateAutoscalingPolicy2()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id   = "id3355",
                Name = "name3373707",
            };

            mockGrpcClient.Setup(x => x.UpdateAutoscalingPolicy(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.UpdateAutoscalingPolicy(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Пример #7
0
 /// <summary>
 /// Updates (replaces) autoscaling policy.
 ///
 /// Disabled check for update_mask, because all updates will be full
 /// replacements.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_UpdateAutoscalingPolicyRequest(ref request, ref callSettings);
     return(_callUpdateAutoscalingPolicy.Async(request, callSettings));
 }
Пример #8
0
 /// <summary>
 /// Updates (replaces) autoscaling policy.
 ///
 /// Disabled check for update_mask, because all updates will be full
 /// replacements.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override AutoscalingPolicy UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_UpdateAutoscalingPolicyRequest(ref request, ref callSettings);
     return(_callUpdateAutoscalingPolicy.Sync(request, callSettings));
 }
Пример #9
0
 partial void Modify_UpdateAutoscalingPolicyRequest(ref UpdateAutoscalingPolicyRequest request, ref gaxgrpc::CallSettings settings);
Пример #10
0
 /// <summary>
 /// Updates (replaces) autoscaling policy.
 ///
 /// Disabled check for update_mask, because all updates will be full
 /// replacements.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, st::CancellationToken cancellationToken) =>
 UpdateAutoscalingPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
Пример #11
0
 /// <summary>
 /// Updates (replaces) autoscaling policy.
 ///
 /// Disabled check for update_mask, because all updates will be full
 /// replacements.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <AutoscalingPolicy> UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
Пример #12
0
 /// <summary>
 /// Updates (replaces) autoscaling policy.
 ///
 /// Disabled check for update_mask, because all updates will be full
 /// replacements.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual AutoscalingPolicy UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();