This directory contains samples for Google Cloud Game Servers. The Google Cloud Game Servers is a managed service that enables game developers to deploy and manage their dedicated game servers across multiple Agones clusters around the world through a single interface.
This sample requires you to have authentication setup. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.
Clone python-docs-samples and change directory to the sample directory you want to use.
$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.
Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
$ virtualenv env $ source env/bin/activate
Install the dependencies needed to run the samples.
$ pip install -r requirements.txt
To run this sample:
$ python create_deployment.py
usage: create_deployment.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python delete_deployment.py
usage: delete_deployment.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python get_deployment.py
usage: get_deployment.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python update_deployment.py
usage: update_deployment.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python get_rollout.py
usage: get_rollout.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python list_deployments.py
usage: list_deployments.py [-h] --project-id PROJECT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
To run this sample:
$ python update_rollout_default.py
usage: update_rollout_default.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID --config-id CONFIG_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
--config-id CONFIG_ID
Your game server config ID.
To run this sample:
$ python update_rollout_override.py
usage: update_rollout_override.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID --config-id CONFIG_ID
--realm-location REALM_LOCATION --realm-id
REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
--config-id CONFIG_ID
Your game server config ID.
--realm-location REALM_LOCATION
Your game server config ID.
--realm-id REALM_ID Your game server config ID.
To run this sample:
$ python update_rollout_remove_default.py
usage: update_rollout_remove_default.py [-h] --project-id PROJECT_ID
--deployment-id DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python update_rollout_remove_override.py
usage: update_rollout_remove_override.py [-h] --project-id PROJECT_ID
--deployment-id DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python create_config.py
usage: create_config.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID --config-id CONFIG_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
--config-id CONFIG_ID
Your game server config ID.
To run this sample:
$ python delete_config.py
usage: delete_config.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID --config-id CONFIG_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
--config-id CONFIG_ID
Your game server config ID.
To run this sample:
$ python get_config.py
usage: get_config.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID --config-id CONFIG_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
--config-id CONFIG_ID
Your game server config ID.
To run this sample:
$ python list_configs.py
usage: list_configs.py [-h] --project-id PROJECT_ID --deployment-id
DEPLOYMENT_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--deployment-id DEPLOYMENT_ID
Your game server deployment ID.
To run this sample:
$ python create_realm.py
usage: create_realm.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
To run this sample:
$ python delete_realm.py
usage: delete_realm.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
To run this sample:
$ python get_realm.py
usage: get_realm.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
To run this sample:
$ python update_realm.py
usage: update_realm.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
To run this sample:
$ python list_realms.py
usage: list_realms.py [-h] --project-id PROJECT_ID --location LOCATION
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
To run this sample:
$ python create_cluster.py
usage: create_cluster.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID --cluster-id CLUSTER_ID
--gke-cluster-name GKE_CLUSTER_NAME
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
--cluster-id CLUSTER_ID
Your game server cluster ID.
--gke-cluster-name GKE_CLUSTER_NAME
The name of the GKE cluster which is managed by the
game server cluster being created.
To run this sample:
$ python delete_cluster.py
usage: delete_cluster.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID --cluster-id CLUSTER_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
--cluster-id CLUSTER_ID
Your game server cluster ID.
To run this sample:
$ python get_cluster.py
usage: get_cluster.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID --cluster-id CLUSTER_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
--cluster-id CLUSTER_ID
Your game server cluster ID.
To run this sample:
$ python update_cluster.py
usage: update_cluster.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID --cluster-id CLUSTER_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
--cluster-id CLUSTER_ID
Your game server cluster ID.
To run this sample:
$ python list_clusters.py
usage: list_clusters.py [-h] --project-id PROJECT_ID --location LOCATION
--realm-id REALM_ID
optional arguments:
-h, --help show this help message and exit
--project-id PROJECT_ID
Your cloud project ID.
--location LOCATION Your realm location.
--realm-id REALM_ID Your realm ID.
This sample uses the Google Cloud Client Library for Python. You can read the documentation for more details on API usage and use GitHub to browse the source and report issues.