o |nh@s4dZddlmZddlmZdZGdddeZdS)zUSERPASS methods module.)utils) VaultApiBaseuserpassc@s^eZdZdZddefddZefddZefddZefd d Zefd d Z d efddZ dS)UserpasszhUSERPASS Auth Method (API). Reference: https://www.vaultproject.io/api/auth/userpass/index.html NcKs8t||d}||dj||d}|jj||dS)a Create/update user in userpass. Supported methods: POST: /auth/{mount_point}/users/{username}. Produces: 204 (empty body) :param username: The username for the user. :type username: str | unicode :param password: The password for the user. Only required when creating the user. :type password: str | unicode :param policies: The list of policies to be set on username created. :type policies: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :param kwargs: Additional arguments to pass along with the corresponding request to Vault. :type kwargs: dict )passwordpolicies'/v1/auth/{mount_point}/users/{username} mount_pointusernameurljson)r remove_nonesupdateformat_adapterpost)selfr rrr kwargsparamsapi_pathrI/usr/local/lib/python3.10/dist-packages/hvac/api/auth_methods/userpass.pycreate_or_update_users zUserpass.create_or_update_usercCsd|d}|jj|dS)a List existing users that have been created in the auth method Supported methods: LIST: /auth/{mount_point}/users. Produces: 200 application/json :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the list_groups request. :rtype: dict z /v1/auth/z/usersr )rlist)rr rrrr list_user7s zUserpass.list_usercCdj||d}|jj|dS)a Read user in the auth method. Supported methods: GET: /auth/{mount_point}/users/{username}. Produces: 200 application/json :param username: The username for the user. :type name: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the read_group request. :rtype: dict rr r)rrgetrr r rrrr read_userH zUserpass.read_usercCr)a Delete user in the auth method. Supported methods: GET: /auth/{mount_point}/users/{username}. Produces: 200 application/json :param username: The username for the user. :type name: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode :return: The JSON response of the read_group request. :rtype: dict rr r)rrdeleter rrr delete_user]r"zUserpass.delete_usercCs&d|i}dj||d}|jj||dS)a update password for the user in userpass. Supported methods: POST: /auth/{mount_point}/users/{username}/password. Produces: 204 (empty body) :param username: The username for the user. :type username: str | unicode :param password: The password for the user. Only required when creating the user. :type password: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode rz0/v1/auth/{mount_point}/users/{username}/passwordr r )rrr)rr rr rrrrrupdate_password_on_userrsz Userpass.update_password_on_userTcCs(d|i}dj||d}|jj|||dS)a Log in with USERPASS credentials. Supported methods: POST: /auth/{mount_point}/login/{username}. Produces: 200 application/json :param username: The username for the user. :type username: str | unicode :param password: The password for the user. Only required when creating the user. :type password: str | unicode :param mount_point: The "path" the method/backend was mounted on. :type mount_point: str | unicode rz'/v1/auth/{mount_point}/login/{username}r )r use_tokenr)rrlogin)rr rr&r rrrrrr'szUserpass.login) __name__ __module__ __qualname____doc__DEFAULT_MOUNT_POINTrrr!r$r%r'rrrrr s )   rN)r+hvacrhvac.api.vault_api_baserr,rrrrrs