Skip to content

Commit ba7f87c

Browse files
committed
Split out 'Fetch' vs' Update' examples for topic IAM policy.
Addresses: #1641 (comment)
1 parent 0dd8f5d commit ba7f87c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/pubsub-usage.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Delete a topic:
6666
>>> topic = client.topic('topic_name')
6767
>>> topic.delete() # API request
6868

69-
Update the IAM policy for a topic:
69+
Fetch the IAM policy for a topic:
7070

7171
.. doctest::
7272

@@ -82,6 +82,15 @@ Update the IAM policy for a topic:
8282
['systemAccount:abc-1234@systemaccounts.example.com']
8383
>>> policy.readers
8484
['domain:example.com']
85+
86+
Update the IAM policy for a topic:
87+
88+
.. doctest::
89+
90+
>>> from gcloud import pubsub
91+
>>> client = pubsub.Client()
92+
>>> topic = client.topic('topic_name')
93+
>>> policy = topic.get_iam_policy() # API request
8594
>>> policy.writers.add(policy.group('editors-list@example.com'))
8695
>>> topic.set_iam_policy(policy) # API request
8796

0 commit comments

Comments
 (0)