-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(samples): add auto-generated samples for Node with api short nam…
…e in region tag (#221) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9
- Loading branch information
1 parent
8d7889b
commit 5e7c7e9
Showing
63 changed files
with
3,436 additions
and
17 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
...ud-gaming/samples/generated/v1/game_server_clusters_service.create_game_server_cluster.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// 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'; | ||
|
||
function main(parent, gameServerClusterId, gameServerCluster) { | ||
// [START gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent resource name, in the following form: | ||
* `projects/{project}/locations/{location}/realms/{realm-id}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The ID of the game server cluster resource to be created. | ||
*/ | ||
// const gameServerClusterId = 'abc123' | ||
/** | ||
* Required. The game server cluster resource to be created. | ||
*/ | ||
// const gameServerCluster = '' | ||
|
||
// Imports the Gaming library | ||
const {GameServerClustersServiceClient} = | ||
require('@google-cloud/game-servers').v1; | ||
|
||
// Instantiates a client | ||
const gamingClient = new GameServerClustersServiceClient(); | ||
|
||
async function createGameServerCluster() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
gameServerClusterId, | ||
gameServerCluster, | ||
}; | ||
|
||
// Run request | ||
const [operation] = await gamingClient.createGameServerCluster(request); | ||
const [response] = await operation.promise(); | ||
console.log(response); | ||
} | ||
|
||
createGameServerCluster(); | ||
// [END gameservices_v1_generated_GameServerClustersService_CreateGameServerCluster_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
55 changes: 55 additions & 0 deletions
55
...ud-gaming/samples/generated/v1/game_server_clusters_service.delete_game_server_cluster.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// 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'; | ||
|
||
function main(name) { | ||
// [START gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the game server cluster to delete, in the following form: | ||
* `projects/{project}/locations/{location}/gameServerClusters/{cluster}`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Gaming library | ||
const {GameServerClustersServiceClient} = | ||
require('@google-cloud/game-servers').v1; | ||
|
||
// Instantiates a client | ||
const gamingClient = new GameServerClustersServiceClient(); | ||
|
||
async function deleteGameServerCluster() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const [operation] = await gamingClient.deleteGameServerCluster(request); | ||
const [response] = await operation.promise(); | ||
console.log(response); | ||
} | ||
|
||
deleteGameServerCluster(); | ||
// [END gameservices_v1_generated_GameServerClustersService_DeleteGameServerCluster_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
63 changes: 63 additions & 0 deletions
63
...cloud-gaming/samples/generated/v1/game_server_clusters_service.get_game_server_cluster.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// 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'; | ||
|
||
function main(name) { | ||
// [START gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the game server cluster to retrieve, in the following form: | ||
* `projects/{project}/locations/{location}/realms/{realm-id}/gameServerClusters/{cluster}`. | ||
*/ | ||
// const name = 'abc123' | ||
/** | ||
* Optional. View for the returned GameServerCluster objects. When `FULL` is | ||
* specified, the `cluster_state` field is also returned in the | ||
* GameServerCluster object, which includes the state of the referenced | ||
* Kubernetes cluster such as versions and provider info. The default/unset | ||
* value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does | ||
* not return the `cluster_state` field. | ||
*/ | ||
// const view = '' | ||
|
||
// Imports the Gaming library | ||
const {GameServerClustersServiceClient} = | ||
require('@google-cloud/game-servers').v1; | ||
|
||
// Instantiates a client | ||
const gamingClient = new GameServerClustersServiceClient(); | ||
|
||
async function getGameServerCluster() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await gamingClient.getGameServerCluster(request); | ||
console.log(response); | ||
} | ||
|
||
getGameServerCluster(); | ||
// [END gameservices_v1_generated_GameServerClustersService_GetGameServerCluster_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
86 changes: 86 additions & 0 deletions
86
...oud-gaming/samples/generated/v1/game_server_clusters_service.list_game_server_clusters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// 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'; | ||
|
||
function main(parent) { | ||
// [START gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent resource name, in the following form: | ||
* "projects/{project}/locations/{location}/realms/{realm}". | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Optional. The maximum number of items to return. If unspecified, the server | ||
* will pick an appropriate default. The server may return fewer items than | ||
* requested. A caller should only rely on response's | ||
* [next_page_token][google.cloud.gaming.v1.ListGameServerClustersResponse.next_page_token] to | ||
* determine if there are more GameServerClusters left to be queried. | ||
*/ | ||
// const pageSize = 1234 | ||
/** | ||
* Optional. The next_page_token value returned from a previous List request, if any. | ||
*/ | ||
// const pageToken = 'abc123' | ||
/** | ||
* Optional. The filter to apply to list results. | ||
*/ | ||
// const filter = 'abc123' | ||
/** | ||
* Optional. Specifies the ordering of results following syntax at | ||
* https://cloud.google.com/apis/design/design_patterns#sorting_order. | ||
*/ | ||
// const orderBy = 'abc123' | ||
/** | ||
* Optional. View for the returned GameServerCluster objects. When `FULL` is | ||
* specified, the `cluster_state` field is also returned in the | ||
* GameServerCluster object, which includes the state of the referenced | ||
* Kubernetes cluster such as versions and provider info. The default/unset | ||
* value is GAME_SERVER_CLUSTER_VIEW_UNSPECIFIED, same as BASIC, which does | ||
* not return the `cluster_state` field. | ||
*/ | ||
// const view = '' | ||
|
||
// Imports the Gaming library | ||
const {GameServerClustersServiceClient} = | ||
require('@google-cloud/game-servers').v1; | ||
|
||
// Instantiates a client | ||
const gamingClient = new GameServerClustersServiceClient(); | ||
|
||
async function listGameServerClusters() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
}; | ||
|
||
// Run request | ||
const iterable = await gamingClient.listGameServerClustersAsync(request); | ||
for await (const response of iterable) { | ||
console.log(response); | ||
} | ||
} | ||
|
||
listGameServerClusters(); | ||
// [END gameservices_v1_generated_GameServerClustersService_ListGameServerClusters_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
73 changes: 73 additions & 0 deletions
73
...g/samples/generated/v1/game_server_clusters_service.preview_create_game_server_cluster.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
|
||
function main(parent, gameServerClusterId, gameServerCluster) { | ||
// [START gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The parent resource name, in the following form: | ||
* `projects/{project}/locations/{location}/realms/{realm}`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The ID of the game server cluster resource to be created. | ||
*/ | ||
// const gameServerClusterId = 'abc123' | ||
/** | ||
* Required. The game server cluster resource to be created. | ||
*/ | ||
// const gameServerCluster = '' | ||
/** | ||
* Optional. The target timestamp to compute the preview. | ||
*/ | ||
// const previewTime = '' | ||
/** | ||
* Optional. This field is deprecated, preview will always return | ||
* KubernetesClusterState. | ||
*/ | ||
// const view = '' | ||
|
||
// Imports the Gaming library | ||
const {GameServerClustersServiceClient} = | ||
require('@google-cloud/game-servers').v1; | ||
|
||
// Instantiates a client | ||
const gamingClient = new GameServerClustersServiceClient(); | ||
|
||
async function previewCreateGameServerCluster() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
gameServerClusterId, | ||
gameServerCluster, | ||
}; | ||
|
||
// Run request | ||
const response = await gamingClient.previewCreateGameServerCluster(request); | ||
console.log(response); | ||
} | ||
|
||
previewCreateGameServerCluster(); | ||
// [END gameservices_v1_generated_GameServerClustersService_PreviewCreateGameServerCluster_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.