mds_plugin/user.py
def list_group_users(name=None, group_id=None, config=None,
                     interactive=True, return_formatted=True):
    """lists the members of a given group
    Args:
        name (str): The name of the group
        group_id (str): The OCID of the group
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        The user account details
    """

    # Get the current config
    try:
        config = configuration.get_current_config(config=config)
    except ValueError as e:
        print(e)
        return

    import oci.identity
    import re

    group = get_group(name=name, group_id=group_id, config=config)
    if group is None:
        print("Operation cancelled.")
        return

    # Initialize the identity client
    identity = core.get_oci_identity_client(config=config)

    try:
        # List the users of the given group
        data = identity.list_user_group_memberships(
            compartment_id=config.get("tenancy"), group_id=group.id).data

        users = []
        for m in data:
            if return_formatted:
                users.append(identity.get_user(user_id=m.user_id).data)
            else:
                users.append(oci.util.to_dict(
                    identity.get_user(user_id=m.user_id).data))

        if return_formatted:
            if len(users) > 0:
                print(f"Users in group {group.name}:")
                print(format_user_listing(users))
            else:
                print("No users in this group.")
        else:
            return users
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except Exception as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
lists the members of a given group
    Args:
        name (str): The name of the group
        group_id (str): The OCID of the group
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        The user account details
    
lists the members of a given group
lists the members of a given group
def list_group_users(name=None, group_id=None, config=None,
                     interactive=True, return_formatted=True):
    try:
        config = configuration.get_current_config(config=config)
    except ValueError as e:
        print(e)
        return
    import oci.identity
    import re
    group = get_group(name=name, group_id=group_id, config=config)
    if group is None:
        print("Operation cancelled.")
        return
    identity = core.get_oci_identity_client(config=config)
    try:
        data = identity.list_user_group_memberships(
            compartment_id=config.get("tenancy"), group_id=group.id).data
        users = []
        for m in data:
            if return_formatted:
                users.append(identity.get_user(user_id=m.user_id).data)
            else:
                users.append(oci.util.to_dict(
                    identity.get_user(user_id=m.user_id).data))
        if return_formatted:
            if len(users) > 0:
                print(f"Users in group {group.name}:")
                print(format_user_listing(users))
            else:
                print("No users in this group.")
        else:
            return users
    except oci.exceptions.ServiceError as e:
        if not interactive:
            raise
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except Exception as e:
        if not interactive:
            raise
        print(f'ERROR: {e}')
        return
def list_group_users ( name = None , group_id = None , config = None , interactive = True , return_formatted = True ) : try : config = configuration . get_current_config ( config = config ) except ValueError as e : print ( e ) return import oci . identity import re group = get_group ( name = name , group_id = group_id , config = config ) if group is None : print ( "Operation cancelled." ) return identity = core . get_oci_identity_client ( config = config ) try : data = identity . list_user_group_memberships ( compartment_id = config . get ( "tenancy" ) , group_id = group . id ) . data users = [ ] for m in data : if return_formatted : users . append ( identity . get_user ( user_id = m . user_id ) . data ) else : users . append ( oci . util . to_dict ( identity . get_user ( user_id = m . user_id ) . data ) ) if return_formatted : if len ( users ) > 0 : print ( f"Users in group {group.name}:" ) print ( format_user_listing ( users ) ) else : print ( "No users in this group." ) else : return users except oci . exceptions . ServiceError as e : if not interactive : raise print ( f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) return except Exception as e : if not interactive : raise print ( f'ERROR: {e}' ) return
lists the members of a given group
lists the members of a given group
"""lists the members of a given group
    Args:
        name (str): The name of the group
        group_id (str): The OCID of the group
        config (object): An OCI config object or None.
        interactive (bool): If set to false exceptions are raised
        return_formatted (bool): If set to true, a list object is returned.

    Returns:
        The user account details
    """ # Get the current config
 # Initialize the identity client
 # List the users of the given group

The user account details
The user account details
name
The name of the group
The name of the group
group_id
The OCID of the group
The OCID of the group
config
An OCI config object or None.
An OCI config object or None .
interactive
If set to false exceptions are raised
If set to false exceptions are raised
return_formatted
If set to true, a list object is returned.
If set to true a list object is returned .