diff --git a/generated,README.md/README.md b/generated,README.md/README.md new file mode 100644 index 0000000000..e328ce9123 --- /dev/null +++ b/generated,README.md/README.md @@ -0,0 +1,484 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." +Google Cloud Platform logo + +# [Google Cloud Game Servers: Node.js Samples](https://github.com/googleapis/nodejs-game-servers) + +[![Open in Cloud Shell][shell_img]][shell_link] + + + +## Table of Contents + +* [Before you begin](#before-you-begin) +* [Samples](#samples) + * [Create_cluster](#create_cluster) + * [Create_config](#create_config) + * [Create_deployment](#create_deployment) + * [Create_realm](#create_realm) + * [Delete_cluster](#delete_cluster) + * [Delete_config](#delete_config) + * [Delete_deployment](#delete_deployment) + * [Delete_realm](#delete_realm) + * [Get_cluster](#get_cluster) + * [Get_config](#get_config) + * [Get_deployment](#get_deployment) + * [Get_realm](#get_realm) + * [Get_rollout](#get_rollout) + * [List_clusters](#list_clusters) + * [List_configs](#list_configs) + * [List_deployments](#list_deployments) + * [List_realms](#list_realms) + * [Create Game Server Realm](#create-game-server-realm) + * [Update_cluster](#update_cluster) + * [Update_deployment](#update_deployment) + * [Update_realm](#update_realm) + * [Update_rollout_default](#update_rollout_default) + * [Update_rollout_override](#update_rollout_override) + * [Update_rollout_remove_default](#update_rollout_remove_default) + * [Update_rollout_remove_override](#update_rollout_remove_override) + +## Before you begin + +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-game-servers#using-the-client-library). + +`cd samples` + +`npm install` + +`cd ..` + +## Samples + + + +### Create_cluster + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/create_cluster.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/create_cluster.js,samples/README.md) + +__Usage:__ + + +`node samples/create_cluster.js` + + +----- + + + + +### Create_config + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/create_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/create_config.js,samples/README.md) + +__Usage:__ + + +`node samples/create_config.js` + + +----- + + + + +### Create_deployment + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/create_deployment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/create_deployment.js,samples/README.md) + +__Usage:__ + + +`node samples/create_deployment.js` + + +----- + + + + +### Create_realm + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/create_realm.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/create_realm.js,samples/README.md) + +__Usage:__ + + +`node samples/create_realm.js` + + +----- + + + + +### Delete_cluster + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/delete_cluster.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/delete_cluster.js,samples/README.md) + +__Usage:__ + + +`node samples/delete_cluster.js` + + +----- + + + + +### Delete_config + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/delete_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/delete_config.js,samples/README.md) + +__Usage:__ + + +`node samples/delete_config.js` + + +----- + + + + +### Delete_deployment + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/delete_deployment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/delete_deployment.js,samples/README.md) + +__Usage:__ + + +`node samples/delete_deployment.js` + + +----- + + + + +### Delete_realm + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/delete_realm.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/delete_realm.js,samples/README.md) + +__Usage:__ + + +`node samples/delete_realm.js` + + +----- + + + + +### Get_cluster + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/get_cluster.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/get_cluster.js,samples/README.md) + +__Usage:__ + + +`node samples/get_cluster.js` + + +----- + + + + +### Get_config + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/get_config.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/get_config.js,samples/README.md) + +__Usage:__ + + +`node samples/get_config.js` + + +----- + + + + +### Get_deployment + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/get_deployment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/get_deployment.js,samples/README.md) + +__Usage:__ + + +`node samples/get_deployment.js` + + +----- + + + + +### Get_realm + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/get_realm.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/get_realm.js,samples/README.md) + +__Usage:__ + + +`node samples/get_realm.js` + + +----- + + + + +### Get_rollout + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/get_rollout.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/get_rollout.js,samples/README.md) + +__Usage:__ + + +`node samples/get_rollout.js` + + +----- + + + + +### List_clusters + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/list_clusters.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/list_clusters.js,samples/README.md) + +__Usage:__ + + +`node samples/list_clusters.js` + + +----- + + + + +### List_configs + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/list_configs.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/list_configs.js,samples/README.md) + +__Usage:__ + + +`node samples/list_configs.js` + + +----- + + + + +### List_deployments + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/list_deployments.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/list_deployments.js,samples/README.md) + +__Usage:__ + + +`node samples/list_deployments.js` + + +----- + + + + +### List_realms + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/list_realms.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/list_realms.js,samples/README.md) + +__Usage:__ + + +`node samples/list_realms.js` + + +----- + + + + +### Create Game Server Realm + +Creates a new Realm within Cloud Game Servers + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/quickstart.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) + +__Usage:__ + + +`node quickstart.js ` + + +----- + + + + +### Update_cluster + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_cluster.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_cluster.js,samples/README.md) + +__Usage:__ + + +`node samples/update_cluster.js` + + +----- + + + + +### Update_deployment + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_deployment.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_deployment.js,samples/README.md) + +__Usage:__ + + +`node samples/update_deployment.js` + + +----- + + + + +### Update_realm + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_realm.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_realm.js,samples/README.md) + +__Usage:__ + + +`node samples/update_realm.js` + + +----- + + + + +### Update_rollout_default + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_rollout_default.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_rollout_default.js,samples/README.md) + +__Usage:__ + + +`node samples/update_rollout_default.js` + + +----- + + + + +### Update_rollout_override + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_rollout_override.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_rollout_override.js,samples/README.md) + +__Usage:__ + + +`node samples/update_rollout_override.js` + + +----- + + + + +### Update_rollout_remove_default + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_rollout_remove_default.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_rollout_remove_default.js,samples/README.md) + +__Usage:__ + + +`node samples/update_rollout_remove_default.js` + + +----- + + + + +### Update_rollout_remove_override + +View the [source code](https://github.com/googleapis/nodejs-game-servers/blob/main/samples/update_rollout_remove_override.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/update_rollout_remove_override.js,samples/README.md) + +__Usage:__ + + +`node samples/update_rollout_remove_override.js` + + + + + + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-game-servers&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/game-servers/ diff --git a/generated,README.md/create_cluster.js b/generated,README.md/create_cluster.js new file mode 100644 index 0000000000..71b177fe07 --- /dev/null +++ b/generated,README.md/create_cluster.js @@ -0,0 +1,86 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers cluster. + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId unique identifier for the new Game Cluster + * @param {string} gkeClusterName The full resource name of the GKE cluster to use + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID', + gkeClusterName = 'GKE_CLUSTER_NAME' +) { + // [START cloud_game_servers_cluster_create] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function createGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'A unique ID for this Game Server Cluster'; + // const gkeClusterName= 'The full resource name of the GKE cluster to use'; + const request = { + // Provide full resource name of a Game Server Realm + parent: client.realmPath(projectId, location, realmId), + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + // In the form of 'projects//locations//clusters/' + cluster: gkeClusterName, + }, + namespace: 'default', + }, + }, + }; + + const [operation] = await client.createGameServerCluster(request); + const [result] = await operation.promise(); + + console.log('Game Server Cluster created:'); + console.log(`\tCluster name: ${result.name}`); + console.log(`\tCluster description: ${result.description}`); + console.log( + `\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}` + ); + } + + createGameServerCluster(); + // [END cloud_game_servers_cluster_create] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/create_config.js b/generated,README.md/create_config.js new file mode 100644 index 0000000000..db1b526157 --- /dev/null +++ b/generated,README.md/create_config.js @@ -0,0 +1,144 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the parent Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + * @param {string} fleetName fleet name to be stored in Agones + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID', + fleetName = 'FLEET_NAME' +) { + // [START cloud_game_servers_config_create] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function createGameServerConfig() { + /** + * 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 configId = 'A unique ID for the Game Server Config'; + // const fleetName = 'The fleet name to be stored in Agones'; + // fleet is the spec portion of an agones Fleet. It must be in JSON format. + // See https://agones.dev/site/docs/reference/fleet/ for more on fleets. + const fleet = ` +{ + "replicas": 10, + "scheduling": "Packed", + "strategy": { + "type": "RollingUpdate", + "rollingUpdate": { + "maxSurge": "25%", + "maxUnavailable": "25%" + } + }, + "template": { + "metadata": { + "labels": { + "gameName": "udp-server" + } + }, + "spec": { + "ports": [ + { + "name": "default", + "portPolicy": "Dynamic", + "containerPort": 2156, + "protocol": "TCP" + } + ], + "health": { + "initialDelaySeconds": 30, + "periodSeconds": 60 + }, + "sdkServer": { + "logLevel": "Info", + "grpcPort": 9357, + "httpPort": 9358 + }, + "template": { + "spec": { + "containers": [ + { + "name": "dedicated", + "image": "gcr.io/agones-images/udp-server:0.17", + "imagePullPolicy": "Always", + "resources": { + "requests": { + "memory": "200Mi", + "cpu": "500m" + }, + "limits": { + "memory": "200Mi", + "cpu": "500m" + } + } + } + ] + } + } + } + } +} +`; + const request = { + parent: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + configId: configId, + gameServerConfig: { + fleetConfigs: [ + { + name: fleetName, + fleetSpec: fleet, + }, + ], + description: 'nodejs test config', + }, + }; + + const [operation] = await client.createGameServerConfig(request); + const [result] = await operation.promise(); + + console.log('Game Server Config created:'); + console.log(`\t Config name: ${result.name}`); + console.log(`\t Config description: ${result.description}`); + } + + createGameServerConfig(); + + // [END cloud_game_servers_config_create] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/create_deployment.js b/generated,README.md/create_deployment.js new file mode 100644 index 0000000000..4b057352f7 --- /dev/null +++ b/generated,README.md/create_deployment.js @@ -0,0 +1,66 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_create] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function createGameServerDeployment() { + /** + * 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 = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + gameServerDeployment: { + description: 'nodejs test deployment', + }, + }; + + const [operation] = await client.createGameServerDeployment(request); + const [result] = await operation.promise(); + + console.log('Game Server Deployment created:'); + console.log(`\t Deployment name: ${result.name}`); + console.log(`\t Deployment description: ${result.description}`); + } + + createGameServerDeployment(); + + // [END cloud_game_servers_deployment_create] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/create_realm.js b/generated,README.md/create_realm.js new file mode 100644 index 0000000000..456de890f7 --- /dev/null +++ b/generated,README.md/create_realm.js @@ -0,0 +1,72 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Create a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId a unique identifier for the new realm + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_realm_create] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function createRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'A unique identifier for the realm'; + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId: realmId, + realm: { + // Must use a supported time zone name. + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 + timeZone: 'US/Pacific', + description: 'My Game Server realm', + }, + }; + + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log('Realm created:'); + + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + } + + createRealm(); + // [END cloud_game_servers_realm_create] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/delete_cluster.js b/generated,README.md/delete_cluster.js new file mode 100644 index 0000000000..ec1266bc88 --- /dev/null +++ b/generated,README.md/delete_cluster.js @@ -0,0 +1,71 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Server cluster + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId the game cluster to delete + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_cluster_delete] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function deleteGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; + const request = { + // Provide full resource name of a Game Server Realm + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), + }; + + const [operation] = await client.deleteGameServerCluster(request); + await operation.promise(); + + console.log('Game Server cluster deleted'); + } + + deleteGameServerCluster(); + // [END cloud_game_servers_cluster_delete] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/delete_config.js b/generated,README.md/delete_config.js new file mode 100644 index 0000000000..b083f29813 --- /dev/null +++ b/generated,README.md/delete_config.js @@ -0,0 +1,68 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_config_delete] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function deleteGameServerConfig() { + /** + * 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 configId = 'A unique ID for the Game Server Config'; + const request = { + // The full resource name + name: client.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + + const [operation] = await client.deleteGameServerConfig(request); + await operation.promise(); + console.log(`Config with name ${request.name} deleted.`); + } + + deleteGameServerConfig(); + + // [END cloud_game_servers_config_delete] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/delete_deployment.js b/generated,README.md/delete_deployment.js new file mode 100644 index 0000000000..e45b144f50 --- /dev/null +++ b/generated,README.md/delete_deployment.js @@ -0,0 +1,61 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_delete] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function deleteGameServerDeployment() { + /** + * 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 [operation] = await client.deleteGameServerDeployment(request); + await operation.promise(); + + console.log(`Deployment with name ${request.name} deleted.`); + } + + deleteGameServerDeployment(); + + // [END cloud_game_servers_deployment_delete] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/delete_realm.js b/generated,README.md/delete_realm.js new file mode 100644 index 0000000000..da1f98ba19 --- /dev/null +++ b/generated,README.md/delete_realm.js @@ -0,0 +1,61 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Delete a realm by ID + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId the unique ID of the realm + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_realm_delete] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function deleteRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; + const request = { + // Realm name is the full resource name including project ID,location, + // and the realm ID. + name: client.realmPath(projectId, location, realmId), + }; + + const [operation] = await client.deleteRealm(request); + await operation.promise(); + console.log(`Realm with ID ${realmId} deleted.`); + } + + deleteRealm(); + // [END cloud_game_servers_realm_delete] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.create_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.create_game_server_cluster.js new file mode 100644 index 0000000000..b9a8eecf7d --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.create_game_server_cluster.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, gameServerClusterId, gameServerCluster) { + // [START gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}/realms/{realm-id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server cluster resource to be created. + */ + // const gameServerClusterId = 'abc123' + /** + * Required. The game server cluster resource to be created. + */ + // const gameServerCluster = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callCreateGameServerCluster() { + // Construct request + const request = { + parent, + gameServerClusterId, + gameServerCluster, + }; + + // Run request + const [operation] = await gamingClient.createGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.delete_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.delete_game_server_cluster.js new file mode 100644 index 0000000000..1966da6a80 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.delete_game_server_cluster.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to delete, in the following form: + * `projects/{project}/locations/{location}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callDeleteGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.get_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.get_game_server_cluster.js new file mode 100644 index 0000000000..6a741c5ce8 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.get_game_server_cluster.js @@ -0,0 +1,71 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to retrieve, in the following form: + * `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + /** + * Optional. View for the returned GameServerCluster objects. When `FULL` is + * specified, the `cluster_state` field is also returned in the + * GameServerCluster object, which includes the state of the referenced + * Kubernetes cluster such as versions and provider info. The default/unset + * value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does + * not return the `cluster_state` field. + */ + // const view = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callGetGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerCluster(request); + console.log(response); + } + + callGetGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.list_game_server_clusters.js b/generated,README.md/generated/v1/game_server_clusters_service.list_game_server_clusters.js new file mode 100644 index 0000000000..f6411da17b --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.list_game_server_clusters.js @@ -0,0 +1,94 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * "projects/{project}/locations/{location}/realms/{realm}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, the server + * will pick an appropriate default. The server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1.ListGameServerClustersResponse.next_page_token to + * determine if there are more GameServerClusters left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + /** + * Optional. View for the returned GameServerCluster objects. When `FULL` is + * specified, the `cluster_state` field is also returned in the + * GameServerCluster object, which includes the state of the referenced + * Kubernetes cluster such as versions and provider info. The default/unset + * value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does + * not return the `cluster_state` field. + */ + // const view = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callListGameServerClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerClusters(); + // [END gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.preview_create_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.preview_create_game_server_cluster.js new file mode 100644 index 0000000000..0713a62e3d --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.preview_create_game_server_cluster.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, gameServerClusterId, gameServerCluster) { + // [START gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server cluster resource to be created. + */ + // const gameServerClusterId = 'abc123' + /** + * Required. The game server cluster resource to be created. + */ + // const gameServerCluster = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + /** + * Optional. This field is deprecated, preview will always return + * KubernetesClusterState. + */ + // const view = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewCreateGameServerCluster() { + // Construct request + const request = { + parent, + gameServerClusterId, + gameServerCluster, + }; + + // Run request + const response = await gamingClient.previewCreateGameServerCluster(request); + console.log(response); + } + + callPreviewCreateGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.preview_delete_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.preview_delete_game_server_cluster.js new file mode 100644 index 0000000000..786f351980 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.preview_delete_game_server_cluster.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to delete, in the following form: + * `projects/{project}/locations/{location}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewDeleteGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.previewDeleteGameServerCluster(request); + console.log(response); + } + + callPreviewDeleteGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.preview_update_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.preview_update_game_server_cluster.js new file mode 100644 index 0000000000..6348196369 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.preview_update_game_server_cluster.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerCluster, updateMask) { + // [START gameservices_v1_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server cluster to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerCluster = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewUpdateGameServerCluster() { + // Construct request + const request = { + gameServerCluster, + updateMask, + }; + + // Run request + const response = await gamingClient.previewUpdateGameServerCluster(request); + console.log(response); + } + + callPreviewUpdateGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_clusters_service.update_game_server_cluster.js b/generated,README.md/generated/v1/game_server_clusters_service.update_game_server_cluster.js new file mode 100644 index 0000000000..4da22444a2 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_clusters_service.update_game_server_cluster.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerCluster, updateMask) { + // [START gameservices_v1_generated_GameServerClustersService_UpdateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server cluster to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerCluster = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callUpdateGameServerCluster() { + // Construct request + const request = { + gameServerCluster, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerCluster(); + // [END gameservices_v1_generated_GameServerClustersService_UpdateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_configs_service.create_game_server_config.js b/generated,README.md/generated/v1/game_server_configs_service.create_game_server_config.js new file mode 100644 index 0000000000..78e713d791 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_configs_service.create_game_server_config.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, configId, gameServerConfig) { + // [START gameservices_v1_generated_GameServerConfigsService_CreateGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server config resource to be created. + */ + // const configId = 'abc123' + /** + * Required. The game server config resource to be created. + */ + // const gameServerConfig = {} + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callCreateGameServerConfig() { + // Construct request + const request = { + parent, + configId, + gameServerConfig, + }; + + // Run request + const [operation] = await gamingClient.createGameServerConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerConfig(); + // [END gameservices_v1_generated_GameServerConfigsService_CreateGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_configs_service.delete_game_server_config.js b/generated,README.md/generated/v1/game_server_configs_service.delete_game_server_config.js new file mode 100644 index 0000000000..889474896f --- /dev/null +++ b/generated,README.md/generated/v1/game_server_configs_service.delete_game_server_config.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerConfigsService_DeleteGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server config to delete, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callDeleteGameServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerConfig(); + // [END gameservices_v1_generated_GameServerConfigsService_DeleteGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_configs_service.get_game_server_config.js b/generated,README.md/generated/v1/game_server_configs_service.get_game_server_config.js new file mode 100644 index 0000000000..3d31a53248 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_configs_service.get_game_server_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerConfigsService_GetGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server config to retrieve, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callGetGameServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerConfig(request); + console.log(response); + } + + callGetGameServerConfig(); + // [END gameservices_v1_generated_GameServerConfigsService_GetGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_configs_service.list_game_server_configs.js b/generated,README.md/generated/v1/game_server_configs_service.list_game_server_configs.js new file mode 100644 index 0000000000..b583c33dd2 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_configs_service.list_game_server_configs.js @@ -0,0 +1,85 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1_generated_GameServerConfigsService_ListGameServerConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1.ListGameServerConfigsResponse.next_page_token to + * determine if there are more GameServerConfigs left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request, if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callListGameServerConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerConfigs(); + // [END gameservices_v1_generated_GameServerConfigsService_ListGameServerConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.create_game_server_deployment.js b/generated,README.md/generated/v1/game_server_deployments_service.create_game_server_deployment.js new file mode 100644 index 0000000000..e3f2af1d78 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.create_game_server_deployment.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, deploymentId, gameServerDeployment) { + // [START gameservices_v1_generated_GameServerDeploymentsService_CreateGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server delpoyment resource to be created. + */ + // const deploymentId = 'abc123' + /** + * Required. The game server delpoyment resource to be created. + */ + // const gameServerDeployment = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callCreateGameServerDeployment() { + // Construct request + const request = { + parent, + deploymentId, + gameServerDeployment, + }; + + // Run request + const [operation] = await gamingClient.createGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerDeployment(); + // [END gameservices_v1_generated_GameServerDeploymentsService_CreateGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.delete_game_server_deployment.js b/generated,README.md/generated/v1/game_server_deployments_service.delete_game_server_deployment.js new file mode 100644 index 0000000000..1112f3ff16 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.delete_game_server_deployment.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to delete, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callDeleteGameServerDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerDeployment(); + // [END gameservices_v1_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.fetch_deployment_state.js b/generated,README.md/generated/v1/game_server_deployments_service.fetch_deployment_state.js new file mode 100644 index 0000000000..d2f510c0d2 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.fetch_deployment_state.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerDeploymentsService_FetchDeploymentState_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callFetchDeploymentState() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.fetchDeploymentState(request); + console.log(response); + } + + callFetchDeploymentState(); + // [END gameservices_v1_generated_GameServerDeploymentsService_FetchDeploymentState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment.js b/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment.js new file mode 100644 index 0000000000..612f36c9da --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to retrieve, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callGetGameServerDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerDeployment(request); + console.log(response); + } + + callGetGameServerDeployment(); + // [END gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment_rollout.js b/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment_rollout.js new file mode 100644 index 0000000000..dd2864a56b --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.get_game_server_deployment_rollout.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to retrieve, in the following form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callGetGameServerDeploymentRollout() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerDeploymentRollout(request); + console.log(response); + } + + callGetGameServerDeploymentRollout(); + // [END gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.list_game_server_deployments.js b/generated,README.md/generated/v1/game_server_deployments_service.list_game_server_deployments.js new file mode 100644 index 0000000000..5b163c39d2 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.list_game_server_deployments.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1_generated_GameServerDeploymentsService_ListGameServerDeployments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, the server + * will pick an appropriate default. The server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1.ListGameServerDeploymentsResponse.next_page_token to + * determine if there are more GameServerDeployments left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callListGameServerDeployments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerDeploymentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerDeployments(); + // [END gameservices_v1_generated_GameServerDeploymentsService_ListGameServerDeployments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.preview_game_server_deployment_rollout.js b/generated,README.md/generated/v1/game_server_deployments_service.preview_game_server_deployment_rollout.js new file mode 100644 index 0000000000..5293fca061 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.preview_game_server_deployment_rollout.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(rollout) { + // [START gameservices_v1_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server deployment rollout to be updated. + * Only fields specified in update_mask are updated. + */ + // const rollout = {} + /** + * Optional. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. Defaults to the immediately + * after the proposed rollout completes. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callPreviewGameServerDeploymentRollout() { + // Construct request + const request = { + rollout, + }; + + // Run request + const response = await gamingClient.previewGameServerDeploymentRollout(request); + console.log(response); + } + + callPreviewGameServerDeploymentRollout(); + // [END gameservices_v1_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment.js b/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment.js new file mode 100644 index 0000000000..cabc47340f --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerDeployment, updateMask) { + // [START gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server delpoyment to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerDeployment = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callUpdateGameServerDeployment() { + // Construct request + const request = { + gameServerDeployment, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerDeployment(); + // [END gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment_rollout.js b/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment_rollout.js new file mode 100644 index 0000000000..f6f3711069 --- /dev/null +++ b/generated,README.md/generated/v1/game_server_deployments_service.update_game_server_deployment_rollout.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(rollout, updateMask) { + // [START gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server delpoyment rollout to be updated. + * Only fields specified in update_mask are updated. + */ + // const rollout = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callUpdateGameServerDeploymentRollout() { + // Construct request + const request = { + rollout, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerDeploymentRollout(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerDeploymentRollout(); + // [END gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.create_realm.js b/generated,README.md/generated/v1/realms_service.create_realm.js new file mode 100644 index 0000000000..fbc6a819f4 --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.create_realm.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, realmId, realm) { + // [START gameservices_v1_generated_RealmsService_CreateRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the realm resource to be created. + */ + // const realmId = 'abc123' + /** + * Required. The realm resource to be created. + */ + // const realm = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callCreateRealm() { + // Construct request + const request = { + parent, + realmId, + realm, + }; + + // Run request + const [operation] = await gamingClient.createRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRealm(); + // [END gameservices_v1_generated_RealmsService_CreateRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.delete_realm.js b/generated,README.md/generated/v1/realms_service.delete_realm.js new file mode 100644 index 0000000000..eced01aade --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.delete_realm.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_RealmsService_DeleteRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the realm to delete, in the following form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callDeleteRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRealm(); + // [END gameservices_v1_generated_RealmsService_DeleteRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.get_realm.js b/generated,README.md/generated/v1/realms_service.get_realm.js new file mode 100644 index 0000000000..d3f94b1712 --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.get_realm.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1_generated_RealmsService_GetRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the realm to retrieve, in the following form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callGetRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getRealm(request); + console.log(response); + } + + callGetRealm(); + // [END gameservices_v1_generated_RealmsService_GetRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.list_realms.js b/generated,README.md/generated/v1/realms_service.list_realms.js new file mode 100644 index 0000000000..68bef442ee --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.list_realms.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1_generated_RealmsService_ListRealms_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name, in the following form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1.ListRealmsResponse.next_page_token to + * determine if there are more realms left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callListRealms() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listRealmsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRealms(); + // [END gameservices_v1_generated_RealmsService_ListRealms_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.preview_realm_update.js b/generated,README.md/generated/v1/realms_service.preview_realm_update.js new file mode 100644 index 0000000000..644e93d491 --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.preview_realm_update.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(realm, updateMask) { + // [START gameservices_v1_generated_RealmsService_PreviewRealmUpdate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The realm to be updated. + * Only fields specified in update_mask are updated. + */ + // const realm = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callPreviewRealmUpdate() { + // Construct request + const request = { + realm, + updateMask, + }; + + // Run request + const response = await gamingClient.previewRealmUpdate(request); + console.log(response); + } + + callPreviewRealmUpdate(); + // [END gameservices_v1_generated_RealmsService_PreviewRealmUpdate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/realms_service.update_realm.js b/generated,README.md/generated/v1/realms_service.update_realm.js new file mode 100644 index 0000000000..4179dbef7a --- /dev/null +++ b/generated,README.md/generated/v1/realms_service.update_realm.js @@ -0,0 +1,70 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(realm, updateMask) { + // [START gameservices_v1_generated_RealmsService_UpdateRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The realm to be updated. + * Only fields specified in update_mask are updated. + */ + // const realm = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callUpdateRealm() { + // Construct request + const request = { + realm, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateRealm(); + // [END gameservices_v1_generated_RealmsService_UpdateRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1/snippet_metadata.google.cloud.gaming.v1.json b/generated,README.md/generated/v1/snippet_metadata.google.cloud.gaming.v1.json new file mode 100644 index 0000000000..e01e8e711e --- /dev/null +++ b/generated,README.md/generated/v1/snippet_metadata.google.cloud.gaming.v1.json @@ -0,0 +1,1259 @@ +{ + "clientLibrary": { + "name": "nodejs-gaming", + "version": "3.1.2", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gaming.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async", + "title": "GameServerClustersService listGameServerClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists game server clusters in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.list_game_server_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerClusters", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.ListGameServerClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.gaming.v1.GameServerClusterView" + } + ], + "resultType": ".google.cloud.gaming.v1.ListGameServerClustersResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "ListGameServerClusters", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.ListGameServerClusters", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async", + "title": "GameServerClustersService getGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.get_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.GetGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "view", + "type": ".google.cloud.gaming.v1.GameServerClusterView" + } + ], + "resultType": ".google.cloud.gaming.v1.GameServerCluster", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "GetGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.GetGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async", + "title": "GameServerClustersService createGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server cluster in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.create_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.CreateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1.GameServerCluster" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "CreateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.CreateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async", + "title": "GameServerClustersService previewCreateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews creation of a new game server cluster in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.preview_create_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewCreateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewCreateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1.GameServerCluster" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "view", + "type": ".google.cloud.gaming.v1.GameServerClusterView" + } + ], + "resultType": ".google.cloud.gaming.v1.PreviewCreateGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewCreateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewCreateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async", + "title": "GameServerClustersService deleteGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.delete_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.DeleteGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "DeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.DeleteGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async", + "title": "GameServerClustersService previewDeleteGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews deletion of a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.preview_delete_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewDeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewDeleteGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1.PreviewDeleteGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewDeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewDeleteGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_UpdateGameServerCluster_async", + "title": "GameServerClustersService updateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Patches a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.update_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.UpdateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1.GameServerCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "UpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.UpdateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async", + "title": "GameServerClustersService previewUpdateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews updating a GameServerCluster.", + "canonical": true, + "file": "game_server_clusters_service.preview_update_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewUpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewUpdateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1.GameServerCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1.PreviewUpdateGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewUpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1.GameServerClustersService.PreviewUpdateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerConfigsService_ListGameServerConfigs_async", + "title": "GameServerClustersService listGameServerConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists game server configs in a given project, location, and game server deployment.", + "canonical": true, + "file": "game_server_configs_service.list_game_server_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 77, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerConfigs", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.ListGameServerConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.ListGameServerConfigsResponse", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "ListGameServerConfigs", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.ListGameServerConfigs", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerConfigsService_GetGameServerConfig_async", + "title": "GameServerClustersService getGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server config.", + "canonical": true, + "file": "game_server_configs_service.get_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.GetGameServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.GameServerConfig", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "GetGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.GetGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerConfigsService_CreateGameServerConfig_async", + "title": "GameServerClustersService createGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server config in a given project, location, and game server deployment. Game server configs are immutable, and are not applied until referenced in the game server deployment rollout resource.", + "canonical": true, + "file": "game_server_configs_service.create_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.CreateGameServerConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_config", + "type": ".google.cloud.gaming.v1.GameServerConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "CreateGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.CreateGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerConfigsService_DeleteGameServerConfig_async", + "title": "GameServerClustersService deleteGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server config. The deletion will fail if the game server config is referenced in a game server deployment rollout.", + "canonical": true, + "file": "game_server_configs_service.delete_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.DeleteGameServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "DeleteGameServerConfig", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService.DeleteGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_ListGameServerDeployments_async", + "title": "GameServerClustersService listGameServerDeployments Sample", + "origin": "API_DEFINITION", + "description": " Lists game server deployments in a given project and location.", + "canonical": true, + "file": "game_server_deployments_service.list_game_server_deployments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerDeployments", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.ListGameServerDeployments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.ListGameServerDeploymentsResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "ListGameServerDeployments", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.ListGameServerDeployments", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeployment_async", + "title": "GameServerClustersService getGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.get_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.GetGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.GameServerDeployment", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "GetGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.GetGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_CreateGameServerDeployment_async", + "title": "GameServerClustersService createGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server deployment in a given project and location.", + "canonical": true, + "file": "game_server_deployments_service.create_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.CreateGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "deployment_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_deployment", + "type": ".google.cloud.gaming.v1.GameServerDeployment" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "CreateGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.CreateGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async", + "title": "GameServerClustersService deleteGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.delete_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.DeleteGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "DeleteGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.DeleteGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async", + "title": "GameServerClustersService updateGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Patches a game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.update_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.UpdateGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "game_server_deployment", + "type": ".google.cloud.gaming.v1.GameServerDeployment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "UpdateGameServerDeployment", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.UpdateGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async", + "title": "GameServerClustersService getGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Gets details a single game server deployment rollout.", + "canonical": true, + "file": "game_server_deployments_service.get_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.GetGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.GameServerDeploymentRollout", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "GetGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.GetGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async", + "title": "GameServerClustersService updateGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Patches a single game server deployment rollout. The method will not return an error if the update does not affect any existing realms. For example - if the default_game_server_config is changed but all existing realms use the override, that is valid. Similarly, if a non existing realm is explicitly called out in game_server_config_overrides field, that will also not result in an error.", + "canonical": true, + "file": "game_server_deployments_service.update_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.UpdateGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "rollout", + "type": ".google.cloud.gaming.v1.GameServerDeploymentRollout" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "UpdateGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.UpdateGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async", + "title": "GameServerClustersService previewGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Previews the game server deployment rollout. This API does not mutate the rollout resource.", + "canonical": true, + "file": "game_server_deployments_service.preview_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.PreviewGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "rollout", + "type": ".google.cloud.gaming.v1.GameServerDeploymentRollout" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1.PreviewGameServerDeploymentRolloutResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "PreviewGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.PreviewGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_GameServerDeploymentsService_FetchDeploymentState_async", + "title": "GameServerClustersService fetchDeploymentState Sample", + "origin": "API_DEFINITION", + "description": " Retrieves information about the current state of the game server deployment. Gathers all the Agones fleets and Agones autoscalers, including fleets running an older version of the game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.fetch_deployment_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchDeploymentState", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.FetchDeploymentState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.FetchDeploymentStateResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "FetchDeploymentState", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService.FetchDeploymentState", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_ListRealms_async", + "title": "GameServerClustersService listRealms Sample", + "origin": "API_DEFINITION", + "description": " Lists realms in a given project and location.", + "canonical": true, + "file": "realms_service.list_realms.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRealms", + "fullName": "google.cloud.gaming.v1.RealmsService.ListRealms", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.ListRealmsResponse", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "ListRealms", + "fullName": "google.cloud.gaming.v1.RealmsService.ListRealms", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_GetRealm_async", + "title": "GameServerClustersService getRealm Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single realm.", + "canonical": true, + "file": "realms_service.get_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.GetRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1.Realm", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "GetRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.GetRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_CreateRealm_async", + "title": "GameServerClustersService createRealm Sample", + "origin": "API_DEFINITION", + "description": " Creates a new realm in a given project and location.", + "canonical": true, + "file": "realms_service.create_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.CreateRealm", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "realm_id", + "type": "TYPE_STRING" + }, + { + "name": "realm", + "type": ".google.cloud.gaming.v1.Realm" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "CreateRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.CreateRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_DeleteRealm_async", + "title": "GameServerClustersService deleteRealm Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single realm.", + "canonical": true, + "file": "realms_service.delete_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.DeleteRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "DeleteRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.DeleteRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_UpdateRealm_async", + "title": "GameServerClustersService updateRealm Sample", + "origin": "API_DEFINITION", + "description": " Patches a single realm.", + "canonical": true, + "file": "realms_service.update_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.UpdateRealm", + "async": true, + "parameters": [ + { + "name": "realm", + "type": ".google.cloud.gaming.v1.Realm" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "UpdateRealm", + "fullName": "google.cloud.gaming.v1.RealmsService.UpdateRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1_generated_RealmsService_PreviewRealmUpdate_async", + "title": "GameServerClustersService previewRealmUpdate Sample", + "origin": "API_DEFINITION", + "description": " Previews patches to a single realm.", + "canonical": true, + "file": "realms_service.preview_realm_update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewRealmUpdate", + "fullName": "google.cloud.gaming.v1.RealmsService.PreviewRealmUpdate", + "async": true, + "parameters": [ + { + "name": "realm", + "type": ".google.cloud.gaming.v1.Realm" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1.PreviewRealmUpdateResponse", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1.RealmsServiceClient" + }, + "method": { + "shortName": "PreviewRealmUpdate", + "fullName": "google.cloud.gaming.v1.RealmsService.PreviewRealmUpdate", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1.RealmsService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.create_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.create_game_server_cluster.js new file mode 100644 index 0000000000..fe5320c14c --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.create_game_server_cluster.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, gameServerClusterId, gameServerCluster) { + // [START gameservices_v1beta_generated_GameServerClustersService_CreateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}/realms/{realm-id}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server cluster resource to be created. + */ + // const gameServerClusterId = 'abc123' + /** + * Required. The game server cluster resource to be created. + */ + // const gameServerCluster = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callCreateGameServerCluster() { + // Construct request + const request = { + parent, + gameServerClusterId, + gameServerCluster, + }; + + // Run request + const [operation] = await gamingClient.createGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_CreateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.delete_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.delete_game_server_cluster.js new file mode 100644 index 0000000000..84cabe9b3a --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.delete_game_server_cluster.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerClustersService_DeleteGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to delete. Uses the form: + * `projects/{project}/locations/{location}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callDeleteGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_DeleteGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.get_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.get_game_server_cluster.js new file mode 100644 index 0000000000..4c507a67da --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.get_game_server_cluster.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerClustersService_GetGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to retrieve. Uses the form: + * `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callGetGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerCluster(request); + console.log(response); + } + + callGetGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_GetGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.list_game_server_clusters.js b/generated,README.md/generated/v1beta/game_server_clusters_service.list_game_server_clusters.js new file mode 100644 index 0000000000..31a2a5947b --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.list_game_server_clusters.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1beta_generated_GameServerClustersService_ListGameServerClusters_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * "projects/{project}/locations/{location}/realms/{realm}". + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, the + * server will pick an appropriate default. The server may return fewer items + * than requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1beta.ListGameServerClustersResponse.next_page_token + * to determine if there are more GameServerClusters left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callListGameServerClusters() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerClustersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerClusters(); + // [END gameservices_v1beta_generated_GameServerClustersService_ListGameServerClusters_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.preview_create_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_create_game_server_cluster.js new file mode 100644 index 0000000000..9bf2f6dc0c --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_create_game_server_cluster.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, gameServerClusterId, gameServerCluster) { + // [START gameservices_v1beta_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server cluster resource to be created. + */ + // const gameServerClusterId = 'abc123' + /** + * Required. The game server cluster resource to be created. + */ + // const gameServerCluster = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewCreateGameServerCluster() { + // Construct request + const request = { + parent, + gameServerClusterId, + gameServerCluster, + }; + + // Run request + const response = await gamingClient.previewCreateGameServerCluster(request); + console.log(response); + } + + callPreviewCreateGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.preview_delete_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_delete_game_server_cluster.js new file mode 100644 index 0000000000..eaf085e063 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_delete_game_server_cluster.js @@ -0,0 +1,66 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server cluster to delete. Uses the form: + * `projects/{project}/locations/{location}/gameServerClusters/{cluster}`. + */ + // const name = 'abc123' + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewDeleteGameServerCluster() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.previewDeleteGameServerCluster(request); + console.log(response); + } + + callPreviewDeleteGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.preview_update_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_update_game_server_cluster.js new file mode 100644 index 0000000000..95cabe4e80 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.preview_update_game_server_cluster.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerCluster, updateMask) { + // [START gameservices_v1beta_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server cluster to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerCluster = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callPreviewUpdateGameServerCluster() { + // Construct request + const request = { + gameServerCluster, + updateMask, + }; + + // Run request + const response = await gamingClient.previewUpdateGameServerCluster(request); + console.log(response); + } + + callPreviewUpdateGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_clusters_service.update_game_server_cluster.js b/generated,README.md/generated/v1beta/game_server_clusters_service.update_game_server_cluster.js new file mode 100644 index 0000000000..fcd3349436 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_clusters_service.update_game_server_cluster.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerCluster, updateMask) { + // [START gameservices_v1beta_generated_GameServerClustersService_UpdateGameServerCluster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server cluster to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerCluster = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerClustersServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerClustersServiceClient(); + + async function callUpdateGameServerCluster() { + // Construct request + const request = { + gameServerCluster, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerCluster(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerCluster(); + // [END gameservices_v1beta_generated_GameServerClustersService_UpdateGameServerCluster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_configs_service.create_game_server_config.js b/generated,README.md/generated/v1beta/game_server_configs_service.create_game_server_config.js new file mode 100644 index 0000000000..878996af86 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_configs_service.create_game_server_config.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, configId, gameServerConfig) { + // [START gameservices_v1beta_generated_GameServerConfigsService_CreateGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server config resource to be created. + */ + // const configId = 'abc123' + /** + * Required. The game server config resource to be created. + */ + // const gameServerConfig = {} + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callCreateGameServerConfig() { + // Construct request + const request = { + parent, + configId, + gameServerConfig, + }; + + // Run request + const [operation] = await gamingClient.createGameServerConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerConfig(); + // [END gameservices_v1beta_generated_GameServerConfigsService_CreateGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_configs_service.delete_game_server_config.js b/generated,README.md/generated/v1beta/game_server_configs_service.delete_game_server_config.js new file mode 100644 index 0000000000..e3f307627d --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_configs_service.delete_game_server_config.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerConfigsService_DeleteGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server config to delete. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callDeleteGameServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerConfig(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerConfig(); + // [END gameservices_v1beta_generated_GameServerConfigsService_DeleteGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_configs_service.get_game_server_config.js b/generated,README.md/generated/v1beta/game_server_configs_service.get_game_server_config.js new file mode 100644 index 0000000000..9fd03435d6 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_configs_service.get_game_server_config.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerConfigsService_GetGameServerConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server config to retrieve. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/{config}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callGetGameServerConfig() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerConfig(request); + console.log(response); + } + + callGetGameServerConfig(); + // [END gameservices_v1beta_generated_GameServerConfigsService_GetGameServerConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_configs_service.list_game_server_configs.js b/generated,README.md/generated/v1beta/game_server_configs_service.list_game_server_configs.js new file mode 100644 index 0000000000..459bf2af4a --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_configs_service.list_game_server_configs.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1beta_generated_GameServerConfigsService_ListGameServerConfigs_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/configs/*`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1beta.ListGameServerConfigsResponse.next_page_token + * to determine if there are more GameServerConfigs left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous list request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {GameServerConfigsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerConfigsServiceClient(); + + async function callListGameServerConfigs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerConfigsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerConfigs(); + // [END gameservices_v1beta_generated_GameServerConfigsService_ListGameServerConfigs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.create_game_server_deployment.js b/generated,README.md/generated/v1beta/game_server_deployments_service.create_game_server_deployment.js new file mode 100644 index 0000000000..491fa24737 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.create_game_server_deployment.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, deploymentId, gameServerDeployment) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_CreateGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the game server delpoyment resource to be created. + */ + // const deploymentId = 'abc123' + /** + * Required. The game server delpoyment resource to be created. + */ + // const gameServerDeployment = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callCreateGameServerDeployment() { + // Construct request + const request = { + parent, + deploymentId, + gameServerDeployment, + }; + + // Run request + const [operation] = await gamingClient.createGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateGameServerDeployment(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_CreateGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.delete_game_server_deployment.js b/generated,README.md/generated/v1beta/game_server_deployments_service.delete_game_server_deployment.js new file mode 100644 index 0000000000..64d0d47e95 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.delete_game_server_deployment.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to delete. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callDeleteGameServerDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteGameServerDeployment(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.fetch_deployment_state.js b/generated,README.md/generated/v1beta/game_server_deployments_service.fetch_deployment_state.js new file mode 100644 index 0000000000..fe8618d547 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.fetch_deployment_state.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_FetchDeploymentState_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment. Uses the form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callFetchDeploymentState() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.fetchDeploymentState(request); + console.log(response); + } + + callFetchDeploymentState(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_FetchDeploymentState_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment.js b/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment.js new file mode 100644 index 0000000000..99533e086c --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to retrieve. Uses the + * form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callGetGameServerDeployment() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerDeployment(request); + console.log(response); + } + + callGetGameServerDeployment(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment_rollout.js b/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment_rollout.js new file mode 100644 index 0000000000..60c630a448 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.get_game_server_deployment_rollout.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the game server delpoyment to retrieve. Uses the + * form: + * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}/rollout`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callGetGameServerDeploymentRollout() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getGameServerDeploymentRollout(request); + console.log(response); + } + + callGetGameServerDeploymentRollout(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.list_game_server_deployments.js b/generated,README.md/generated/v1beta/game_server_deployments_service.list_game_server_deployments.js new file mode 100644 index 0000000000..f216b0082d --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.list_game_server_deployments.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_ListGameServerDeployments_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, the + * server will pick an appropriate default. The server may return fewer items + * than requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1beta.ListGameServerDeploymentsResponse.next_page_token + * to determine if there are more GameServerDeployments left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callListGameServerDeployments() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listGameServerDeploymentsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListGameServerDeployments(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_ListGameServerDeployments_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.preview_game_server_deployment_rollout.js b/generated,README.md/generated/v1beta/game_server_deployments_service.preview_game_server_deployment_rollout.js new file mode 100644 index 0000000000..d1050e5f01 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.preview_game_server_deployment_rollout.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(rollout) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server deployment rollout to be updated. + * Only fields specified in update_mask are updated. + */ + // const rollout = {} + /** + * Optional. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. Defaults to the + * immediately after the proposed rollout completes. + */ + // const previewTime = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callPreviewGameServerDeploymentRollout() { + // Construct request + const request = { + rollout, + }; + + // Run request + const response = await gamingClient.previewGameServerDeploymentRollout(request); + console.log(response); + } + + callPreviewGameServerDeploymentRollout(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment.js b/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment.js new file mode 100644 index 0000000000..3c29a23ada --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(gameServerDeployment, updateMask) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server delpoyment to be updated. + * Only fields specified in update_mask are updated. + */ + // const gameServerDeployment = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callUpdateGameServerDeployment() { + // Construct request + const request = { + gameServerDeployment, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerDeployment(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerDeployment(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment_rollout.js b/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment_rollout.js new file mode 100644 index 0000000000..f4033b8ee3 --- /dev/null +++ b/generated,README.md/generated/v1beta/game_server_deployments_service.update_game_server_deployment_rollout.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(rollout, updateMask) { + // [START gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The game server delpoyment rollout to be updated. + * Only fields specified in update_mask are updated. + */ + // const rollout = {} + /** + * Required. Mask of fields to update. At least one path must be supplied in + * this field. For the `FieldMask` definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {GameServerDeploymentsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new GameServerDeploymentsServiceClient(); + + async function callUpdateGameServerDeploymentRollout() { + // Construct request + const request = { + rollout, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateGameServerDeploymentRollout(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateGameServerDeploymentRollout(); + // [END gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.create_realm.js b/generated,README.md/generated/v1beta/realms_service.create_realm.js new file mode 100644 index 0000000000..62c0fcd4b7 --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.create_realm.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, realmId, realm) { + // [START gameservices_v1beta_generated_RealmsService_CreateRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Required. The ID of the realm resource to be created. + */ + // const realmId = 'abc123' + /** + * Required. The realm resource to be created. + */ + // const realm = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callCreateRealm() { + // Construct request + const request = { + parent, + realmId, + realm, + }; + + // Run request + const [operation] = await gamingClient.createRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRealm(); + // [END gameservices_v1beta_generated_RealmsService_CreateRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.delete_realm.js b/generated,README.md/generated/v1beta/realms_service.delete_realm.js new file mode 100644 index 0000000000..f082d26994 --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.delete_realm.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_RealmsService_DeleteRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the realm to delete. Uses the form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callDeleteRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await gamingClient.deleteRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRealm(); + // [END gameservices_v1beta_generated_RealmsService_DeleteRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.get_realm.js b/generated,README.md/generated/v1beta/realms_service.get_realm.js new file mode 100644 index 0000000000..3a0f060662 --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.get_realm.js @@ -0,0 +1,62 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START gameservices_v1beta_generated_RealmsService_GetRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the realm to retrieve. Uses the form: + * `projects/{project}/locations/{location}/realms/{realm}`. + */ + // const name = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callGetRealm() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await gamingClient.getRealm(request); + console.log(response); + } + + callGetRealm(); + // [END gameservices_v1beta_generated_RealmsService_GetRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.list_realms.js b/generated,README.md/generated/v1beta/realms_service.list_realms.js new file mode 100644 index 0000000000..10b0feb181 --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.list_realms.js @@ -0,0 +1,86 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START gameservices_v1beta_generated_RealmsService_ListRealms_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource name. Uses the form: + * `projects/{project}/locations/{location}`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of items to return. If unspecified, server + * will pick an appropriate default. Server may return fewer items than + * requested. A caller should only rely on response's + * next_page_token google.cloud.gaming.v1beta.ListRealmsResponse.next_page_token + * to determine if there are more realms left to be queried. + */ + // const pageSize = 1234 + /** + * Optional. The next_page_token value returned from a previous List request, + * if any. + */ + // const pageToken = 'abc123' + /** + * Optional. The filter to apply to list results. + */ + // const filter = 'abc123' + /** + * Optional. Specifies the ordering of results following syntax at + * https://cloud.google.com/apis/design/design_patterns#sorting_order. + */ + // const orderBy = 'abc123' + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callListRealms() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await gamingClient.listRealmsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRealms(); + // [END gameservices_v1beta_generated_RealmsService_ListRealms_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.preview_realm_update.js b/generated,README.md/generated/v1beta/realms_service.preview_realm_update.js new file mode 100644 index 0000000000..67c55bd2f7 --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.preview_realm_update.js @@ -0,0 +1,75 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(realm, updateMask) { + // [START gameservices_v1beta_generated_RealmsService_PreviewRealmUpdate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The realm to be updated. + * Only fields specified in update_mask are updated. + */ + // const realm = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` + * definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + /** + * Optional. The target timestamp to compute the preview. + */ + // const previewTime = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callPreviewRealmUpdate() { + // Construct request + const request = { + realm, + updateMask, + }; + + // Run request + const response = await gamingClient.previewRealmUpdate(request); + console.log(response); + } + + callPreviewRealmUpdate(); + // [END gameservices_v1beta_generated_RealmsService_PreviewRealmUpdate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/realms_service.update_realm.js b/generated,README.md/generated/v1beta/realms_service.update_realm.js new file mode 100644 index 0000000000..ba91f2afba --- /dev/null +++ b/generated,README.md/generated/v1beta/realms_service.update_realm.js @@ -0,0 +1,72 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(realm, updateMask) { + // [START gameservices_v1beta_generated_RealmsService_UpdateRealm_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The realm to be updated. + * Only fields specified in update_mask are updated. + */ + // const realm = {} + /** + * Required. The update mask applies to the resource. For the `FieldMask` + * definition, see + * https: + * //developers.google.com/protocol-buffers + * // /docs/reference/google.protobuf#fieldmask + */ + // const updateMask = {} + + // Imports the Gaming library + const {RealmsServiceClient} = require('@google-cloud/game-servers').v1beta; + + // Instantiates a client + const gamingClient = new RealmsServiceClient(); + + async function callUpdateRealm() { + // Construct request + const request = { + realm, + updateMask, + }; + + // Run request + const [operation] = await gamingClient.updateRealm(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateRealm(); + // [END gameservices_v1beta_generated_RealmsService_UpdateRealm_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/generated,README.md/generated/v1beta/snippet_metadata.google.cloud.gaming.v1beta.json b/generated,README.md/generated/v1beta/snippet_metadata.google.cloud.gaming.v1beta.json new file mode 100644 index 0000000000..4a97faa7c8 --- /dev/null +++ b/generated,README.md/generated/v1beta/snippet_metadata.google.cloud.gaming.v1beta.json @@ -0,0 +1,1247 @@ +{ + "clientLibrary": { + "name": "nodejs-gaming", + "version": "3.1.2", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.gaming.v1beta", + "version": "v1beta" + } + ] + }, + "snippets": [ + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_ListGameServerClusters_async", + "title": "GameServerClustersService listGameServerClusters Sample", + "origin": "API_DEFINITION", + "description": " Lists game server clusters in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.list_game_server_clusters.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerClusters", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.ListGameServerClusters", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.ListGameServerClustersResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "ListGameServerClusters", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.ListGameServerClusters", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_GetGameServerCluster_async", + "title": "GameServerClustersService getGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.get_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.GetGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.GameServerCluster", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "GetGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.GetGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_CreateGameServerCluster_async", + "title": "GameServerClustersService createGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server cluster in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.create_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.CreateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1beta.GameServerCluster" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "CreateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.CreateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_PreviewCreateGameServerCluster_async", + "title": "GameServerClustersService previewCreateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews creation of a new game server cluster in a given project and location.", + "canonical": true, + "file": "game_server_clusters_service.preview_create_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewCreateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewCreateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1beta.GameServerCluster" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1beta.PreviewCreateGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewCreateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewCreateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_DeleteGameServerCluster_async", + "title": "GameServerClustersService deleteGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.delete_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.DeleteGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "DeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.DeleteGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_PreviewDeleteGameServerCluster_async", + "title": "GameServerClustersService previewDeleteGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews deletion of a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.preview_delete_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewDeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewDeleteGameServerCluster", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1beta.PreviewDeleteGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewDeleteGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewDeleteGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_UpdateGameServerCluster_async", + "title": "GameServerClustersService updateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Patches a single game server cluster.", + "canonical": true, + "file": "game_server_clusters_service.update_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.UpdateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1beta.GameServerCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "UpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.UpdateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerClustersService_PreviewUpdateGameServerCluster_async", + "title": "GameServerClustersService previewUpdateGameServerCluster Sample", + "origin": "API_DEFINITION", + "description": " Previews updating a GameServerCluster.", + "canonical": true, + "file": "game_server_clusters_service.preview_update_game_server_cluster.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewUpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewUpdateGameServerCluster", + "async": true, + "parameters": [ + { + "name": "game_server_cluster", + "type": ".google.cloud.gaming.v1beta.GameServerCluster" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1beta.PreviewUpdateGameServerClusterResponse", + "client": { + "shortName": "GameServerClustersServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersServiceClient" + }, + "method": { + "shortName": "PreviewUpdateGameServerCluster", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService.PreviewUpdateGameServerCluster", + "service": { + "shortName": "GameServerClustersService", + "fullName": "google.cloud.gaming.v1beta.GameServerClustersService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerConfigsService_ListGameServerConfigs_async", + "title": "GameServerClustersService listGameServerConfigs Sample", + "origin": "API_DEFINITION", + "description": " Lists game server configs in a given project, location, and game server deployment.", + "canonical": true, + "file": "game_server_configs_service.list_game_server_configs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerConfigs", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.ListGameServerConfigs", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.ListGameServerConfigsResponse", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "ListGameServerConfigs", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.ListGameServerConfigs", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerConfigsService_GetGameServerConfig_async", + "title": "GameServerClustersService getGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server config.", + "canonical": true, + "file": "game_server_configs_service.get_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.GetGameServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.GameServerConfig", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "GetGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.GetGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerConfigsService_CreateGameServerConfig_async", + "title": "GameServerClustersService createGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server config in a given project, location, and game server deployment. Game server configs are immutable, and are not applied until referenced in the game server deployment rollout resource.", + "canonical": true, + "file": "game_server_configs_service.create_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.CreateGameServerConfig", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "config_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_config", + "type": ".google.cloud.gaming.v1beta.GameServerConfig" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "CreateGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.CreateGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerConfigsService_DeleteGameServerConfig_async", + "title": "GameServerClustersService deleteGameServerConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server config. The deletion will fail if the game server config is referenced in a game server deployment rollout.", + "canonical": true, + "file": "game_server_configs_service.delete_game_server_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.DeleteGameServerConfig", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerConfigsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsServiceClient" + }, + "method": { + "shortName": "DeleteGameServerConfig", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService.DeleteGameServerConfig", + "service": { + "shortName": "GameServerConfigsService", + "fullName": "google.cloud.gaming.v1beta.GameServerConfigsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_ListGameServerDeployments_async", + "title": "GameServerClustersService listGameServerDeployments Sample", + "origin": "API_DEFINITION", + "description": " Lists game server deployments in a given project and location.", + "canonical": true, + "file": "game_server_deployments_service.list_game_server_deployments.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListGameServerDeployments", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.ListGameServerDeployments", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.ListGameServerDeploymentsResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "ListGameServerDeployments", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.ListGameServerDeployments", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeployment_async", + "title": "GameServerClustersService getGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.get_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.GetGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.GameServerDeployment", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "GetGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.GetGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_CreateGameServerDeployment_async", + "title": "GameServerClustersService createGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Creates a new game server deployment in a given project and location.", + "canonical": true, + "file": "game_server_deployments_service.create_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.CreateGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "deployment_id", + "type": "TYPE_STRING" + }, + { + "name": "game_server_deployment", + "type": ".google.cloud.gaming.v1beta.GameServerDeployment" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "CreateGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.CreateGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_DeleteGameServerDeployment_async", + "title": "GameServerClustersService deleteGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.delete_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.DeleteGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "DeleteGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.DeleteGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeployment_async", + "title": "GameServerClustersService updateGameServerDeployment Sample", + "origin": "API_DEFINITION", + "description": " Patches a game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.update_game_server_deployment.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.UpdateGameServerDeployment", + "async": true, + "parameters": [ + { + "name": "game_server_deployment", + "type": ".google.cloud.gaming.v1beta.GameServerDeployment" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "UpdateGameServerDeployment", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.UpdateGameServerDeployment", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_GetGameServerDeploymentRollout_async", + "title": "GameServerClustersService getGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Gets details a single game server deployment rollout.", + "canonical": true, + "file": "game_server_deployments_service.get_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.GetGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.GameServerDeploymentRollout", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "GetGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.GetGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_UpdateGameServerDeploymentRollout_async", + "title": "GameServerClustersService updateGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Patches a single game server deployment rollout. The method will not return an error if the update does not affect any existing realms. For example - if the default_game_server_config is changed but all existing realms use the override, that is valid. Similarly, if a non existing realm is explicitly called out in game_server_config_overrides field, that will also not result in an error.", + "canonical": true, + "file": "game_server_deployments_service.update_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.UpdateGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "rollout", + "type": ".google.cloud.gaming.v1beta.GameServerDeploymentRollout" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "UpdateGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.UpdateGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_PreviewGameServerDeploymentRollout_async", + "title": "GameServerClustersService previewGameServerDeploymentRollout Sample", + "origin": "API_DEFINITION", + "description": " Previews the game server deployment rollout. This API does not mutate the rollout resource.", + "canonical": true, + "file": "game_server_deployments_service.preview_game_server_deployment_rollout.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.PreviewGameServerDeploymentRollout", + "async": true, + "parameters": [ + { + "name": "rollout", + "type": ".google.cloud.gaming.v1beta.GameServerDeploymentRollout" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1beta.PreviewGameServerDeploymentRolloutResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "PreviewGameServerDeploymentRollout", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.PreviewGameServerDeploymentRollout", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_GameServerDeploymentsService_FetchDeploymentState_async", + "title": "GameServerClustersService fetchDeploymentState Sample", + "origin": "API_DEFINITION", + "description": " Retrieves information about the current state of the game server deployment. Gathers all the Agones fleets and Agones autoscalers, including fleets running an older version of the game server deployment.", + "canonical": true, + "file": "game_server_deployments_service.fetch_deployment_state.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchDeploymentState", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.FetchDeploymentState", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.FetchDeploymentStateResponse", + "client": { + "shortName": "GameServerDeploymentsServiceClient", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsServiceClient" + }, + "method": { + "shortName": "FetchDeploymentState", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService.FetchDeploymentState", + "service": { + "shortName": "GameServerDeploymentsService", + "fullName": "google.cloud.gaming.v1beta.GameServerDeploymentsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_ListRealms_async", + "title": "GameServerClustersService listRealms Sample", + "origin": "API_DEFINITION", + "description": " Lists realms in a given project and location.", + "canonical": true, + "file": "realms_service.list_realms.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRealms", + "fullName": "google.cloud.gaming.v1beta.RealmsService.ListRealms", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.ListRealmsResponse", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "ListRealms", + "fullName": "google.cloud.gaming.v1beta.RealmsService.ListRealms", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_GetRealm_async", + "title": "GameServerClustersService getRealm Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single realm.", + "canonical": true, + "file": "realms_service.get_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.GetRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.gaming.v1beta.Realm", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "GetRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.GetRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_CreateRealm_async", + "title": "GameServerClustersService createRealm Sample", + "origin": "API_DEFINITION", + "description": " Creates a new realm in a given project and location.", + "canonical": true, + "file": "realms_service.create_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.CreateRealm", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "realm_id", + "type": "TYPE_STRING" + }, + { + "name": "realm", + "type": ".google.cloud.gaming.v1beta.Realm" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "CreateRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.CreateRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_DeleteRealm_async", + "title": "GameServerClustersService deleteRealm Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single realm.", + "canonical": true, + "file": "realms_service.delete_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.DeleteRealm", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "DeleteRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.DeleteRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_UpdateRealm_async", + "title": "GameServerClustersService updateRealm Sample", + "origin": "API_DEFINITION", + "description": " Patches a single realm.", + "canonical": true, + "file": "realms_service.update_realm.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.UpdateRealm", + "async": true, + "parameters": [ + { + "name": "realm", + "type": ".google.cloud.gaming.v1beta.Realm" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "UpdateRealm", + "fullName": "google.cloud.gaming.v1beta.RealmsService.UpdateRealm", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + }, + { + "regionTag": "gameservices_v1beta_generated_RealmsService_PreviewRealmUpdate_async", + "title": "GameServerClustersService previewRealmUpdate Sample", + "origin": "API_DEFINITION", + "description": " Previews patches to a single realm.", + "canonical": true, + "file": "realms_service.preview_realm_update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreviewRealmUpdate", + "fullName": "google.cloud.gaming.v1beta.RealmsService.PreviewRealmUpdate", + "async": true, + "parameters": [ + { + "name": "realm", + "type": ".google.cloud.gaming.v1beta.Realm" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "preview_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.gaming.v1beta.PreviewRealmUpdateResponse", + "client": { + "shortName": "RealmsServiceClient", + "fullName": "google.cloud.gaming.v1beta.RealmsServiceClient" + }, + "method": { + "shortName": "PreviewRealmUpdate", + "fullName": "google.cloud.gaming.v1beta.RealmsService.PreviewRealmUpdate", + "service": { + "shortName": "RealmsService", + "fullName": "google.cloud.gaming.v1beta.RealmsService" + } + } + } + } + ] +} \ No newline at end of file diff --git a/generated,README.md/get_cluster.js b/generated,README.md/get_cluster.js new file mode 100644 index 0000000000..8701ac805b --- /dev/null +++ b/generated,README.md/get_cluster.js @@ -0,0 +1,85 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Server cluster + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + * @param {string} gameClusterId the game cluster to get + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_cluster_get] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function getGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + // const gameClusterId = 'The unique ID for this Game Server Cluster'; + const request = { + // Provide full resource name of a Game Server Realm + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), + view: 'FULL', + }; + + const [cluster] = await client.getGameServerCluster(request); + + console.log('Game Server Cluster:'); + console.log(`\tCluster name: ${cluster.name}`); + console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tCluster installed Agones version: ${cluster.clusterState.agonesVersionInstalled}` + ); + console.log( + `\tCluster installed Kubernetes version: ${cluster.clusterState.kubernetesVersionInstalled}` + ); + console.log( + `\tCluster installation state: ${cluster.clusterState.installationState}` + ); + console.log( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + } + + getGameServerCluster(); + // [END cloud_game_servers_cluster_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/get_config.js b/generated,README.md/get_config.js new file mode 100644 index 0000000000..1272918fec --- /dev/null +++ b/generated,README.md/get_config.js @@ -0,0 +1,72 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_config_get] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function getGameServerConfig() { + /** + * 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 configId = 'A unique ID for the Game Server Config'; + const request = { + // The full resource name + name: client.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + + const [config] = await client.getGameServerConfig(request); + console.log(`Config name: ${config.name}`); + console.log(`Config description: ${config.description}`); + + const createTime = config.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Config created on: ${createDate.toLocaleDateString()}\n`); + } + + getGameServerConfig(); + + // [END cloud_game_servers_config_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/get_deployment.js b/generated,README.md/get_deployment.js new file mode 100644 index 0000000000..d1b65c936f --- /dev/null +++ b/generated,README.md/get_deployment.js @@ -0,0 +1,64 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_get] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function getGameServerDeployment() { + /** + * 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 [deployment] = await client.getGameServerDeployment(request); + console.log(`Deployment name: ${deployment.name}`); + console.log(`Deployment description: ${deployment.description}`); + + const createTime = deployment.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Deployment created on: ${createDate.toLocaleDateString()}\n`); + } + + getGameServerDeployment(); + + // [END cloud_game_servers_deployment_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/get_realm.js b/generated,README.md/get_realm.js new file mode 100644 index 0000000000..ae35dd99c0 --- /dev/null +++ b/generated,README.md/get_realm.js @@ -0,0 +1,66 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a realm by ID + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId the unique ID of the realm + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_realm_get] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function getRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'Unique identifier of the realm'; + const request = { + // Realm name is the full resource name including project ID and location + name: client.realmPath(projectId, location, realmId), + }; + + const [realm] = await client.getRealm(request); + console.log(`Realm name: ${realm.name}`); + console.log(`Realm description: ${realm.description}`); + console.log(`Realm time zone: ${realm.timeZone}`); + + const createTime = realm.createTime; + const createDate = new Date(createTime.seconds * 1000); + + console.log(`Realm created on: ${createDate.toLocaleDateString()}`); + } + + getRealm(); + // [END cloud_game_servers_realm_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/get_rollout.js b/generated,README.md/get_rollout.js new file mode 100644 index 0000000000..72ba1ff80c --- /dev/null +++ b/generated,README.md/get_rollout.js @@ -0,0 +1,70 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Get a Game Servers Rollout. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_rollout_get] + const { + GameServerDeploymentsServiceClient, + } = 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: ${rollout.name}`); + console.log(`Rollout default: ${rollout.defaultGameServerConfig}`); + for (const override of rollout.gameServerConfigOverrides) { + console.log(`Rollout config overrides: ${override.configVersion}`); + console.log( + `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`); + } + + getGameServerDeploymentRollout(); + + // [END cloud_game_servers_rollout_get] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/list_clusters.js b/generated,README.md/list_clusters.js new file mode 100644 index 0000000000..c73a7f0d26 --- /dev/null +++ b/generated,README.md/list_clusters.js @@ -0,0 +1,80 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List Game Server clusters + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region + * @param {string} realmId the realm to use + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_cluster_list] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function listGameServerClusters() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm to locate this cluster in'; + const request = { + // Provide full resource name of a Game Server Realm + parent: client.realmPath(projectId, location, realmId), + view: 'FULL', + }; + + const results = await client.listGameServerClusters(request); + const [clusters] = results; + + for (const cluster of clusters) { + console.log('Game Server Cluster:'); + console.log(`\tCluster name: ${cluster.name}`); + console.log(`\tCluster description: ${cluster.description}`); + console.log( + `\tCluster installed Agones version: ${cluster.clusterState.agonesVersionInstalled}` + ); + console.log( + `\tCluster installed Kubernetes version: ${cluster.clusterState.kubernetesVersionInstalled}` + ); + console.log( + `\tCluster installation state: ${cluster.clusterState.installationState}` + ); + console.log( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + } + } + + listGameServerClusters(); + // [END cloud_game_servers_cluster_list] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/list_configs.js b/generated,README.md/list_configs.js new file mode 100644 index 0000000000..f6a844b50c --- /dev/null +++ b/generated,README.md/list_configs.js @@ -0,0 +1,69 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all the Game Servers Configs. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_config_list] + const { + GameServerConfigsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerConfigsServiceClient(); + + async function listGameServerConfigs() { + /** + * 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 = { + parent: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + const [results] = await client.listGameServerConfigs(request); + for (const config of results) { + console.log(`Config name: ${config.name}`); + console.log(`Config description: ${config.description}`); + + const createTime = config.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Config created on: ${createDate.toLocaleDateString()}\n`); + } + } + + listGameServerConfigs(); + + // [END cloud_game_servers_config_list] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/list_deployments.js b/generated,README.md/list_deployments.js new file mode 100644 index 0000000000..d79534ecd0 --- /dev/null +++ b/generated,README.md/list_deployments.js @@ -0,0 +1,62 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all the Game Servers Deployments. + * @param {string} projectId string project identifier + */ +async function main(projectId = 'YOUR_PROJECT_ID') { + // [START cloud_game_servers_deployment_list] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function listGameServerDeployments() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + const request = { + parent: `projects/${projectId}/locations/global`, + }; + + const [results] = await client.listGameServerDeployments(request); + for (const deployment of results) { + console.log(`Deployment name: ${deployment.name}`); + console.log(`Deployment description: ${deployment.description}`); + + const createTime = deployment.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log( + `Deployment created on: ${createDate.toLocaleDateString()}\n` + ); + } + } + + listGameServerDeployments(); + + // [END cloud_game_servers_deployment_list] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/list_realms.js b/generated,README.md/list_realms.js new file mode 100644 index 0000000000..ded96df687 --- /dev/null +++ b/generated,README.md/list_realms.js @@ -0,0 +1,60 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * List all of the realms in a project. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + */ +async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { + // [START cloud_game_servers_realm_list] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function listRealms() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + const request = { + parent: `projects/${projectId}/locations/${location}`, + }; + + const [results] = await client.listRealms(request); + for (const realm of results) { + console.log(`Realm name: ${realm.name}`); + console.log(`Realm description: ${realm.description}`); + console.log(`Realm time zone: ${realm.timeZone}`); + + const createTime = realm.createTime; + const createDate = new Date(createTime.seconds * 1000); + console.log(`Realm created on: ${createDate.toLocaleDateString()}\n`); + } + } + + listRealms(); + // [END cloud_game_servers_realm_list] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/package.json b/generated,README.md/package.json new file mode 100644 index 0000000000..e9d4c3a6e8 --- /dev/null +++ b/generated,README.md/package.json @@ -0,0 +1,24 @@ +{ + "name": "nodejs-game-server-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=12.0.0" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/game-servers": "^3.1.2" + }, + "devDependencies": { + "c8": "^7.2.1", + "chai": "^4.2.0", + "mocha": "^8.0.0", + "uuid": "^9.0.0" + } +} diff --git a/generated,README.md/quickstart.js b/generated,README.md/quickstart.js new file mode 100644 index 0000000000..3a9c542322 --- /dev/null +++ b/generated,README.md/quickstart.js @@ -0,0 +1,67 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +// sample-metadata: +// title: Create Game Server Realm +// description: Creates a new Realm within Cloud Game Servers +// usage: node quickstart.js + +/** + * Create a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId unique identifier for the realm. + */ +async function main(projectId, location, realmId) { + // [START cloud_game_servers_quickstart] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + async function quickstart() { + const client = new RealmsServiceClient(); + + // TODO(developer): uncomment the following section, and add values + // const projectId = 'YOUR_PROJECT_ID'; + // const location = 'us-central1; + // const realmId = 'DESIRED_REALM_ID'; + + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId, + realm: { + // Must use a valid support time zone. + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 + timeZone: 'US/Pacific', + description: 'My Game Server realm', + }, + }; + + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log('Realm created:'); + + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + } + quickstart(); + // [END cloud_game_servers_quickstart] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/generated,README.md/test/clean.js b/generated,README.md/test/clean.js new file mode 100644 index 0000000000..bed48b96ca --- /dev/null +++ b/generated,README.md/test/clean.js @@ -0,0 +1,71 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const {GameServerClustersServiceClient} = require('@google-cloud/game-servers'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const gameServerClusterClient = new GameServerClustersServiceClient(); +const realmsClient = new RealmsServiceClient(); + +/** + * Utility function for removing unneeded realms from project. + */ +module.exports = async () => { + const projectId = await realmsClient.getProjectId(); + const location = 'us-central1'; + + const request = { + parent: `projects/${projectId}/locations/${location}`, + }; + + const MAX_REALM_LIFESPAN = 3600000; // One hour (in milliseconds) + const NOW = new Date(); + + const [results] = await realmsClient.listRealms(request); + for (const realm of results) { + // Check age of realm. If older than maximum life span, delete. + const ageOfRealm = new Date(realm.createTime.seconds * 1000); + if (NOW - ageOfRealm > MAX_REALM_LIFESPAN) { + // First, delete all clusters associated with this realm. + const clustersRequest = { + parent: realm.name, + }; + + const clustersResult = + await gameServerClusterClient.listGameServerClusters(clustersRequest); + const [clusters] = clustersResult; + for (const cluster of clusters) { + const deleteClusterRequest = { + name: cluster.name, + }; + + const [deleteClusterOperation] = + await gameServerClusterClient.deleteGameServerCluster( + deleteClusterRequest + ); + await deleteClusterOperation.promise(); + } + + // Then delete the realm itself. + const realmDeleteRequest = { + name: realm.name, + }; + + const [deleteRealmOperation] = await realmsClient.deleteRealm( + realmDeleteRequest + ); + await deleteRealmOperation.promise(); + } + } +}; diff --git a/generated,README.md/test/create_cluster.test.js b/generated,README.md/test/create_cluster.test.js new file mode 100644 index 0000000000..a13ea88e66 --- /dev/null +++ b/generated,README.md/test/create_cluster.test.js @@ -0,0 +1,91 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers Create Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `create-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const request = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation] = await realmsClient.createRealm(request); + await operation.promise(); + }); + + it('should create a Game Server cluster', async () => { + const projectId = await realmsClient.getProjectId(); + gameClusterId = `test-${uuid.v4()}`; + + const create_output = execSync( + `node create_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId} ${GKE_CLUSTER_NAME}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/generated,README.md/test/create_realm.test.js b/generated,README.md/test/create_realm.test.js new file mode 100644 index 0000000000..93a49344e7 --- /dev/null +++ b/generated,README.md/test/create_realm.test.js @@ -0,0 +1,55 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, it, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Create Realm Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + await cleanup(); + }); + + it('should create a realm', async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + const create_output = execSync( + `node create_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(create_output, /Realm time zone:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/crud_config.test.js b/generated,README.md/test/crud_config.test.js new file mode 100644 index 0000000000..d5c533c3d1 --- /dev/null +++ b/generated,README.md/test/crud_config.test.js @@ -0,0 +1,97 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, after, it} = require('mocha'); +const { + GameServerConfigsServiceClient, + GameServerDeploymentsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Config Test', () => { + const client = new GameServerConfigsServiceClient(); + const deploymentClient = new GameServerDeploymentsServiceClient(); + let deploymentId; + let configId; + let projectId; + + before(async () => { + await cleanup(); + + projectId = await client.getProjectId(); + deploymentId = `test-${uuid.v4()}`; + configId = `test-${uuid.v4()}`; + + const request = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + }; + const [operation] = await deploymentClient.createGameServerDeployment( + request + ); + await operation.promise(); + }); + + it('should create a game server config', async () => { + const create_output = execSync( + `node create_config.js ${projectId} ${deploymentId} ${configId} nodejs_fleet_name` + ); + assert.match(create_output, /Config name:/); + }); + + it('should get a game server config', async () => { + const get_output = execSync( + `node get_config.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(get_output, /Config name:/); + }); + + it('should list a game server config', async () => { + const list_output = execSync( + `node list_configs.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(list_output, /Config name:/); + }); + + it('should delete a game server config', async () => { + const delete_output = execSync( + `node delete_config.js ${projectId} ${deploymentId} ${configId}` + ); + assert.match(delete_output, /deleted./); + }); + + after(async () => { + // Delete the Game Server Deployment + const request = { + // Provide full resource name of a Game Server Deployment + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + const [operation] = await deploymentClient.deleteGameServerDeployment( + request + ); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/crud_deployment.test.js b/generated,README.md/test/crud_deployment.test.js new file mode 100644 index 0000000000..5dd7218b30 --- /dev/null +++ b/generated,README.md/test/crud_deployment.test.js @@ -0,0 +1,79 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, it} = require('mocha'); +const { + GameServerDeploymentsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Deployment Test', () => { + const client = new GameServerDeploymentsServiceClient(); + let deploymentId; + let projectId; + + before(async () => { + projectId = await client.getProjectId(); + deploymentId = `test-${uuid.v4()}`; + + await cleanup(); + }); + + it('should create a game server deployment', async () => { + const create_output = execSync( + `node create_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(create_output, /Deployment name:/); + }); + + it('should update a game server deployment', async () => { + const update_output = execSync( + `node update_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(update_output, /Deployment updated:/); + }); + + it('should get a game server deployment', async () => { + const get_output = execSync( + `node get_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(get_output, /Deployment name:/); + assert.match( + get_output, + /Deployment description: My updated Game Server deployment/ + ); + }); + + it('should list a game server deployment', async () => { + const list_output = execSync( + `node list_deployments.js ${projectId} ${deploymentId}` + ); + assert.match(list_output, /Deployment name:/); + }); + + it('should delete a game server deployment', async () => { + const delete_output = execSync( + `node delete_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(delete_output, /deleted./); + }); +}); diff --git a/generated,README.md/test/delete_cluster.test.js b/generated,README.md/test/delete_cluster.test.js new file mode 100644 index 0000000000..d6b2003a41 --- /dev/null +++ b/generated,README.md/test/delete_cluster.test.js @@ -0,0 +1,97 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers Delete Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let projectId, realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + projectId = await realmsClient.getProjectId(); + realmId = `delete-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should delete a Game Server cluster in a realm', async () => { + const create_output = execSync( + `node delete_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(create_output, /Game Server cluster deleted/); + }); + + after(async () => { + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/delete_realm.test.js b/generated,README.md/test/delete_realm.test.js new file mode 100644 index 0000000000..915aa83b8e --- /dev/null +++ b/generated,README.md/test/delete_realm.test.js @@ -0,0 +1,59 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Delete Realm Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should delete a realm', async () => { + const projectId = await client.getProjectId(); + + const delete_output = execSync( + `node delete_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(delete_output, /deleted./); + }); +}); diff --git a/generated,README.md/test/get_cluster.test.js b/generated,README.md/test/get_cluster.test.js new file mode 100644 index 0000000000..d62765c3f5 --- /dev/null +++ b/generated,README.md/test/get_cluster.test.js @@ -0,0 +1,111 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers Get Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `get-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should get a Game Server cluster in a realm', async () => { + const projectId = await realmsClient.getProjectId(); + + const create_output = execSync( + `node get_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/generated,README.md/test/get_realm.test.js b/generated,README.md/test/get_realm.test.js new file mode 100644 index 0000000000..43b6ecb494 --- /dev/null +++ b/generated,README.md/test/get_realm.test.js @@ -0,0 +1,68 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Get Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should get a realm', async () => { + const projectId = await client.getProjectId(); + + const get_output = execSync( + `node get_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(get_output, /Realm description:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/list_clusters.test.js b/generated,README.md/test/list_clusters.test.js new file mode 100644 index 0000000000..b32b7ed245 --- /dev/null +++ b/generated,README.md/test/list_clusters.test.js @@ -0,0 +1,111 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers List Clusters Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId; + + before(async () => { + await cleanup(); + + // Create a realm + const projectId = await realmsClient.getProjectId(); + realmId = `list-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should list Game Server clusters in a realm', async () => { + const projectId = await realmsClient.getProjectId(); + + const create_output = execSync( + `node list_clusters.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(create_output, /Cluster name:/); + }); + + after(async () => { + const projectId = await realmsClient.getProjectId(); + + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/generated,README.md/test/list_realms.test.js b/generated,README.md/test/list_realms.test.js new file mode 100644 index 0000000000..574b6a5187 --- /dev/null +++ b/generated,README.md/test/list_realms.test.js @@ -0,0 +1,68 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers List Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should list realms', async () => { + const projectId = await client.getProjectId(); + + const list_output = execSync( + `node list_realms.js ${projectId} ${LOCATION}` + ); + assert.match(list_output, /Realm name:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/quickstart.js b/generated,README.md/test/quickstart.js new file mode 100644 index 0000000000..e9faf4f075 --- /dev/null +++ b/generated,README.md/test/quickstart.js @@ -0,0 +1,53 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +const {assert} = require('chai'); +const cp = require('child_process'); +const {describe, it, after, before} = require('mocha'); +const uuid = require('uuid'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Quickstart', () => { + let projectId; + let client; + const location = 'us-central1'; + const realmId = `realm-${uuid.v4().split('-')[0]}`; + + before(async () => { + client = new RealmsServiceClient(); + projectId = await client.getProjectId(); + }); + + it('should run quickstart', async () => { + const stdout = execSync( + `node quickstart.js ${projectId} ${location} ${realmId}` + ); + assert.include(stdout, 'Realm created:'); + }); + + after(async () => { + const [operation] = await client.deleteRealm({ + name: client.realmPath(projectId, location, realmId), + }); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/quickstart.test.js b/generated,README.md/test/quickstart.test.js new file mode 100644 index 0000000000..8d370fa7d5 --- /dev/null +++ b/generated,README.md/test/quickstart.test.js @@ -0,0 +1,55 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Quickstart Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + before(async () => { + await cleanup(); + }); + + it('should create a realm', async () => { + const projectId = await client.getProjectId(); + realmId = `test-${uuid.v4()}`; + + const quickstart_output = execSync( + `node quickstart.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(quickstart_output, /Realm time zone:/); + }); + + after(async () => { + const projectId = await client.getProjectId(); + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/generated,README.md/test/rollout.js b/generated,README.md/test/rollout.js new file mode 100644 index 0000000000..c2bbb53c35 --- /dev/null +++ b/generated,README.md/test/rollout.js @@ -0,0 +1,216 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, before, after, it} = require('mocha'); +const { + GameServerConfigsServiceClient, + GameServerDeploymentsServiceClient, + RealmsServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +describe('Game Server Rollout Test', () => { + const configClient = new GameServerConfigsServiceClient(); + const deploymentClient = new GameServerDeploymentsServiceClient(); + const realmClient = new RealmsServiceClient(); + let projectId; + const deploymentId = `test-nodejs-${uuid.v4()}`; + const configId = `test-nodejs-${uuid.v4()}`; + const realmId = `test-nodejs-${uuid.v4()}`; + const realmLocation = 'us-central1'; + + before(async () => { + await cleanup(); + + projectId = await deploymentClient.getProjectId(); + + const request = { + parent: `projects/${projectId}/locations/global`, + deploymentId: deploymentId, + }; + const [operation] = await deploymentClient.createGameServerDeployment( + request + ); + await operation.promise(); + + const request2 = { + parent: configClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + configId: configId, + }; + const [operation2] = await configClient.createGameServerConfig(request2); + await operation2.promise(); + + const request3 = { + parent: `projects/${projectId}/locations/${realmLocation}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation3] = await realmClient.createRealm(request3); + await operation3.promise(); + }); + + it('should update rollout default', async () => { + const updateDefaultOutput = execSync( + `node update_rollout_default.js ${projectId} ${deploymentId} ${configId}` + ); + + assert.match(updateDefaultOutput, /Deployment updated:/); + + const getRolloutOutput = execSync( + `node get_rollout.js ${projectId} ${deploymentId} ${configId}` + ); + + const configName = configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ); + assert.match(getRolloutOutput, /Rollout name:/); + assert.match( + getRolloutOutput, + new RegExp(`Rollout default: ${configName}`) + ); + }); + + it('should remove rollout default', async () => { + const removeDefaultOutput = execSync( + `node update_rollout_remove_default.js ${projectId} ${deploymentId} ${configId}` + ); + + assert.match(removeDefaultOutput, /Deployment updated:/); + + const request = { + // The full resource name + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + const [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + assert.strictEqual(rollout.defaultGameServerConfig, ''); + }); + + it('should update rollout override', async () => { + const updateOverrideOutput = execSync( + `node update_rollout_override.js ${projectId} ${deploymentId} ${configId} ${realmId} ${realmLocation}` + ); + assert.match(updateOverrideOutput, /Deployment updated:/); + + const getRolloutOutput = execSync( + `node get_rollout.js ${projectId} ${deploymentId} ${configId}` + ); + + const configName = configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ); + const realmName = realmClient.realmPath(projectId, realmLocation, realmId); + assert.match( + getRolloutOutput, + new RegExp(`Rollout config overrides: .*${configName}`) + ); + assert.match(getRolloutOutput, new RegExp(realmName)); + }); + + it('should remove rollout override', async () => { + const removeOverrideOutput = execSync( + `node update_rollout_remove_override.js ${projectId} ${deploymentId}` + ); + + assert.match(removeOverrideOutput, /Deployment updated:/); + + const request = { + // The full resource name + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + + let rollout; + try { + [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + } catch (err) { + if (err.message.includes(/The service is currently unavailable/)) { + return; + } + throw err; + } + + assert.strictEqual(rollout.gameServerConfigOverrides.length, 0); + }); + + after(async () => { + // Delete the Game Server Config + const request = { + // Provide full resource name of a Game Server Config + name: configClient.gameServerConfigPath( + projectId, + 'global', + deploymentId, + configId + ), + }; + const [operation] = await configClient.deleteGameServerConfig(request); + await operation.promise(); + + // Delete the Game Server Deployment + const request2 = { + // Provide full resource name of a Game Server Deployment + name: deploymentClient.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }; + const [operation2] = await deploymentClient.deleteGameServerDeployment( + request2 + ); + await operation2.promise(); + + // Delete the Realm + const request3 = { + // Provide full resource name of a Realm + name: realmClient.realmPath(projectId, realmLocation, realmId), + }; + const [operation3] = await realmClient.deleteRealm(request3); + await operation3.promise(); + }); +}); diff --git a/generated,README.md/test/update_cluster_test.js b/generated,README.md/test/update_cluster_test.js new file mode 100644 index 0000000000..7eadb4b428 --- /dev/null +++ b/generated,README.md/test/update_cluster_test.js @@ -0,0 +1,115 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const { + RealmsServiceClient, + GameServerClustersServiceClient, +} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; +const GKE_CLUSTER_NAME = + process.env.SAMPLE_CLUSTER_NAME || + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; + +describe('Game Servers Update Cluster Test', () => { + const realmsClient = new RealmsServiceClient(); + const gameClustersClient = new GameServerClustersServiceClient(); + let realmId, gameClusterId, projectId; + + before(async () => { + await cleanup(); + + // Create a realm + projectId = await realmsClient.getProjectId(); + realmId = `update-realm-${uuid.v4()}`; + gameClusterId = `test-${uuid.v4()}`; + + const createRealmRequest = { + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Server realm', + }, + }; + + const [operation1] = await realmsClient.createRealm(createRealmRequest); + await operation1.promise(); + + // Create a cluster + const createClusterRequest = { + parent: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + gameServerClusterId: gameClusterId, + gameServerCluster: { + description: 'My Game Server Cluster', + connectionInfo: { + gkeClusterReference: { + // Provide full resource name of a Kubernetes Engine cluster + cluster: GKE_CLUSTER_NAME, + }, + namespace: 'default', + }, + }, + }; + + const [operation2] = await gameClustersClient.createGameServerCluster( + createClusterRequest + ); + await operation2.promise(); + }); + + it('should update a Game Server cluster in a realm', async () => { + const update_output = execSync( + `node update_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match(update_output, /Cluster updated:/); + + const get_output = execSync( + `node get_cluster.js ${projectId} ${LOCATION} ${realmId} ${gameClusterId}` + ); + assert.match( + get_output, + /Cluster description: My updated Game Server Cluster/ + ); + }); + + after(async () => { + // Delete the Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/generated,README.md/test/update_realm_test.js b/generated,README.md/test/update_realm_test.js new file mode 100644 index 0000000000..f55ae28291 --- /dev/null +++ b/generated,README.md/test/update_realm_test.js @@ -0,0 +1,70 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +const {assert} = require('chai'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); +const {RealmsServiceClient} = require('@google-cloud/game-servers'); + +const cp = require('child_process'); +const uuid = require('uuid'); + +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); + +const LOCATION = 'us-central1'; + +describe('Game Servers Update Realms Test', () => { + const client = new RealmsServiceClient(); + let realmId, projectId; + + before(async () => { + projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + + realmId = `test-${uuid.v4()}`; + + await client.createRealm({ + parent: `projects/${projectId}/locations/${LOCATION}`, + realmId: realmId, + realm: { + timeZone: 'US/Pacific', + description: 'Test Game Realm', + }, + }); + }); + + it('should update a realm', async () => { + const update_output = execSync( + `node update_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(update_output, /Realm updated:/); + + const get_output = execSync( + `node get_realm.js ${projectId} ${LOCATION} ${realmId}` + ); + assert.match(get_output, /Realm description: My updated Game Server realm/); + }); + + after(async () => { + const request = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation] = await client.deleteRealm(request); + await operation.promise(); + }); +}); diff --git a/generated,README.md/update_cluster.js b/generated,README.md/update_cluster.js new file mode 100644 index 0000000000..b07342fc39 --- /dev/null +++ b/generated,README.md/update_cluster.js @@ -0,0 +1,80 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers cluster. + * @param {string} projectId string project identifier + * @param {string} location Compute Engine region for the realm + * @param {string} realmId the realm to use + * @param {string} gameClusterId unique identifier for the Game Cluster + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_cluster_update] + const { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function updateGameServerCluster() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The ID of the realm of this cluster'; + // const gameClusterId = 'A unique ID for this Game Server Cluster'; + const request = { + // Provide full resource name of a Game Server Cluster + gameServerCluster: { + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), + labels: { + 'label-key-1': 'label-value-1', + }, + description: 'My updated Game Server Cluster', + }, + updateMask: { + paths: ['labels', 'description'], + }, + }; + + const [operation] = await client.updateGameServerCluster(request); + const [result] = await operation.promise(); + + console.log(`Cluster updated: ${result.name}`); + } + + updateGameServerCluster(); + // [END cloud_game_servers_cluster_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_deployment.js b/generated,README.md/update_deployment.js new file mode 100644 index 0000000000..dde260eacf --- /dev/null +++ b/generated,README.md/update_deployment.js @@ -0,0 +1,73 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers Deployment. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_update] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function updateGameServerDeployment() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const deploymentId = 'The unique ID for the Game Server Deployment'; + const request = { + gameServerDeployment: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + labels: { + 'label-key-1': 'label-value-1', + }, + description: 'My updated Game Server deployment', + }, + updateMask: { + paths: ['labels', 'description'], + }, + }; + + const [operation] = await client.updateGameServerDeployment(request); + const [result] = await operation.promise(); + + console.log(`Deployment updated: ${result.name}`); + } + + updateGameServerDeployment(); + + // [END cloud_game_servers_deployment_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_realm.js b/generated,README.md/update_realm.js new file mode 100644 index 0000000000..ffdd19a817 --- /dev/null +++ b/generated,README.md/update_realm.js @@ -0,0 +1,71 @@ +// Copyright 2021, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Update a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + * @param {string} realmId unique identifier for the realm + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_realm_update] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function updateRealm() { + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + // const projectId = 'Your Google Cloud Project ID'; + // const location = 'A Compute Engine region, e.g. "us-central1"'; + // const realmId = 'The unique identifier for the realm'; + const request = { + realm: { + name: client.realmPath(projectId, location, realmId), + labels: { + 'label-key-1': 'label-value-1', + }, + timeZone: 'US/Pacific', + description: 'My updated Game Server realm', + }, + updateMask: { + paths: ['labels', 'time_zone', 'description'], + }, + }; + + const [operation] = await client.updateRealm(request); + const results = await operation.promise(); + const [realm] = results; + + console.log(`Realm updated: ${realm.name}`); + } + + updateRealm(); + // [END cloud_game_servers_realm_update] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_rollout_default.js b/generated,README.md/update_rollout_default.js new file mode 100644 index 0000000000..1aa9edf372 --- /dev/null +++ b/generated,README.md/update_rollout_default.js @@ -0,0 +1,73 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to add default config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID' +) { + // [START cloud_game_servers_deployment_rollout_default] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function rolloutDefaultGameServerDeployment() { + /** + * 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 configId = 'A unique ID for the Game Server Config'; + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + defaultGameServerConfig: configId, + }, + updateMask: { + paths: ['default_game_server_config'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + rolloutDefaultGameServerDeployment(); + + // [END cloud_game_servers_deployment_rollout_default] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_rollout_override.js b/generated,README.md/update_rollout_override.js new file mode 100644 index 0000000000..ee27d4b738 --- /dev/null +++ b/generated,README.md/update_rollout_override.js @@ -0,0 +1,86 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to add override config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + * @param {string} configId unique identifier for the new Game Server Config + * @param {string} realmId the unique ID of the realm + * @param {string} realmLocation Compute Engine region for realm location. + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID', + configId = 'CONFIG_ID', + realmId = 'REALM_ID', + realmLocation = 'REALM_LOCATION' +) { + // [START cloud_game_servers_deployment_rollout_override] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function rolloutGameServerDeploymentOverride() { + /** + * 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 configId = 'A unique ID for the Game Server Config'; + // const realmId = 'A unique ID for the realm' + // const realmLocation = 'compute engine region for realm location' + const request = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + gameServerConfigOverrides: [ + { + realmsSelector: { + realms: [client.realmPath(projectId, realmLocation, realmId)], + }, + configVersion: configId, + }, + ], + }, + updateMask: { + paths: ['game_server_config_overrides'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + rolloutGameServerDeploymentOverride(); + + // [END cloud_game_servers_deployment_rollout_override] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_rollout_remove_default.js b/generated,README.md/update_rollout_remove_default.js new file mode 100644 index 0000000000..7584a00bfc --- /dev/null +++ b/generated,README.md/update_rollout_remove_default.js @@ -0,0 +1,70 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to remove default config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_rollout_remove_default] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function removeRolloutDefaultGameServerDeployment() { + /** + * 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 = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + defaultGameServerConfig: '', + }, + updateMask: { + paths: ['default_game_server_config'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + removeRolloutDefaultGameServerDeployment(); + + // [END cloud_game_servers_deployment_rollout_remove_default] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); diff --git a/generated,README.md/update_rollout_remove_override.js b/generated,README.md/update_rollout_remove_override.js new file mode 100644 index 0000000000..031e950c01 --- /dev/null +++ b/generated,README.md/update_rollout_remove_override.js @@ -0,0 +1,69 @@ +// Copyright 2020, Google LLC. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +'use strict'; + +/** + * Rollout update to remove override config. + * @param {string} projectId string project identifier + * @param {string} deploymentId unique identifier for the new Game Server Deployment + */ +async function main( + projectId = 'YOUR_PROJECT_ID', + deploymentId = 'DEPLOYMENT_ID' +) { + // [START cloud_game_servers_deployment_rollout_remove_override] + const { + GameServerDeploymentsServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerDeploymentsServiceClient(); + + async function removeRolloutGameServerDeploymentOverride() { + /** + * 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 = { + rollout: { + name: client.gameServerDeploymentPath( + projectId, + 'global', + deploymentId + ), + }, + updateMask: { + paths: ['game_server_config_overrides'], + }, + }; + + const [operation] = await client.updateGameServerDeploymentRollout(request); + const [deployment] = await operation.promise(); + + console.log(`Deployment updated: ${deployment.name}`); + } + + removeRolloutGameServerDeploymentOverride(); + + // [END cloud_game_servers_deployment_rollout_remove_override] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err.message); + process.exitCode = 1; +}); +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +});