/// <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 CreateGameServerConfigAsync</summary>
        public async Task CreateGameServerConfigAsync()
        {
            // Snippet: CreateGameServerConfigAsync(string, GameServerConfig, CallSettings)
            // Additional: CreateGameServerConfigAsync(string, GameServerConfig, CancellationToken)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = await GameServerConfigsServiceClient.CreateAsync();

            // Initialize request argument(s)
            string           parent           = "projects/[PROJECT]/locations/[LOCATION]/gameServerDeployments/[DEPLOYMENT]";
            GameServerConfig gameServerConfig = new GameServerConfig();
            // Make the request
            Operation <GameServerConfig, OperationMetadata> response = await gameServerConfigsServiceClient.CreateGameServerConfigAsync(parent, gameServerConfig);

            // 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.PollOnceCreateGameServerConfigAsync(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 ListGameServerConfigs</summary>
        public async Task ListGameServerConfigsRequestObjectAsync()
        {
            // Snippet: ListGameServerConfigsAsync(ListGameServerConfigsRequest, CallSettings)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = await GameServerConfigsServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListGameServerConfigsRequest request = new ListGameServerConfigsRequest
            {
                ParentAsGameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment("[PROJECT]", "[LOCATION]", "[DEPLOYMENT]"),
                Filter  = "",
                OrderBy = "",
            };
            // Make the request
            PagedAsyncEnumerable <ListGameServerConfigsResponse, GameServerConfig> response = gameServerConfigsServiceClient.ListGameServerConfigsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((GameServerConfig item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListGameServerConfigsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (GameServerConfig item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <GameServerConfig> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (GameServerConfig item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // 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
        }
        /// <summary>Snippet for GetGameServerConfigAsync</summary>
        public async Task GetGameServerConfigAsync()
        {
            // Snippet: GetGameServerConfigAsync(string, CallSettings)
            // Additional: GetGameServerConfigAsync(string, CancellationToken)
            // Create client
            GameServerConfigsServiceClient gameServerConfigsServiceClient = await GameServerConfigsServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/gameServerDeployments/[DEPLOYMENT]/configs/[CONFIG]";
            // Make the request
            GameServerConfig response = await gameServerConfigsServiceClient.GetGameServerConfigAsync(name);

            // End snippet
        }
    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);
    }