Exemple #1
0
def SetDatabaseIamPolicy(database_ref, policy):
    """Sets the IAM policy on a database."""
    msgs = apis.GetMessagesModule('spanner', 'v1')
    policy = iam_util.ParsePolicyFile(policy, msgs.Policy)
    return databases.SetPolicy(database_ref, policy)
Exemple #2
0
def RemoveDatabaseIamPolicyBinding(database_ref, member, role):
    """Removes a policy binding from a database IAM policy."""
    policy = databases.GetIamPolicy(database_ref)
    iam_util.RemoveBindingFromIamPolicy(policy, member, role)
    return databases.SetPolicy(database_ref, policy)
Exemple #3
0
def AddDatabaseIamPolicyBinding(database_ref, member, role):
    """Adds a policy binding to a database IAM policy."""
    msgs = apis.GetMessagesModule('spanner', 'v1')
    policy = databases.GetIamPolicy(database_ref)
    iam_util.AddBindingToIamPolicy(msgs, policy, member, role)
    return databases.SetPolicy(database_ref, policy)