-
Notifications
You must be signed in to change notification settings - Fork 591
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 (#520) PiperOrigin-RevId: 399287285 Source-Link: googleapis/googleapis@1575986 Source-Link: googleapis/googleapis-gen@b27fff6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Benjamin E. Coe <bencoe@google.com>
- Loading branch information
1 parent
8b4837c
commit 2706f6e
Showing
20 changed files
with
1,198 additions
and
4 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
packages/google-cloud-iot/samples/generated/v1/device_manager.bind_device_to_gateway.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,66 @@ | ||
// 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, gatewayId, deviceId) { | ||
// [START cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the registry. For example, | ||
* `projects/example-project/locations/us-central1/registries/my-registry`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The value of `gateway_id` can be either the device numeric ID or the | ||
* user-defined device identifier. | ||
*/ | ||
// const gatewayId = 'abc123' | ||
/** | ||
* Required. The device to associate with the specified gateway. The value of | ||
* `device_id` can be either the device numeric ID or the user-defined device | ||
* identifier. | ||
*/ | ||
// const deviceId = 'abc123' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function bindDeviceToGateway() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
gatewayId, | ||
deviceId, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.bindDeviceToGateway(request); | ||
console.log(response); | ||
} | ||
|
||
bindDeviceToGateway(); | ||
// [END cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
61 changes: 61 additions & 0 deletions
61
packages/google-cloud-iot/samples/generated/v1/device_manager.create_device.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,61 @@ | ||
// 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, device) { | ||
// [START cloudiot_v1_generated_DeviceManager_CreateDevice_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the device registry where this device should be created. | ||
* For example, | ||
* `projects/example-project/locations/us-central1/registries/my-registry`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The device registration details. The field `name` must be empty. The server | ||
* generates `name` from the device registry `id` and the | ||
* `parent` field. | ||
*/ | ||
// const device = '' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function createDevice() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
device, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.createDevice(request); | ||
console.log(response); | ||
} | ||
|
||
createDevice(); | ||
// [END cloudiot_v1_generated_DeviceManager_CreateDevice_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
60 changes: 60 additions & 0 deletions
60
packages/google-cloud-iot/samples/generated/v1/device_manager.create_device_registry.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,60 @@ | ||
// 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, deviceRegistry) { | ||
// [START cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The project and cloud region where this device registry must be created. | ||
* For example, `projects/example-project/locations/us-central1`. | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The device registry. The field `name` must be empty. The server will | ||
* generate that field from the device registry `id` provided and the | ||
* `parent` field. | ||
*/ | ||
// const deviceRegistry = '' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function createDeviceRegistry() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
deviceRegistry, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.createDeviceRegistry(request); | ||
console.log(response); | ||
} | ||
|
||
createDeviceRegistry(); | ||
// [END cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
54 changes: 54 additions & 0 deletions
54
packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device.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,54 @@ | ||
// 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 cloudiot_v1_generated_DeviceManager_DeleteDevice_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the device. For example, | ||
* `projects/p0/locations/us-central1/registries/registry0/devices/device0` or | ||
* `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function deleteDevice() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.deleteDevice(request); | ||
console.log(response); | ||
} | ||
|
||
deleteDevice(); | ||
// [END cloudiot_v1_generated_DeviceManager_DeleteDevice_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
53 changes: 53 additions & 0 deletions
53
packages/google-cloud-iot/samples/generated/v1/device_manager.delete_device_registry.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,53 @@ | ||
// 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 cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the device registry. For example, | ||
* `projects/example-project/locations/us-central1/registries/my-registry`. | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function deleteDeviceRegistry() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.deleteDeviceRegistry(request); | ||
console.log(response); | ||
} | ||
|
||
deleteDeviceRegistry(); | ||
// [END cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
60 changes: 60 additions & 0 deletions
60
packages/google-cloud-iot/samples/generated/v1/device_manager.get_device.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,60 @@ | ||
// 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 cloudiot_v1_generated_DeviceManager_GetDevice_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the device. For example, | ||
* `projects/p0/locations/us-central1/registries/registry0/devices/device0` or | ||
* `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. | ||
*/ | ||
// const name = 'abc123' | ||
/** | ||
* The fields of the `Device` resource to be returned in the response. If the | ||
* field mask is unset or empty, all fields are returned. Fields have to be | ||
* provided in snake_case format, for example: `last_heartbeat_time`. | ||
*/ | ||
// const fieldMask = '' | ||
|
||
// Imports the Iot library | ||
const {DeviceManagerClient} = require('@google-cloud/iot').v1; | ||
|
||
// Instantiates a client | ||
const iotClient = new DeviceManagerClient(); | ||
|
||
async function getDevice() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await iotClient.getDevice(request); | ||
console.log(response); | ||
} | ||
|
||
getDevice(); | ||
// [END cloudiot_v1_generated_DeviceManager_GetDevice_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
Oops, something went wrong.