Skip to content

Commit 3a50b3b

Browse files
authored
Updates README and cleans up package.json (#431)
1 parent c330971 commit 3a50b3b

File tree

2 files changed

+61
-32
lines changed

2 files changed

+61
-32
lines changed

iot/manager/README.md

+40-30
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,43 @@ Run the following command to install the library dependencies for NodeJS:
1515

1616
# Running the sample
1717

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

iot/manager/package.json

+21-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,31 @@
22
"name": "nodejs-docs-samples-iot-manager",
33
"version": "0.0.1",
44
"description": "Example of Cloud IoT device administration",
5-
"main": "cloudiot-device-manager-example.js",
5+
"main": "manager.js",
6+
"license": "Apache-2.0",
7+
"author": "Google Inc.",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
11+
},
12+
"engines": {
13+
"node": ">=4.3.2"
14+
},
15+
"scripts": {
16+
"lint": "samples lint",
17+
"pretest": "npm run lint",
18+
"system-test": "ava -T 3m --verbose system-test/*.test.js",
19+
"test": "npm run system-test"
20+
},
621
"dependencies": {
722
"@google-cloud/nodejs-repo-tools": "^1.4.15",
823
"@google-cloud/pubsub": "0.12.0",
9-
"ava": "^0.20.0",
1024
"googleapis": "19.0.0",
1125
"yargs": "^8.0.2"
26+
},
27+
"devDependencies": {
28+
"@google-cloud/nodejs-repo-tools": "1.4.15",
29+
"ava": "0.20.0",
30+
"uuid": "3.1.0"
1231
}
1332
}

0 commit comments

Comments
 (0)