mds_plugin/user.py
def list_user_api_keys(user_name=None, user_id=None, config=None,
                       interactive=True, return_formatted=True):
    """Lists the API Keys of the user

    Args:
        user_name (str): The name of the user
        user_id (str): The OCID of the user
        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 API Keys of the user
    """

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

    import oci.identity

    user = get_user(user_name=user_name, user_id=user_id, config=config)
    if user is None:
        print("Operation cancelled.")
        return

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

    # List the users
    try:
        api_keys = identity.list_api_keys(user.id).data
    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

    if return_formatted:
        out = ""
        i = 1
        for k in api_keys:
            out += (f"{i:>4} {k.fingerprint:49} "
                    f"{k.time_created:%Y-%m-%d %H:%M} {k.lifecycle_state}\n")
            i += 1

        return out
    else:
        return oci.util.to_dict(api_keys)
Lists the API Keys of the user

    Args:
        user_name (str): The name of the user
        user_id (str): The OCID of the user
        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 API Keys of the user
    
Lists the API Keys of the user
Lists the API Keys of the user
def list_user_api_keys(user_name=None, user_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
    user = get_user(user_name=user_name, user_id=user_id, config=config)
    if user is None:
        print("Operation cancelled.")
        return
    identity = core.get_oci_identity_client(config=config)
    try:
        api_keys = identity.list_api_keys(user.id).data
    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
    if return_formatted:
        out = ""
        i = 1
        for k in api_keys:
            out += (f"{i:>4} {k.fingerprint:49} "
                    f"{k.time_created:%Y-%m-%d %H:%M} {k.lifecycle_state}\n")
            i += 1
        return out
    else:
        return oci.util.to_dict(api_keys)
def list_user_api_keys ( user_name = None , user_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 user = get_user ( user_name = user_name , user_id = user_id , config = config ) if user is None : print ( "Operation cancelled." ) return identity = core . get_oci_identity_client ( config = config ) try : api_keys = identity . list_api_keys ( user . id ) . data 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 if return_formatted : out = "" i = 1 for k in api_keys : out += ( f"{i:>4} {k.fingerprint:49} " f"{k.time_created:%Y-%m-%d %H:%M} {k.lifecycle_state}\n" ) i += 1 return out else : return oci . util . to_dict ( api_keys )
Lists the API Keys of the user
Lists the API Keys of the user
"""Lists the API Keys of the user

    Args:
        user_name (str): The name of the user
        user_id (str): The OCID of the user
        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 API Keys of the user
    """ # Get the current config
 # Initialize the identity client
 # List the users

The API Keys of the user
The API Keys of the user
user_name
The name of the user
The name of the user
user_id
The OCID of the user
The OCID of the user
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 .