public async stt::Task CreateAutoscalingPolicyRequestObjectAsync()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                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.CreateAutoscalingPolicyAsync(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.CreateAutoscalingPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void CreateAutoscalingPolicyResourceNames2()
        {
            moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new moq::Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(moq::MockBehavior.Strict);
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                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.CreateAutoscalingPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            AutoscalingPolicy response            = client.CreateAutoscalingPolicy(request.ParentAsRegionName, request.Policy);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #3
0
 /// <summary>Snippet for CreateAutoscalingPolicy</summary>
 public void CreateAutoscalingPolicyRequestObject()
 {
     // Snippet: CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest, CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
     {
         ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
         Policy = new AutoscalingPolicy(),
     };
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(request);
     // End snippet
 }
 /// <summary>Snippet for CreateAutoscalingPolicy</summary>
 public void CreateAutoscalingPolicy_RequestObject()
 {
     // Snippet: CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest,CallSettings)
     // Create client
     AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
     // Initialize request argument(s)
     CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
     {
         Parent = new RegionName("[PROJECT]", "[REGION]").ToString(),
         Policy = new AutoscalingPolicy(),
     };
     // Make the request
     AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(request);
     // End snippet
 }
예제 #5
0
        /// <summary>Snippet for CreateAutoscalingPolicyAsync</summary>
        public async Task CreateAutoscalingPolicyRequestObjectAsync()
        {
            // Snippet: CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest, CallSettings)
            // Additional: CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Policy = new AutoscalingPolicy(),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.CreateAutoscalingPolicyAsync(request);

            // End snippet
        }
예제 #6
0
        public void CreateAutoscalingPolicy2()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                Parent = new RegionName("[PROJECT]", "[REGION]").ToString(),
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id   = "id3355",
                Name = "name3373707",
            };

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

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #7
0
        public async Task CreateAutoscalingPolicyAsync()
        {
            Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient> mockGrpcClient = new Mock <AutoscalingPolicyService.AutoscalingPolicyServiceClient>(MockBehavior.Strict);
            CreateAutoscalingPolicyRequest expectedRequest = new CreateAutoscalingPolicyRequest
            {
                Parent = new RegionName("[PROJECT]", "[REGION]").ToString(),
                Policy = new AutoscalingPolicy(),
            };
            AutoscalingPolicy expectedResponse = new AutoscalingPolicy
            {
                Id   = "id3355",
                Name = "name3373707",
            };

            mockGrpcClient.Setup(x => x.CreateAutoscalingPolicyAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <AutoscalingPolicy>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoscalingPolicyServiceClient client = new AutoscalingPolicyServiceClientImpl(mockGrpcClient.Object, null);
            string            formattedParent     = new RegionName("[PROJECT]", "[REGION]").ToString();
            AutoscalingPolicy policy   = new AutoscalingPolicy();
            AutoscalingPolicy response = await client.CreateAutoscalingPolicyAsync(formattedParent, policy);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #8
0
 /// <summary>
 /// Creates new autoscaling policy.
 /// </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> CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_CreateAutoscalingPolicyRequest(ref request, ref callSettings);
     return(_callCreateAutoscalingPolicy.Async(request, callSettings));
 }
예제 #9
0
 /// <summary>
 /// Creates new autoscaling policy.
 /// </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 CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_CreateAutoscalingPolicyRequest(ref request, ref callSettings);
     return(_callCreateAutoscalingPolicy.Sync(request, callSettings));
 }
예제 #10
0
 partial void Modify_CreateAutoscalingPolicyRequest(ref CreateAutoscalingPolicyRequest request, ref gaxgrpc::CallSettings settings);
예제 #11
0
 /// <summary>
 /// Creates new autoscaling policy.
 /// </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> CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest request, st::CancellationToken cancellationToken) =>
 CreateAutoscalingPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
예제 #12
0
 /// <summary>
 /// Creates new autoscaling policy.
 /// </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> CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
예제 #13
0
 /// <summary>
 /// Creates new autoscaling policy.
 /// </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 CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();