def check_subscription_permissions(topic_name, subscription_name):
 pubsub_client = pubsub.Client()
 topic = pubsub_client.topic(topic_name)
 subscription = topic.subscription(subscription_name)
 permissions_to_check = ['pubsub.subscriptions.consume', 'pubsub.subscriptions.update']
 allowed_permissions = subscription.check_iam_permissions(permissions_to_check)
 print 'Allowed permissions for subscription {} on topic {}: {}'.format(subscription.name, topic.name, allowed_permissions)

def check_subscription_permissions ( topic_name , subscription_name ) : pubsub_client = pubsub . Client ( ) topic = pubsub_client . topic ( topic_name ) subscription = topic . subscription ( subscription_name ) permissions_to_check = [ 'pubsub.subscriptions.consume' , 'pubsub.subscriptions.update' ] allowed_permissions = subscription . check_iam_permissions ( permissions_to_check ) print 'Allowed permissions for subscription {} on topic {}: {}' . format ( subscription . name , topic . name , allowed_permissions )
checks to which permissions are available on the given subscription .