mds_plugin/user.py
def create_user(**kwargs):
    """Creates a new user

    This function will create a new user.

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        name (str): The name of the user.
        description (str): A description for the user.
        email (str): The email of the user
        config (dict): An OCI config dict
        return_object (bool): If the object should be returned

    Returns:
        The user object or None
    """

    name = kwargs.get("name")
    description = kwargs.get("description")
    email = kwargs.get("email")
    config = kwargs.get("config")
    return_object = kwargs.get("return_object", False)

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

    import oci.identity
    import mysqlsh

    if name is None:
        name = mysqlsh.globals.shell.prompt(
            "Please enter a name for the new user account: ",
            {'defaultValue': ''}).strip()

        if name == '':
            print("User creation cancelled.")
            return

    if description is None:
        description = mysqlsh.globals.shell.prompt(
            "Please enter a description for the new user account [-]: ",
            {'defaultValue': '-'}).strip()

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

    # Setup the user details
    user_details = oci.identity.models.CreateUserDetails(
        compartment_id=config.get("tenancy"),
        name=name,
        description=description if description is not None else "-",
        email=email
    )

    # Create the compartment
    try:
        user = identity.create_user(user_details).data
    except oci.exceptions.ServiceError as e:
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except (ValueError, oci.exceptions.ClientError) as e:
        print(f'ERROR: {e}')

    # Return the response
    if return_object:
        return user
    else:
        print(f"User {name} created.")
Creates a new user

    This function will create a new user.

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        name (str): The name of the user.
        description (str): A description for the user.
        email (str): The email of the user
        config (dict): An OCI config dict
        return_object (bool): If the object should be returned

    Returns:
        The user object or None
    
Creates a new user
This function will create a new user.
Creates a new user This function will create a new user .
def create_user(**kwargs):
    name = kwargs.get("name")
    description = kwargs.get("description")
    email = kwargs.get("email")
    config = kwargs.get("config")
    return_object = kwargs.get("return_object", False)
    try:
        config = configuration.get_current_config(config=config)
    except ValueError as e:
        print(e)
        return
    import oci.identity
    import mysqlsh
    if name is None:
        name = mysqlsh.globals.shell.prompt(
            "Please enter a name for the new user account: ",
            {'defaultValue': ''}).strip()
        if name == '':
            print("User creation cancelled.")
            return
    if description is None:
        description = mysqlsh.globals.shell.prompt(
            "Please enter a description for the new user account [-]: ",
            {'defaultValue': '-'}).strip()
    identity = core.get_oci_identity_client(config=config)
    user_details = oci.identity.models.CreateUserDetails(
        compartment_id=config.get("tenancy"),
        name=name,
        description=description if description is not None else "-",
        email=email
    )
    try:
        user = identity.create_user(user_details).data
    except oci.exceptions.ServiceError as e:
        print(f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})')
        return
    except (ValueError, oci.exceptions.ClientError) as e:
        print(f'ERROR: {e}')
    if return_object:
        return user
    else:
        print(f"User {name} created.")
def create_user ( ** kwargs ) : name = kwargs . get ( "name" ) description = kwargs . get ( "description" ) email = kwargs . get ( "email" ) config = kwargs . get ( "config" ) return_object = kwargs . get ( "return_object" , False ) try : config = configuration . get_current_config ( config = config ) except ValueError as e : print ( e ) return import oci . identity import mysqlsh if name is None : name = mysqlsh . globals . shell . prompt ( "Please enter a name for the new user account: " , { 'defaultValue' : '' } ) . strip ( ) if name == '' : print ( "User creation cancelled." ) return if description is None : description = mysqlsh . globals . shell . prompt ( "Please enter a description for the new user account [-]: " , { 'defaultValue' : '-' } ) . strip ( ) identity = core . get_oci_identity_client ( config = config ) user_details = oci . identity . models . CreateUserDetails ( compartment_id = config . get ( "tenancy" ) , name = name , description = description if description is not None else "-" , email = email ) try : user = identity . create_user ( user_details ) . data except oci . exceptions . ServiceError as e : print ( f'ERROR: {e.message}. (Code: {e.code}; Status: {e.status})' ) return except ( ValueError , oci . exceptions . ClientError ) as e : print ( f'ERROR: {e}' ) if return_object : return user else : print ( f"User {name} created." )
Creates a new user
This function will create a new user.
Creates a new user This function will create a new user .
"""Creates a new user

    This function will create a new user.

    Args:
        **kwargs: Optional parameters

    Keyword Args:
        name (str): The name of the user.
        description (str): A description for the user.
        email (str): The email of the user
        config (dict): An OCI config dict
        return_object (bool): If the object should be returned

    Returns:
        The user object or None
    """ # Get the current config
 # Initialize the identity client
 # Setup the user details
 # Create the compartment
 # Return the response

The user object or None
The user object or None
**kwargs
None