using Google.Api.Gax;
using Google.Cloud.Gaming.V1;
using System.Collections.Generic;
using System.Linq;
public class ListConfigsSample
{
public IList<GameServerConfig> ListConfigs(
string projectId, string regionId, string deploymentId)
{
// Create the client.
GameServerConfigsServiceClient client = GameServerConfigsServiceClient.Create();
ListGameServerConfigsRequest request = new ListGameServerConfigsRequest
{
ParentAsGameServerDeploymentName = GameServerDeploymentName.FromProjectLocationDeployment(projectId, regionId, deploymentId)
};
// Make the request.
PagedEnumerable<ListGameServerConfigsResponse, GameServerConfig> response = client.ListGameServerConfigs(request);
// The returned sequence will lazily perform RPCs as it's being iterated over.
return response.ToList();
}
}
def list_configs(project_id, deployment_id):
"""Lists the existing game server deployments."""
client = gaming.GameServerConfigsServiceClient()
# Location is hard coded as global, as game server configs can
# only be created in global. This is done for all operations on
# game server configs.
response = client.list_game_server_configs(
parent=f"projects/{project_id}/locations/global/gameServerDeployments/{deployment_id}"
)
for config in response.game_server_configs:
print(f"Name: {config.name}")
return response.game_server_configs