34577913e8d62f0db23231f4882263b6825fa271,pubsub/cloud-client/iam.py,,set_subscription_policy,#Any#Any#,82

Before Change



def set_subscription_policy(topic_name, subscription_name):
    Sets the IAM policy for a topic.
    pubsub_client = pubsub.Client()
    topic = pubsub_client.topic(topic_name)
    subscription = topic.subscription(subscription_name)
    policy = subscription.get_iam_policy()

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

    // Set the policy
    subscription.set_iam_policy(policy)

After Change


    // Set the policy
    policy = client.set_iam_policy(subscription_path, policy)

    print("IAM policy for subscription {} set: {}".format(
        subscription_name, policy))


def check_topic_permissions(project, topic_name):
    Checks to which permissions are available on the given topic.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 34577913e8d62f0db23231f4882263b6825fa271
Time: 2017-08-28
Author: jonwayne@google.com
File Name: pubsub/cloud-client/iam.py
Class Name:
Method Name: set_subscription_policy


Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 34577913e8d62f0db23231f4882263b6825fa271
Time: 2017-08-28
Author: jonwayne@google.com
File Name: pubsub/cloud-client/iam.py
Class Name:
Method Name: get_subscription_policy


Project Name: tensorflow/minigo
Commit Name: 68e099aff7200ffff5f2edbca98a924a47ef8384
Time: 2019-04-22
Author: sethtroisi@google.com
File Name: ratings/cbt_ratings.py
Class Name:
Method Name: main