示例#1
0
def SetInstanceIamPolicy(instance_ref, policy):
    """Sets the IAM policy on an instance."""
    msgs = util.GetAdminMessages()
    policy = iam_util.ParsePolicyFile(policy, msgs.Policy)
    return instances.SetPolicy(instance_ref, policy)
示例#2
0
def RemoveInstanceIamPolicyBinding(instance_ref, member, role):
    """Removes a policy binding from an instance IAM policy."""
    policy = instances.GetIamPolicy(instance_ref)
    iam_util.RemoveBindingFromIamPolicy(policy, member, role)
    return instances.SetPolicy(instance_ref, policy)
示例#3
0
def AddInstanceIamPolicyBinding(instance_ref, member, role):
    """Adds a policy binding to an instance IAM policy."""
    msgs = util.GetAdminMessages()
    policy = instances.GetIamPolicy(instance_ref)
    iam_util.AddBindingToIamPolicy(msgs.Binding, policy, member, role)
    return instances.SetPolicy(instance_ref, policy)