/// <summary>Snippet for DeleteGameServerConfig</summary>
        public void DeleteGameServerConfigRequestObject()
        {
            // Snippet: DeleteGameServerConfig(DeleteGameServerConfigRequest, CallSettings)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = GameServerConfigsServiceClient.Create();
            // Initialize request argument(s)
            DeleteGameServerConfigRequest request = new DeleteGameServerConfigRequest
            {
                GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"),
            };
            // Make the request
            Operation <GameServerConfig, OperationMetadata> response = gameServerConfigsServiceClient.DeleteGameServerConfig(request);

            // Poll until the returned long-running operation is complete
            Operation <GameServerConfig, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            GameServerConfig result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <GameServerConfig, OperationMetadata> retrievedResponse = gameServerConfigsServiceClient.PollOnceDeleteGameServerConfig(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                GameServerConfig retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for DeleteGameServerConfigAsync</summary>
        public async Task DeleteGameServerConfigResourceNamesAsync()
        {
            // Snippet: DeleteGameServerConfigAsync(GameServerConfigName, CallSettings)
            // Additional: DeleteGameServerConfigAsync(GameServerConfigName, CancellationToken)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = await GameServerConfigsServiceClient.CreateAsync();

            // Initialize request argument(s)
            GameServerConfigName name = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
            // Make the request
            Operation <GameServerConfig, OperationMetadata> response = await gameServerConfigsServiceClient.DeleteGameServerConfigAsync(name);

            // Poll until the returned long-running operation is complete
            Operation <GameServerConfig, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            GameServerConfig result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <GameServerConfig, OperationMetadata> retrievedResponse = await gameServerConfigsServiceClient.PollOnceDeleteGameServerConfigAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                GameServerConfig retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
 /// <summary>Snippet for GetGameServerConfig</summary>
 public void GetGameServerConfigResourceNames()
 {
     // Snippet: GetGameServerConfig(GameServerConfigName, CallSettings)
     // Create client
     GameServerConfigsServiceClient gameServerConfigsServiceClient = GameServerConfigsServiceClient.Create();
     // Initialize request argument(s)
     GameServerConfigName name = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
     // Make the request
     GameServerConfig response = gameServerConfigsServiceClient.GetGameServerConfig(name);
     // End snippet
 }
        /// <summary>Snippet for GetGameServerConfigAsync</summary>
        public async Task GetGameServerConfigResourceNamesAsync()
        {
            // Snippet: GetGameServerConfigAsync(GameServerConfigName, CallSettings)
            // Additional: GetGameServerConfigAsync(GameServerConfigName, CancellationToken)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = await GameServerConfigsServiceClient.CreateAsync();

            // Initialize request argument(s)
            GameServerConfigName name = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]");
            // Make the request
            GameServerConfig response = await gameServerConfigsServiceClient.GetGameServerConfigAsync(name);

            // End snippet
        }
    public GameServerConfig GetConfig(
        string projectId, string regionId, string deploymentId, string configId)
    {
        // Create the client.
        GameServerConfigsServiceClient client = GameServerConfigsServiceClient.Create();

        GetGameServerConfigRequest request = new GetGameServerConfigRequest
        {
            GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig(projectId, regionId, deploymentId, configId)
        };

        // Make the request.
        GameServerConfig response = client.GetGameServerConfig(request);

        return(response);
    }
    public void DeleteConfig(
        string projectId, string regionId, string deploymentId, string configId)
    {
        // Create the client.
        GameServerConfigsServiceClient client = GameServerConfigsServiceClient.Create();

        DeleteGameServerConfigRequest request = new DeleteGameServerConfigRequest
        {
            GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig(projectId, regionId, deploymentId, configId)
        };

        // Make the request.
        Operation <Empty, OperationMetadata> response = client.DeleteGameServerConfig(request);

        // Poll until the returned long-running operation is complete.
        response.PollUntilCompleted();
    }
        public async stt::Task GetGameServerConfigRequestObjectAsync()
        {
            moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient> mockGrpcClient = new moq::Mock <GameServerConfigsService.GameServerConfigsServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetGameServerConfigRequest request = new GetGameServerConfigRequest
            {
                GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"),
            };
            GameServerConfig expectedResponse = new GameServerConfig
            {
                GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"),
                CreateTime           = new wkt::Timestamp(),
                UpdateTime           = new wkt::Timestamp(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                FleetConfigs   = { new FleetConfig(), },
                ScalingConfigs =
                {
                    new ScalingConfig(),
                },
                Description = "description2cf9da67",
            };

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

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

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

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetGameServerConfigRequest request = new GetGameServerConfigRequest
            {
                GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"),
            };
            GameServerConfig expectedResponse = new GameServerConfig
            {
                GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]", "[CONFIG]"),
                CreateTime           = new wkt::Timestamp(),
                UpdateTime           = new wkt::Timestamp(),
                Labels =
                {
                    {
                        "key8a0b6e3c",
                        "value60c16320"
                    },
                },
                FleetConfigs   = { new FleetConfig(), },
                ScalingConfigs =
                {
                    new ScalingConfig(),
                },
                Description = "description2cf9da67",
            };

            mockGrpcClient.Setup(x => x.GetGameServerConfig(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GameServerConfigsServiceClient client = new GameServerConfigsServiceClientImpl(mockGrpcClient.Object, null);
            GameServerConfig response             = client.GetGameServerConfig(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
    public async Task <GameServerConfig> CreateConfigAsync(
        string projectId, string regionId, string deploymentId, string configId)
    {
        // Create the client.
        GameServerConfigsServiceClient client = await GameServerConfigsServiceClient.CreateAsync();

        GameServerConfig config = new GameServerConfig
        {
            GameServerConfigName = GameServerConfigName.FromProjectLocationDeploymentConfig(projectId, regionId, deploymentId, configId),
            Description          = "My Game Server Config",
            FleetConfigs         =
            {
                new FleetConfig
                {
                    Name      = "fleet-spec-1",
                    FleetSpec = JsonConvert.SerializeObject(new
                    {
                        replicas   = 10,
                        scheduling = "Packed",
                        strategy   = new
                        {
                            type          = "RollingUpdate",
                            rollingUpdate = new
                            {
                                maxSurge       = "25%",
                                maxUnavailable = "25%",
                            }
                        },
                        template = new
                        {
                            metadata = new
                            {
                                labels = new
                                {
                                    gameName = "udp-server",
                                }
                            },
                            spec = new
                            {
                                ports = new []      {
                                    new             {
                                        name          = "default",
                                        portPolicy    = "Dynamic",
                                        containerPort = 7654,
                                        protocol      = "UDP",
                                    }
                                },
                                health = new
                                {
                                    initialDelaySeconds = 30,
                                    periodSeconds       = 60,
                                },
                                sdkServer = new
                                {
                                    logLevel = "Info",
                                    grpcPort = 9357,
                                    httpPort = 9358,
                                },
                                template = new
                                {
                                    spec = new
                                    {
                                        containers = new []{
                                            new     {
                                                name            = "dedicated",
                                                image           = "gcr.io/agones-images/udp-server:0.21",
                                                imagePullPolicy = "Always",
                                                resources       = new
                                                {
                                                    requests = new
                                                    {
                                                        memory = "200Mi",
                                                        cpu    = "500m",
                                                    },
                                                    limits = new
                                                    {
                                                        memory = "200Mi",
                                                        cpu    = "500m",
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    })
                }
            }
        };

        CreateGameServerConfigRequest request = new CreateGameServerConfigRequest
        {
            ParentAsGameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment(projectId, regionId, deploymentId),
            ConfigId         = configId,
            GameServerConfig = config
        };

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

        // Poll until the returned long-running operation is complete.
        Operation <GameServerConfig, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

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