@@ -87,6 +87,12 @@ def create_rs256_device(
8787 """Create a new device with the given id, using RS256 for
8888 authentication."""
8989 # [START iot_create_rsa_device]
90+ # project_id = 'YOUR_PROJECT_ID'
91+ # cloud_region = 'us-central1'
92+ # registry_id = 'your-registry-id'
93+ # device_id = 'your-device-id'
94+ # certificate_file = 'path/to/certificate.pem'
95+
9096 client = iot_v1 .DeviceManagerClient ()
9197
9298 parent = client .registry_path (project_id , cloud_region , registry_id )
@@ -115,6 +121,12 @@ def create_es256_device(
115121 """Create a new device with the given id, using ES256 for
116122 authentication."""
117123 # [START iot_create_es_device]
124+ # project_id = 'YOUR_PROJECT_ID'
125+ # cloud_region = 'us-central1'
126+ # registry_id = 'your-registry-id'
127+ # device_id = 'your-device-id'
128+ # public_key_file = 'path/to/certificate.pem'
129+
118130 client = iot_v1 .DeviceManagerClient ()
119131
120132 parent = client .registry_path (project_id , cloud_region , registry_id )
@@ -142,6 +154,11 @@ def create_device(
142154 device_id ):
143155 """Create a device to bind to a gateway if it does not exist."""
144156 # [START iot_create_device]
157+ # project_id = 'YOUR_PROJECT_ID'
158+ # cloud_region = 'us-central1'
159+ # registry_id = 'your-registry-id'
160+ # device_id = 'your-device-id'
161+
145162 # Check that the device doesn't already exist
146163 client = iot_v1 .DeviceManagerClient ()
147164
@@ -177,6 +194,10 @@ def create_unauth_device(
177194 device_id ):
178195 """Create a new device without authentication."""
179196 # [START iot_create_unauth_device]
197+ # project_id = 'YOUR_PROJECT_ID'
198+ # cloud_region = 'us-central1'
199+ # registry_id = 'your-registry-id'
200+ # device_id = 'your-device-id'
180201 client = iot_v1 .DeviceManagerClient ()
181202
182203 parent = client .registry_path (project_id , cloud_region , registry_id )
@@ -194,6 +215,10 @@ def delete_device(
194215 device_id ):
195216 """Delete the device with the given id."""
196217 # [START iot_delete_device]
218+ # project_id = 'YOUR_PROJECT_ID'
219+ # cloud_region = 'us-central1'
220+ # registry_id = 'your-registry-id'
221+ # device_id = 'your-device-id'
197222 print ('Delete device' )
198223 client = iot_v1 .DeviceManagerClient ()
199224
@@ -208,6 +233,9 @@ def delete_registry(
208233 service_account_json , project_id , cloud_region , registry_id ):
209234 """Deletes the specified registry."""
210235 # [START iot_delete_registry]
236+ # project_id = 'YOUR_PROJECT_ID'
237+ # cloud_region = 'us-central1'
238+ # registry_id = 'your-registry-id'
211239 print ('Delete registry' )
212240
213241 client = iot_v1 .DeviceManagerClient ()
@@ -228,6 +256,10 @@ def get_device(
228256 device_id ):
229257 """Retrieve the device with the given id."""
230258 # [START iot_get_device]
259+ # project_id = 'YOUR_PROJECT_ID'
260+ # cloud_region = 'us-central1'
261+ # registry_id = 'your-registry-id'
262+ # device_id = 'your-device-id'
231263 print ('Getting device' )
232264 client = iot_v1 .DeviceManagerClient ()
233265 device_path = client .device_path (
@@ -271,6 +303,10 @@ def get_state(
271303 device_id ):
272304 """Retrieve a device's state blobs."""
273305 # [START iot_get_device_state]
306+ # project_id = 'YOUR_PROJECT_ID'
307+ # cloud_region = 'us-central1'
308+ # registry_id = 'your-registry-id'
309+ # device_id = 'your-device-id'
274310 client = iot_v1 .DeviceManagerClient ()
275311 device_path = client .device_path (
276312 project_id , cloud_region , registry_id , device_id )
@@ -291,6 +327,9 @@ def list_devices(
291327 service_account_json , project_id , cloud_region , registry_id ):
292328 """List all devices in the registry."""
293329 # [START iot_list_devices]
330+ # project_id = 'YOUR_PROJECT_ID'
331+ # cloud_region = 'us-central1'
332+ # registry_id = 'your-registry-id'
294333 print ('Listing devices' )
295334
296335 client = iot_v1 .DeviceManagerClient ()
@@ -307,6 +346,8 @@ def list_devices(
307346def list_registries (service_account_json , project_id , cloud_region ):
308347 """List all registries in the project."""
309348 # [START iot_list_registries]
349+ # project_id = 'YOUR_PROJECT_ID'
350+ # cloud_region = 'us-central1'
310351 print ('Listing Registries' )
311352 client = iot_v1 .DeviceManagerClient ()
312353 parent = client .location_path (project_id , cloud_region )
@@ -327,6 +368,10 @@ def create_registry(
327368 """ Creates a registry and returns the result. Returns an empty result if
328369 the registry already exists."""
329370 # [START iot_create_registry]
371+ # project_id = 'YOUR_PROJECT_ID'
372+ # cloud_region = 'us-central1'
373+ # pubsub_topic = 'your-pubsub-topic'
374+ # registry_id = 'your-registry-id'
330375 client = iot_v1 .DeviceManagerClient ()
331376 parent = client .location_path (project_id , cloud_region )
332377
@@ -357,6 +402,9 @@ def get_registry(
357402 service_account_json , project_id , cloud_region , registry_id ):
358403 """ Retrieves a device registry."""
359404 # [START iot_get_registry]
405+ # project_id = 'YOUR_PROJECT_ID'
406+ # cloud_region = 'us-central1'
407+ # registry_id = 'your-registry-id'
360408 client = iot_v1 .DeviceManagerClient ()
361409 registry_path = client .registry_path (project_id , cloud_region , registry_id )
362410
@@ -368,6 +416,10 @@ def open_registry(
368416 service_account_json , project_id , cloud_region , pubsub_topic ,
369417 registry_id ):
370418 """Gets or creates a device registry."""
419+ # project_id = 'YOUR_PROJECT_ID'
420+ # cloud_region = 'us-central1'
421+ # pubsub_topic = 'your-pubsub-topic'
422+ # registry_id = 'your-registry-id'
371423 print ('Creating registry' )
372424
373425 response = create_registry (
@@ -392,6 +444,11 @@ def patch_es256_auth(
392444 device_id , public_key_file ):
393445 """Patch the device to add an ES256 public key to the device."""
394446 # [START iot_patch_es]
447+ # project_id = 'YOUR_PROJECT_ID'
448+ # cloud_region = 'us-central1'
449+ # registry_id = 'your-registry-id'
450+ # device_id = 'your-device-id'
451+ # public_key_file = 'path/to/certificate.pem'
395452 print ('Patch device with ES256 certificate' )
396453
397454 client = iot_v1 .DeviceManagerClient ()
@@ -427,6 +484,11 @@ def patch_rsa256_auth(
427484 public_key_file ):
428485 """Patch the device to add an RSA256 public key to the device."""
429486 # [START iot_patch_rsa]
487+ # project_id = 'YOUR_PROJECT_ID'
488+ # cloud_region = 'us-central1'
489+ # registry_id = 'your-registry-id'
490+ # device_id = 'your-device-id'
491+ # public_key_file = 'path/to/certificate.pem'
430492 print ('Patch device with RSA256 certificate' )
431493
432494 client = iot_v1 .DeviceManagerClient ()
@@ -462,6 +524,12 @@ def set_config(
462524 service_account_json , project_id , cloud_region , registry_id , device_id ,
463525 version , config ):
464526 # [START iot_set_device_config]
527+ # project_id = 'YOUR_PROJECT_ID'
528+ # cloud_region = 'us-central1'
529+ # registry_id = 'your-registry-id'
530+ # device_id = 'your-device-id'
531+ # version = '0'
532+ # config= 'your-config-data'
465533 print ('Set device configuration' )
466534 client = iot_v1 .DeviceManagerClient ()
467535 device_path = client .device_path (
@@ -478,6 +546,10 @@ def get_config_versions(
478546 device_id ):
479547 """Lists versions of a device config in descending order (newest first)."""
480548 # [START iot_get_device_configs]
549+ # project_id = 'YOUR_PROJECT_ID'
550+ # cloud_region = 'us-central1'
551+ # registry_id = 'your-registry-id'
552+ # device_id = 'your-device-id'
481553 client = iot_v1 .DeviceManagerClient ()
482554 device_path = client .device_path (
483555 project_id , cloud_region , registry_id , device_id )
@@ -498,6 +570,9 @@ def get_iam_permissions(
498570 service_account_json , project_id , cloud_region , registry_id ):
499571 """Retrieves IAM permissions for the given registry."""
500572 # [START iot_get_iam_policy]
573+ # project_id = 'YOUR_PROJECT_ID'
574+ # cloud_region = 'us-central1'
575+ # registry_id = 'your-registry-id'
501576 client = iot_v1 .DeviceManagerClient ()
502577
503578 registry_path = client .registry_path (project_id , cloud_region , registry_id )
@@ -513,6 +588,11 @@ def set_iam_permissions(
513588 member ):
514589 """Sets IAM permissions for the given registry to a single role/member."""
515590 # [START iot_set_iam_policy]
591+ # project_id = 'YOUR_PROJECT_ID'
592+ # cloud_region = 'us-central1'
593+ # registry_id = 'your-registry-id'
594+ # role = 'viewer'
595+ # member = 'group:[email protected] ' 516596 client = iot_v1 .DeviceManagerClient ()
517597 registry_path = client .registry_path (project_id , cloud_region , registry_id )
518598
@@ -549,6 +629,13 @@ def create_gateway(
549629 gateway_id , certificate_file , algorithm ):
550630 """Create a gateway to bind devices to."""
551631 # [START iot_create_gateway]
632+ # project_id = 'YOUR_PROJECT_ID'
633+ # cloud_region = 'us-central1'
634+ # registry_id = 'your-registry-id'
635+ # device_id = 'your-device-id'
636+ # gateway_id = 'your-gateway-id'
637+ # certificate_file = 'path/to/certificate.pem'
638+ # algorithm = 'ES256'
552639 # Check that the gateway doesn't already exist
553640 exists = False
554641 client = iot_v1 .DeviceManagerClient ()
@@ -602,6 +689,11 @@ def bind_device_to_gateway(
602689 gateway_id ):
603690 """Binds a device to a gateway."""
604691 # [START iot_bind_device_to_gateway]
692+ # project_id = 'YOUR_PROJECT_ID'
693+ # cloud_region = 'us-central1'
694+ # registry_id = 'your-registry-id'
695+ # device_id = 'your-device-id'
696+ # gateway_id = 'your-gateway-id'
605697 client = iot_v1 .DeviceManagerClient ()
606698
607699 create_device (
@@ -621,6 +713,11 @@ def unbind_device_from_gateway(
621713 gateway_id ):
622714 """Unbinds a device to a gateway."""
623715 # [START iot_unbind_device_from_gateway]
716+ # project_id = 'YOUR_PROJECT_ID'
717+ # cloud_region = 'us-central1'
718+ # registry_id = 'your-registry-id'
719+ # device_id = 'your-device-id'
720+ # gateway_id = 'your-gateway-id'
624721 client = iot_v1 .DeviceManagerClient ()
625722
626723 parent = client .registry_path (project_id , cloud_region , registry_id )
@@ -635,6 +732,9 @@ def list_gateways(
635732 service_account_json , project_id , cloud_region , registry_id ):
636733 """Lists gateways in a registry"""
637734 # [START iot_list_gateways]
735+ # project_id = 'YOUR_PROJECT_ID'
736+ # cloud_region = 'us-central1'
737+ # registry_id = 'your-registry-id'
638738 client = iot_v1 .DeviceManagerClient ()
639739
640740 path = client .registry_path (project_id , cloud_region , registry_id )
@@ -655,6 +755,10 @@ def list_devices_for_gateway(
655755 gateway_id ):
656756 """List devices bound to a gateway"""
657757 # [START iot_list_devices_for_gateway]
758+ # project_id = 'YOUR_PROJECT_ID'
759+ # cloud_region = 'us-central1'
760+ # registry_id = 'your-registry-id'
761+ # gateway_id = 'your-gateway-id'
658762 client = iot_v1 .DeviceManagerClient ()
659763
660764 path = client .registry_path (project_id , cloud_region , registry_id )
0 commit comments