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

samples: add samples from pubsub/cloud-client #151

Merged
merged 102 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
a740170
Revert "samples: add samples from pubsub/cloud-client (#134)"
plamut Jul 10, 2020
7bbaba0
Add pubsub publisher and subscriber samples
Aug 24, 2016
bcf2693
Update readme
Aug 24, 2016
b444e38
Add pubsub iam samples
Aug 25, 2016
709a9ac
Fix lint issue
Sep 1, 2016
bb28d99
Auto-update dependencies. [(#540)](https://github.com/GoogleCloudPlat…
dpebot Sep 23, 2016
6f37fba
Auto-update dependencies. [(#542)](https://github.com/GoogleCloudPlat…
dpebot Sep 26, 2016
81f6ae9
Move to google-cloud [(#544)](https://github.com/GoogleCloudPlatform/…
Sep 30, 2016
448a066
Add new "quickstart" samples [(#547)](https://github.com/GoogleCloudP…
jmdobry Oct 5, 2016
7041fbe
Quickstart tests [(#569)](https://github.com/GoogleCloudPlatform/pyth…
Oct 12, 2016
9555356
Generate readmes for most service samples [(#599)](https://github.com…
Oct 24, 2016
2dd4785
Update samples to support latest Google Cloud Python [(#656)](https:/…
Nov 15, 2016
fdee3c4
Auto-update dependencies. [(#715)](https://github.com/GoogleCloudPlat…
dpebot Dec 13, 2016
d47fb0f
Fix pubusb tests
Feb 16, 2017
f135a5b
Auto-update dependencies. [(#825)](https://github.com/GoogleCloudPlat…
dpebot Mar 11, 2017
101d32c
Auto-update dependencies. [(#876)](https://github.com/GoogleCloudPlat…
dpebot Apr 4, 2017
2f5d2a9
Fix reference to our testing tools
Apr 12, 2017
3ba6fa1
Re-generate all readmes
Apr 27, 2017
9b113cf
Auto-update dependencies. [(#922)](https://github.com/GoogleCloudPlat…
dpebot May 1, 2017
1ed3e69
Fix README rst links [(#962)](https://github.com/GoogleCloudPlatform/…
waprin May 24, 2017
a0daf6d
Auto-update dependencies. [(#1004)](https://github.com/GoogleCloudPla…
dpebot Jun 27, 2017
0f4a96b
Auto-update dependencies. [(#1055)](https://github.com/GoogleCloudPla…
dpebot Aug 7, 2017
8c5312c
Update pubsub samples [(#1092)](https://github.com/GoogleCloudPlatfor…
Aug 28, 2017
1343f98
Fix argpraser for pubsub subscriber
Aug 28, 2017
bd92f8b
Add comment about result blocking in pubsub samples
Aug 28, 2017
4e3eb07
Auto-update dependencies. [(#1097)](https://github.com/GoogleCloudPla…
dpebot Sep 12, 2017
4485e7c
Update all generated readme auth instructions [(#1121)](https://githu…
Sep 18, 2017
e138d7d
Added Link to Python Setup Guide [(#1158)](https://github.com/GoogleC…
Oct 12, 2017
9adce68
Auto-update dependencies. [(#1138)](https://github.com/GoogleCloudPla…
dpebot Oct 23, 2017
671d787
Fix a few more lint issues
Oct 24, 2017
76b7463
Add Snippet for Listing All Subscriptions in a Project [(#1169)](http…
Oct 31, 2017
229569a
Auto-update dependencies. [(#1186)](https://github.com/GoogleCloudPla…
dpebot Nov 1, 2017
7e31f49
Auto-update dependencies. [(#1234)](https://github.com/GoogleCloudPla…
dpebot Nov 28, 2017
e0e31c8
Auto-update dependencies. [(#1239)](https://github.com/GoogleCloudPla…
dpebot Nov 30, 2017
31ffa0e
Added "Open in Cloud Shell" buttons to README files [(#1254)](https:/…
Dec 7, 2017
d099168
Auto-update dependencies. [(#1263)](https://github.com/GoogleCloudPla…
dpebot Dec 11, 2017
70ec3ec
Auto-update dependencies. [(#1272)](https://github.com/GoogleCloudPla…
dpebot Dec 12, 2017
e4181e1
Auto-update dependencies. [(#1282)](https://github.com/GoogleCloudPla…
dpebot Jan 2, 2018
489b381
Add listen for errors sample. [(#1306)](https://github.com/GoogleClou…
noerog Jan 8, 2018
010ad9d
Fix subscription.open get called twice in the client libraries [(#132…
luxiangu Jan 17, 2018
0f83623
Add tests for creating push subscription. [(#1332)](https://github.co…
noerog Jan 25, 2018
3d5cedc
Add create push subscription sample. [(#1331)](https://github.com/Goo…
noerog Jan 25, 2018
79d2279
Add sample for updating a subscription. [(#1335)](https://github.com/…
noerog Feb 2, 2018
68e80ff
Change update_subscription to change endpoint URL. [(#1344)](https://…
noerog Feb 5, 2018
4b4a205
Auto-update dependencies. [(#1359)](https://github.com/GoogleCloudPla…
dpebot Feb 26, 2018
b9e39a3
Auto-update dependencies. [(#1389)](https://github.com/GoogleCloudPla…
dpebot Mar 8, 2018
d92b510
Added sample for publishing/receiving messages with custom attributes…
Mar 16, 2018
ca14620
Auto-update dependencies.
dpebot Apr 2, 2018
a4b8f30
Regenerate the README files and fix the Open in Cloud Shell link for …
Apr 7, 2018
9123079
Update READMEs to fix numbering and add git clone [(#1464)](https://g…
frankyn Apr 26, 2018
6f6c60c
PubSub: adds region tags and updates existing to standard [(#1491)](h…
alixhami May 21, 2018
31b0415
Pubsub: Add missing region tag [(#1498)](https://github.com/GoogleClo…
alixhami May 22, 2018
618bf11
Add the Pub/Sub handle_publisher_error sample [(#1440)](https://githu…
Jun 21, 2018
59de9b8
Modified publisher with error handling [(#1568)](https://github.com/G…
anguillanneuf Jul 19, 2018
3b41ec3
Updated google-cloud-pubsub to version 0.35 [(#1624)](https://github.…
anguillanneuf Aug 10, 2018
28d35a1
Added timeout in error handling [(#1636)](https://github.com/GoogleC…
anguillanneuf Aug 15, 2018
37feb9d
Auto-update dependencies. [(#1658)](https://github.com/GoogleCloudPla…
dpebot Aug 28, 2018
d264c75
Added sample for Pub/Sub synchronous pull subscriber [(#1673)](https:…
anguillanneuf Aug 30, 2018
8e689f7
Updated variable name [(#1680)](https://github.com/GoogleCloudPlatfor…
anguillanneuf Aug 31, 2018
319b370
Fixed return object from `subscriber.subscribe()` [(#1685)](https://g…
anguillanneuf Sep 7, 2018
a88c9f0
Pub/Sub: synchronous pull with lease management [(#1701)](https://git…
anguillanneuf Sep 14, 2018
d28750b
Pub/Sub: moved import statements inside region tags [(#1753)](https:/…
anguillanneuf Oct 12, 2018
bb3e135
Pub/Sub end-to-end sample [(#1800)](https://github.com/GoogleCloudPla…
anguillanneuf Oct 30, 2018
31d8762
Add test for updating a subscription. [(#1336)](https://github.com/Go…
noerog Dec 7, 2018
aa05874
Fix update test to use new endpoint [(#1925)](https://github.com/Goog…
engelke Dec 13, 2018
f16c5ee
Auto-update dependencies. [(#1980)](https://github.com/GoogleCloudPla…
dpebot Feb 6, 2019
aad1e18
Cloud Pub/Sub Quickstart V2 [(#2004)](https://github.com/GoogleCloudP…
anguillanneuf Feb 12, 2019
4650d3a
Pub/Sub: publish with error-handling comments [(#2222)](https://githu…
anguillanneuf Jun 14, 2019
51439fe
Resolve all futures [(#2231)](https://github.com/GoogleCloudPlatform/…
anguillanneuf Jun 20, 2019
bd1a4ca
Pub/Sub: add publish retry sample [(#2273)](https://github.com/Google…
anguillanneuf Jul 22, 2019
678a1eb
Fix a TODO comment on pubsub/cloud-client/subscriber.py [(#2302)](htt…
Jul 30, 2019
c328d26
Print actual number of messages pulled [(#2078)](https://github.com/G…
olivercoad Aug 12, 2019
96d642d
Pub/Sub: fix subscriber async region tag mistake [(#2334)](https://gi…
anguillanneuf Aug 13, 2019
2387979
Pub/Sub: update retry settings in sample [(#2395)](https://github.com…
anguillanneuf Sep 12, 2019
65c8ff6
Pub/Sub: improve pub.py [(#2403)](https://github.com/GoogleCloudPlatf…
anguillanneuf Sep 17, 2019
e497a94
Adds updates for samples profiler ... vision [(#2439)](https://github…
gguuss Oct 7, 2019
1ec3338
Pub/Sub: update how subscriber client listens to StreamingPullFuture …
anguillanneuf Oct 21, 2019
a2b4ac6
Pub/Sub: update how to test with mock [(#2555)](https://github.com/Go…
anguillanneuf Dec 11, 2019
0120862
Pub/Sub: remove infinite while loops in subscriber examples [(#2604)]…
anguillanneuf Dec 12, 2019
d453424
Pub/Sub: add timeout in argparse [(#2637)](https://github.com/GoogleC…
anguillanneuf Dec 18, 2019
7d4b6c5
Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPla…
dpebot Dec 21, 2019
1486d27
remove publish concurrency control sample [(#2960)](https://github.co…
anguillanneuf Feb 24, 2020
f2336e6
Pub/Sub: remove unreferenced samples [(#2986)](https://github.com/Goo…
anguillanneuf Feb 26, 2020
bd44acd
Pub/Sub: add SubscriberClient.close() to examples [(#3118)](https://g…
anguillanneuf Mar 23, 2020
c222598
Pub/Sub: update publish with batch settings sample [(#3137)](https://…
anguillanneuf Mar 25, 2020
faee641
Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatf…
kurtisvg Apr 2, 2020
103ac43
chore: remove gcp-devrel-py-tools from iot and pubsub [(#3470)](https…
Apr 23, 2020
b171356
Update dependency google-cloud-pubsub to v1.4.2 in Storage and Pub/Su…
busunkim96 Apr 24, 2020
5871203
chore: some lint fixes [(#3748)](https://github.com/GoogleCloudPlatfo…
May 13, 2020
1ed1dc9
chore(deps): update dependency google-cloud-pubsub to v1.4.3 [(#3725)…
renovate-bot May 13, 2020
1407699
chore(deps): update dependency google-cloud-pubsub to v1.5.0 [(#3781)…
renovate-bot May 21, 2020
c93a485
samples: add Pub/Sub dead letter queue samples [(#3904)](https://gith…
anguillanneuf May 30, 2020
47e051d
fix: make timeout an optional positional arg [(#3938)](https://github…
anguillanneuf Jun 3, 2020
fa1c813
fix: replace name with id in samples [(#3953)](https://github.com/Goo…
anguillanneuf Jun 4, 2020
c84240d
Replace GCLOUD_PROJECT with GOOGLE_CLOUD_PROJECT. [(#4022)](https://g…
kurtisvg Jun 9, 2020
a40dcf0
nit: remove redundant/wrong Pub/Sub region tag [(#4027)](https://gith…
anguillanneuf Jun 11, 2020
0686bfb
Pub/Sub: wrap subscriber in a with block and add comments [(#4070)](h…
anguillanneuf Jun 12, 2020
7a68bf6
Update dependency google-cloud-pubsub to v1.6.0 [(#4039)](https://git…
renovate-bot Jun 20, 2020
39050eb
chore: update templates
plamut Jun 26, 2020
e48ed53
chore(deps): update google-cloud-pubsub to v1.6.1
plamut Jul 10, 2020
f11d069
Fix URLs, commands, etc. in samples README
plamut Jul 10, 2020
777cdf3
Merge branch 'master' into add-snippets-samples-take-2
plamut Jul 10, 2020
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
54 changes: 24 additions & 30 deletions samples/snippets/README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

.. This file is automatically generated. Do not edit this file directly.

Google Cloud Pub/Sub 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=pubsub/cloud-client/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/README.rst


This directory contains samples for Google Cloud Pub/Sub. `Google Cloud Pub/Sub`_ is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.
Expand All @@ -16,11 +15,13 @@ This directory contains samples for Google Cloud Pub/Sub. `Google Cloud Pub/Sub`
.. _Google Cloud Pub/Sub: https://cloud.google.com/pubsub/docs





Setup
-------------------------------------------------------------------------------



Authentication
++++++++++++++

Expand All @@ -31,17 +32,14 @@ credentials for applications.
.. _Authentication Getting Started Guide:
https://cloud.google.com/docs/authentication/getting-started




Install Dependencies
++++++++++++++++++++

#. Clone python-docs-samples and change directory to the sample directory you want to use.

.. code-block:: bash

$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
$ git clone https://github.com/googleapis/python-pubsub.git

#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.

Expand All @@ -64,20 +62,30 @@ Install Dependencies
.. _pip: https://pip.pypa.io/
.. _virtualenv: https://virtualenv.pypa.io/

Samples
-------------------------------------------------------------------------------

Quickstart (Publisher)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. image:: https://gstatic.com/cloudssh/images/open-btn.png
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/quickstart/pub.py,samples/snippets/README.rst



Samples
-------------------------------------------------------------------------------

To run this sample:

.. code-block:: bash

Quickstart
$ python quickstart/pub.py


Quickstart (Subscriber)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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=pubsub/cloud-client/quickstart.py,pubsub/cloud-client/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/quickstart/sub.py,samples/snippets/README.rst



Expand All @@ -86,16 +94,14 @@ To run this sample:

.. code-block:: bash

$ python quickstart.py


$ python quickstart/sub.py


Publisher
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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=pubsub/cloud-client/publisher.py,pubsub/cloud-client/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/publisher.py,samples/snippets/README.rst



Expand All @@ -106,7 +112,6 @@ To run this sample:

$ python publisher.py


usage: publisher.py [-h]
project_id
{list,create,delete,publish,publish-with-custom-attributes,publish-with-error-handler,publish-with-batch-settings,publish-with-retry-settings}
Expand Down Expand Up @@ -142,13 +147,11 @@ To run this sample:





Subscribers
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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=pubsub/cloud-client/subscriber.py,pubsub/cloud-client/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/subscriber.py,samples/snippets/README.rst



Expand All @@ -159,7 +162,6 @@ To run this sample:

$ python subscriber.py


usage: subscriber.py [-h]
project_id
{list-in-topic,list-in-project,create,create-with-dead-letter-policy,create-push,delete,update-push,update-dead-letter-policy,remove-dead-letter-policy,receive,receive-custom-attributes,receive-flow-control,receive-synchronously,receive-synchronously-with-lease,listen-for-errors,receive-messages-with-delivery-attempts}
Expand Down Expand Up @@ -207,13 +209,11 @@ To run this sample:





Identity and Access Management
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.. 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=pubsub/cloud-client/iam.py,pubsub/cloud-client/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor=samples/snippets/iam.py,samples/snippets/README.rst



Expand All @@ -224,7 +224,6 @@ To run this sample:

$ python iam.py


usage: iam.py [-h]
project
{get-topic-policy,get-subscription-policy,set-topic-policy,set-subscription-policy,check-topic-permissions,check-subscription-permissions}
Expand Down Expand Up @@ -259,10 +258,6 @@ To run this sample:







The client library
-------------------------------------------------------------------------------

Expand All @@ -278,5 +273,4 @@ to `browse the source`_ and `report issues`_.
https://github.com/GoogleCloudPlatform/google-cloud-python/issues



.. _Google Cloud SDK: https://cloud.google.com/sdk/
.. _Google Cloud SDK: https://cloud.google.com/sdk/
8 changes: 5 additions & 3 deletions samples/snippets/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ setup:
- install_deps

samples:
- name: Quickstart
file: quickstart.py
- name: Quickstart (Publisher)
file: quickstart/pub.py
- name: Quickstart (Subscriber)
file: quickstart/sub.py
- name: Publisher
file: publisher.py
show_help: true
Expand All @@ -27,4 +29,4 @@ samples:

cloud_client_library: true

folder: pubsub/cloud-client
folder: samples/snippets
4 changes: 2 additions & 2 deletions scripts/readme-gen/templates/README.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
===============================================================================

.. 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={{folder}}/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/python-pubsub&page=editor&open_in_editor={{folder}}/README.rst


This directory contains samples for {{product.name}}. {{product.description}}
Expand Down Expand Up @@ -46,7 +46,7 @@ Samples

{% if not sample.hide_cloudshell_button %}
.. 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={{folder}}/{{sample.file}},{{folder}}/README.rst
:target: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com//googleapis/python-pubsub&page=editor&open_in_editor={{folder}}/{{sample.file}},{{folder}}/README.rst
{% endif %}


Expand Down
4 changes: 2 additions & 2 deletions scripts/readme-gen/templates/install_deps.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Install Dependencies

.. code-block:: bash

$ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
$ git clone https://github.com/googleapis/python-pubsub.git

#. Install `pip`_ and `virtualenv`_ if you do not already have them. You may want to refer to the `Python Development Environment Setup Guide`_ for Google Cloud Platform for instructions.

.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.
#. Create a virtualenv. Samples are compatible with Python 3.6+.

.. code-block:: bash

Expand Down