def Run(self, args):
    """This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      A IAM policy message.
    """
    instance_ref = util.GetInstanceRef(args.instance)
    return instances.GetIamPolicy(instance_ref)
Exemple #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)
Exemple #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)