Skip to content

Commit e4d6162

Browse files
Jon Wayne Parrottplamut
Jon Wayne Parrott
authored andcommitted
Update all generated readme auth instructions [(#1121)](GoogleCloudPlatform/python-docs-samples#1121)
Change-Id: I03b5eaef8b17ac3dc3c0339fd2c7447bd3e11bd2
1 parent 4d6ebcc commit e4d6162

File tree

1 file changed

+30
-35
lines changed

1 file changed

+30
-35
lines changed

samples/snippets/README.rst

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,12 @@ Setup
1717
Authentication
1818
++++++++++++++
1919

20-
Authentication is typically done through `Application Default Credentials`_,
21-
which means you do not have to change the code to authenticate as long as
22-
your environment has credentials. You have a few options for setting up
23-
authentication:
20+
This sample requires you to have authentication setup. Refer to the
21+
`Authentication Getting Started Guide`_ for instructions on setting up
22+
credentials for applications.
2423

25-
#. When running locally, use the `Google Cloud SDK`_
26-
27-
.. code-block:: bash
28-
29-
gcloud auth application-default login
30-
31-
32-
#. When running on App Engine or Compute Engine, credentials are already
33-
set-up. However, you may need to configure your Compute Engine instance
34-
with `additional scopes`_.
35-
36-
#. You can create a `Service Account key file`_. This file can be used to
37-
authenticate to Google Cloud Platform services from any environment. To use
38-
the file, set the ``GOOGLE_APPLICATION_CREDENTIALS`` environment variable to
39-
the path to the key file, for example:
40-
41-
.. code-block:: bash
42-
43-
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
44-
45-
.. _Application Default Credentials: https://cloud.google.com/docs/authentication#getting_credentials_for_server-centric_flow
46-
.. _additional scopes: https://cloud.google.com/compute/docs/authentication#using
47-
.. _Service Account key file: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
24+
.. _Authentication Getting Started Guide:
25+
https://cloud.google.com/docs/authentication/getting-started
4826

4927
Install Dependencies
5028
++++++++++++++++++++
@@ -93,7 +71,10 @@ To run this sample:
9371
9472
$ python publisher.py
9573
96-
usage: publisher.py [-h] {list,create,delete,publish} ...
74+
usage: publisher.py [-h]
75+
project
76+
{list,create,delete,publish,publish-with-futures,publish-with-batch-settings}
77+
...
9778
9879
This application demonstrates how to perform basic operations on topics
9980
with the Cloud Pub/Sub API.
@@ -102,12 +83,18 @@ To run this sample:
10283
at https://cloud.google.com/pubsub/docs.
10384
10485
positional arguments:
105-
{list,create,delete,publish}
106-
list Lists all Pub/Sub topics in the current project.
86+
project Your Google Cloud project ID
87+
{list,create,delete,publish,publish-with-futures,publish-with-batch-settings}
88+
list Lists all Pub/Sub topics in the given project.
10789
create Create a new Pub/Sub topic.
10890
delete Deletes an existing Pub/Sub topic.
109-
publish Publishes a message to a Pub/Sub topic with the given
110-
data.
91+
publish Publishes multiple messages to a Pub/Sub topic.
92+
publish-with-futures
93+
Publishes multiple messages to a Pub/Sub topic and
94+
prints their message IDs.
95+
publish-with-batch-settings
96+
Publishes multiple messages to a Pub/Sub topic with
97+
batch settings.
11198
11299
optional arguments:
113100
-h, --help show this help message and exit
@@ -124,7 +111,9 @@ To run this sample:
124111
125112
$ python subscriber.py
126113
127-
usage: subscriber.py [-h] {list,create,delete,receive} ...
114+
usage: subscriber.py [-h]
115+
project {list,create,delete,receive,receive-flow-control}
116+
...
128117
129118
This application demonstrates how to perform basic operations on
130119
subscriptions with the Cloud Pub/Sub API.
@@ -133,11 +122,15 @@ To run this sample:
133122
at https://cloud.google.com/pubsub/docs.
134123
135124
positional arguments:
136-
{list,create,delete,receive}
125+
project Your Google Cloud project ID
126+
{list,create,delete,receive,receive-flow-control}
137127
list Lists all subscriptions for a given topic.
138128
create Create a new pull subscription on the given topic.
139129
delete Deletes an existing Pub/Sub topic.
140-
receive Receives a message from a pull subscription.
130+
receive Receives messages from a pull subscription.
131+
receive-flow-control
132+
Receives messages from a pull subscription with flow
133+
control.
141134
142135
optional arguments:
143136
-h, --help show this help message and exit
@@ -155,6 +148,7 @@ To run this sample:
155148
$ python iam.py
156149
157150
usage: iam.py [-h]
151+
project
158152
{get-topic-policy,get-subscription-policy,set-topic-policy,set-subscription-policy,check-topic-permissions,check-subscription-permissions}
159153
...
160154
@@ -165,6 +159,7 @@ To run this sample:
165159
at https://cloud.google.com/pubsub/docs.
166160
167161
positional arguments:
162+
project Your Google Cloud project ID
168163
{get-topic-policy,get-subscription-policy,set-topic-policy,set-subscription-policy,check-topic-permissions,check-subscription-permissions}
169164
get-topic-policy Prints the IAM policy for the given topic.
170165
get-subscription-policy

0 commit comments

Comments
 (0)