U Ec_T@s,ddlmZmZmZmZGdddeZdS))NamespacedClient query_params _make_path SKIP_IN_PATHc@seZdZed?ddZedd@ddZeddAdd ZedBd d ZeddCd d ZeddDddZ eddEddZ eddFddZ eddGddZ eddHddZ eddIddZeddddddJdd ZedKd!d"ZedLd#d$ZedMd%d&ZedNd'd(ZedOd)d*ZedPd+d,ZedQd-d.ZedRd/d0ZedSd1d2ZeddTd3d4ZeddUd5d6ZeddVd7d8ZeddWd9d:ZedXd;d<ZedYd=d>ZdS)ZSecurityClientNcCs|jjdd||dS)z Enables authentication as a user and retrieve information about the authenticated user. ``_ GETz/_security/_authenticateparamsheaders transportperform_requestselfr r rD/tmp/pip-target-m1bursmm/lib/python/elasticsearch/client/security.py authenticates zSecurityClient.authenticateZrefreshcCs0|tkrtd|jjdtdd|d|||dS)a Changes the passwords of users in the native realm and built-in users. ``_ :arg body: the new password for the user :arg username: The username of the user to change the password for :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for 2Empty value passed for a required argument 'body'.PUT _securityuserZ _passwordr r bodyr ValueErrorr r r)rrusernamer r rrrchange_password!s zSecurityClient.change_passwordZ usernamescCs.|tkrtd|jjdtdd|d||dS)av Evicts users from the user cache. Can completely clear the cache or evict specific users. ``_ :arg realms: Comma-separated list of realms to clear :arg usernames: Comma-separated list of usernames to clear from the cache z4Empty value passed for a required argument 'realms'.POSTrrealm _clear_cacherr)rZrealmsr r rrrclear_cached_realms:s  z"SecurityClient.clear_cached_realmscCs.|tkrtd|jjdtdd|d||dS)z Evicts roles from the native role cache. ``_ :arg name: Role name 2Empty value passed for a required argument 'name'.rrrolerrrrnamer r rrrclear_cached_rolesOs z!SecurityClient.clear_cached_rolescCs&|tkrtd|jjdd|||dS)a< Creates an API key for access without requiring basic authentication. ``_ :arg body: The api key request to create an API key :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for rr/_security/api_keyrrrr r rrr r rrrcreate_api_keyas zSecurityClient.create_api_keycCs<||fD]}|tkrtdq|jjdtdd||||dS)a) Removes application privileges. ``_ :arg application: Application name :arg name: Privilege name :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for +Empty value passed for a required argument.DELETEr privilegerr)r applicationr$r r paramrrrdelete_privilegests   z SecurityClient.delete_privilegescCs,|tkrtd|jjdtdd|||dS)a Removes roles in the native realm. ``_ :arg name: Role name :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r!r+rr"rrr#rrr delete_roles  zSecurityClient.delete_rolecCs,|tkrtd|jjdtdd|||dS)a Removes role mappings. ``_ :arg name: Role-mapping name :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r!r+r role_mappingrrr#rrrdelete_role_mappings  z"SecurityClient.delete_role_mappingcCs,|tkrtd|jjdtdd|||dS)a Deletes users from the native realm. ``_ :arg username: username :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for 6Empty value passed for a required argument 'username'.r+rrrrrrr r rrr delete_users  zSecurityClient.delete_usercCs.|tkrtd|jjdtdd|d||dS)a Disables users in the native realm. ``_ :arg username: The username of the user to disable :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r3rrrZ_disablerrr4rrr disable_users  zSecurityClient.disable_usercCs.|tkrtd|jjdtdd|d||dS)a Enables users in the native realm. ``_ :arg username: The username of the user to enable :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r3rrrZ_enablerrr4rrr enable_users  zSecurityClient.enable_useridr$ownerZ realm_namercCs|jjdd||dS)aK Retrieves information for one or more API keys. ``_ :arg id: API key id of the API key to be retrieved :arg name: API key name of the API key to be retrieved :arg owner: flag to query API keys owned by the currently authenticated user :arg realm_name: realm name of the user who created this API key to be retrieved :arg username: user name of the user who created this API key to be retrieved rr&rr rrrr get_api_keys zSecurityClient.get_api_keycCs|jjdtdd||||dS)z Retrieves application privileges. ``_ :arg application: Application name :arg name: Privilege name rrr,rr r r)rr-r$r r rrrget_privileges s  zSecurityClient.get_privilegescCs|jjdtdd|||dS)z Retrieves roles in the native realm. ``_ :arg name: Role name rrr"rr;r#rrrget_roles  zSecurityClient.get_rolecCs|jjdtdd|||dS)z Retrieves role mappings. ``_ :arg name: Role-Mapping name rrr1rr;r#rrrget_role_mapping)s  zSecurityClient.get_role_mappingcCs&|tkrtd|jjdd|||dS)z Creates a bearer token for access without requiring basic authentication. ``_ :arg body: The token request to get rr/_security/oauth2/tokenrr'r(rrr get_token8szSecurityClient.get_tokencCs|jjdtdd|||dS)z Retrieves information about users in the native realm and built-in users. ``_ :arg username: A comma-separated list of usernames rrrrr;r4rrrget_userGs  zSecurityClient.get_usercCs|jjdd||dS)z Retrieves application privileges. ``_ rz/_security/user/_privilegesrr rrrrget_user_privilegesVs z"SecurityClient.get_user_privilegescCs0|tkrtd|jjdtdd|d|||dS)a  Determines whether the specified user has a specified list of privileges. ``_ :arg body: The privileges to test :arg user: Username rrrrZ_has_privilegesrr)rrrr r rrrhas_privileges`s  zSecurityClient.has_privilegescCs&|tkrtd|jjdd|||dS)z Invalidates one or more API keys. ``_ :arg body: The api key request to invalidate API key(s) rr+r&rr'r(rrrinvalidate_api_keytsz!SecurityClient.invalidate_api_keycCs&|tkrtd|jjdd|||dS)z Invalidates one or more access tokens or refresh tokens. ``_ :arg body: The token to invalidate rr+r?rr'r(rrrinvalidate_tokenszSecurityClient.invalidate_tokencCs&|tkrtd|jjdd|||dS)a  Adds or updates application privileges. ``_ :arg body: The privilege(s) to add :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for rrz/_security/privilege/rr'r(rrrput_privilegess zSecurityClient.put_privilegescCs<||fD]}|tkrtdq|jjdtdd||||dS)a  Adds and updates roles in the native realm. ``_ :arg name: Role name :arg body: The role to add :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r*rrr"rrrr$rr r r.rrrput_roles   zSecurityClient.put_rolecCs<||fD]}|tkrtdq|jjdtdd||||dS)a/ Creates and updates role mappings. ``_ :arg name: Role-mapping name :arg body: The role mapping to add :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r*rrr1rrrGrrrput_role_mappings   zSecurityClient.put_role_mappingcCs<||fD]}|tkrtdq|jjdtdd||||dS)aq Adds and updates users in the native realm. These users are commonly referred to as native users. ``_ :arg username: The username of the User :arg body: The user to add :arg refresh: If `true` (the default) then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` then do nothing with refreshes. Valid choices: true, false, wait_for r*rrrrr)rrrr r r.rrrput_users   zSecurityClient.put_usercCs|jjdd||dS)z Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch. ``_ rz/_security/privilege/_builtinrr rrrrget_builtin_privilegess z%SecurityClient.get_builtin_privilegescCs.|tkrtd|jjdtdd|d||dS)a Evicts application privileges from the native application privileges cache. ``_ :arg application: A comma-separated list of application names z9Empty value passed for a required argument 'application'.rrr,rrr)rr-r r rrrclear_cached_privilegess z&SecurityClient.clear_cached_privileges)NN)NNN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NN)NNNN)NNN)NNN)NN)NNN)NN)NNN)NN)NN)NN)NN)NN)NN)NN)NN)__name__ __module__ __qualname__rrrr r%r)r/r0r2r5r6r7r:r<r=r>r@rArBrCrDrErFrHrIrJrKrLrrrrrsl                          rN)utilsrrrrrrrrrs