@@ -15,33 +15,43 @@ Run the following command to install the library dependencies for NodeJS:
15
15
16
16
# Running the sample
17
17
18
- The following command summarizes the sample usage:
19
-
20
- Usage: cloudiot_device_manager_example [options]
21
-
22
- Example Google Cloud IoT device manager integration
23
-
24
- Options:
25
-
26
- -h, --help output usage information
27
- --project_id <project_id> GCP cloud project name.
28
- --pubsub_topic <pubsub_topic> Cloud Pub/Sub topic to use.
29
- --api_key <api_key> Your API key.
30
- --ec_public_key_file <ec_public_key_file> Path to EC public key.
31
- --rsa_certificate_file <rsa_certificate_file> Path to RSA certificate file.
32
- --cloud_region <cloud_region> GCP cloud region.
33
- --service_account_json <service_account_json> Path to service account JSON file.
34
- --registry_id <registry_id> Custom registry id. If not provided, a unique registry id will be generated.
35
-
36
- For example, if your project ID is ` blue-jet-123 ` , your service account
37
- credentials are stored in your home folder in creds.json and you have generated
38
- your credentials using the shell script provided in the parent folder, you can
39
- run the sample as:
40
-
41
- node cloudiot_device_manager_example.js \
42
- --service_account_json=$HOME/creds.json \
43
- --api_key=YOUR_CLIENT_ID \
44
- --project_id=blue-jet-123 \
45
- --pubsub_topic=projects/blue-jet-123/topics/device-events \
46
- --ec_public_key_file=../ec_public.pem \
47
- --rsa_certificate_file=../rsa_cert.pem
18
+ Commands:
19
+ createRsa256Device <deviceId > <registryId > <rsaPath > Creates an RSA256 device.
20
+ createEs256Device <deviceId > <registryId > <esPath > Creates an ES256 device.
21
+ createUnauthDevice <deviceId > <registryId > Creates a device without authorization.
22
+ createRegistry <registryId > <pubsubTopic > Creates a device registry.
23
+ createIotTopic <pubsubTopic > Creates and configures a PubSub topic for Cloud IoT Core.
24
+ setupIotTopic <pubsubTopic > Configures the PubSub topic for Cloud IoT Core.
25
+ deleteDevice <deviceId > <registryId > Deletes a device from the device registry.
26
+ clearRegistry <registryId > !!Be careful! Removes all devices and then deletes a device
27
+ registry!!
28
+ deleteRegistry <registryId > Deletes a device registry.
29
+ getDevice <deviceId > <registryId > Retrieves device info given a device ID.
30
+ listDevices <registryId > Lists the devices in a given registry.
31
+ patchEs256 <deviceId > <registryId > <es256Path > Patches a device with ES256 authorization credentials.
32
+ patchRsa256 <deviceId > <registryId > <rsa256Path > Patches a device with RSA256 authentication credentials.
33
+
34
+ Options:
35
+ --apiKey, -a The API key used for discoverying the API. [ string]
36
+ --projectId, -p The Project ID to use. Defaults to the value of the GCLOUD_PROJECT or GOOGLE_CLOUD_PROJECT
37
+ environment variables. [ string]
38
+ --serviceAccount, -s The path to your service credentials JSON. [ string]
39
+ --help Show help [ boolean]
40
+ --cloudRegion, -c [ string] [ default: "us-central1"]
41
+
42
+ Examples:
43
+ node manager.js createEs256Device my-es-device my-registry ../ec_public.pem --apiKey=abc123zz
44
+ node manager.js createRegistry my-registry my-iot-topic --service_account_json=$HOME/creds_iot.json
45
+ --api_key=abc123zz --project_id=my-project-id
46
+ node manager.js createRsa256Device my-rsa-device my-registry ../rsa_cert.pem --apiKey=abc123zz
47
+ node manager.js createUnauthDevice my-device my-registry
48
+ node manager.js deleteDevice my-device my-registry
49
+ node manager.js deleteRegistry my-device my-registry
50
+ node manager.js getDevice my-device my-registry
51
+ node manager.js listDevices my-node-registry
52
+ node manager.js patchRsa256 my-device my-registry ../rsa_cert.pem
53
+ node manager.js patchEs256 my-device my-registry ../ec_public.pem
54
+ node manager.js setupTopic my-iot-topic --service_account_json=$HOME/creds_iot.json --api_key=abc123zz
55
+ --project_id=my-project-id
56
+
57
+ For more information, see https://cloud.google.com/iot-core/docs
0 commit comments