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: Some value that we want to have printed later. """ return databases.GetIamPolicy(args.CONCEPTS.database.Parse())
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: Some value that we want to have printed later. """ database_ref = resources.REGISTRY.Parse( args.database, params={'instancesId': args.instance}, collection='spanner.projects.instances.databases') return databases.GetIamPolicy(database_ref)
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)
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)