@@ -17,34 +17,12 @@ Setup
17
17
Authentication
18
18
++++++++++++++
19
19
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.
24
23
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
48
26
49
27
Install Dependencies
50
28
++++++++++++++++++++
@@ -93,7 +71,10 @@ To run this sample:
93
71
94
72
$ python publisher.py
95
73
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
+ ...
97
78
98
79
This application demonstrates how to perform basic operations on topics
99
80
with the Cloud Pub/Sub API.
@@ -102,12 +83,18 @@ To run this sample:
102
83
at https://cloud.google.com/pubsub/docs.
103
84
104
85
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.
107
89
create Create a new Pub/Sub topic.
108
90
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.
111
98
112
99
optional arguments:
113
100
-h, --help show this help message and exit
@@ -124,7 +111,9 @@ To run this sample:
124
111
125
112
$ python subscriber.py
126
113
127
- usage: subscriber.py [-h] {list,create,delete,receive} ...
114
+ usage: subscriber.py [-h]
115
+ project {list,create,delete,receive,receive-flow-control}
116
+ ...
128
117
129
118
This application demonstrates how to perform basic operations on
130
119
subscriptions with the Cloud Pub/Sub API.
@@ -133,11 +122,15 @@ To run this sample:
133
122
at https://cloud.google.com/pubsub/docs.
134
123
135
124
positional arguments:
136
- {list,create,delete,receive}
125
+ project Your Google Cloud project ID
126
+ {list,create,delete,receive,receive-flow-control}
137
127
list Lists all subscriptions for a given topic.
138
128
create Create a new pull subscription on the given topic.
139
129
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.
141
134
142
135
optional arguments:
143
136
-h, --help show this help message and exit
@@ -155,6 +148,7 @@ To run this sample:
155
148
$ python iam.py
156
149
157
150
usage: iam.py [-h]
151
+ project
158
152
{get-topic-policy,get-subscription-policy,set-topic-policy,set-subscription-policy,check-topic-permissions,check-subscription-permissions}
159
153
...
160
154
@@ -165,6 +159,7 @@ To run this sample:
165
159
at https://cloud.google.com/pubsub/docs.
166
160
167
161
positional arguments:
162
+ project Your Google Cloud project ID
168
163
{get-topic-policy,get-subscription-policy,set-topic-policy,set-subscription-policy,check-topic-permissions,check-subscription-permissions}
169
164
get-topic-policy Prints the IAM policy for the given topic.
170
165
get-subscription-policy
0 commit comments