public async stt::Task GetGameServerDeploymentRolloutResourceNamesAsync()
        {
            moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient> mockGrpcClient = new moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetGameServerDeploymentRolloutRequest request = new GetGameServerDeploymentRolloutRequest
            {
                GameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"),
            };
            GameServerDeploymentRollout expectedResponse = new GameServerDeploymentRollout
            {
                GameServerDeploymentRolloutName = GameServerDeploymentRolloutName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"),
                CreateTime = new wkt::Timestamp(),
                UpdateTime = new wkt::Timestamp(),
                DefaultGameServerConfig   = "default_game_server_config2214de2f",
                GameServerConfigOverrides =
                {
                    new GameServerConfigOverride(),
                },
                Etag = "etage8ad7218",
            };

            mockGrpcClient.Setup(x => x.GetGameServerDeploymentRolloutAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GameServerDeploymentRollout>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            GameServerDeploymentsServiceClient client = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null);
            GameServerDeploymentRollout        responseCallSettings = await client.GetGameServerDeploymentRolloutAsync(request.GameServerDeploymentName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            GameServerDeploymentRollout responseCancellationToken = await client.GetGameServerDeploymentRolloutAsync(request.GameServerDeploymentName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetGameServerDeploymentRolloutResourceNames()
        {
            moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient> mockGrpcClient = new moq::Mock <GameServerDeploymentsService.GameServerDeploymentsServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetGameServerDeploymentRolloutRequest request = new GetGameServerDeploymentRolloutRequest
            {
                GameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"),
            };
            GameServerDeploymentRollout expectedResponse = new GameServerDeploymentRollout
            {
                GameServerDeploymentRolloutName = GameServerDeploymentRolloutName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"),
                CreateTime = new wkt::Timestamp(),
                UpdateTime = new wkt::Timestamp(),
                DefaultGameServerConfig   = "default_game_server_config2214de2f",
                GameServerConfigOverrides =
                {
                    new GameServerConfigOverride(),
                },
                Etag = "etage8ad7218",
            };

            mockGrpcClient.Setup(x => x.GetGameServerDeploymentRollout(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GameServerDeploymentsServiceClient client   = new GameServerDeploymentsServiceClientImpl(mockGrpcClient.Object, null);
            GameServerDeploymentRollout        response = client.GetGameServerDeploymentRollout(request.GameServerDeploymentName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #3
0
    public async Task <GameServerDeployment> UpdateRolloutRemoveOverrideConfigAsync(
        string projectId, string deploymentId)
    {
        // Create the client.
        GameServerDeploymentsServiceClient client = await GameServerDeploymentsServiceClient.CreateAsync();

        GameServerDeploymentRollout rollout = new GameServerDeploymentRollout
        {
            Name = GameServerDeploymentName.FormatProjectLocationDeployment(projectId, "global", deploymentId)
        };

        UpdateGameServerDeploymentRolloutRequest request = new UpdateGameServerDeploymentRolloutRequest
        {
            Rollout    = rollout,
            UpdateMask = new FieldMask {
                Paths = { "game_server_config_overrides" }
            }
        };

        // Make the request.
        Operation <GameServerDeployment, OperationMetadata> response = await client.UpdateGameServerDeploymentRolloutAsync(request);

        Operation <GameServerDeployment, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

        // Retrieve the operation result.
        return(completedResponse.Result);
    }
Example #4
0
    public GameServerDeploymentRollout GetRollout(
        string projectId, string deploymentId)
    {
        // Create the client.
        GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.Create();

        GetGameServerDeploymentRolloutRequest request = new GetGameServerDeploymentRolloutRequest
        {
            GameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment(projectId, "global", deploymentId)
        };

        // Make the request.
        GameServerDeploymentRollout response = client.GetGameServerDeploymentRollout(request);

        return(response);
    }
    public async Task <GameServerDeployment> UpdateRolloutOverrideConfigAsync(
        string projectId, string deploymentId, string configId, string realmRegionId, string realmId)
    {
        // Create the client.
        GameServerDeploymentsServiceClient client = await GameServerDeploymentsServiceClient.CreateAsync();

        GameServerConfigOverride configOverride = new GameServerConfigOverride
        {
            ConfigVersion  = configId,
            RealmsSelector = new RealmSelector()
        };

        configOverride.RealmsSelector.Realms.Add(RealmName.FormatProjectLocationRealm(projectId, realmRegionId, realmId));

        GameServerDeploymentRollout rollout = new GameServerDeploymentRollout
        {
            Name = GameServerDeploymentName.FormatProjectLocationDeployment(projectId, "global", deploymentId)
        };

        rollout.GameServerConfigOverrides.Add(configOverride);

        UpdateGameServerDeploymentRolloutRequest request = new UpdateGameServerDeploymentRolloutRequest
        {
            Rollout    = rollout,
            UpdateMask = new FieldMask {
                Paths = { "game_server_config_overrides" }
            }
        };

        // Make the request.
        Operation <GameServerDeployment, OperationMetadata> response = await client.UpdateGameServerDeploymentRolloutAsync(request);

        Operation <GameServerDeployment, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

        // Retrieve the operation result.
        return(completedResponse.Result);
    }