From 6f81664b67e86c8fcc50e0725dcd80ce2726ea9b Mon Sep 17 00:00:00 2001 From: Gus Class Date: Wed, 19 Jul 2017 14:07:21 -0400 Subject: [PATCH] Updates README and cleans up package.json --- iot/manager/README.md | 70 +++++++++++++++++++++++----------------- iot/manager/package.json | 23 +++++++++++-- 2 files changed, 61 insertions(+), 32 deletions(-) diff --git a/iot/manager/README.md b/iot/manager/README.md index bb9d5c4e17..f29821be08 100644 --- a/iot/manager/README.md +++ b/iot/manager/README.md @@ -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 GCP cloud project name. - --pubsub_topic Cloud Pub/Sub topic to use. - --api_key Your API key. - --ec_public_key_file Path to EC public key. - --rsa_certificate_file Path to RSA certificate file. - --cloud_region GCP cloud region. - --service_account_json Path to service account JSON file. - --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 Creates an RSA256 device. + createEs256Device Creates an ES256 device. + createUnauthDevice Creates a device without authorization. + createRegistry Creates a device registry. + createIotTopic Creates and configures a PubSub topic for Cloud IoT Core. + setupIotTopic Configures the PubSub topic for Cloud IoT Core. + deleteDevice Deletes a device from the device registry. + clearRegistry !!Be careful! Removes all devices and then deletes a device + registry!! + deleteRegistry Deletes a device registry. + getDevice Retrieves device info given a device ID. + listDevices Lists the devices in a given registry. + patchEs256 Patches a device with ES256 authorization credentials. + patchRsa256 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 diff --git a/iot/manager/package.json b/iot/manager/package.json index 90200ce762..a5c7f3d903 100644 --- a/iot/manager/package.json +++ b/iot/manager/package.json @@ -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" } }