U vi4 @s@dZddlmZddlmZmZmZmZmZGddde Z dS)z Users are those with access to InfluxDB. To grant a user permission to access data, add them as a member of an organization and provide them with an authentication token. )Union) UsersServiceUserUsers UserResponsePasswordResetBodyc@seZdZdZddZedddZeeddd Zee d d d Z e eee fed dddZ e eee fd d ddZ edddZe eee fdddZd S)UsersApiz,Implementation for '/api/v2/users' endpoint.cCs||_t|j|_dS)zInitialize defaults.N)Z_influxdb_clientrZ api_client_service)selfinfluxdb_clientr Q/opt/alt/python38/lib/python3.8/site-packages/influxdb_client/client/users_api.py__init__szUsersApi.__init__)returncCs|j}|S)z&Return the current authenticated user.)r Zget_mer userr r r mes z UsersApi.me)namercCst|d}|jj|dS)zCreate a user.)rr)rr Z post_users)r rrr r r create_users zUsersApi.create_user)rrcCs|jj|j|dS)zcUpdate a user. :param user: User update to apply (required) :return: User )user_idr)r Zpatch_users_ididrr r r update_userszUsersApi.update_userN)rpasswordrcCs||}|jj|t|dS)zUpdate a password. :param user: User to update password (required) :param password: New password (required) :return: None )rZpassword_reset_body)_user_idr Zpost_users_id_passwordr)r rrrr r r update_password's zUsersApi.update_passwordcCs||}|jj|dS)zSDelete a user. :param user: user id or User :return: None )r)rr Zdelete_users_idr rrr r r delete_user2s zUsersApi.delete_usercKs|jjf|S)aList all users. :key int offset: The offset for pagination. The number of records to skip. :key int limit: Limits the number of records returned. Default is `20`. :key str after: The last resource ID from which to seek from (but not including). This is to be used instead of `offset`. :key str name: The user name. :key str id: The user ID. :return: Buckets )r Z get_users)r kwargsr r r find_users<s zUsersApi.find_usersrcCs,t|tr|j}nt|tr$|j}n|}|S)N) isinstancerrrrr r r rIs   zUsersApi._user_id)__name__ __module__ __qualname____doc__rrrstrrrrrrrrrrr r r r r s   rN) r$typingrr rrrrrobjectrr r r r s