Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate code from googleapis/nodejs-game-servers #2819

Closed
wants to merge 51 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7600832
Initial client library creation
telpirion Feb 10, 2020
472db86
feat: updates package.json files and quickstart
telpirion Feb 11, 2020
80f618f
Adds quickstart
telpirion Feb 21, 2020
37dd210
build: get the build passing (#17)
yoshi-automation Mar 1, 2020
41c82c2
build: get sample and system tests passing (#18)
JustinBeckwith Mar 1, 2020
a188eaf
chore(deps): update dependency @types/mocha (#1)
renovate-bot Mar 1, 2020
f642114
chore(deps): update dependency c8 to v7 (#2)
renovate-bot Mar 1, 2020
67b2077
chore: release 1.0.0 (#4)
release-please[bot] Mar 2, 2020
55d2f4a
feat: adds CRUD samples for GS realms (#21)
telpirion Mar 3, 2020
2c715d0
chore: release 1.1.0 (#22)
release-please[bot] Mar 3, 2020
78d8cd1
test: adds cleanup function for tests (#28)
telpirion Mar 10, 2020
d728547
build: generator updates and new coverage approach (#59)
yoshi-automation Apr 27, 2020
730d396
feat: adds CRUD samples, tests for GS clusters (#24)
telpirion Apr 29, 2020
3f0f21f
chore(deps): update dependency uuid to v8 (#63)
renovate-bot May 1, 2020
9de5e5c
chore: release 2.0.0 (#38)
release-please[bot] Jun 4, 2020
c2a8706
chore(deps): update dependency mocha to v8 (#72)
renovate-bot Jun 11, 2020
f7b2326
chore: release 2.0.1 (#75)
release-please[bot] Jun 16, 2020
e0c2adb
test: fix sample test by pointing at a shared cluster with Agones (#81)
xwxw-g Jul 9, 2020
855756e
chore: release 2.0.2 (#82)
release-please[bot] Jul 10, 2020
d51e738
docs(samples): fix sample formatting issues (#94)
pooneh-m Jul 16, 2020
cbf88f8
docs(samples): Add Game Server deployment samples (#92)
pooneh-m Jul 16, 2020
d32da4d
docs(samples): change tags to be aligned with golang samples (#97)
pooneh-m Jul 16, 2020
71ce195
Add samples for GameServerConfigs (#98)
pooneh-m Jul 24, 2020
c42eea2
Add sample for game server rollout (#102)
pooneh-m Jul 24, 2020
a25ae0f
chore: release 2.1.0 (#110)
release-please[bot] Aug 5, 2020
edc3850
chore: release 2.1.1 (#133)
release-please[bot] Nov 11, 2020
4475e43
chore: release 2.1.2 (#137)
release-please[bot] Dec 2, 2020
cb82643
chore: release 2.2.0 (#143)
release-please[bot] Jan 12, 2021
d425de1
chore: release 2.3.0 (#148)
release-please[bot] Mar 2, 2021
dda23f4
chore: migrate to owl bot (#153)
SurferJeffAtGoogle May 18, 2021
e9d5835
chore: release 2.3.1 (#163)
release-please[bot] May 20, 2021
e9ba710
chore: release 2.3.2 (#173)
release-please[bot] May 24, 2021
d2fcafb
chore: release 2.3.3 (#180)
release-please[bot] Jun 10, 2021
dd67edc
chore: release 2.3.4 (#187)
release-please[bot] Jun 22, 2021
5c42089
chore: release 2.3.5 (#193)
release-please[bot] Jun 29, 2021
0b4c852
chore: release 2.3.6 (#197)
release-please[bot] Jul 12, 2021
60e78ea
chore: release 2.3.7 (#199)
release-please[bot] Jul 16, 2021
8af821e
chore: release 2.3.8 (#207)
release-please[bot] Aug 17, 2021
8f5fe3b
chore: release 2.4.0 (#210)
release-please[bot] Aug 24, 2021
e747bff
chore: release 2.5.0 (#214)
release-please[bot] Aug 30, 2021
d0d186f
chore: show cluster installation state details for get and list metho…
irataxy Sep 2, 2021
984ad67
docs(samples): add auto-generated samples for Node with api short nam…
gcf-owl-bot[bot] Sep 28, 2021
f4bc8b2
docs: add update samples (#230)
irataxy Nov 18, 2021
80c9585
build!: update library to use Node 12 (#266)
alexander-fenster May 17, 2022
2eaa7f3
chore(main): release 3.0.0 (#267)
release-please[bot] May 18, 2022
bd9d1e8
chore(main): release 3.1.0 (#272)
release-please[bot] Jul 5, 2022
131b91c
build: do not test if service is unavailable (#275)
sofisl Jul 12, 2022
9605211
chore(main): release 3.1.1 (#307)
release-please[bot] Sep 7, 2022
eaa7ea2
chore(deps): update dependency uuid to v9 (#312)
renovate-bot Sep 8, 2022
dba2192
chore(main): release 3.1.2 (#314)
release-please[bot] Sep 22, 2022
49317ab
Merge remote-tracking branch 'migration/main' into nodejs-game-server…
pattishin Nov 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions cloud-game-servers/snippets/create_cluster.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers cluster.
* @param {string} projectId string project identifier
* @param {string} location Compute Engine region
* @param {string} realmId the realm to use
* @param {string} gameClusterId unique identifier for the new Game Cluster
* @param {string} gkeClusterName The full resource name of the GKE cluster to use
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
location = 'LOCATION_ID',
realmId = 'REALM_ID',
gameClusterId = 'GAME_CLUSTER_ID',
gkeClusterName = 'GKE_CLUSTER_NAME'
) {
// [START cloud_game_servers_cluster_create]
const {
GameServerClustersServiceClient,
} = require('@google-cloud/game-servers');

const client = new GameServerClustersServiceClient();

async function createGameServerCluster() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const location = 'A Compute Engine region, e.g. "us-central1"';
// const realmId = 'The ID of the realm to locate this cluster in';
// const gameClusterId = 'A unique ID for this Game Server Cluster';
// const gkeClusterName= 'The full resource name of the GKE cluster to use';
const request = {
// Provide full resource name of a Game Server Realm
parent: client.realmPath(projectId, location, realmId),
gameServerClusterId: gameClusterId,
gameServerCluster: {
description: 'My Game Server Cluster',
connectionInfo: {
gkeClusterReference: {
// Provide full resource name of a Kubernetes Engine cluster
// In the form of 'projects/<project-id>/locations/<location>/clusters/<gke-cluster-name>'
cluster: gkeClusterName,
},
namespace: 'default',
},
},
};

const [operation] = await client.createGameServerCluster(request);
const [result] = await operation.promise();

console.log('Game Server Cluster created:');
console.log(`\tCluster name: ${result.name}`);
console.log(`\tCluster description: ${result.description}`);
console.log(
`\tGKE cluster: ${result.connectionInfo.gkeClusterReference.cluster}`
);
}

createGameServerCluster();
// [END cloud_game_servers_cluster_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
144 changes: 144 additions & 0 deletions cloud-game-servers/snippets/create_config.js
Original file line number Diff line number Diff line change
@@ -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;
});
66 changes: 66 additions & 0 deletions cloud-game-servers/snippets/create_deployment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers Deployment.
* @param {string} projectId string project identifier
* @param {string} deploymentId unique identifier for the new Game Server Deployment
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
deploymentId = 'DEPLOYMENT_ID'
) {
// [START cloud_game_servers_deployment_create]
const {
GameServerDeploymentsServiceClient,
} = require('@google-cloud/game-servers');

const client = new GameServerDeploymentsServiceClient();

async function createGameServerDeployment() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const deploymentId = 'A unique ID for the Game Server Deployment';
const request = {
parent: `projects/${projectId}/locations/global`,
deploymentId: deploymentId,
gameServerDeployment: {
description: 'nodejs test deployment',
},
};

const [operation] = await client.createGameServerDeployment(request);
const [result] = await operation.promise();

console.log('Game Server Deployment created:');
console.log(`\t Deployment name: ${result.name}`);
console.log(`\t Deployment description: ${result.description}`);
}

createGameServerDeployment();

// [END cloud_game_servers_deployment_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
72 changes: 72 additions & 0 deletions cloud-game-servers/snippets/create_realm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2020, Google LLC.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

'use strict';

/**
* Create a Game Servers realm.
* @param {string} projectId string project identifier.
* @param {string} location Compute Engine region.
* @param {string} realmId a unique identifier for the new realm
*/
async function main(
projectId = 'YOUR_PROJECT_ID',
location = 'LOCATION_ID',
realmId = 'REALM_ID'
) {
// [START cloud_game_servers_realm_create]
const {RealmsServiceClient} = require('@google-cloud/game-servers');

const client = new RealmsServiceClient();

async function createRealm() {
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
// const projectId = 'Your Google Cloud Project ID';
// const location = 'A Compute Engine region, e.g. "us-central1"';
// const realmId = 'A unique identifier for the realm';
const request = {
parent: `projects/${projectId}/locations/${location}`,
realmId: realmId,
realm: {
// Must use a supported time zone name.
// See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188
timeZone: 'US/Pacific',
description: 'My Game Server realm',
},
};

const [operation] = await client.createRealm(request);
const results = await operation.promise();
const [realm] = results;

console.log('Realm created:');

console.log(`\tRealm name: ${realm.name}`);
console.log(`\tRealm description: ${realm.description}`);
console.log(`\tRealm time zone: ${realm.timeZone}`);
}

createRealm();
// [END cloud_game_servers_realm_create]
}

main(...process.argv.slice(2)).catch(err => {
console.error(err.message);
process.exitCode = 1;
});
process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
Loading