def add_member_cli(api_client, parent_name, user_name, group_name): """Add a user or group to a group.""" member_type = None member_name = None if user_name: member_type = "user" member_name = user_name elif group_name: member_type = "group" member_name = group_name GroupsApi(api_client).add_member(parent_name, member_type, member_name)
def list_parents_cli(api_client, user_name=None, group_name=None): """Retrieve all groups in which a given user or group is a member.""" member_type = None member_name = None if user_name: member_type = "user" member_name = user_name elif group_name: member_type = "group" member_name = group_name content = GroupsApi(api_client).list_parents(member_type, member_name) click.echo(pretty_format(content))
def remove_member_cli(api_client, parent_name, user_name=None, group_name=None): """Remove a user or group from a group.""" member_type = None member_name = None if user_name: member_type = "user" member_name = user_name elif group_name: member_type = "group" member_name = group_name GroupsApi(api_client).remove_member(parent_name=parent_name, member_type=member_type, member_name=member_name)
def list_all_cli(api_client): """Return all of the groups in an organization.""" content = GroupsApi(api_client).list_all() click.echo(pretty_format(content))
def list_members_cli(api_client, group_name): """Return all of the members of a particular group.""" content = GroupsApi(api_client).list_members(group_name) click.echo(pretty_format(content))
def create_cli(api_client, group_name): """Create a new group with the given name.""" content = GroupsApi(api_client).create(group_name) click.echo(pretty_format(content))
def add_member_cli(api_client, parent_name, user_name, group_name): """Add a user or group to a group.""" GroupsApi(api_client).add_member(parent_name=parent_name, user_name=user_name, group_name=group_name)
def delete_cli(api_client, group_name): """Remove a group from this organization.""" content = GroupsApi(api_client).delete(group_name) click.echo(pretty_format(content))
def remove_member_cli(api_client, parent_name, user_name, group_name): GroupsApi(api_client).remove_member(parent_name=parent_name, user_name=user_name, group_name=group_name)
def list_parents_cli(api_client, user_name, group_name): """Retrieve all groups in which a given user or group is a member.""" content = GroupsApi(api_client).list_parents(user_name=user_name, group_name=group_name) click.echo(pretty_format(content))