Get rollout

Get details of a rollout of Game Servers.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


To learn how to install and use the client library for Game Servers, see the Game Servers Client Libraries.

import (

	gaming ""
	gamingpb ""

// getGameServerDeploymentRollout retrieves info on a game server deployment's rollout.
func getGameServerDeploymentRollout(w io.Writer, projectID, deploymentID string) error {
	// projectID := "my-project"
	// deploymentID := "mydeployment"
	ctx := context.Background()
	client, err := gaming.NewGameServerDeploymentsClient(ctx)
	if err != nil {
		return fmt.Errorf("NewGameServerDeploymentsClient: %v", err)
	defer client.Close()

	req := &gamingpb.GetGameServerDeploymentRolloutRequest{
		Name: fmt.Sprintf("projects/%s/locations/global/gameServerDeployments/%s", projectID, deploymentID),

	resp, err := client.GetGameServerDeploymentRollout(ctx, req)
	if err != nil {
		return fmt.Errorf("GetGameServerDeploymentRollout: %v", err)

	fmt.Fprintf(w, "Rollout default: %v\n", resp.DefaultGameServerConfig)
	for _, override := range resp.GameServerConfigOverrides {
		switch override.Selector.(type) {
		case *gamingpb.GameServerConfigOverride_RealmsSelector:
			fmt.Fprint(w, "Override these realms ", override.GetRealmsSelector().Realms)
			fmt.Fprint(w, "Unknown override selector")

		switch override.Change.(type) {
		case *gamingpb.GameServerConfigOverride_ConfigVersion:
			fmt.Fprint(w, "with this config: ", override.GetConfigVersion())
			fmt.Fprint(w, "with an unknown override")
	return nil


To learn how to install and use the client library for Game Servers, see the Game Servers Client Libraries.

const {
} = require('@google-cloud/game-servers');

const client = new GameServerDeploymentsServiceClient();

async function getGameServerDeploymentRollout() {
   * TODO(developer): Uncomment these variables before running the sample.
  // const projectId = 'Your Google Cloud Project ID';
  // const deploymentId = 'A unique ID for the Game Server Deployment';
  const request = {
    // The full resource name
    name: client.gameServerDeploymentPath(projectId, 'global', deploymentId),

  const [rollout] = await client.getGameServerDeploymentRollout(request);
  console.log(`Rollout name: ${}`);
  console.log(`Rollout default: ${rollout.defaultGameServerConfig}`);
  for (const override of rollout.gameServerConfigOverrides) {
    console.log(`Rollout config overrides: ${override.configVersion}`);
      `Rollout realm overrides: ${JSON.stringify(override.realmsSelector)}`

  const updateTime = rollout.updateTime;
  const updateDate = new Date(updateTime.seconds * 1000);
  console.log(`Rollout updated on: ${updateDate.toLocaleDateString()}\n`);



To learn how to install and use the client library for Game Servers, see the Game Servers Client Libraries.

def get_rollout(project_id, deployment_id):
    """Gets the rollout of a game server deployment."""

    client = gaming.GameServerDeploymentsServiceClient()

    # Location is hard coded as global, as game server deployments can
    # only be created in global.  This is done for all operations on
    # game server deployments, as well as for its child resource types.
    request = game_server_deployments.GetGameServerDeploymentRolloutRequest(

    response = client.get_game_server_deployment_rollout(request)
    print(f"Get deployment response:\n{response}")
    return response

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser