Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds region to examples #1378

Merged
merged 1 commit into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions iot/api-client/http_example/README.rst
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions iot/api-client/http_example/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 3 additions & 5 deletions iot/api-client/manager/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
21 changes: 10 additions & 11 deletions iot/api-client/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)


Expand Down
11 changes: 6 additions & 5 deletions iot/api-client/mqtt_example/README.rst
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
-------------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions iot/api-client/mqtt_example/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down