Skip to content

Commit

Permalink
Auto-update dependencies. [(googleapis#922)](GoogleCloudPlatform/pyth…
Browse files Browse the repository at this point in the history
…on-docs-samples#922)

* Auto-update dependencies.

* Fix pubsub iam samples
  • Loading branch information
dpebot authored and Jon Wayne Parrott committed May 1, 2017
1 parent 558ed2c commit eba2d3c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions samples/snippets/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ def set_topic_policy(topic_name):
policy = topic.get_iam_policy()

# Add all users as viewers.
policy.viewers.add(policy.all_users())
# Add a group as editors.
policy.editors.add(policy.group('cloud-logs@google.com'))
policy['roles/pubsub.viewer'] = [policy.all_users()]
# Add a group as publisherss.
publishers = policy.get('roles/pubsub.publisher', [])
publishers.append(policy.group('cloud-logs@google.com'))
policy['roles/pubsub.publisher'] = publishers

# Set the policy
topic.set_iam_policy(policy)
Expand All @@ -85,9 +87,11 @@ def set_subscription_policy(topic_name, subscription_name):
policy = subscription.get_iam_policy()

# Add all users as viewers.
policy.viewers.add(policy.all_users())
# Add a group as editors.
policy.editors.add(policy.group('cloud-logs@google.com'))
policy['roles/viewer'] = [policy.all_users()]
# # Add a group as editors.
editors = policy.get('roles/editor', [])
editors.append(policy.group('cloud-logs@google.com'))
policy['roles/editor'] = editors

# Set the policy
subscription.set_iam_policy(policy)
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/iam_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_set_topic_policy(test_topic):

policy = test_topic.get_iam_policy()
assert policy.viewers
assert policy.editors
assert policy['roles/pubsub.publisher']


def test_set_subscription_policy(test_subscription):
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-pubsub==0.24.0
google-cloud-pubsub==0.25.0

0 comments on commit eba2d3c

Please sign in to comment.