Skip to content

Commit 5cbfc1c

Browse files
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: googleapis/googleapis@1575986 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b27fff623a5d8d586b703b5e4919856abe7c2eb3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
1 parent 7e4880a commit 5cbfc1c

File tree

55 files changed

+3404
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3404
-1
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, gameServerClusterId, gameServerCluster) {
18+
// [START gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The parent resource name, in the following form:
24+
* `projects/{project}/locations/{location}/realms/{realm-id}`.
25+
*/
26+
// const parent = 'abc123'
27+
/**
28+
* Required. The ID of the game server cluster resource to be created.
29+
*/
30+
// const gameServerClusterId = 'abc123'
31+
/**
32+
* Required. The game server cluster resource to be created.
33+
*/
34+
// const gameServerCluster = ''
35+
36+
// Imports the Gaming library
37+
const {GameServerClustersServiceClient} =
38+
require('@google-cloud/game-servers').v1;
39+
40+
// Instantiates a client
41+
const gamingClient = new GameServerClustersServiceClient();
42+
43+
async function createGameServerCluster() {
44+
// Construct request
45+
const request = {
46+
parent,
47+
gameServerClusterId,
48+
gameServerCluster,
49+
};
50+
51+
// Run request
52+
const [operation] = await gamingClient.createGameServerCluster(request);
53+
const [response] = await operation.promise();
54+
console.log(response);
55+
}
56+
57+
createGameServerCluster();
58+
// [END gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async]
59+
}
60+
61+
process.on('unhandledRejection', err => {
62+
console.error(err.message);
63+
process.exitCode = 1;
64+
});
65+
main(...process.argv.slice(2));
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The name of the game server cluster to delete, in the following form:
24+
* `projects/{project}/locations/{location}/gameServerClusters/{cluster}`.
25+
*/
26+
// const name = 'abc123'
27+
28+
// Imports the Gaming library
29+
const {GameServerClustersServiceClient} =
30+
require('@google-cloud/game-servers').v1;
31+
32+
// Instantiates a client
33+
const gamingClient = new GameServerClustersServiceClient();
34+
35+
async function deleteGameServerCluster() {
36+
// Construct request
37+
const request = {
38+
name,
39+
};
40+
41+
// Run request
42+
const [operation] = await gamingClient.deleteGameServerCluster(request);
43+
const [response] = await operation.promise();
44+
console.log(response);
45+
}
46+
47+
deleteGameServerCluster();
48+
// [END gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async]
49+
}
50+
51+
process.on('unhandledRejection', err => {
52+
console.error(err.message);
53+
process.exitCode = 1;
54+
});
55+
main(...process.argv.slice(2));
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(name) {
18+
// [START gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The name of the game server cluster to retrieve, in the following form:
24+
* `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`.
25+
*/
26+
// const name = 'abc123'
27+
/**
28+
* Optional. View for the returned GameServerCluster objects. When `FULL` is
29+
* specified, the `cluster_state` field is also returned in the
30+
* GameServerCluster object, which includes the state of the referenced
31+
* Kubernetes cluster such as versions and provider info. The default/unset
32+
* value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does
33+
* not return the `cluster_state` field.
34+
*/
35+
// const view = ''
36+
37+
// Imports the Gaming library
38+
const {GameServerClustersServiceClient} =
39+
require('@google-cloud/game-servers').v1;
40+
41+
// Instantiates a client
42+
const gamingClient = new GameServerClustersServiceClient();
43+
44+
async function getGameServerCluster() {
45+
// Construct request
46+
const request = {
47+
name,
48+
};
49+
50+
// Run request
51+
const response = await gamingClient.getGameServerCluster(request);
52+
console.log(response);
53+
}
54+
55+
getGameServerCluster();
56+
// [END gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async]
57+
}
58+
59+
process.on('unhandledRejection', err => {
60+
console.error(err.message);
61+
process.exitCode = 1;
62+
});
63+
main(...process.argv.slice(2));
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent) {
18+
// [START gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The parent resource name, in the following form:
24+
* "projects/{project}/locations/{location}/realms/{realm}".
25+
*/
26+
// const parent = 'abc123'
27+
/**
28+
* Optional. The maximum number of items to return. If unspecified, the server
29+
* will pick an appropriate default. The server may return fewer items than
30+
* requested. A caller should only rely on response's
31+
* [next_page_token][google.cloud.gaming.v1.ListGameServerClustersResponse.next_page_token] to
32+
* determine if there are more GameServerClusters left to be queried.
33+
*/
34+
// const pageSize = 1234
35+
/**
36+
* Optional. The next_page_token value returned from a previous List request, if any.
37+
*/
38+
// const pageToken = 'abc123'
39+
/**
40+
* Optional. The filter to apply to list results.
41+
*/
42+
// const filter = 'abc123'
43+
/**
44+
* Optional. Specifies the ordering of results following syntax at
45+
* https://cloud.google.com/apis/design/design_patterns#sorting_order.
46+
*/
47+
// const orderBy = 'abc123'
48+
/**
49+
* Optional. View for the returned GameServerCluster objects. When `FULL` is
50+
* specified, the `cluster_state` field is also returned in the
51+
* GameServerCluster object, which includes the state of the referenced
52+
* Kubernetes cluster such as versions and provider info. The default/unset
53+
* value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does
54+
* not return the `cluster_state` field.
55+
*/
56+
// const view = ''
57+
58+
// Imports the Gaming library
59+
const {GameServerClustersServiceClient} =
60+
require('@google-cloud/game-servers').v1;
61+
62+
// Instantiates a client
63+
const gamingClient = new GameServerClustersServiceClient();
64+
65+
async function listGameServerClusters() {
66+
// Construct request
67+
const request = {
68+
parent,
69+
};
70+
71+
// Run request
72+
const iterable = await gamingClient.listGameServerClustersAsync(request);
73+
for await (const response of iterable) {
74+
console.log(response);
75+
}
76+
}
77+
78+
listGameServerClusters();
79+
// [END gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async]
80+
}
81+
82+
process.on('unhandledRejection', err => {
83+
console.error(err.message);
84+
process.exitCode = 1;
85+
});
86+
main(...process.argv.slice(2));
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright 2021 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
'use strict';
16+
17+
function main(parent, gameServerClusterId, gameServerCluster) {
18+
// [START gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
/**
23+
* Required. The parent resource name, in the following form:
24+
* `projects/{project}/locations/{location}/realms/{realm}`.
25+
*/
26+
// const parent = 'abc123'
27+
/**
28+
* Required. The ID of the game server cluster resource to be created.
29+
*/
30+
// const gameServerClusterId = 'abc123'
31+
/**
32+
* Required. The game server cluster resource to be created.
33+
*/
34+
// const gameServerCluster = ''
35+
/**
36+
* Optional. The target timestamp to compute the preview.
37+
*/
38+
// const previewTime = ''
39+
/**
40+
* Optional. This field is deprecated, preview will always return
41+
* KubernetesClusterState.
42+
*/
43+
// const view = ''
44+
45+
// Imports the Gaming library
46+
const {GameServerClustersServiceClient} =
47+
require('@google-cloud/game-servers').v1;
48+
49+
// Instantiates a client
50+
const gamingClient = new GameServerClustersServiceClient();
51+
52+
async function previewCreateGameServerCluster() {
53+
// Construct request
54+
const request = {
55+
parent,
56+
gameServerClusterId,
57+
gameServerCluster,
58+
};
59+
60+
// Run request
61+
const response = await gamingClient.previewCreateGameServerCluster(request);
62+
console.log(response);
63+
}
64+
65+
previewCreateGameServerCluster();
66+
// [END gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async]
67+
}
68+
69+
process.on('unhandledRejection', err => {
70+
console.error(err.message);
71+
process.exitCode = 1;
72+
});
73+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)