Skip to content

Commit

Permalink
Updates README and cleans up package.json (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
gguuss authored Jul 21, 2017
1 parent c330971 commit 3a50b3b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 32 deletions.
70 changes: 40 additions & 30 deletions iot/manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,43 @@ Run the following command to install the library dependencies for NodeJS:

# Running the sample

The following command summarizes the sample usage:

Usage: cloudiot_device_manager_example [options]

Example Google Cloud IoT device manager integration

Options:

-h, --help output usage information
--project_id <project_id> GCP cloud project name.
--pubsub_topic <pubsub_topic> Cloud Pub/Sub topic to use.
--api_key <api_key> Your API key.
--ec_public_key_file <ec_public_key_file> Path to EC public key.
--rsa_certificate_file <rsa_certificate_file> Path to RSA certificate file.
--cloud_region <cloud_region> GCP cloud region.
--service_account_json <service_account_json> Path to service account JSON file.
--registry_id <registry_id> Custom registry id. If not provided, a unique registry id will be generated.

For example, if your project ID is `blue-jet-123`, your service account
credentials are stored in your home folder in creds.json and you have generated
your credentials using the shell script provided in the parent folder, you can
run the sample as:

node cloudiot_device_manager_example.js \
--service_account_json=$HOME/creds.json \
--api_key=YOUR_CLIENT_ID \
--project_id=blue-jet-123 \
--pubsub_topic=projects/blue-jet-123/topics/device-events \
--ec_public_key_file=../ec_public.pem \
--rsa_certificate_file=../rsa_cert.pem
Commands:
createRsa256Device <deviceId> <registryId> <rsaPath> Creates an RSA256 device.
createEs256Device <deviceId> <registryId> <esPath> Creates an ES256 device.
createUnauthDevice <deviceId> <registryId> Creates a device without authorization.
createRegistry <registryId> <pubsubTopic> Creates a device registry.
createIotTopic <pubsubTopic> Creates and configures a PubSub topic for Cloud IoT Core.
setupIotTopic <pubsubTopic> Configures the PubSub topic for Cloud IoT Core.
deleteDevice <deviceId> <registryId> Deletes a device from the device registry.
clearRegistry <registryId> !!Be careful! Removes all devices and then deletes a device
registry!!
deleteRegistry <registryId> Deletes a device registry.
getDevice <deviceId> <registryId> Retrieves device info given a device ID.
listDevices <registryId> Lists the devices in a given registry.
patchEs256 <deviceId> <registryId> <es256Path> Patches a device with ES256 authorization credentials.
patchRsa256 <deviceId> <registryId> <rsa256Path> Patches a device with RSA256 authentication credentials.

Options:
--apiKey, -a The API key used for discoverying the API. [string]
--projectId, -p The Project ID to use. Defaults to the value of the GCLOUD_PROJECT or GOOGLE_CLOUD_PROJECT
environment variables. [string]
--serviceAccount, -s The path to your service credentials JSON. [string]
--help Show help [boolean]
--cloudRegion, -c [string] [default: "us-central1"]

Examples:
node manager.js createEs256Device my-es-device my-registry ../ec_public.pem --apiKey=abc123zz
node manager.js createRegistry my-registry my-iot-topic --service_account_json=$HOME/creds_iot.json
--api_key=abc123zz --project_id=my-project-id
node manager.js createRsa256Device my-rsa-device my-registry ../rsa_cert.pem --apiKey=abc123zz
node manager.js createUnauthDevice my-device my-registry
node manager.js deleteDevice my-device my-registry
node manager.js deleteRegistry my-device my-registry
node manager.js getDevice my-device my-registry
node manager.js listDevices my-node-registry
node manager.js patchRsa256 my-device my-registry ../rsa_cert.pem
node manager.js patchEs256 my-device my-registry ../ec_public.pem
node manager.js setupTopic my-iot-topic --service_account_json=$HOME/creds_iot.json --api_key=abc123zz
--project_id=my-project-id

For more information, see https://cloud.google.com/iot-core/docs
23 changes: 21 additions & 2 deletions iot/manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@
"name": "nodejs-docs-samples-iot-manager",
"version": "0.0.1",
"description": "Example of Cloud IoT device administration",
"main": "cloudiot-device-manager-example.js",
"main": "manager.js",
"license": "Apache-2.0",
"author": "Google Inc.",
"repository": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"engines": {
"node": ">=4.3.2"
},
"scripts": {
"lint": "samples lint",
"pretest": "npm run lint",
"system-test": "ava -T 3m --verbose system-test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/nodejs-repo-tools": "^1.4.15",
"@google-cloud/pubsub": "0.12.0",
"ava": "^0.20.0",
"googleapis": "19.0.0",
"yargs": "^8.0.2"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.15",
"ava": "0.20.0",
"uuid": "3.1.0"
}
}

0 comments on commit 3a50b3b

Please sign in to comment.