def set_subscription_policy(topic_name, subscription_name):
 pubsub_client = pubsub.Client()
 topic = pubsub_client.topic(topic_name)
 subscription = topic.subscription(subscription_name)
 policy = subscription.get_iam_policy()
 policy.viewers.add(policy.all_users())
 policy.editors.add(policy.group('cloud-logs@google.com'))
 subscription.set_iam_policy(policy)
 print 'IAM policy for subscription {} on topic {} set.'.format(topic.name, subscription.name)

def set_subscription_policy ( topic_name , subscription_name ) : pubsub_client = pubsub . Client ( ) topic = pubsub_client . topic ( topic_name ) subscription = topic . subscription ( subscription_name ) policy = subscription . get_iam_policy ( ) policy . viewers . add ( policy . all_users ( ) ) policy . editors . add ( policy . group ( 'cloud-logs@google.com' ) ) subscription . set_iam_policy ( policy ) print 'IAM policy for subscription {} on topic {} set.' . format ( topic . name , subscription . name )
sets the iam policy for a topic .