diff --git a/iot/api-client/http_example/README.rst b/iot/api-client/http_example/README.rst index 4b02f763e67c..047ee6f26c26 100644 --- a/iot/api-client/http_example/README.rst +++ b/iot/api-client/http_example/README.rst @@ -1,17 +1,18 @@ .. This file is automatically generated. Do not edit this file directly. -Google Cloud IoT Core API Python Samples +Google Cloud IoT Core Python Samples =============================================================================== .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=iot/api-client/http_example/README.rst -This directory contains samples for Google Cloud IoT Core API. `Google Cloud IoT Core`_ allows developers to easily integrate Publish and Subscribe functionality with devices and programmatically manage device authorization. -The following example runs the sample using the project ID `blue-jet-123` and the device name `my-python-device`: +This directory contains samples for Google Cloud IoT Core. `Google Cloud IoT Core`_ allows developers to easily integrate Publish and Subscribe functionality with devices and programmatically manage device authorization. +The following example runs the sample using the project ID ``blue-jet-123`` and the device name ``my-python-device``:: python cloudiot_http_example.py \ --registry_id=my-registry \ + --cloud_region=us-central1 \ --project_id=blue-jet-123 \ --device_id=my-python-device \ --message_type=event \ @@ -21,7 +22,7 @@ The following example runs the sample using the project ID `blue-jet-123` and th -.. _Google Cloud IoT Core API: https://cloud.google.com/iot/docs +.. _Google Cloud IoT Core: https://cloud.google.com/iot/docs Setup ------------------------------------------------------------------------------- diff --git a/iot/api-client/http_example/README.rst.in b/iot/api-client/http_example/README.rst.in index 3fdf6f4a4cdb..b7bb0a2aa7e8 100644 --- a/iot/api-client/http_example/README.rst.in +++ b/iot/api-client/http_example/README.rst.in @@ -14,6 +14,7 @@ product: python cloudiot_http_example.py \ --registry_id=my-registry \ + --cloud_region=us-central1 \ --project_id=blue-jet-123 \ --device_id=my-python-device \ --message_type=event \ diff --git a/iot/api-client/manager/README.rst b/iot/api-client/manager/README.rst index 75ce31c196be..bdbdb768c442 100644 --- a/iot/api-client/manager/README.rst +++ b/iot/api-client/manager/README.rst @@ -88,11 +88,9 @@ To run this sample: python manager.py \ --project_id=my-project-id \ - --pubsub_topic=projects/my-project-id/topics/my-topic-id \ - --ec_public_key_file=../ec_public.pem \ - --rsa_certificate_file=../rsa_cert.pem \ - --service_account_json=$HOME/service_account.json - list + --cloud_region=us-central1 \ + --service_account_json=$HOME/service_account.json \ + list-registries positional arguments: {create-es256,create-registry,create-rsa256,create-topic,create-unauth,delete-device,delete-registry,get,get-config-versions,get-iam-permissions,get-registry,get-state,list,list-registries,patch-es256,patch-rs256,set-config,set-iam-permissions} diff --git a/iot/api-client/manager/manager.py b/iot/api-client/manager/manager.py index 931daab968c1..190f83a6262c 100644 --- a/iot/api-client/manager/manager.py +++ b/iot/api-client/manager/manager.py @@ -23,11 +23,9 @@ python manager.py \\ --project_id=my-project-id \\ - --pubsub_topic=projects/my-project-id/topics/my-topic-id \\ - --ec_public_key_file=../ec_public.pem \\ - --rsa_certificate_file=../rsa_cert.pem \\ - --service_account_json=$HOME/service_account.json - list + --cloud_region=us-central1 \\ + --service_account_json=$HOME/service_account.json \\ + list-registries """ import argparse @@ -501,16 +499,13 @@ def parse_command_line_args(): description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - # Required arguments + # Optional arguments + parser.add_argument( + '--cloud_region', default='us-central1', help='GCP cloud region') parser.add_argument( '--pubsub_topic', - required=True, help=('Google Cloud Pub/Sub topic. ' 'Format is projects/project_id/topics/topic-id')) - - # Optional arguments - parser.add_argument( - '--cloud_region', default='us-central1', help='GCP cloud region') parser.add_argument( '--config', default=None, @@ -597,11 +592,15 @@ def run_create(args): args.cloud_region, args.registry_id, args.device_id) elif args.command == 'create-registry': + if (args.pubsub_topic is None): + sys.exit('Error: specify --pubsub_topic') open_registry( args.service_account_json, args.project_id, args.cloud_region, args.pubsub_topic, args.registry_id) elif args.command == 'create-topic': + if (args.pubsub_topic is None): + sys.exit('Error: specify --pubsub_topic') create_iot_topic(args.project_id, args.pubsub_topic) diff --git a/iot/api-client/mqtt_example/README.rst b/iot/api-client/mqtt_example/README.rst index eff574da25c4..d61a22f211d5 100644 --- a/iot/api-client/mqtt_example/README.rst +++ b/iot/api-client/mqtt_example/README.rst @@ -1,18 +1,19 @@ .. This file is automatically generated. Do not edit this file directly. -Google Cloud IoT Core API Python Samples +Google Cloud IoT Core Python Samples =============================================================================== .. image:: https://gstatic.com/cloudssh/images/open-btn.png :target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=iot/api-client/mqtt_example/README.rst -This directory contains samples for Google Cloud IoT Core API. `Google Cloud IoT Core`_ allows developers to easily integrate Publish and Subscribe functionality with devices and programmatically manage device authorization. -Before you run the sample, you must retrieve the Google root certificate. For example, `wget https://pki.goog/roots.pem` or `curl https://pki.goog/roots.pem > roots.pem`. -The following example runs the sample using the project ID `blue-jet-123` and the device name `my-python-device`: +This directory contains samples for Google Cloud IoT Core. `Google Cloud IoT Core`_ allows developers to easily integrate Publish and Subscribe functionality with devices and programmatically manage device authorization. +Before you run the sample, you must retrieve the Google root certificate. For example, ``wget https://pki.goog/roots.pem`` or ``curl https://pki.goog/roots.pem > roots.pem``. +The following example runs the sample using the project ID ``blue-jet-123`` and the device name ``my-python-device``:: python cloudiot_mqtt_example.py \ --registry_id=my-registry \ + --cloud_region=us-central1 \ --project_id=blue-jet-123 \ --device_id=my-python-device \ --algorithm=RS256 \ @@ -21,7 +22,7 @@ The following example runs the sample using the project ID `blue-jet-123` and th -.. _Google Cloud IoT Core API: https://cloud.google.com/iot/docs +.. _Google Cloud IoT Core: https://cloud.google.com/iot/docs Setup ------------------------------------------------------------------------------- diff --git a/iot/api-client/mqtt_example/README.rst.in b/iot/api-client/mqtt_example/README.rst.in index 958aa9641c4b..bcc057a359d2 100644 --- a/iot/api-client/mqtt_example/README.rst.in +++ b/iot/api-client/mqtt_example/README.rst.in @@ -18,6 +18,7 @@ product: python cloudiot_mqtt_example.py \ --registry_id=my-registry \ + --cloud_region=us-central1 \ --project_id=blue-jet-123 \ --device_id=my-python-device \ --algorithm=RS256 \