From 7600832351f9baa751ec33d33bf8e4af39676f9e Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Mon, 10 Feb 2020 13:56:48 -0800 Subject: [PATCH 01/50] Initial client library creation --- cloud-game-servers/snippets/package.json | 23 +++++++++++++ cloud-game-servers/snippets/quickstart.js | 29 ++++++++++++++++ .../snippets/test/quickstart.js | 34 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 cloud-game-servers/snippets/package.json create mode 100644 cloud-game-servers/snippets/quickstart.js create mode 100644 cloud-game-servers/snippets/test/quickstart.js diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json new file mode 100644 index 0000000000..1202f25b5d --- /dev/null +++ b/cloud-game-servers/snippets/package.json @@ -0,0 +1,23 @@ +{ + "name": "nodejs-game-server-samples", + "private": true, + "license": "Apache-2.0", + "author": "Google LLC", + "engines": { + "node": ">=8" + }, + "files": [ + "*.js" + ], + "scripts": { + "test": "c8 mocha --timeout 600000 test/*.js" + }, + "dependencies": { + "@google-cloud/game-servers": "^1.0.1" + }, + "devDependencies": { + "c8": "^5.0.1", + "chai": "^4.2.0", + "mocha": "^6.1.4" + } +} diff --git a/cloud-game-servers/snippets/quickstart.js b/cloud-game-servers/snippets/quickstart.js new file mode 100644 index 0000000000..4b8eca19b8 --- /dev/null +++ b/cloud-game-servers/snippets/quickstart.js @@ -0,0 +1,29 @@ +// 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'; + +/** +* DESCRIBE WHAT THIS SAMPLE DOES. +* @param {string} LIST EXPECTED ARGUMENTS. +*/ +async function main() { +// [START LIBRARY_NAME_quickstart] + +// [END LIBRARY_NAME_quickstart] +} + +main(...process.argv.slice(2)).catch(err => { + console.error(err); + process.exitCode = 1; +}); diff --git a/cloud-game-servers/snippets/test/quickstart.js b/cloud-game-servers/snippets/test/quickstart.js new file mode 100644 index 0000000000..5a021415dc --- /dev/null +++ b/cloud-game-servers/snippets/test/quickstart.js @@ -0,0 +1,34 @@ +// 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 path = require("path"); +const { assert } = require("chai"); +const cp = require("child_process"); +const { describe, it } = require("mocha"); + +const execSync = cmd => cp.execSync(cmd, { encoding: "utf-8" }); + +const cwd = path.join(__dirname, ".."); + +describe("Quickstart", () => { + it("should run quickstart", async () => { + const stdout = execSync(`node ./samples/quickstart.js`, { cwd }); + }); +}); From 472db864478bb346e39c0c39df01b826988aa44d Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 11 Feb 2020 14:21:43 -0800 Subject: [PATCH 02/50] feat: updates package.json files and quickstart --- cloud-game-servers/snippets/package.json | 2 +- .../snippets/test/quickstart.js | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 1202f25b5d..7e445c2d4a 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.0.1" + "@google-cloud/game-servers": "^0.1.0" }, "devDependencies": { "c8": "^5.0.1", diff --git a/cloud-game-servers/snippets/test/quickstart.js b/cloud-game-servers/snippets/test/quickstart.js index 5a021415dc..e8365800a0 100644 --- a/cloud-game-servers/snippets/test/quickstart.js +++ b/cloud-game-servers/snippets/test/quickstart.js @@ -16,19 +16,19 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -"use strict"; +'use strict'; -const path = require("path"); -const { assert } = require("chai"); -const cp = require("child_process"); -const { describe, it } = require("mocha"); +const path = require('path'); +const {assert} = require('chai'); +const cp = require('child_process'); +const {describe, it} = require('mocha'); -const execSync = cmd => cp.execSync(cmd, { encoding: "utf-8" }); +const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); -const cwd = path.join(__dirname, ".."); +const cwd = path.join(__dirname, '..'); -describe("Quickstart", () => { - it("should run quickstart", async () => { - const stdout = execSync(`node ./samples/quickstart.js`, { cwd }); +describe('Quickstart', () => { + it('should run quickstart', async () => { + const stdout = execSync(`node quickstart.js`, {cwd}); }); }); From 80f618f9c4e73484b79fa1f48d39aa5460c55ecb Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Fri, 21 Feb 2020 14:50:55 -0800 Subject: [PATCH 03/50] Adds quickstart --- cloud-game-servers/snippets/quickstart.js | 36 +++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/cloud-game-servers/snippets/quickstart.js b/cloud-game-servers/snippets/quickstart.js index 4b8eca19b8..197b63d827 100644 --- a/cloud-game-servers/snippets/quickstart.js +++ b/cloud-game-servers/snippets/quickstart.js @@ -14,13 +14,37 @@ 'use strict'; /** -* DESCRIBE WHAT THIS SAMPLE DOES. -* @param {string} LIST EXPECTED ARGUMENTS. -*/ -async function main() { -// [START LIBRARY_NAME_quickstart] + * Create a Game Servers realm. + * @param {string} projectId string project identifier. + * @param {string} location Compute Engine region. + */ +async function main(projectId, location) { + // [START game_servers_quickstart] + const {RealmsServiceClient} = require('@google-cloud/game-servers'); -// [END LIBRARY_NAME_quickstart] + const client = new RealmsServiceClient(); + + const request = { + parent: `projects/${projectId}/locations/${location}`, + realmId: 'my-realm', + 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}`); + // [END game_servers_quickstart] } main(...process.argv.slice(2)).catch(err => { From 37dd210544d528662c43daa368fd3fe233f9843d Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Sun, 1 Mar 2020 10:11:21 -0800 Subject: [PATCH 04/50] build: get the build passing (#17) --- cloud-game-servers/snippets/package.json | 3 +- cloud-game-servers/snippets/quickstart.js | 51 ++++++++++++------- .../snippets/test/quickstart.js | 28 ++++++++-- 3 files changed, 57 insertions(+), 25 deletions(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 7e445c2d4a..c844a88d0c 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -18,6 +18,7 @@ "devDependencies": { "c8": "^5.0.1", "chai": "^4.2.0", - "mocha": "^6.1.4" + "mocha": "^6.1.4", + "uuid": "^7.0.1" } } diff --git a/cloud-game-servers/snippets/quickstart.js b/cloud-game-servers/snippets/quickstart.js index 197b63d827..a6dc596f2b 100644 --- a/cloud-game-servers/snippets/quickstart.js +++ b/cloud-game-servers/snippets/quickstart.js @@ -13,37 +13,50 @@ '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. */ -async function main(projectId, location) { +async function main(projectId, location, realmId) { // [START game_servers_quickstart] const {RealmsServiceClient} = require('@google-cloud/game-servers'); - const client = new RealmsServiceClient(); + 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 realIm = 'DESIRED_REALM_ID'; - const request = { - parent: `projects/${projectId}/locations/${location}`, - realmId: 'my-realm', - 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 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; + const [operation] = await client.createRealm(request); + const results = await operation.promise(); + const [realm] = results; - console.log('Realm created:'); + console.log('Realm created:'); - console.log(`\tRealm name: ${realm.name}`); - console.log(`\tRealm description: ${realm.description}`); - console.log(`\tRealm time zone: ${realm.timeZone}`); + console.log(`\tRealm name: ${realm.name}`); + console.log(`\tRealm description: ${realm.description}`); + console.log(`\tRealm time zone: ${realm.timeZone}`); + } + quickstart(); // [END game_servers_quickstart] } diff --git a/cloud-game-servers/snippets/test/quickstart.js b/cloud-game-servers/snippets/test/quickstart.js index e8365800a0..1c04c5ac07 100644 --- a/cloud-game-servers/snippets/test/quickstart.js +++ b/cloud-game-servers/snippets/test/quickstart.js @@ -18,17 +18,35 @@ 'use strict'; -const path = require('path'); const {assert} = require('chai'); const cp = require('child_process'); -const {describe, it} = require('mocha'); +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'}); -const cwd = path.join(__dirname, '..'); - 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`, {cwd}); + const stdout = execSync( + `node quickstart.js ${projectId} ${location} ${realmId}` + ); + assert.include(stdout, 'Realm created:'); + }); + + after(async () => { + await client.deleteRealm({ + name: client.realmPath(projectId, location, realmId), + }); }); }); From 41c82c2416cf6bab144df488b08463136dedbc99 Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 1 Mar 2020 10:25:06 -0800 Subject: [PATCH 05/50] build: get sample and system tests passing (#18) --- cloud-game-servers/snippets/test/quickstart.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/test/quickstart.js b/cloud-game-servers/snippets/test/quickstart.js index 1c04c5ac07..e9faf4f075 100644 --- a/cloud-game-servers/snippets/test/quickstart.js +++ b/cloud-game-servers/snippets/test/quickstart.js @@ -45,8 +45,9 @@ describe('Quickstart', () => { }); after(async () => { - await client.deleteRealm({ + const [operation] = await client.deleteRealm({ name: client.realmPath(projectId, location, realmId), }); + await operation.promise(); }); }); From a188eaf1f0d13b6def51adc73e18e0ee42440f4a Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 1 Mar 2020 19:32:03 +0100 Subject: [PATCH 06/50] chore(deps): update dependency @types/mocha (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@types/mocha](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^5.2.5` -> `^7.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/5.2.7/7.0.1) | | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^6.1.4` -> `^7.0.0`](https://renovatebot.com/diffs/npm/mocha/6.2.2/7.1.0) | --- ### Release Notes
mochajs/mocha ### [`v7.1.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​710--2020-02-26) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.1...v7.1.0) #### :tada: Enhancements [#​4038](https://togithub.com/mochajs/mocha/issues/4038): Add Node.js native ESM support ([**@​giltayar**](https://togithub.com/giltayar)) Mocha supports writing your test files as ES modules: - Node.js only v12.11.0 and above - Node.js below v13.2.0, you must set `--experimental-modules` option - current limitations: please check our [documentation](https://mochajs.org/#nodejs-native-esm-support) - for programmatic usage: see [API: loadFilesAsync()](https://mochajs.org/api/mocha#loadFilesAsync) **Note:** Node.JS native [ECMAScript Modules](https://nodejs.org/api/esm.html) implementation has status: **Stability: 1 - Experimental** #### :bug: Fixes - [#​4181](https://togithub.com/mochajs/mocha/issues/4181): Programmatic API cannot access retried test objects ([**@​juergba**](https://togithub.com/juergba)) - [#​4174](https://togithub.com/mochajs/mocha/issues/4174): Browser: fix `allowUncaught` option ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4058](https://togithub.com/mochajs/mocha/issues/4058): Manage author list in AUTHORS instead of `package.json` ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4138](https://togithub.com/mochajs/mocha/issues/4138): Upgrade ESLint v6.8 ([**@​kaicataldo**](https://togithub.com/kaicataldo)) ### [`v7.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​701--2020-01-25) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.0.0...v7.0.1) #### :bug: Fixes - [#​4165](https://togithub.com/mochajs/mocha/issues/4165): Fix exception when skipping tests programmatically ([**@​juergba**](https://togithub.com/juergba)) - [#​4153](https://togithub.com/mochajs/mocha/issues/4153): Restore backwards compatibility for `reporterOptions` ([**@​holm**](https://togithub.com/holm)) - [#​4150](https://togithub.com/mochajs/mocha/issues/4150): Fix recovery of an open test upon uncaught exception ([**@​juergba**](https://togithub.com/juergba)) - [#​4147](https://togithub.com/mochajs/mocha/issues/4147): Fix regression of leaking uncaught exception handler ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4146](https://togithub.com/mochajs/mocha/issues/4146): Update copyright & trademark notices per OJSF ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4140](https://togithub.com/mochajs/mocha/issues/4140): Fix broken links ([**@​KyoungWan**](https://togithub.com/KyoungWan)) #### :nut_and_bolt: Other - [#​4133](https://togithub.com/mochajs/mocha/issues/4133): Print more descriptive error message ([**@​Zirak**](https://togithub.com/Zirak)) ### [`v7.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​700--2020-01-05) [Compare Source](https://togithub.com/mochajs/mocha/compare/v6.2.2...v7.0.0) #### :boom: Breaking Changes - [#​3885](https://togithub.com/mochajs/mocha/issues/3885): **Drop Node.js v6.x support** ([**@​mojosoeun**](https://togithub.com/mojosoeun)) - [#​3890](https://togithub.com/mochajs/mocha/issues/3890): Remove Node.js debug-related flags `--debug`/`--debug-brk` and deprecate `debug` argument ([**@​juergba**](https://togithub.com/juergba)) - [#​3962](https://togithub.com/mochajs/mocha/issues/3962): Changes to command-line options ([**@​ParkSB**](https://togithub.com/ParkSB)): - `--list-interfaces` replaces `--interfaces` - `--list-reporters` replaces `--reporters` - Hook pattern of `this.skip()` ([**@​juergba**](https://togithub.com/juergba)): - [#​3859](https://togithub.com/mochajs/mocha/issues/3859): When conditionally skipping in a `it` test, related `afterEach` hooks are now executed - [#​3741](https://togithub.com/mochajs/mocha/issues/3741): When conditionally skipping in a `beforeEach` hook, subsequent inner `beforeEach` hooks are now skipped and related `afterEach` hooks are executed - [#​4136](https://togithub.com/mochajs/mocha/issues/4136): Disallow `this.skip()` within `after` hooks - [#​3967](https://togithub.com/mochajs/mocha/issues/3967): Remove deprecated `getOptions()` and `lib/cli/options.js` ([**@​juergba**](https://togithub.com/juergba)) - [#​4083](https://togithub.com/mochajs/mocha/issues/4083): Uncaught exception in `pending` test: don't swallow, but retrospectively fail the test for correct exit code ([**@​juergba**](https://togithub.com/juergba)) - [#​4004](https://togithub.com/mochajs/mocha/issues/4004): Align `Mocha` constructor's option names with command-line options ([**@​juergba**](https://togithub.com/juergba)) #### :tada: Enhancements - [#​3980](https://togithub.com/mochajs/mocha/issues/3980): Refactor and improve `--watch` mode with chokidar ([**@​geigerzaehler**](https://togithub.com/geigerzaehler)): - adds command-line options `--watch-files` and `--watch-ignore` - removes `--watch-extensions` - [#​3979](https://togithub.com/mochajs/mocha/issues/3979): Type "rs\\n" to restart tests ([**@​broofa**](https://togithub.com/broofa)) #### :fax: Deprecations These are _soft_-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha: - [#​3968](https://togithub.com/mochajs/mocha/issues/3968): Deprecate legacy configuration via `mocha.opts` ([**@​juergba**](https://togithub.com/juergba)) #### :bug: Fixes - [#​4125](https://togithub.com/mochajs/mocha/issues/4125): Fix timeout handling with `--inspect-brk`/`--inspect` ([**@​juergba**](https://togithub.com/juergba)) - [#​4070](https://togithub.com/mochajs/mocha/issues/4070): `Mocha` constructor: improve browser setup ([**@​juergba**](https://togithub.com/juergba)) - [#​4068](https://togithub.com/mochajs/mocha/issues/4068): XUnit reporter should handle exceptions during diff generation ([**@​rgroothuijsen**](https://togithub.com/rgroothuijsen)) - [#​4030](https://togithub.com/mochajs/mocha/issues/4030): Fix `--allow-uncaught` with `this.skip()` ([**@​juergba**](https://togithub.com/juergba)) #### :mag: Coverage - [#​4109](https://togithub.com/mochajs/mocha/issues/4109): Add Node.js v13.x to CI test matrix ([**@​juergba**](https://togithub.com/juergba)) #### :book: Documentation - [#​4129](https://togithub.com/mochajs/mocha/issues/4129): Fix broken links ([**@​SaeromB**](https://togithub.com/SaeromB)) - [#​4127](https://togithub.com/mochajs/mocha/issues/4127): Add reporter alias names to docs ([**@​khg0712**](https://togithub.com/khg0712)) - [#​4101](https://togithub.com/mochajs/mocha/issues/4101): Clarify invalid usage of `done()` ([**@​jgehrcke**](https://togithub.com/jgehrcke)) - [#​4092](https://togithub.com/mochajs/mocha/issues/4092): Replace `:coffee:` with emoji ☕️ ([**@​pzrq**](https://togithub.com/pzrq)) - [#​4088](https://togithub.com/mochajs/mocha/issues/4088): Initial draft of project charter ([**@​boneskull**](https://togithub.com/boneskull)) - [#​4066](https://togithub.com/mochajs/mocha/issues/4066): Change `sh` to `bash` for code block in docs/index.md ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​4045](https://togithub.com/mochajs/mocha/issues/4045): Update README.md concerning GraphicsMagick installation ([**@​HyunSangHan**](https://togithub.com/HyunSangHan)) - [#​3988](https://togithub.com/mochajs/mocha/issues/3988): Fix sponsors background color for readability ([**@​outsideris**](https://togithub.com/outsideris)) #### :nut_and_bolt: Other - [#​4118](https://togithub.com/mochajs/mocha/issues/4118): Update node-environment-flags to 1.0.6 ([**@​kylef**](https://togithub.com/kylef)) - [#​4097](https://togithub.com/mochajs/mocha/issues/4097): Add GH Funding Metadata ([**@​SheetJSDev**](https://togithub.com/SheetJSDev)) - [#​4089](https://togithub.com/mochajs/mocha/issues/4089): Add funding information to `package.json` ([**@​Munter**](https://togithub.com/Munter)) - [#​4077](https://togithub.com/mochajs/mocha/issues/4077): Improve integration tests ([**@​soobing**](https://togithub.com/soobing))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :ghost: **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/config-help/issues) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-game-servers). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index c844a88d0c..d1d2cdd902 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -18,7 +18,7 @@ "devDependencies": { "c8": "^5.0.1", "chai": "^4.2.0", - "mocha": "^6.1.4", + "mocha": "^7.0.0", "uuid": "^7.0.1" } } From f6421149056e90f2f34575b05d729324724c8f44 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Sun, 1 Mar 2020 19:38:03 +0100 Subject: [PATCH 07/50] chore(deps): update dependency c8 to v7 (#2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [c8](https://togithub.com/bcoe/c8) | devDependencies | major | [`^5.0.1` -> `^7.0.0`](https://renovatebot.com/diffs/npm/c8/5.0.4/7.1.0) | | [c8](https://togithub.com/bcoe/c8) | devDependencies | major | [`^6.0.0` -> `^7.0.0`](https://renovatebot.com/diffs/npm/c8/6.0.1/7.1.0) | --- ### Release Notes
bcoe/c8 ### [`v7.1.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.1...v7.1.0) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.1`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​710httpswwwgithubcombcoec8comparev701v710-2020-02-09) [Compare Source](https://togithub.com/bcoe/c8/compare/v7.0.0...v7.0.1) ##### Features - adds TypeScript definitions ([d39801b](https://www.github.com/bcoe/c8/commit/d39801bc9b2713aa56592010e6394a295bd12b0b)), closes [#​195](https://www.github.com/bcoe/c8/issues/195) ##### Bug Fixes - **deps:** update dependency furi to v2 ([#​193](https://www.github.com/bcoe/c8/issues/193)) ([6b9af6e](https://www.github.com/bcoe/c8/commit/6b9af6ee8cbbacd85eea91dc49bb269fe3651c12)) - **deps:** v8-to-istanbul with patch for crasher ([#​200](https://www.github.com/bcoe/c8/issues/200)) ([d4b7d80](https://www.github.com/bcoe/c8/commit/d4b7d80d78f3d1cb2e9a2e9e106af0cef327b446)) ##### [7.0.1](https://www.github.com/bcoe/c8/compare/v7.0.0...v7.0.1) (2020-01-13) ##### Bug Fixes - all flag not propagated to check-coverage command ([#​188](https://www.github.com/bcoe/c8/issues/188)) ([86eaf72](https://www.github.com/bcoe/c8/commit/86eaf72a8c7af93d6ec9699b741d11df50017a8d)) ### [`v7.0.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​700httpswwwgithubcombcoec8comparev601v700-2019-12-22) [Compare Source](https://togithub.com/bcoe/c8/compare/v6.0.1...v7.0.0) ##### ⚠ BREAKING CHANGES - new test-exclude with modified exclude rules ([#​179](https://togithub.com/bcoe/c8/issues/179)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://togithub.com/bcoe/c8/issues/168)) ##### Features - adds --all functionality ([#​158](https://www.github.com/bcoe/c8/issues/158)) ([2eb631e](https://www.github.com/bcoe/c8/commit/2eb631e460eba3d06925ee1d128e0db82ec50b6c)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://www.github.com/bcoe/c8/issues/168)) ([35d9338](https://www.github.com/bcoe/c8/commit/35d9338b69ba803c19a19d16ff601e3ec5692fa6)) - new test-exclude with modified exclude rules ([#​179](https://www.github.com/bcoe/c8/issues/179)) ([af7d94d](https://www.github.com/bcoe/c8/commit/af7d94d715ab98d67e6b5bff5dfba19430681c9c)) ##### Bug Fixes - **deps:** update dependency v8-to-istanbul to v4 ([#​167](https://www.github.com/bcoe/c8/issues/167)) ([97b9769](https://www.github.com/bcoe/c8/commit/97b97699870ddc4af780cedb25cbb3a87e0eb777)) - **deps:** update dependency yargs to v15 ([#​164](https://www.github.com/bcoe/c8/issues/164)) ([e41a483](https://www.github.com/bcoe/c8/commit/e41a4831aac92591f303d48038a327e9631affee)) - **deps:** update dependency yargs-parser to v16 ([#​157](https://www.github.com/bcoe/c8/issues/157)) ([15746e5](https://www.github.com/bcoe/c8/commit/15746e51640e6e172f27f02c12056e2977342005)) ##### [6.0.1](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) (2019-10-26) ##### Bug Fixes - regex flags in dependency were breaking Node 8 ([a9d9645](https://togithub.com/bcoe/c8/commit/a9d9645858031cee985087828f5e04cfd8922868)) ### [`v6.0.1`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​700httpswwwgithubcombcoec8comparev601v700-2019-12-22) [Compare Source](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) ##### ⚠ BREAKING CHANGES - new test-exclude with modified exclude rules ([#​179](https://togithub.com/bcoe/c8/issues/179)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://togithub.com/bcoe/c8/issues/168)) ##### Features - adds --all functionality ([#​158](https://www.github.com/bcoe/c8/issues/158)) ([2eb631e](https://www.github.com/bcoe/c8/commit/2eb631e460eba3d06925ee1d128e0db82ec50b6c)) - **istanbul-reports:** lcov reports now use relative paths ([#​168](https://www.github.com/bcoe/c8/issues/168)) ([35d9338](https://www.github.com/bcoe/c8/commit/35d9338b69ba803c19a19d16ff601e3ec5692fa6)) - new test-exclude with modified exclude rules ([#​179](https://www.github.com/bcoe/c8/issues/179)) ([af7d94d](https://www.github.com/bcoe/c8/commit/af7d94d715ab98d67e6b5bff5dfba19430681c9c)) ##### Bug Fixes - **deps:** update dependency v8-to-istanbul to v4 ([#​167](https://www.github.com/bcoe/c8/issues/167)) ([97b9769](https://www.github.com/bcoe/c8/commit/97b97699870ddc4af780cedb25cbb3a87e0eb777)) - **deps:** update dependency yargs to v15 ([#​164](https://www.github.com/bcoe/c8/issues/164)) ([e41a483](https://www.github.com/bcoe/c8/commit/e41a4831aac92591f303d48038a327e9631affee)) - **deps:** update dependency yargs-parser to v16 ([#​157](https://www.github.com/bcoe/c8/issues/157)) ([15746e5](https://www.github.com/bcoe/c8/commit/15746e51640e6e172f27f02c12056e2977342005)) ##### [6.0.1](https://togithub.com/bcoe/c8/compare/v6.0.0...v6.0.1) (2019-10-26) ##### Bug Fixes - regex flags in dependency were breaking Node 8 ([a9d9645](https://togithub.com/bcoe/c8/commit/a9d9645858031cee985087828f5e04cfd8922868)) ### [`v6.0.0`](https://togithub.com/bcoe/c8/blob/master/CHANGELOG.md#​600httpsgithubcombcoec8comparev504v600-2019-10-24) [Compare Source](https://togithub.com/bcoe/c8/compare/v5.0.4...v6.0.0) ##### ⚠ BREAKING CHANGES - Node.js' source-map and lineLength cache is now used to remap coverage output (this allows tools like ts-node to be supported, which transpile at runtime). ##### Features - use Node.js' source-map cache, to support tools like ts-node ([#​152](https://togithub.com/bcoe/c8/issues/152)) ([53bba15](https://togithub.com/bcoe/c8/commit/53bba15bee07e8f0446fd85cc59d2b562fe34a21)) ##### Bug Fixes - **deps:** update dependency yargs-parser to v15 ([#​153](https://togithub.com/bcoe/c8/issues/153)) ([80153de](https://togithub.com/bcoe/c8/commit/80153de61be8e5830f1c228945184e4878f8cf0c)) ##### [5.0.4](https://togithub.com/bcoe/c8/compare/v5.0.3...v5.0.4) (2019-09-06) ##### Bug Fixes - **deps:** merging failed when the same script occurred multiple times in the same report ([#​147](https://togithub.com/bcoe/c8/issues/147)) ([1ebcaf9](https://togithub.com/bcoe/c8/commit/1ebcaf9)) - don't load JSON that does not look like coverage ([#​146](https://togithub.com/bcoe/c8/issues/146)) ([a6481f1](https://togithub.com/bcoe/c8/commit/a6481f1)) - **deps:** update dependency yargs-parser to v14 ([#​144](https://togithub.com/bcoe/c8/issues/144)) ([9b3d089](https://togithub.com/bcoe/c8/commit/9b3d089)) ##### [5.0.3](https://www.github.com/bcoe/c8/compare/v5.0.2...v5.0.3) (2019-09-06) ##### Bug Fixes - **deps:** update dependency rimraf to v3 ([#​132](https://www.github.com/bcoe/c8/issues/132)) ([7601748](https://www.github.com/bcoe/c8/commit/7601748)) - **deps:** update dependency yargs to v14 ([#​134](https://www.github.com/bcoe/c8/issues/134)) ([e49737f](https://www.github.com/bcoe/c8/commit/e49737f)) - **deps:** update deps to address warning in cross-spawn ([#​141](https://www.github.com/bcoe/c8/issues/141)) ([4b66221](https://www.github.com/bcoe/c8/commit/4b66221)) ##### [5.0.2](https://www.github.com/bcoe/c8/compare/v5.0.1...v5.0.2) (2019-06-24) ##### Bug Fixes - HTML report now has correct source positions for Node >10.16.0 ([#​125](https://www.github.com/bcoe/c8/issues/125)) ([c49fa7f](https://www.github.com/bcoe/c8/commit/c49fa7f)) - **deps:** update dependency find-up to v4 ([#​119](https://www.github.com/bcoe/c8/issues/119)) ([c568d96](https://www.github.com/bcoe/c8/commit/c568d96)) - **deps:** update dependency yargs-parser to v13 ([#​124](https://www.github.com/bcoe/c8/issues/124)) ([1eb3394](https://www.github.com/bcoe/c8/commit/1eb3394)) - do not override NODE_V8_COVERAGE if set ([#​70](https://www.github.com/bcoe/c8/issues/70)) ([8bb67b0](https://www.github.com/bcoe/c8/commit/8bb67b0)) ##### [5.0.1](https://www.github.com/bcoe/c8/compare/v5.0.0...v5.0.1) (2019-05-20) ##### Bug Fixes - temporary files should be in tmp folder ([#​106](https://www.github.com/bcoe/c8/issues/106)) ([64dd2e6](https://www.github.com/bcoe/c8/commit/64dd2e6))
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-game-servers). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index d1d2cdd902..91be2ba1fd 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -16,7 +16,7 @@ "@google-cloud/game-servers": "^0.1.0" }, "devDependencies": { - "c8": "^5.0.1", + "c8": "^7.0.0", "chai": "^4.2.0", "mocha": "^7.0.0", "uuid": "^7.0.1" From 67b2077436133408f0754cd143c8f29f1ff047ee Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 08:34:51 -0800 Subject: [PATCH 08/50] chore: release 1.0.0 (#4) * created CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] Co-authored-by: Justin Beckwith --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 91be2ba1fd..8d05ef4a00 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^0.1.0" + "@google-cloud/game-servers": "^1.0.0" }, "devDependencies": { "c8": "^7.0.0", From 55d2f4ab1f4094794b257cd037fd1dea1a418603 Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Mon, 2 Mar 2020 16:42:59 -0800 Subject: [PATCH 09/50] feat: adds CRUD samples for GS realms (#21) * Adds Game Servers realm samples * feat: adds realm CRUD tests * feat: adds quickstart test * fix: updates region tags --- cloud-game-servers/snippets/create_realm.js | 65 +++++++++++++++++++ cloud-game-servers/snippets/delete_realm.js | 55 ++++++++++++++++ cloud-game-servers/snippets/get_realm.js | 54 +++++++++++++++ cloud-game-servers/snippets/list_realms.js | 49 ++++++++++++++ cloud-game-servers/snippets/quickstart.js | 7 +- .../snippets/test/create_realm.test.js | 50 ++++++++++++++ .../snippets/test/delete_realm.test.js | 54 +++++++++++++++ .../snippets/test/get_realm.test.js | 63 ++++++++++++++++++ .../snippets/test/list_realms.test.js | 63 ++++++++++++++++++ .../snippets/test/quickstart.test.js | 50 ++++++++++++++ 10 files changed, 507 insertions(+), 3 deletions(-) create mode 100644 cloud-game-servers/snippets/create_realm.js create mode 100644 cloud-game-servers/snippets/delete_realm.js create mode 100644 cloud-game-servers/snippets/get_realm.js create mode 100644 cloud-game-servers/snippets/list_realms.js create mode 100644 cloud-game-servers/snippets/test/create_realm.test.js create mode 100644 cloud-game-servers/snippets/test/delete_realm.test.js create mode 100644 cloud-game-servers/snippets/test/get_realm.test.js create mode 100644 cloud-game-servers/snippets/test/list_realms.test.js create mode 100644 cloud-game-servers/snippets/test/quickstart.test.js diff --git a/cloud-game-servers/snippets/create_realm.js b/cloud-game-servers/snippets/create_realm.js new file mode 100644 index 0000000000..8ce712035f --- /dev/null +++ b/cloud-game-servers/snippets/create_realm.js @@ -0,0 +1,65 @@ +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_create_realm] + /** + * 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 {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function createRealm() { + 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}`); + // [END cloud_game_servers_create_realm] + } + + createRealm(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/delete_realm.js b/cloud-game-servers/snippets/delete_realm.js new file mode 100644 index 0000000000..f5224437c3 --- /dev/null +++ b/cloud-game-servers/snippets/delete_realm.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 +// +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_delete_realm] + /** + * 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 {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function deleteRealm() { + const request = { + // Realm name is the full resource name including project ID,location, + // and the realm ID. + name: `projects/${projectId}/locations/${location}/realms/${realmId}`, + }; + + const [operation] = await client.deleteRealm(request); + await operation.promise(); + console.log(`Realm with ID ${realmId} deleted.`); + + // [END cloud_game_servers_delete_realm] + } + + deleteRealm(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/get_realm.js b/cloud-game-servers/snippets/get_realm.js new file mode 100644 index 0000000000..f2379ad5ae --- /dev/null +++ b/cloud-game-servers/snippets/get_realm.js @@ -0,0 +1,54 @@ +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_get_realm] + /** + * 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 {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function getRealm() { + const request = { + // Realm name is the full resource name including project ID and location + name: `projects/${projectId}/locations/${location}/realms/${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}`); + // [END cloud_game_servers_get_realm] + } + + getRealm(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/list_realms.js b/cloud-game-servers/snippets/list_realms.js new file mode 100644 index 0000000000..d8a7f9c6d8 --- /dev/null +++ b/cloud-game-servers/snippets/list_realms.js @@ -0,0 +1,49 @@ +// 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. + */ +function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { + // [START cloud_game_servers_list_realms] + /** + * 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 {RealmsServiceClient} = require('@google-cloud/game-servers'); + + const client = new RealmsServiceClient(); + + async function listRealms() { + const request = { + parent: `projects/${projectId}/locations/${location}`, + }; + + const [results] = await client.listRealms(request); + for (const realm of results.realms) { + console.log(`Realm name: ${realm.name}`); + console.log(`Realm description: ${realm.description}`); + console.log(`Realm time zone: ${realm.timeZone}\n`); + } + // [END cloud_game_servers_list_realms] + } + + listRealms(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/quickstart.js b/cloud-game-servers/snippets/quickstart.js index a6dc596f2b..3a9c542322 100644 --- a/cloud-game-servers/snippets/quickstart.js +++ b/cloud-game-servers/snippets/quickstart.js @@ -22,9 +22,10 @@ * 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 game_servers_quickstart] + // [START cloud_game_servers_quickstart] const {RealmsServiceClient} = require('@google-cloud/game-servers'); async function quickstart() { @@ -33,7 +34,7 @@ async function main(projectId, location, realmId) { // TODO(developer): uncomment the following section, and add values // const projectId = 'YOUR_PROJECT_ID'; // const location = 'us-central1; - // const realIm = 'DESIRED_REALM_ID'; + // const realmId = 'DESIRED_REALM_ID'; const request = { parent: `projects/${projectId}/locations/${location}`, @@ -57,7 +58,7 @@ async function main(projectId, location, realmId) { console.log(`\tRealm time zone: ${realm.timeZone}`); } quickstart(); - // [END game_servers_quickstart] + // [END cloud_game_servers_quickstart] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/test/create_realm.test.js b/cloud-game-servers/snippets/test/create_realm.test.js new file mode 100644 index 0000000000..293298a2dc --- /dev/null +++ b/cloud-game-servers/snippets/test/create_realm.test.js @@ -0,0 +1,50 @@ +// 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 {describe, 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; + + 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/cloud-game-servers/snippets/test/delete_realm.test.js b/cloud-game-servers/snippets/test/delete_realm.test.js new file mode 100644 index 0000000000..e88a1d3530 --- /dev/null +++ b/cloud-game-servers/snippets/test/delete_realm.test.js @@ -0,0 +1,54 @@ +// 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 {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(); + 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/cloud-game-servers/snippets/test/get_realm.test.js b/cloud-game-servers/snippets/test/get_realm.test.js new file mode 100644 index 0000000000..4eb9ebc9c8 --- /dev/null +++ b/cloud-game-servers/snippets/test/get_realm.test.js @@ -0,0 +1,63 @@ +// 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 {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(); + 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/cloud-game-servers/snippets/test/list_realms.test.js b/cloud-game-servers/snippets/test/list_realms.test.js new file mode 100644 index 0000000000..35c78613bd --- /dev/null +++ b/cloud-game-servers/snippets/test/list_realms.test.js @@ -0,0 +1,63 @@ +// 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 {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(); + 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/cloud-game-servers/snippets/test/quickstart.test.js b/cloud-game-servers/snippets/test/quickstart.test.js new file mode 100644 index 0000000000..74b1644527 --- /dev/null +++ b/cloud-game-servers/snippets/test/quickstart.test.js @@ -0,0 +1,50 @@ +// 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 {describe, 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 Quickstart Test', () => { + const client = new RealmsServiceClient(); + let realmId; + + 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(); + }); +}); From 2c715d080118e9bbadebee6a6ec44077adaf45d0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 16:55:19 -0800 Subject: [PATCH 10/50] chore: release 1.1.0 (#22) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json [ci skip] --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 8d05ef4a00..b738ce91b0 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.0.0" + "@google-cloud/game-servers": "^1.1.0" }, "devDependencies": { "c8": "^7.0.0", From 78d8cd15e992c9b6d0ab42f62fb287d0e646c77b Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Tue, 10 Mar 2020 10:13:20 -0700 Subject: [PATCH 11/50] test: adds cleanup function for tests (#28) * feat: adds cleanup function for tests --- cloud-game-servers/snippets/get_realm.js | 5 ++ cloud-game-servers/snippets/list_realms.js | 6 +- cloud-game-servers/snippets/test/clean.js | 73 +++++++++++++++++++ .../snippets/test/create_realm.test.js | 7 +- .../snippets/test/delete_realm.test.js | 5 ++ .../snippets/test/get_realm.test.js | 5 ++ .../snippets/test/list_realms.test.js | 5 ++ .../snippets/test/quickstart.test.js | 7 +- 8 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 cloud-game-servers/snippets/test/clean.js diff --git a/cloud-game-servers/snippets/get_realm.js b/cloud-game-servers/snippets/get_realm.js index f2379ad5ae..620deadc14 100644 --- a/cloud-game-servers/snippets/get_realm.js +++ b/cloud-game-servers/snippets/get_realm.js @@ -45,6 +45,11 @@ function main( 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()}`); // [END cloud_game_servers_get_realm] } diff --git a/cloud-game-servers/snippets/list_realms.js b/cloud-game-servers/snippets/list_realms.js index d8a7f9c6d8..18039dfce3 100644 --- a/cloud-game-servers/snippets/list_realms.js +++ b/cloud-game-servers/snippets/list_realms.js @@ -38,7 +38,11 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { for (const realm of results.realms) { console.log(`Realm name: ${realm.name}`); console.log(`Realm description: ${realm.description}`); - console.log(`Realm time zone: ${realm.timeZone}\n`); + 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`); } // [END cloud_game_servers_list_realms] } diff --git a/cloud-game-servers/snippets/test/clean.js b/cloud-game-servers/snippets/test/clean.js new file mode 100644 index 0000000000..814852c614 --- /dev/null +++ b/cloud-game-servers/snippets/test/clean.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 +// +// 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.realms) { + // 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.gameServerClusters) { + 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/cloud-game-servers/snippets/test/create_realm.test.js b/cloud-game-servers/snippets/test/create_realm.test.js index 293298a2dc..93a49344e7 100644 --- a/cloud-game-servers/snippets/test/create_realm.test.js +++ b/cloud-game-servers/snippets/test/create_realm.test.js @@ -15,7 +15,8 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, after} = require('mocha'); +const cleanup = require('./clean.js'); +const {describe, before, it, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); const cp = require('child_process'); @@ -29,6 +30,10 @@ 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()}`; diff --git a/cloud-game-servers/snippets/test/delete_realm.test.js b/cloud-game-servers/snippets/test/delete_realm.test.js index e88a1d3530..915aa83b8e 100644 --- a/cloud-game-servers/snippets/test/delete_realm.test.js +++ b/cloud-game-servers/snippets/test/delete_realm.test.js @@ -15,6 +15,7 @@ 'use strict'; const {assert} = require('chai'); +const cleanup = require('./clean.js'); const {describe, it, before} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); @@ -31,6 +32,10 @@ describe('Game Servers Delete Realm Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/cloud-game-servers/snippets/test/get_realm.test.js b/cloud-game-servers/snippets/test/get_realm.test.js index 4eb9ebc9c8..43b6ecb494 100644 --- a/cloud-game-servers/snippets/test/get_realm.test.js +++ b/cloud-game-servers/snippets/test/get_realm.test.js @@ -15,6 +15,7 @@ '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'); @@ -31,6 +32,10 @@ describe('Game Servers Get Realms Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/cloud-game-servers/snippets/test/list_realms.test.js b/cloud-game-servers/snippets/test/list_realms.test.js index 35c78613bd..574b6a5187 100644 --- a/cloud-game-servers/snippets/test/list_realms.test.js +++ b/cloud-game-servers/snippets/test/list_realms.test.js @@ -15,6 +15,7 @@ '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'); @@ -31,6 +32,10 @@ describe('Game Servers List Realms Test', () => { before(async () => { const projectId = await client.getProjectId(); + + // Clean up any stray realms + await cleanup(); + realmId = `test-${uuid.v4()}`; await client.createRealm({ diff --git a/cloud-game-servers/snippets/test/quickstart.test.js b/cloud-game-servers/snippets/test/quickstart.test.js index 74b1644527..8d370fa7d5 100644 --- a/cloud-game-servers/snippets/test/quickstart.test.js +++ b/cloud-game-servers/snippets/test/quickstart.test.js @@ -15,7 +15,8 @@ 'use strict'; const {assert} = require('chai'); -const {describe, it, after} = require('mocha'); +const cleanup = require('./clean.js'); +const {describe, it, before, after} = require('mocha'); const {RealmsServiceClient} = require('@google-cloud/game-servers'); const cp = require('child_process'); @@ -29,6 +30,10 @@ 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()}`; From d728547236509214a2e4f940604c69dfb8e04a69 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Mon, 27 Apr 2020 10:36:01 -0700 Subject: [PATCH 12/50] build: generator updates and new coverage approach (#59) --- cloud-game-servers/snippets/list_realms.js | 2 +- cloud-game-servers/snippets/test/clean.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cloud-game-servers/snippets/list_realms.js b/cloud-game-servers/snippets/list_realms.js index 18039dfce3..fbeb7256f8 100644 --- a/cloud-game-servers/snippets/list_realms.js +++ b/cloud-game-servers/snippets/list_realms.js @@ -35,7 +35,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { }; const [results] = await client.listRealms(request); - for (const realm of results.realms) { + for (const realm of results) { console.log(`Realm name: ${realm.name}`); console.log(`Realm description: ${realm.description}`); console.log(`Realm time zone: ${realm.timeZone}`); diff --git a/cloud-game-servers/snippets/test/clean.js b/cloud-game-servers/snippets/test/clean.js index 814852c614..7436f1870a 100644 --- a/cloud-game-servers/snippets/test/clean.js +++ b/cloud-game-servers/snippets/test/clean.js @@ -33,7 +33,7 @@ module.exports = async () => { const NOW = new Date(); const [results] = await realmsClient.listRealms(request); - for (const realm of results.realms) { + 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) { From 730d39632a00839c7f545f01a02b5b2c962c3c0c Mon Sep 17 00:00:00 2001 From: Eric Schmidt Date: Wed, 29 Apr 2020 14:44:17 -0700 Subject: [PATCH 13/50] feat: adds CRUD samples, tests for GS clusters (#24) --- cloud-game-servers/snippets/create_cluster.js | 79 ++++++++++++ cloud-game-servers/snippets/delete_cluster.js | 58 +++++++++ cloud-game-servers/snippets/get_cluster.js | 63 ++++++++++ cloud-game-servers/snippets/list_clusters.js | 63 ++++++++++ cloud-game-servers/snippets/test/clean.js | 2 +- .../snippets/test/create_cluster.test.js | 91 ++++++++++++++ .../snippets/test/delete_cluster.test.js | 112 ++++++++++++++++++ .../snippets/test/get_cluster.test.js | 111 +++++++++++++++++ .../snippets/test/list_clusters.test.js | 111 +++++++++++++++++ 9 files changed, 689 insertions(+), 1 deletion(-) create mode 100644 cloud-game-servers/snippets/create_cluster.js create mode 100644 cloud-game-servers/snippets/delete_cluster.js create mode 100644 cloud-game-servers/snippets/get_cluster.js create mode 100644 cloud-game-servers/snippets/list_clusters.js create mode 100644 cloud-game-servers/snippets/test/create_cluster.test.js create mode 100644 cloud-game-servers/snippets/test/delete_cluster.test.js create mode 100644 cloud-game-servers/snippets/test/get_cluster.test.js create mode 100644 cloud-game-servers/snippets/test/list_clusters.test.js diff --git a/cloud-game-servers/snippets/create_cluster.js b/cloud-game-servers/snippets/create_cluster.js new file mode 100644 index 0000000000..57f19fc1ff --- /dev/null +++ b/cloud-game-servers/snippets/create_cluster.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 +// +// 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} gkeClusterId the GKE cluster to connect to + * @param {string} gkeLocation the location of the GKE cluster + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID', + gkeClusterName = 'GKE_CLUSTER_NAME' +) { + // [START cloud_game_servers_create_cluster] + /** + * 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 { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function createGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + 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: 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}` + ); + // [END cloud_game_servers_create_cluster] + } + + createGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/delete_cluster.js b/cloud-game-servers/snippets/delete_cluster.js new file mode 100644 index 0000000000..8ef0e09fea --- /dev/null +++ b/cloud-game-servers/snippets/delete_cluster.js @@ -0,0 +1,58 @@ +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_delete_cluster] + /** + * 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 { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function deleteGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + + await client.deleteGameServerCluster(request); + + console.log('Game Server cluster deleted'); + // [END cloud_game_servers_delete_cluster] + } + + deleteGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/get_cluster.js b/cloud-game-servers/snippets/get_cluster.js new file mode 100644 index 0000000000..8cebc8ff75 --- /dev/null +++ b/cloud-game-servers/snippets/get_cluster.js @@ -0,0 +1,63 @@ +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID', + gameClusterId = 'GAME_CLUSTER_ID' +) { + // [START cloud_game_servers_get_cluster] + /** + * 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 { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function getGameServerCluster() { + const request = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + + 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( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + // [END cloud_game_servers_get_cluster] + } + + getGameServerCluster(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/list_clusters.js b/cloud-game-servers/snippets/list_clusters.js new file mode 100644 index 0000000000..d2faa73f53 --- /dev/null +++ b/cloud-game-servers/snippets/list_clusters.js @@ -0,0 +1,63 @@ +// 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 + */ +function main( + projectId = 'YOUR_PROJECT_ID', + location = 'LOCATION_ID', + realmId = 'REALM_ID' +) { + // [START cloud_game_servers_list_clusters] + /** + * 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 { + GameServerClustersServiceClient, + } = require('@google-cloud/game-servers'); + + const client = new GameServerClustersServiceClient(); + + async function listGameServerClusters() { + const request = { + // Provide full resource name of a Game Server Realm + parent: `projects/${projectId}/locations/${location}/realms/${realmId}`, + }; + + 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( + `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` + ); + } + // [END cloud_game_servers_list_clusters] + } + + listGameServerClusters(); +} + +main(...process.argv.slice(2)); diff --git a/cloud-game-servers/snippets/test/clean.js b/cloud-game-servers/snippets/test/clean.js index 7436f1870a..cf62661619 100644 --- a/cloud-game-servers/snippets/test/clean.js +++ b/cloud-game-servers/snippets/test/clean.js @@ -46,7 +46,7 @@ module.exports = async () => { clustersRequest ); const [clusters] = clustersResult; - for (const cluster of clusters.gameServerClusters) { + for (const cluster of clusters) { const deleteClusterRequest = { name: cluster.name, }; diff --git a/cloud-game-servers/snippets/test/create_cluster.test.js b/cloud-game-servers/snippets/test/create_cluster.test.js new file mode 100644 index 0000000000..dc0bb66235 --- /dev/null +++ b/cloud-game-servers/snippets/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/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +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/cloud-game-servers/snippets/test/delete_cluster.test.js b/cloud-game-servers/snippets/test/delete_cluster.test.js new file mode 100644 index 0000000000..c09a1b528a --- /dev/null +++ b/cloud-game-servers/snippets/test/delete_cluster.test.js @@ -0,0 +1,112 @@ +// 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/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +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 Game Server cluster + const deleteClusterRequest = { + // Provide full resource name of a Game Server Realm + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + }; + try { + const [operation1] = await gameClustersClient.deleteGameServerCluster( + deleteClusterRequest + ); + await operation1.promise(); + } catch (ex) { + console.log(ex); + console.log(`Realm ID: ${realmId}`); + console.log(`Cluster ID: ${gameClusterId}`); + } + // Delete the realm + const deleteRealmRequest = { + name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, + }; + const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation2.promise(); + }); +}); diff --git a/cloud-game-servers/snippets/test/get_cluster.test.js b/cloud-game-servers/snippets/test/get_cluster.test.js new file mode 100644 index 0000000000..fc0a761ae2 --- /dev/null +++ b/cloud-game-servers/snippets/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/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +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/cloud-game-servers/snippets/test/list_clusters.test.js b/cloud-game-servers/snippets/test/list_clusters.test.js new file mode 100644 index 0000000000..51d5478742 --- /dev/null +++ b/cloud-game-servers/snippets/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/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + +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(); + }); +}); From 3f0f21f764fce3623eb5b3b042c0c0addf0260e0 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 1 May 2020 06:54:18 +0200 Subject: [PATCH 14/50] chore(deps): update dependency uuid to v8 (#63) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | devDependencies | major | [`^7.0.1` -> `^8.0.0`](https://renovatebot.com/diffs/npm/uuid/7.0.3/8.0.0) | --- ### Release Notes
uuidjs/uuid ### [`v8.0.0`](https://togithub.com/uuidjs/uuid/blob/master/CHANGELOG.md#​800-httpsgithubcomuuidjsuuidcomparev703v800-2020-04-29) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v7.0.3...v8.0.0) ##### ⚠ BREAKING CHANGES - For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export. ```diff -import uuid from 'uuid'; -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869' +import { v4 as uuidv4 } from 'uuid'; +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d' ``` - Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported. Instead use the named exports that this module exports. For ECMAScript Modules (ESM): ```diff -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; uuidv4(); ``` For CommonJS: ```diff -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); uuidv4(); ``` ##### Features - native Node.js ES Modules (wrapper approach) ([#​423](https://togithub.com/uuidjs/uuid/issues/423)) ([2d9f590](https://togithub.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#​245](https://togithub.com/uuidjs/uuid/issues/245) [#​419](https://togithub.com/uuidjs/uuid/issues/419) [#​342](https://togithub.com/uuidjs/uuid/issues/342) - remove deep requires ([#​426](https://togithub.com/uuidjs/uuid/issues/426)) ([daf72b8](https://togithub.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba)) ##### Bug Fixes - add CommonJS syntax example to README quickstart section ([#​417](https://togithub.com/uuidjs/uuid/issues/417)) ([e0ec840](https://togithub.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0)) ##### [7.0.3](https://togithub.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31) ##### Bug Fixes - make deep require deprecation warning work in browsers ([#​409](https://togithub.com/uuidjs/uuid/issues/409)) ([4b71107](https://togithub.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#​408](https://togithub.com/uuidjs/uuid/issues/408) ##### [7.0.2](https://togithub.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04) ##### Bug Fixes - make access to msCrypto consistent ([#​393](https://togithub.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://togithub.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c)) - simplify link in deprecation warning ([#​391](https://togithub.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://togithub.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7)) - update links to match content in readme ([#​386](https://togithub.com/uuidjs/uuid/issues/386)) ([44f2f86](https://togithub.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4)) ##### [7.0.1](https://togithub.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25) ##### Bug Fixes - clean up esm builds for node and browser ([#​383](https://togithub.com/uuidjs/uuid/issues/383)) ([59e6a49](https://togithub.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc)) - provide browser versions independent from module system ([#​380](https://togithub.com/uuidjs/uuid/issues/380)) ([4344a22](https://togithub.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#​378](https://togithub.com/uuidjs/uuid/issues/378)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-game-servers). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index b738ce91b0..4743b60f84 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -19,6 +19,6 @@ "c8": "^7.0.0", "chai": "^4.2.0", "mocha": "^7.0.0", - "uuid": "^7.0.1" + "uuid": "^8.0.0" } } From 9de5e5c494c0cb77ba9e9386b11634ca7534f61d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 4 Jun 2020 11:05:54 -0700 Subject: [PATCH 15/50] chore: release 2.0.0 (#38) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 4743b60f84..e6a9411fa7 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^1.1.0" + "@google-cloud/game-servers": "^2.0.0" }, "devDependencies": { "c8": "^7.0.0", From c2a87069990e03357700589199914a799541f045 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 11 Jun 2020 17:46:07 +0200 Subject: [PATCH 16/50] chore(deps): update dependency mocha to v8 (#72) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [mocha](https://mochajs.org/) ([source](https://togithub.com/mochajs/mocha)) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) | --- ### Release Notes
mochajs/mocha ### [`v8.0.1`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​801--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v8.0.0...v8.0.1) The obligatory patch after a major. #### :bug: Fixes - [#​4328](https://togithub.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@​boneskull**](https://togithub.com/boneskull)) ### [`v8.0.0`](https://togithub.com/mochajs/mocha/blob/master/CHANGELOG.md#​800--2020-06-10) [Compare Source](https://togithub.com/mochajs/mocha/compare/v7.2.0...v8.0.0) In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below. Let's welcome [**@​giltayar**](https://togithub.com/giltayar) and [**@​nicojs**](https://togithub.com/nicojs) to the maintenance team! #### :boom: Breaking Changes - [#​4164](https://togithub.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@​UlisesGascon**](https://togithub.com/UlisesGascon)) - [#​4175](https://togithub.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs). - [#​4260](https://togithub.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@​craigtaub**](https://togithub.com/craigtaub)) :sparkles: **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`. - [#​4315](https://togithub.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@​juergba**](https://togithub.com/juergba)) :sparkles: **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`). - [#​4309](https://togithub.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@​juergba**](https://togithub.com/juergba)) - [#​4282](https://togithub.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@​arvidOtt**](https://togithub.com/arvidOtt)) - [#​4223](https://togithub.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@​juergba**](https://togithub.com/juergba)) - [#​4178](https://togithub.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@​wnghdcjfe**](https://togithub.com/wnghdcjfe)): - `Mocha.prototype.ignoreLeaks()` - `Mocha.prototype.useColors()` - `Mocha.prototype.useInlineDiffs()` - `Mocha.prototype.hideDiff()` #### :tada: Enhancements - [#​4245](https://togithub.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@​boneskull**](https://togithub.com/boneskull)) :exclamation: See also [#​4244](https://togithub.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_ - [#​4304](https://togithub.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@​JacobLey**](https://togithub.com/JacobLey)) - [#​4299](https://togithub.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@​giltayar**](https://togithub.com/giltayar)) #### :book: Documentation - [#​4246](https://togithub.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@​boneskull**](https://togithub.com/boneskull)) #### :bug: Fixes (All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)
--- ### Renovate configuration :date: **Schedule**: "after 9am and before 3pm" (UTC). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-game-servers). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index e6a9411fa7..b24d1d469b 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -18,7 +18,7 @@ "devDependencies": { "c8": "^7.0.0", "chai": "^4.2.0", - "mocha": "^7.0.0", + "mocha": "^8.0.0", "uuid": "^8.0.0" } } From f7b23266c365035583af108488f1311862afd6f9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2020 09:01:48 -0700 Subject: [PATCH 17/50] chore: release 2.0.1 (#75) * updated CHANGELOG.md [ci skip] * updated package.json [ci skip] * updated samples/package.json Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index b24d1d469b..9b6401e6c3 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.0" + "@google-cloud/game-servers": "^2.0.1" }, "devDependencies": { "c8": "^7.0.0", From e0c2adb23a02f5db3dfb6ee01c376d1474af8d8c Mon Sep 17 00:00:00 2001 From: xwxw-g <58997759+xwxw-g@users.noreply.github.com> Date: Wed, 8 Jul 2020 18:03:04 -0700 Subject: [PATCH 18/50] test: fix sample test by pointing at a shared cluster with Agones (#81) --- cloud-game-servers/snippets/test/create_cluster.test.js | 2 +- cloud-game-servers/snippets/test/delete_cluster.test.js | 2 +- cloud-game-servers/snippets/test/get_cluster.test.js | 2 +- cloud-game-servers/snippets/test/list_clusters.test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud-game-servers/snippets/test/create_cluster.test.js b/cloud-game-servers/snippets/test/create_cluster.test.js index dc0bb66235..a13ea88e66 100644 --- a/cloud-game-servers/snippets/test/create_cluster.test.js +++ b/cloud-game-servers/snippets/test/create_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Create Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/cloud-game-servers/snippets/test/delete_cluster.test.js b/cloud-game-servers/snippets/test/delete_cluster.test.js index c09a1b528a..832e51737b 100644 --- a/cloud-game-servers/snippets/test/delete_cluster.test.js +++ b/cloud-game-servers/snippets/test/delete_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Delete Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/cloud-game-servers/snippets/test/get_cluster.test.js b/cloud-game-servers/snippets/test/get_cluster.test.js index fc0a761ae2..d62765c3f5 100644 --- a/cloud-game-servers/snippets/test/get_cluster.test.js +++ b/cloud-game-servers/snippets/test/get_cluster.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers Get Cluster Test', () => { const realmsClient = new RealmsServiceClient(); diff --git a/cloud-game-servers/snippets/test/list_clusters.test.js b/cloud-game-servers/snippets/test/list_clusters.test.js index 51d5478742..b32b7ed245 100644 --- a/cloud-game-servers/snippets/test/list_clusters.test.js +++ b/cloud-game-servers/snippets/test/list_clusters.test.js @@ -30,7 +30,7 @@ const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); const LOCATION = 'us-central1'; const GKE_CLUSTER_NAME = process.env.SAMPLE_CLUSTER_NAME || - 'projects/1046198160504/locations/us-west1-a/clusters/grpc-bug-cluster'; + 'projects/217093627905/locations/us-central1/clusters/gke-shared-default'; describe('Game Servers List Clusters Test', () => { const realmsClient = new RealmsServiceClient(); From 855756e5049b527c0eab58980a51828b8f809f4b Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2020 01:14:15 +0000 Subject: [PATCH 19/50] chore: release 2.0.2 (#82) :robot: I have created a release \*beep\* \*boop\* --- ### [2.0.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.0.1...v2.0.2) (2020-07-09) ### Bug Fixes * correct return type of delete operations ([#79](https://www.github.com/googleapis/nodejs-game-servers/issues/79)) ([e946632](https://www.github.com/googleapis/nodejs-game-servers/commit/e9466329399c62c0f6f49a713f68ecf8ef96213b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 9b6401e6c3..92c20f638d 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.1" + "@google-cloud/game-servers": "^2.0.2" }, "devDependencies": { "c8": "^7.0.0", From d51e738f101c46c859e19d6ec2a356ecfffd81d9 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 09:23:07 -0700 Subject: [PATCH 20/50] docs(samples): fix sample formatting issues (#94) --- cloud-game-servers/snippets/create_cluster.js | 31 ++++++++++------- cloud-game-servers/snippets/create_realm.js | 25 +++++++++----- cloud-game-servers/snippets/delete_cluster.js | 34 +++++++++++++------ cloud-game-servers/snippets/delete_realm.js | 28 +++++++++------ cloud-game-servers/snippets/get_cluster.js | 34 +++++++++++++------ cloud-game-servers/snippets/get_realm.js | 27 +++++++++------ cloud-game-servers/snippets/list_clusters.js | 27 +++++++++------ cloud-game-servers/snippets/list_realms.js | 23 ++++++++----- 8 files changed, 147 insertions(+), 82 deletions(-) diff --git a/cloud-game-servers/snippets/create_cluster.js b/cloud-game-servers/snippets/create_cluster.js index 57f19fc1ff..120e5f83b7 100644 --- a/cloud-game-servers/snippets/create_cluster.js +++ b/cloud-game-servers/snippets/create_cluster.js @@ -22,7 +22,7 @@ * @param {string} gkeClusterId the GKE cluster to connect to * @param {string} gkeLocation the location of the GKE cluster */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', @@ -30,14 +30,6 @@ function main( gkeClusterName = 'GKE_CLUSTER_NAME' ) { // [START cloud_game_servers_create_cluster] - /** - * 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 { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -45,9 +37,17 @@ function main( 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: `projects/${projectId}/locations/${location}/realms/${realmId}`, + parent: client.realmPath(projectId, location, realmId), gameServerClusterId: gameClusterId, gameServerCluster: { description: 'My Game Server Cluster', @@ -70,10 +70,17 @@ function main( console.log( `\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}` ); - // [END cloud_game_servers_create_cluster] } createGameServerCluster(); + // [END cloud_game_servers_create_cluster] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/create_realm.js b/cloud-game-servers/snippets/create_realm.js index 8ce712035f..517b440313 100644 --- a/cloud-game-servers/snippets/create_realm.js +++ b/cloud-game-servers/snippets/create_realm.js @@ -19,23 +19,23 @@ * @param {string} location Compute Engine region. * @param {string} realmId a unique identifier for the new realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_create_realm] - /** - * 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 {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, @@ -56,10 +56,17 @@ function main( console.log(`\tRealm name: ${realm.name}`); console.log(`\tRealm description: ${realm.description}`); console.log(`\tRealm time zone: ${realm.timeZone}`); - // [END cloud_game_servers_create_realm] } createRealm(); + // [END cloud_game_servers_create_realm] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/delete_cluster.js b/cloud-game-servers/snippets/delete_cluster.js index 8ef0e09fea..4b4c4d4778 100644 --- a/cloud-game-servers/snippets/delete_cluster.js +++ b/cloud-game-servers/snippets/delete_cluster.js @@ -20,20 +20,13 @@ * @param {string} realmId the realm to use * @param {string} gameClusterId the game cluster to delete */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { // [START cloud_game_servers_delete_cluster] - /** - * 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 { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -41,18 +34,37 @@ function main( 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: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), }; await client.deleteGameServerCluster(request); console.log('Game Server cluster deleted'); - // [END cloud_game_servers_delete_cluster] } deleteGameServerCluster(); + // [END cloud_game_servers_delete_cluster] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/delete_realm.js b/cloud-game-servers/snippets/delete_realm.js index f5224437c3..d5ba2ed6fc 100644 --- a/cloud-game-servers/snippets/delete_realm.js +++ b/cloud-game-servers/snippets/delete_realm.js @@ -19,37 +19,43 @@ * @param {string} location Compute Engine region. * @param {string} realmId the unique ID of the realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_delete_realm] - /** - * 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 {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: `projects/${projectId}/locations/${location}/realms/${realmId}`, + name: client.realmPath(projectId, location, realmId), }; const [operation] = await client.deleteRealm(request); await operation.promise(); console.log(`Realm with ID ${realmId} deleted.`); - - // [END cloud_game_servers_delete_realm] } deleteRealm(); + // [END cloud_game_servers_delete_realm] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/get_cluster.js b/cloud-game-servers/snippets/get_cluster.js index 8cebc8ff75..5fb715e544 100644 --- a/cloud-game-servers/snippets/get_cluster.js +++ b/cloud-game-servers/snippets/get_cluster.js @@ -20,20 +20,13 @@ * @param {string} realmId the realm to use * @param {string} gameClusterId the game cluster to get */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { // [START cloud_game_servers_get_cluster] - /** - * 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 { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -41,9 +34,21 @@ function main( 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: `projects/${projectId}/locations/${location}/realms/${realmId}/gameServerClusters/${gameClusterId}`, + name: client.gameServerClusterPath( + projectId, + location, + realmId, + gameClusterId + ), }; const [cluster] = await client.getGameServerCluster(request); @@ -54,10 +59,17 @@ function main( console.log( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); - // [END cloud_game_servers_get_cluster] } getGameServerCluster(); + // [END cloud_game_servers_get_cluster] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/get_realm.js b/cloud-game-servers/snippets/get_realm.js index 620deadc14..b87e2f02d7 100644 --- a/cloud-game-servers/snippets/get_realm.js +++ b/cloud-game-servers/snippets/get_realm.js @@ -19,26 +19,26 @@ * @param {string} location Compute Engine region. * @param {string} realmId the unique ID of the realm */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_get_realm] - /** - * 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 {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: `projects/${projectId}/locations/${location}/realms/${realmId}`, + name: client.realmPath(projectId, location, realmId), }; const [realm] = await client.getRealm(request); @@ -50,10 +50,17 @@ function main( const createDate = new Date(createTime.seconds * 1000); console.log(`Realm created on: ${createDate.toLocaleDateString()}`); - // [END cloud_game_servers_get_realm] } getRealm(); + // [END cloud_game_servers_get_realm] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/list_clusters.js b/cloud-game-servers/snippets/list_clusters.js index d2faa73f53..88c1b8e101 100644 --- a/cloud-game-servers/snippets/list_clusters.js +++ b/cloud-game-servers/snippets/list_clusters.js @@ -19,18 +19,12 @@ * @param {string} location Compute Engine region * @param {string} realmId the realm to use */ -function main( +async function main( projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID', realmId = 'REALM_ID' ) { // [START cloud_game_servers_list_clusters] - /** - * 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 { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -38,9 +32,15 @@ function main( 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: `projects/${projectId}/locations/${location}/realms/${realmId}`, + parent: client.realmPath(projectId, location, realmId), }; const results = await client.listGameServerClusters(request); @@ -54,10 +54,17 @@ function main( `\tGKE cluster: ${cluster.connectionInfo.gkeClusterReference.cluster}` ); } - // [END cloud_game_servers_list_clusters] } listGameServerClusters(); + // [END cloud_game_servers_list_clusters] } -main(...process.argv.slice(2)); +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/cloud-game-servers/snippets/list_realms.js b/cloud-game-servers/snippets/list_realms.js index fbeb7256f8..b3c2253c4c 100644 --- a/cloud-game-servers/snippets/list_realms.js +++ b/cloud-game-servers/snippets/list_realms.js @@ -18,18 +18,18 @@ * @param {string} projectId string project identifier. * @param {string} location Compute Engine region. */ -function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { +async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { // [START cloud_game_servers_list_realms] - /** - * 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 {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}`, }; @@ -44,10 +44,17 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { const createDate = new Date(createTime.seconds * 1000); console.log(`Realm created on: ${createDate.toLocaleDateString()}\n`); } - // [END cloud_game_servers_list_realms] } listRealms(); + // [END cloud_game_servers_list_realms] } -main(...process.argv.slice(2)); +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; +}); From cbf88f841a937e24d5099ad4fc56d4a60c80ddc7 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 09:31:19 -0700 Subject: [PATCH 21/50] docs(samples): Add Game Server deployment samples (#92) Co-authored-by: Justin Beckwith --- cloud-game-servers/snippets/create_cluster.js | 4 +- .../snippets/create_deployment.js | 66 ++++++++++++++++++ .../snippets/delete_deployment.js | 60 ++++++++++++++++ cloud-game-servers/snippets/get_deployment.js | 64 +++++++++++++++++ .../snippets/list_deployments.js | 62 +++++++++++++++++ cloud-game-servers/snippets/package.json | 2 +- .../snippets/test/crud_deployment.test.js | 68 +++++++++++++++++++ 7 files changed, 323 insertions(+), 3 deletions(-) create mode 100644 cloud-game-servers/snippets/create_deployment.js create mode 100644 cloud-game-servers/snippets/delete_deployment.js create mode 100644 cloud-game-servers/snippets/get_deployment.js create mode 100644 cloud-game-servers/snippets/list_deployments.js create mode 100644 cloud-game-servers/snippets/test/crud_deployment.test.js diff --git a/cloud-game-servers/snippets/create_cluster.js b/cloud-game-servers/snippets/create_cluster.js index 120e5f83b7..3455b846c6 100644 --- a/cloud-game-servers/snippets/create_cluster.js +++ b/cloud-game-servers/snippets/create_cluster.js @@ -19,8 +19,7 @@ * @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} gkeClusterId the GKE cluster to connect to - * @param {string} gkeLocation the location of the GKE cluster + * @param {string} gkeClusterName The full resource name of the GKE cluster to use */ async function main( projectId = 'YOUR_PROJECT_ID', @@ -54,6 +53,7 @@ async function main( connectionInfo: { gkeClusterReference: { // Provide full resource name of a Kubernetes Engine cluster + // In the form of 'projects//locations//clusters/' cluster: gkeClusterName, }, namespace: 'default', diff --git a/cloud-game-servers/snippets/create_deployment.js b/cloud-game-servers/snippets/create_deployment.js new file mode 100644 index 0000000000..d4d9813259 --- /dev/null +++ b/cloud-game-servers/snippets/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_create_deployment] + 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_create_deployment] +} + +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/cloud-game-servers/snippets/delete_deployment.js b/cloud-game-servers/snippets/delete_deployment.js new file mode 100644 index 0000000000..7dbebde90b --- /dev/null +++ b/cloud-game-servers/snippets/delete_deployment.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'; + +/** + * 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_delete_deployment] + 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), + }; + + await client.deleteGameServerDeployment(request); + + console.log('deleted.'); + } + + deleteGameServerDeployment(); + + // [END cloud_game_servers_delete_deployment] +} + +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/cloud-game-servers/snippets/get_deployment.js b/cloud-game-servers/snippets/get_deployment.js new file mode 100644 index 0000000000..70361bfd51 --- /dev/null +++ b/cloud-game-servers/snippets/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_get_deployment] + 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_get_deployment] +} + +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/cloud-game-servers/snippets/list_deployments.js b/cloud-game-servers/snippets/list_deployments.js new file mode 100644 index 0000000000..4c39dbbb9e --- /dev/null +++ b/cloud-game-servers/snippets/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_list_deployments] + 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_list_deployments] +} + +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/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 92c20f638d..d6364f03a0 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -16,7 +16,7 @@ "@google-cloud/game-servers": "^2.0.2" }, "devDependencies": { - "c8": "^7.0.0", + "c8": "^7.2.1", "chai": "^4.2.0", "mocha": "^8.0.0", "uuid": "^8.0.0" diff --git a/cloud-game-servers/snippets/test/crud_deployment.test.js b/cloud-game-servers/snippets/test/crud_deployment.test.js new file mode 100644 index 0000000000..229c5c0f8e --- /dev/null +++ b/cloud-game-servers/snippets/test/crud_deployment.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, 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 get a game server deployment', async () => { + const get_output = execSync( + `node get_deployment.js ${projectId} ${deploymentId}` + ); + assert.match(get_output, /Deployment name:/); + }); + + 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./); + }); +}); From d32da4dda614d650359324d0a1e67b5e90b1ef58 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Thu, 16 Jul 2020 13:21:44 -0700 Subject: [PATCH 22/50] docs(samples): change tags to be aligned with golang samples (#97) --- cloud-game-servers/snippets/create_cluster.js | 4 ++-- cloud-game-servers/snippets/create_deployment.js | 4 ++-- cloud-game-servers/snippets/create_realm.js | 4 ++-- cloud-game-servers/snippets/delete_cluster.js | 4 ++-- cloud-game-servers/snippets/delete_deployment.js | 4 ++-- cloud-game-servers/snippets/delete_realm.js | 4 ++-- cloud-game-servers/snippets/get_cluster.js | 4 ++-- cloud-game-servers/snippets/get_deployment.js | 4 ++-- cloud-game-servers/snippets/get_realm.js | 4 ++-- cloud-game-servers/snippets/list_clusters.js | 4 ++-- cloud-game-servers/snippets/list_deployments.js | 4 ++-- cloud-game-servers/snippets/list_realms.js | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cloud-game-servers/snippets/create_cluster.js b/cloud-game-servers/snippets/create_cluster.js index 3455b846c6..71b177fe07 100644 --- a/cloud-game-servers/snippets/create_cluster.js +++ b/cloud-game-servers/snippets/create_cluster.js @@ -28,7 +28,7 @@ async function main( gameClusterId = 'GAME_CLUSTER_ID', gkeClusterName = 'GKE_CLUSTER_NAME' ) { - // [START cloud_game_servers_create_cluster] + // [START cloud_game_servers_cluster_create] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -73,7 +73,7 @@ async function main( } createGameServerCluster(); - // [END cloud_game_servers_create_cluster] + // [END cloud_game_servers_cluster_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/create_deployment.js b/cloud-game-servers/snippets/create_deployment.js index d4d9813259..4b057352f7 100644 --- a/cloud-game-servers/snippets/create_deployment.js +++ b/cloud-game-servers/snippets/create_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_create_deployment] + // [START cloud_game_servers_deployment_create] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -53,7 +53,7 @@ async function main( createGameServerDeployment(); - // [END cloud_game_servers_create_deployment] + // [END cloud_game_servers_deployment_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/create_realm.js b/cloud-game-servers/snippets/create_realm.js index 517b440313..456de890f7 100644 --- a/cloud-game-servers/snippets/create_realm.js +++ b/cloud-game-servers/snippets/create_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_create_realm] + // [START cloud_game_servers_realm_create] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -59,7 +59,7 @@ async function main( } createRealm(); - // [END cloud_game_servers_create_realm] + // [END cloud_game_servers_realm_create] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/delete_cluster.js b/cloud-game-servers/snippets/delete_cluster.js index 4b4c4d4778..7c0b327870 100644 --- a/cloud-game-servers/snippets/delete_cluster.js +++ b/cloud-game-servers/snippets/delete_cluster.js @@ -26,7 +26,7 @@ async function main( realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { - // [START cloud_game_servers_delete_cluster] + // [START cloud_game_servers_cluster_delete] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -57,7 +57,7 @@ async function main( } deleteGameServerCluster(); - // [END cloud_game_servers_delete_cluster] + // [END cloud_game_servers_cluster_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/delete_deployment.js b/cloud-game-servers/snippets/delete_deployment.js index 7dbebde90b..b85ee6e266 100644 --- a/cloud-game-servers/snippets/delete_deployment.js +++ b/cloud-game-servers/snippets/delete_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_delete_deployment] + // [START cloud_game_servers_deployment_delete] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -47,7 +47,7 @@ async function main( deleteGameServerDeployment(); - // [END cloud_game_servers_delete_deployment] + // [END cloud_game_servers_deployment_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/delete_realm.js b/cloud-game-servers/snippets/delete_realm.js index d5ba2ed6fc..da1f98ba19 100644 --- a/cloud-game-servers/snippets/delete_realm.js +++ b/cloud-game-servers/snippets/delete_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_delete_realm] + // [START cloud_game_servers_realm_delete] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -48,7 +48,7 @@ async function main( } deleteRealm(); - // [END cloud_game_servers_delete_realm] + // [END cloud_game_servers_realm_delete] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/get_cluster.js b/cloud-game-servers/snippets/get_cluster.js index 5fb715e544..cbe3ee4641 100644 --- a/cloud-game-servers/snippets/get_cluster.js +++ b/cloud-game-servers/snippets/get_cluster.js @@ -26,7 +26,7 @@ async function main( realmId = 'REALM_ID', gameClusterId = 'GAME_CLUSTER_ID' ) { - // [START cloud_game_servers_get_cluster] + // [START cloud_game_servers_cluster_get] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -62,7 +62,7 @@ async function main( } getGameServerCluster(); - // [END cloud_game_servers_get_cluster] + // [END cloud_game_servers_cluster_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/get_deployment.js b/cloud-game-servers/snippets/get_deployment.js index 70361bfd51..d1b65c936f 100644 --- a/cloud-game-servers/snippets/get_deployment.js +++ b/cloud-game-servers/snippets/get_deployment.js @@ -22,7 +22,7 @@ async function main( projectId = 'YOUR_PROJECT_ID', deploymentId = 'DEPLOYMENT_ID' ) { - // [START cloud_game_servers_get_deployment] + // [START cloud_game_servers_deployment_get] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -51,7 +51,7 @@ async function main( getGameServerDeployment(); - // [END cloud_game_servers_get_deployment] + // [END cloud_game_servers_deployment_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/get_realm.js b/cloud-game-servers/snippets/get_realm.js index b87e2f02d7..ae35dd99c0 100644 --- a/cloud-game-servers/snippets/get_realm.js +++ b/cloud-game-servers/snippets/get_realm.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_get_realm] + // [START cloud_game_servers_realm_get] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -53,7 +53,7 @@ async function main( } getRealm(); - // [END cloud_game_servers_get_realm] + // [END cloud_game_servers_realm_get] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/list_clusters.js b/cloud-game-servers/snippets/list_clusters.js index 88c1b8e101..5a8d92a819 100644 --- a/cloud-game-servers/snippets/list_clusters.js +++ b/cloud-game-servers/snippets/list_clusters.js @@ -24,7 +24,7 @@ async function main( location = 'LOCATION_ID', realmId = 'REALM_ID' ) { - // [START cloud_game_servers_list_clusters] + // [START cloud_game_servers_cluster_list] const { GameServerClustersServiceClient, } = require('@google-cloud/game-servers'); @@ -57,7 +57,7 @@ async function main( } listGameServerClusters(); - // [END cloud_game_servers_list_clusters] + // [END cloud_game_servers_cluster_list] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/list_deployments.js b/cloud-game-servers/snippets/list_deployments.js index 4c39dbbb9e..d79534ecd0 100644 --- a/cloud-game-servers/snippets/list_deployments.js +++ b/cloud-game-servers/snippets/list_deployments.js @@ -18,7 +18,7 @@ * @param {string} projectId string project identifier */ async function main(projectId = 'YOUR_PROJECT_ID') { - // [START cloud_game_servers_list_deployments] + // [START cloud_game_servers_deployment_list] const { GameServerDeploymentsServiceClient, } = require('@google-cloud/game-servers'); @@ -49,7 +49,7 @@ async function main(projectId = 'YOUR_PROJECT_ID') { listGameServerDeployments(); - // [END cloud_game_servers_list_deployments] + // [END cloud_game_servers_deployment_list] } main(...process.argv.slice(2)).catch(err => { diff --git a/cloud-game-servers/snippets/list_realms.js b/cloud-game-servers/snippets/list_realms.js index b3c2253c4c..ded96df687 100644 --- a/cloud-game-servers/snippets/list_realms.js +++ b/cloud-game-servers/snippets/list_realms.js @@ -19,7 +19,7 @@ * @param {string} location Compute Engine region. */ async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { - // [START cloud_game_servers_list_realms] + // [START cloud_game_servers_realm_list] const {RealmsServiceClient} = require('@google-cloud/game-servers'); const client = new RealmsServiceClient(); @@ -47,7 +47,7 @@ async function main(projectId = 'YOUR_PROJECT_ID', location = 'LOCATION_ID') { } listRealms(); - // [END cloud_game_servers_list_realms] + // [END cloud_game_servers_realm_list] } main(...process.argv.slice(2)).catch(err => { From 71ce1952d5ed08cbbcd608942007d7a90f66dae9 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Fri, 24 Jul 2020 09:59:57 -0700 Subject: [PATCH 23/50] Add samples for GameServerConfigs (#98) Co-authored-by: Justin Beckwith --- cloud-game-servers/snippets/create_config.js | 144 ++++++++++++++++++ cloud-game-servers/snippets/delete_cluster.js | 3 +- cloud-game-servers/snippets/delete_config.js | 68 +++++++++ .../snippets/delete_deployment.js | 5 +- cloud-game-servers/snippets/get_config.js | 72 +++++++++ cloud-game-servers/snippets/list_configs.js | 69 +++++++++ .../snippets/test/crud_config.test.js | 97 ++++++++++++ .../snippets/test/delete_cluster.test.js | 19 +-- 8 files changed, 457 insertions(+), 20 deletions(-) create mode 100644 cloud-game-servers/snippets/create_config.js create mode 100644 cloud-game-servers/snippets/delete_config.js create mode 100644 cloud-game-servers/snippets/get_config.js create mode 100644 cloud-game-servers/snippets/list_configs.js create mode 100644 cloud-game-servers/snippets/test/crud_config.test.js diff --git a/cloud-game-servers/snippets/create_config.js b/cloud-game-servers/snippets/create_config.js new file mode 100644 index 0000000000..db1b526157 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/delete_cluster.js b/cloud-game-servers/snippets/delete_cluster.js index 7c0b327870..ec1266bc88 100644 --- a/cloud-game-servers/snippets/delete_cluster.js +++ b/cloud-game-servers/snippets/delete_cluster.js @@ -51,7 +51,8 @@ async function main( ), }; - await client.deleteGameServerCluster(request); + const [operation] = await client.deleteGameServerCluster(request); + await operation.promise(); console.log('Game Server cluster deleted'); } diff --git a/cloud-game-servers/snippets/delete_config.js b/cloud-game-servers/snippets/delete_config.js new file mode 100644 index 0000000000..b083f29813 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/delete_deployment.js b/cloud-game-servers/snippets/delete_deployment.js index b85ee6e266..e45b144f50 100644 --- a/cloud-game-servers/snippets/delete_deployment.js +++ b/cloud-game-servers/snippets/delete_deployment.js @@ -40,9 +40,10 @@ async function main( name: client.gameServerDeploymentPath(projectId, 'global', deploymentId), }; - await client.deleteGameServerDeployment(request); + const [operation] = await client.deleteGameServerDeployment(request); + await operation.promise(); - console.log('deleted.'); + console.log(`Deployment with name ${request.name} deleted.`); } deleteGameServerDeployment(); diff --git a/cloud-game-servers/snippets/get_config.js b/cloud-game-servers/snippets/get_config.js new file mode 100644 index 0000000000..1272918fec --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/list_configs.js b/cloud-game-servers/snippets/list_configs.js new file mode 100644 index 0000000000..f6a844b50c --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/test/crud_config.test.js b/cloud-game-servers/snippets/test/crud_config.test.js new file mode 100644 index 0000000000..d5c533c3d1 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/test/delete_cluster.test.js b/cloud-game-servers/snippets/test/delete_cluster.test.js index 832e51737b..d6b2003a41 100644 --- a/cloud-game-servers/snippets/test/delete_cluster.test.js +++ b/cloud-game-servers/snippets/test/delete_cluster.test.js @@ -87,26 +87,11 @@ describe('Game Servers Delete Cluster Test', () => { }); 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}`, - }; - try { - const [operation1] = await gameClustersClient.deleteGameServerCluster( - deleteClusterRequest - ); - await operation1.promise(); - } catch (ex) { - console.log(ex); - console.log(`Realm ID: ${realmId}`); - console.log(`Cluster ID: ${gameClusterId}`); - } // Delete the realm const deleteRealmRequest = { name: `projects/${projectId}/locations/${LOCATION}/realms/${realmId}`, }; - const [operation2] = await realmsClient.deleteRealm(deleteRealmRequest); - await operation2.promise(); + const [operation] = await realmsClient.deleteRealm(deleteRealmRequest); + await operation.promise(); }); }); From c42eea273bb49e45aa31684fb1d9640dfd462418 Mon Sep 17 00:00:00 2001 From: pooneh-m <46979170+pooneh-m@users.noreply.github.com> Date: Fri, 24 Jul 2020 10:34:08 -0700 Subject: [PATCH 24/50] Add sample for game server rollout (#102) Co-authored-by: Justin Beckwith --- cloud-game-servers/snippets/get_rollout.js | 70 ++++++ cloud-game-servers/snippets/test/rollout.js | 207 ++++++++++++++++++ .../snippets/update_rollout_default.js | 73 ++++++ .../snippets/update_rollout_override.js | 86 ++++++++ .../snippets/update_rollout_remove_default.js | 70 ++++++ .../update_rollout_remove_override.js | 69 ++++++ 6 files changed, 575 insertions(+) create mode 100644 cloud-game-servers/snippets/get_rollout.js create mode 100644 cloud-game-servers/snippets/test/rollout.js create mode 100644 cloud-game-servers/snippets/update_rollout_default.js create mode 100644 cloud-game-servers/snippets/update_rollout_override.js create mode 100644 cloud-game-servers/snippets/update_rollout_remove_default.js create mode 100644 cloud-game-servers/snippets/update_rollout_remove_override.js diff --git a/cloud-game-servers/snippets/get_rollout.js b/cloud-game-servers/snippets/get_rollout.js new file mode 100644 index 0000000000..72ba1ff80c --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/test/rollout.js b/cloud-game-servers/snippets/test/rollout.js new file mode 100644 index 0000000000..975a78f936 --- /dev/null +++ b/cloud-game-servers/snippets/test/rollout.js @@ -0,0 +1,207 @@ +// 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 + ), + }; + + const [rollout] = await deploymentClient.getGameServerDeploymentRollout( + request + ); + 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/cloud-game-servers/snippets/update_rollout_default.js b/cloud-game-servers/snippets/update_rollout_default.js new file mode 100644 index 0000000000..1aa9edf372 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_rollout_override.js b/cloud-game-servers/snippets/update_rollout_override.js new file mode 100644 index 0000000000..ee27d4b738 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_rollout_remove_default.js b/cloud-game-servers/snippets/update_rollout_remove_default.js new file mode 100644 index 0000000000..7584a00bfc --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_rollout_remove_override.js b/cloud-game-servers/snippets/update_rollout_remove_override.js new file mode 100644 index 0000000000..031e950c01 --- /dev/null +++ b/cloud-game-servers/snippets/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; +}); From a25ae0ffb4fdb2ce380937c5c8503f6634f1adc3 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2020 13:25:11 -0700 Subject: [PATCH 25/50] chore: release 2.1.0 (#110) --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index d6364f03a0..c3fcc34a9d 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.0.2" + "@google-cloud/game-servers": "^2.1.0" }, "devDependencies": { "c8": "^7.2.1", From edc3850b9835609b378e7085901cd8a117b4d472 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:53:46 -0800 Subject: [PATCH 26/50] chore: release 2.1.1 (#133) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index c3fcc34a9d..0fa8ddcac8 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.0" + "@google-cloud/game-servers": "^2.1.1" }, "devDependencies": { "c8": "^7.2.1", From 4475e430ef5751fe6986571ae0acd237fcc0f640 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 2 Dec 2020 19:40:31 +0000 Subject: [PATCH 27/50] chore: release 2.1.2 (#137) :robot: I have created a release \*beep\* \*boop\* --- ### [2.1.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.1.1...v2.1.2) (2020-11-25) ### Bug Fixes * **browser:** check for fetch on window ([#136](https://www.github.com/googleapis/nodejs-game-servers/issues/136)) ([3c28ff7](https://www.github.com/googleapis/nodejs-game-servers/commit/3c28ff7c610caf58df0dfbd4b3acd2954ae7f019)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 0fa8ddcac8..c90597a47a 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.1" + "@google-cloud/game-servers": "^2.1.2" }, "devDependencies": { "c8": "^7.2.1", From cb82643ab0b4d34f5a9d54d5ea1a77838422201d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 18:36:19 +0000 Subject: [PATCH 28/50] chore: release 2.2.0 (#143) :robot: I have created a release \*beep\* \*boop\* --- ## [2.2.0](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.1.2...v2.2.0) (2021-01-09) ### Features * adds style enumeration ([#142](https://www.github.com/googleapis/nodejs-game-servers/issues/142)) ([59f7332](https://www.github.com/googleapis/nodejs-game-servers/commit/59f7332fee754b11e8a395d19013cc78351e5659)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index c90597a47a..e898dd45b9 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.1.2" + "@google-cloud/game-servers": "^2.2.0" }, "devDependencies": { "c8": "^7.2.1", From d425de175ca11aee167b5cd97db1a19448bf65c5 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 16:22:19 -0800 Subject: [PATCH 29/50] chore: release 2.3.0 (#148) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index e898dd45b9..39fa4d8023 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.2.0" + "@google-cloud/game-servers": "^2.3.0" }, "devDependencies": { "c8": "^7.2.1", From dda23f4818198a21d24e787c089c2ebc9b1e73f7 Mon Sep 17 00:00:00 2001 From: Jeffrey Rennie Date: Mon, 17 May 2021 17:45:33 -0700 Subject: [PATCH 30/50] chore: migrate to owl bot (#153) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: migrate to owl bot * chore: copy files from googleapis-gen fb91803ccef5d7c695139b22788b309e2197856b * chore: run the post processor * 🦉 Updates from OwlBot * fix: help tests pass * 🦉 Updates from OwlBot * update Docker image * 🦉 Updates from OwlBot Co-authored-by: Owl Bot Co-authored-by: Sofia Leon --- cloud-game-servers/snippets/test/clean.js | 14 ++++++-------- .../snippets/test/list_clusters.test.js | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cloud-game-servers/snippets/test/clean.js b/cloud-game-servers/snippets/test/clean.js index cf62661619..bed48b96ca 100644 --- a/cloud-game-servers/snippets/test/clean.js +++ b/cloud-game-servers/snippets/test/clean.js @@ -42,20 +42,18 @@ module.exports = async () => { parent: realm.name, }; - const clustersResult = await gameServerClusterClient.listGameServerClusters( - clustersRequest - ); + 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 - ); + const [deleteClusterOperation] = + await gameServerClusterClient.deleteGameServerCluster( + deleteClusterRequest + ); await deleteClusterOperation.promise(); } diff --git a/cloud-game-servers/snippets/test/list_clusters.test.js b/cloud-game-servers/snippets/test/list_clusters.test.js index b32b7ed245..419e138fb8 100644 --- a/cloud-game-servers/snippets/test/list_clusters.test.js +++ b/cloud-game-servers/snippets/test/list_clusters.test.js @@ -79,7 +79,7 @@ describe('Game Servers List Clusters Test', () => { await operation2.promise(); }); - it('should list Game Server clusters in a realm', async () => { + it.only('should list Game Server clusters in a realm', async () => { const projectId = await realmsClient.getProjectId(); const create_output = execSync( From e9d5835421f4d23dc338301e22c5cff069f15cc2 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 20 May 2021 00:56:04 +0000 Subject: [PATCH 31/50] chore: release 2.3.1 (#163) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.1](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.0...v2.3.1) (2021-05-20) ### Bug Fixes * **deps:** require google-gax v2.12.0 ([#162](https://www.github.com/googleapis/nodejs-game-servers/issues/162)) ([546c13d](https://www.github.com/googleapis/nodejs-game-servers/commit/546c13d64abedafd055fad9c118d58750f0f9f25)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 39fa4d8023..b120a2ad55 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.0" + "@google-cloud/game-servers": "^2.3.1" }, "devDependencies": { "c8": "^7.2.1", From e9ba7108868f7e2246d629beefac64e7e1ed129f Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 24 May 2021 23:10:02 +0000 Subject: [PATCH 32/50] chore: release 2.3.2 (#173) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.2](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.1...v2.3.2) (2021-05-24) ### Bug Fixes * use require() to load JSON protos ([#164](https://www.github.com/googleapis/nodejs-game-servers/issues/164)) ([b77e1e5](https://www.github.com/googleapis/nodejs-game-servers/commit/b77e1e5f7fc9396cdb30d4f1bfac370dd85800b8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index b120a2ad55..639c3a8d8b 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.1" + "@google-cloud/game-servers": "^2.3.2" }, "devDependencies": { "c8": "^7.2.1", From d2fcafb3bc4baeb443ec87486094d098886fafbc Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 10 Jun 2021 00:34:05 +0000 Subject: [PATCH 33/50] chore: release 2.3.3 (#180) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.3](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.2...v2.3.3) (2021-06-10) ### Bug Fixes * GoogleAdsError missing using generator version after 1.3.0 ([#175](https://www.github.com/googleapis/nodejs-game-servers/issues/175)) ([a0df035](https://www.github.com/googleapis/nodejs-game-servers/commit/a0df03530d0dc438c8c4318854fbcfa8d7752f8d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 639c3a8d8b..84cd65e15f 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.2" + "@google-cloud/game-servers": "^2.3.3" }, "devDependencies": { "c8": "^7.2.1", From dd67edc2b86f49c83608a3bd5bd1f4b5072ed8a4 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:40:43 +0000 Subject: [PATCH 34/50] chore: release 2.3.4 (#187) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.4](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.3...v2.3.4) (2021-06-22) ### Bug Fixes * make request optional in all cases ([#186](https://www.github.com/googleapis/nodejs-game-servers/issues/186)) ([99424ec](https://www.github.com/googleapis/nodejs-game-servers/commit/99424ecd0f87341bd4814cdbe092d2820c9a78d7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 84cd65e15f..1d19919d30 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.3" + "@google-cloud/game-servers": "^2.3.4" }, "devDependencies": { "c8": "^7.2.1", From 5c4208925961195558c072c6038748528d0cc441 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 17:02:27 +0000 Subject: [PATCH 35/50] chore: release 2.3.5 (#193) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.5](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.4...v2.3.5) (2021-06-29) ### Bug Fixes * **deps:** google-gax v2.17.0 with mTLS ([#192](https://www.github.com/googleapis/nodejs-game-servers/issues/192)) ([4d37a74](https://www.github.com/googleapis/nodejs-game-servers/commit/4d37a7497ebe77cbfabc5e2bb0ea925e7ac138bb)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 1d19919d30..61df81ac9d 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.4" + "@google-cloud/game-servers": "^2.3.5" }, "devDependencies": { "c8": "^7.2.1", From 0b4c852b212698abe565006b8d74dbf27f869cd0 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 12 Jul 2021 22:04:22 +0000 Subject: [PATCH 36/50] chore: release 2.3.6 (#197) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.6](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.5...v2.3.6) (2021-07-12) ### Bug Fixes * **deps:** google-gax v2.17.1 ([#196](https://www.github.com/googleapis/nodejs-game-servers/issues/196)) ([5a65e3f](https://www.github.com/googleapis/nodejs-game-servers/commit/5a65e3f4398667b2aba2295088c1cc0e2ecf0a8c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 61df81ac9d..ab077b18bb 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.5" + "@google-cloud/game-servers": "^2.3.6" }, "devDependencies": { "c8": "^7.2.1", From 60e78ea0cb0d7f9bde859ce2cc278046e1a68f90 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 16 Jul 2021 12:53:10 -0700 Subject: [PATCH 37/50] chore: release 2.3.7 (#199) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index ab077b18bb..bcb0f98605 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.6" + "@google-cloud/game-servers": "^2.3.7" }, "devDependencies": { "c8": "^7.2.1", From 8af821e4312002f13f07d6e7c9ea3f19ca577731 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 17:20:26 +0000 Subject: [PATCH 38/50] chore: release 2.3.8 (#207) :robot: I have created a release \*beep\* \*boop\* --- ### [2.3.8](https://www.github.com/googleapis/nodejs-game-servers/compare/v2.3.7...v2.3.8) (2021-08-17) ### Bug Fixes * **build:** migrate to using main branch ([#206](https://www.github.com/googleapis/nodejs-game-servers/issues/206)) ([04998bf](https://www.github.com/googleapis/nodejs-game-servers/commit/04998bf4f24613792beb12fff9d1a14da795b74b)) * **deps:** google-gax v2.24.1 ([#208](https://www.github.com/googleapis/nodejs-game-servers/issues/208)) ([8462da4](https://www.github.com/googleapis/nodejs-game-servers/commit/8462da415e3df130356f70e34f97698628f48b2b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index bcb0f98605..ffba77a5fb 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.7" + "@google-cloud/game-servers": "^2.3.8" }, "devDependencies": { "c8": "^7.2.1", From 8f5fe3b9661c6291aa402794ed3298aec87d4d86 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 08:31:08 -0700 Subject: [PATCH 39/50] chore: release 2.4.0 (#210) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index ffba77a5fb..5955bdb378 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.3.8" + "@google-cloud/game-servers": "^2.4.0" }, "devDependencies": { "c8": "^7.2.1", From e747bffca249012519bb2ba8c7b277888f5212a7 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:58:41 -0500 Subject: [PATCH 40/50] chore: release 2.5.0 (#214) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 5955bdb378..2ea3f59a0b 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.4.0" + "@google-cloud/game-servers": "^2.5.0" }, "devDependencies": { "c8": "^7.2.1", From d0d186fdac77f495a65426ac9bfca23db3957598 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Wed, 1 Sep 2021 17:20:28 -0700 Subject: [PATCH 41/50] chore: show cluster installation state details for get and list methods (#216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [X] Ensure the tests and linter pass - [X] Code coverage does not decrease (if any source code was changed) - [X] Appropriate docs were updated (if necessary) Fixes b:179738605 🦕 --- cloud-game-servers/snippets/get_cluster.js | 10 ++++++++++ cloud-game-servers/snippets/list_clusters.js | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/cloud-game-servers/snippets/get_cluster.js b/cloud-game-servers/snippets/get_cluster.js index cbe3ee4641..8701ac805b 100644 --- a/cloud-game-servers/snippets/get_cluster.js +++ b/cloud-game-servers/snippets/get_cluster.js @@ -49,6 +49,7 @@ async function main( realmId, gameClusterId ), + view: 'FULL', }; const [cluster] = await client.getGameServerCluster(request); @@ -56,6 +57,15 @@ async function main( 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}` ); diff --git a/cloud-game-servers/snippets/list_clusters.js b/cloud-game-servers/snippets/list_clusters.js index 5a8d92a819..c73a7f0d26 100644 --- a/cloud-game-servers/snippets/list_clusters.js +++ b/cloud-game-servers/snippets/list_clusters.js @@ -41,6 +41,7 @@ async function main( 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); @@ -50,6 +51,15 @@ async function main( 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}` ); From 984ad67bb92b855e900ec6671a2b7c99cb7365b5 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 23:36:33 +0000 Subject: [PATCH 42/50] docs(samples): add auto-generated samples for Node with api short name in region tag (#221) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: https://github.com/googleapis/googleapis/commit/15759865d1c54e3d46429010f7e472fe6c3d3715 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b27fff623a5d8d586b703b5e4919856abe7c2eb3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 2ea3f59a0b..589bce6b6a 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=8" + "node": ">=10" }, "files": [ "*.js" From f4bc8b2aef6431fc4c9119655186fa6639abd297 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Thu, 18 Nov 2021 10:07:03 -0800 Subject: [PATCH 43/50] docs: add update samples (#230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Add update samples * Address feedback * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../snippets/test/crud_deployment.test.js | 11 ++ .../snippets/test/list_clusters.test.js | 2 +- .../snippets/test/update_cluster_test.js | 115 ++++++++++++++++++ .../snippets/test/update_realm_test.js | 70 +++++++++++ cloud-game-servers/snippets/update_cluster.js | 80 ++++++++++++ .../snippets/update_deployment.js | 73 +++++++++++ cloud-game-servers/snippets/update_realm.js | 71 +++++++++++ 7 files changed, 421 insertions(+), 1 deletion(-) create mode 100644 cloud-game-servers/snippets/test/update_cluster_test.js create mode 100644 cloud-game-servers/snippets/test/update_realm_test.js create mode 100644 cloud-game-servers/snippets/update_cluster.js create mode 100644 cloud-game-servers/snippets/update_deployment.js create mode 100644 cloud-game-servers/snippets/update_realm.js diff --git a/cloud-game-servers/snippets/test/crud_deployment.test.js b/cloud-game-servers/snippets/test/crud_deployment.test.js index 229c5c0f8e..5dd7218b30 100644 --- a/cloud-game-servers/snippets/test/crud_deployment.test.js +++ b/cloud-game-servers/snippets/test/crud_deployment.test.js @@ -45,11 +45,22 @@ describe('Game Server Deployment Test', () => { 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 () => { diff --git a/cloud-game-servers/snippets/test/list_clusters.test.js b/cloud-game-servers/snippets/test/list_clusters.test.js index 419e138fb8..b32b7ed245 100644 --- a/cloud-game-servers/snippets/test/list_clusters.test.js +++ b/cloud-game-servers/snippets/test/list_clusters.test.js @@ -79,7 +79,7 @@ describe('Game Servers List Clusters Test', () => { await operation2.promise(); }); - it.only('should list Game Server clusters in a realm', async () => { + it('should list Game Server clusters in a realm', async () => { const projectId = await realmsClient.getProjectId(); const create_output = execSync( diff --git a/cloud-game-servers/snippets/test/update_cluster_test.js b/cloud-game-servers/snippets/test/update_cluster_test.js new file mode 100644 index 0000000000..7eadb4b428 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/test/update_realm_test.js b/cloud-game-servers/snippets/test/update_realm_test.js new file mode 100644 index 0000000000..f55ae28291 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_cluster.js b/cloud-game-servers/snippets/update_cluster.js new file mode 100644 index 0000000000..b07342fc39 --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_deployment.js b/cloud-game-servers/snippets/update_deployment.js new file mode 100644 index 0000000000..dde260eacf --- /dev/null +++ b/cloud-game-servers/snippets/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/cloud-game-servers/snippets/update_realm.js b/cloud-game-servers/snippets/update_realm.js new file mode 100644 index 0000000000..ffdd19a817 --- /dev/null +++ b/cloud-game-servers/snippets/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; +}); From 80c9585f8e2c46d2f1f2213ab6878fe88807b18f Mon Sep 17 00:00:00 2001 From: Alexander Fenster Date: Mon, 16 May 2022 17:35:19 -0700 Subject: [PATCH 44/50] build!: update library to use Node 12 (#266) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat!: Update library to use Node 12 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 589bce6b6a..fb42c43aee 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -4,7 +4,7 @@ "license": "Apache-2.0", "author": "Google LLC", "engines": { - "node": ">=10" + "node": ">=12.0.0" }, "files": [ "*.js" From 2eaa7f37505d5faa3162a54df625d09be45effae Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 17 May 2022 17:04:19 -0700 Subject: [PATCH 45/50] chore(main): release 3.0.0 (#267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.0.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index fb42c43aee..6efa1c0e16 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^2.5.0" + "@google-cloud/game-servers": "^3.0.0" }, "devDependencies": { "c8": "^7.2.1", From bd9d1e89bc225a25d2f145dd7a126f22b03e865c Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Tue, 5 Jul 2022 11:21:16 -0400 Subject: [PATCH 46/50] chore(main): release 3.1.0 (#272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 6efa1c0e16..1a9843e3a4 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.0.0" + "@google-cloud/game-servers": "^3.1.0" }, "devDependencies": { "c8": "^7.2.1", From 131b91ce2221aec66c1287ad4aa37f313156ba2a Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 12 Jul 2022 13:32:03 -0700 Subject: [PATCH 47/50] build: do not test if service is unavailable (#275) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * build: do not test if service is unavailable * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- cloud-game-servers/snippets/test/rollout.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cloud-game-servers/snippets/test/rollout.js b/cloud-game-servers/snippets/test/rollout.js index 975a78f936..c2bbb53c35 100644 --- a/cloud-game-servers/snippets/test/rollout.js +++ b/cloud-game-servers/snippets/test/rollout.js @@ -162,9 +162,18 @@ describe('Game Server Rollout Test', () => { ), }; - const [rollout] = await deploymentClient.getGameServerDeploymentRollout( - request - ); + 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); }); From 9605211ff32645cc904bd0c56257e4cd0d901761 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:55:06 -0400 Subject: [PATCH 48/50] chore(main): release 3.1.1 (#307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.1 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 1a9843e3a4..43808d1bbe 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.1.0" + "@google-cloud/game-servers": "^3.1.1" }, "devDependencies": { "c8": "^7.2.1", From eaa7ea2540c87774d37360f38a6cbfb4f1de1865 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Fri, 9 Sep 2022 01:26:20 +0200 Subject: [PATCH 49/50] chore(deps): update dependency uuid to v9 (#312) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [uuid](https://togithub.com/uuidjs/uuid) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/uuid/8.3.2/9.0.0) | [![age](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/compatibility-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/uuid/9.0.0/confidence-slim/8.3.2)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
uuidjs/uuid ### [`v9.0.0`](https://togithub.com/uuidjs/uuid/blob/HEAD/CHANGELOG.md#​900-httpsgithubcomuuidjsuuidcomparev832v900-2022-09-05) [Compare Source](https://togithub.com/uuidjs/uuid/compare/v8.3.2...v9.0.0) ##### ⚠ BREAKING CHANGES - Drop Node.js 10.x support. This library always aims at supporting one EOLed LTS release which by this time now is 12.x which has reached EOL 30 Apr 2022. - Remove the minified UMD build from the package. Minified code is hard to audit and since this is a widely used library it seems more appropriate nowadays to optimize for auditability than to ship a legacy module format that, at best, serves educational purposes nowadays. For production browser use cases, users should be using a bundler. For educational purposes, today's online sandboxes like replit.com offer convenient ways to load npm modules, so the use case for UMD through repos like UNPKG or jsDelivr has largely vanished. - Drop IE 11 and Safari 10 support. Drop support for browsers that don't correctly implement const/let and default arguments, and no longer transpile the browser build to ES2015. This also removes the fallback on msCrypto instead of the crypto API. Browser tests are run in the first supported version of each supported browser and in the latest (as of this commit) version available on Browserstack. ##### Features - optimize uuid.v1 by 1.3x uuid.v4 by 4.3x (430%) ([#​597](https://togithub.com/uuidjs/uuid/issues/597)) ([3a033f6](https://togithub.com/uuidjs/uuid/commit/3a033f6bab6bb3780ece6d645b902548043280bc)) - remove UMD build ([#​645](https://togithub.com/uuidjs/uuid/issues/645)) ([e948a0f](https://togithub.com/uuidjs/uuid/commit/e948a0f22bf22f4619b27bd913885e478e20fe6f)), closes [#​620](https://togithub.com/uuidjs/uuid/issues/620) - use native crypto.randomUUID when available ([#​600](https://togithub.com/uuidjs/uuid/issues/600)) ([c9e076c](https://togithub.com/uuidjs/uuid/commit/c9e076c852edad7e9a06baaa1d148cf4eda6c6c4)) ##### Bug Fixes - add Jest/jsdom compatibility ([#​642](https://togithub.com/uuidjs/uuid/issues/642)) ([16f9c46](https://togithub.com/uuidjs/uuid/commit/16f9c469edf46f0786164cdf4dc980743984a6fd)) - change default export to named function ([#​545](https://togithub.com/uuidjs/uuid/issues/545)) ([c57bc5a](https://togithub.com/uuidjs/uuid/commit/c57bc5a9a0653273aa639cda9177ce52efabe42a)) - handle error when parameter is not set in v3 and v5 ([#​622](https://togithub.com/uuidjs/uuid/issues/622)) ([fcd7388](https://togithub.com/uuidjs/uuid/commit/fcd73881692d9fabb63872576ba28e30ff852091)) - run npm audit fix ([#​644](https://togithub.com/uuidjs/uuid/issues/644)) ([04686f5](https://togithub.com/uuidjs/uuid/commit/04686f54c5fed2cfffc1b619f4970c4bb8532353)) - upgrading from uuid3 broken link ([#​568](https://togithub.com/uuidjs/uuid/issues/568)) ([1c849da](https://togithub.com/uuidjs/uuid/commit/1c849da6e164259e72e18636726345b13a7eddd6)) ##### build - drop Node.js 8.x from babel transpile target ([#​603](https://togithub.com/uuidjs/uuid/issues/603)) ([aa11485](https://togithub.com/uuidjs/uuid/commit/aa114858260402107ec8a1e1a825dea0a259bcb5)) - drop support for legacy browsers (IE11, Safari 10) ([#​604](https://togithub.com/uuidjs/uuid/issues/604)) ([0f433e5](https://togithub.com/uuidjs/uuid/commit/0f433e5ec444edacd53016de67db021102f36148)) - drop node 10.x to upgrade dev dependencies ([#​653](https://togithub.com/uuidjs/uuid/issues/653)) ([28a5712](https://togithub.com/uuidjs/uuid/commit/28a571283f8abda6b9d85e689f95b7d3ee9e282e)), closes [#​643](https://togithub.com/uuidjs/uuid/issues/643) ##### [8.3.2](https://togithub.com/uuidjs/uuid/compare/v8.3.1...v8.3.2) (2020-12-08) ##### Bug Fixes - lazy load getRandomValues ([#​537](https://togithub.com/uuidjs/uuid/issues/537)) ([16c8f6d](https://togithub.com/uuidjs/uuid/commit/16c8f6df2f6b09b4d6235602d6a591188320a82e)), closes [#​536](https://togithub.com/uuidjs/uuid/issues/536) ##### [8.3.1](https://togithub.com/uuidjs/uuid/compare/v8.3.0...v8.3.1) (2020-10-04) ##### Bug Fixes - support expo>=39.0.0 ([#​515](https://togithub.com/uuidjs/uuid/issues/515)) ([c65a0f3](https://togithub.com/uuidjs/uuid/commit/c65a0f3fa73b901959d638d1e3591dfacdbed867)), closes [#​375](https://togithub.com/uuidjs/uuid/issues/375)
--- ### Configuration 📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-game-servers). --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 43808d1bbe..0575371282 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -19,6 +19,6 @@ "c8": "^7.2.1", "chai": "^4.2.0", "mocha": "^8.0.0", - "uuid": "^8.0.0" + "uuid": "^9.0.0" } } From dba219207060d1500f81083523ccadd966fe6932 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 22 Sep 2022 14:24:02 -0700 Subject: [PATCH 50/50] chore(main): release 3.1.2 (#314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(main): release 3.1.2 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Owl Bot --- cloud-game-servers/snippets/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloud-game-servers/snippets/package.json b/cloud-game-servers/snippets/package.json index 0575371282..e9d4c3a6e8 100644 --- a/cloud-game-servers/snippets/package.json +++ b/cloud-game-servers/snippets/package.json @@ -13,7 +13,7 @@ "test": "c8 mocha --timeout 600000 test/*.js" }, "dependencies": { - "@google-cloud/game-servers": "^3.1.1" + "@google-cloud/game-servers": "^3.1.2" }, "devDependencies": { "c8": "^7.2.1",