|
14 | 14 | 'use strict';
|
15 | 15 |
|
16 | 16 | /**
|
17 |
| -* DESCRIBE WHAT THIS SAMPLE DOES. |
18 |
| -* @param {string} LIST EXPECTED ARGUMENTS. |
19 |
| -*/ |
20 |
| -async function main() { |
21 |
| -// [START LIBRARY_NAME_quickstart] |
| 17 | + * Create a Game Servers realm. |
| 18 | + * @param {string} projectId string project identifier. |
| 19 | + * @param {string} location Compute Engine region. |
| 20 | + */ |
| 21 | +async function main(projectId, location) { |
| 22 | + // [START game_servers_quickstart] |
| 23 | + const {RealmsServiceClient} = require('@google-cloud/game-servers'); |
22 | 24 |
|
23 |
| -// [END LIBRARY_NAME_quickstart] |
| 25 | + const client = new RealmsServiceClient(); |
| 26 | + |
| 27 | + const request = { |
| 28 | + parent: `projects/${projectId}/locations/${location}`, |
| 29 | + realmId: 'my-realm', |
| 30 | + realm: { |
| 31 | + // Must use a valid support time zone. |
| 32 | + // See https://cloud.google.com/dataprep/docs/html/Supported-Time-Zone-Values_66194188 |
| 33 | + timeZone: 'US/Pacific', |
| 34 | + description: 'My Game Server realm', |
| 35 | + }, |
| 36 | + }; |
| 37 | + |
| 38 | + const [operation] = await client.createRealm(request); |
| 39 | + const results = await operation.promise(); |
| 40 | + const [realm] = results; |
| 41 | + |
| 42 | + console.log('Realm created:'); |
| 43 | + |
| 44 | + console.log(`\tRealm name: ${realm.name}`); |
| 45 | + console.log(`\tRealm description: ${realm.description}`); |
| 46 | + console.log(`\tRealm time zone: ${realm.timeZone}`); |
| 47 | + // [END game_servers_quickstart] |
24 | 48 | }
|
25 | 49 |
|
26 | 50 | main(...process.argv.slice(2)).catch(err => {
|
|
0 commit comments