
    9i_                         S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSK
Jr  SSK
Jr  SS	K
Jr  SS
K
Jr  SSKJr  SSKJr  \R(                  " \5      r " S S\	5      rg)z(
This module provides a client for IAM.
    N)	iteritems)bce_v1_signer)BceBaseClient)bce_http_client)handler)http_content_types)http_headers)http_methods)iam)requiredc                      \ rS rSrSrS6S jr     S7S jrS rS rS r	S	 r
S
 rS rS rS r\" \\4S9S 5       rS rS8S jrS6S jrS6S jrS rS6S jrS6S jrS rS6S jrS6S jrS r\" \\4\\4S9S 5       rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+\" \\4\\4S*9S+ 5       r,S, r-S- r.S. r/S/ r0S0 r1S1 r2S2 r3S3 r4S4 r5S5r6g)9	IamClient$   z
sdk client
Nc                 0    [         R                  " X5        g N)r   __init__)selfconfigs     `/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/iam/iam_client.pyr   IamClient.__init__)   s    t,    c           
          U R                  U5      n[        R                  U-   nUc  [        R                  n[
        R                  " U[        R                  [        R                  U/XX4U5      $ r   )
_merge_configr   
URL_PREFIXr   
parse_jsonr   send_requestr   signparse_error)r   http_methodpathbodyheadersparamsr   body_parsers           r   _send_iam_requestIamClient._send_iam_request,   se     ##F+~~$!,,K++M&&)<)<k(Jtf6 	6r   c                     Uc  U R                   $ [        R                  " U R                   5      nUR                  U5        U$ r   )r   copymerge_non_none_values)r   r   
new_configs      r   r   IamClient._merge_config=   s7    >;;4;;/J,,V4r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ 7
:type role_name: bytes

:return:
    **HttpResponse**
   /role/r"   r    r%   r
   GETr	   CONTENT_TYPEr   JSONr   	role_namer    s      r   get_roleIamClient.get_roleG   G     9$%%!..0B0G0GH & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSnU R                  [        R                  [        R                  [        R                  0UUS9$ )z@
:type create_role_request: dict

:return:
    **HttpResponse**
Ns"   create_role_request should be dict   /roler"   r    r!   
isinstancedict	TypeErrorjsondumpsr%   r
   POSTr	   r3   r   r4   )r   create_role_requestr!   r    s       r   create_roleIamClient.create_roleV   y     &D1488 EFFzz"56%%!..0B0G0GH	 & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSU-   nU R                  [        R                  [        R                  [        R                  0UUS9$ )zW
:type role_name: bytes
:type update_role_request: dict

:return:
    **HttpResponse**
Ns"   update_role_request should be dictr/   r<   r>   r?   r@   rA   rB   r%   r
   PUTr	   r3   r   r4   )r   r6   update_role_requestr!   r    s        r   update_roleIamClient.update_rolem   s~     &D1488 EFFzz"569$%%!..0B0G0GH	 & 
 	
r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ r-   r%   r
   DELETEr	   r3   r   r4   r5   s      r   delete_roleIamClient.delete_role   G     9$%%!..0B0G0GH & 
 	
r   c                     SnU R                  [        R                  [        R                  [
        R                  0US9$ )
:return:
    **HttpResponse**
r;   r0   r1   r   r    s     r   	list_roleIamClient.list_role   B    
 %%!..0B0G0GH & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSnU R                  [        R                  [        R                  [        R                  0UUS9$ )zB
:type create_policy_request: dict

:return:
    **HttpResponse**
Ns$   create_policy_request should be dict   /policyr<   r=   )r   create_policy_requestr!   r    s       r   create_policyIamClient.create_policy   sy     !(D3T:: GHHzz"78%%!..0B0G0GH	 & 
 	
r   c                     SU-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ )zQ
:type policy_name: bytes
:type policy_type: bytes
:return:
    **HttpResponse**
   /policy/
   policyTyper"   r    r#   r1   )r   policy_namepolicy_typer    r#   s        r   
get_policyIamClient.get_policy   sT     [(-%%!..0B0G0GH	 & 
 	
r   )rc   c                 P   Un[        U[        5      (       a  UR                  S5      nUc  SnO6[        U[        5      (       d  [	        S5      e[
        R                  " U5      nSU-   nU R                  [        R                  [        R                  [        R                  0UUS9$ )zB
:type update_policy_request: dict

:return:
    **HttpResponse**
utf-8Ns$   update_policy_request should be dictr`   r<   )r>   strencoder?   r@   rA   rB   r%   r
   rC   r	   r3   r   r4   )r   rc   update_policy_requestpolicy_name_bytesr!   r    s         r   update_policyIamClient.update_policy   s     (k3'' + 2 27 ; (D3T:: GHHzz"78..%%!..0B0G0GH	 & 
 	
r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ )z9
:type policy_name: bytes

:return:
    **HttpResponse**
r`   r0   rO   )r   rc   r    s      r   delete_policyIamClient.delete_policy   sG     [(%%!..0B0G0GH & 
 	
r   c                     SnXS.nU R                  [        R                  [        R                  [
        R                  0UUS9$ )zm
:type policy_type: bytes

:type name_filter: bytes
:param name_filter: bytes

:return:
    **HttpResponse**
r[   )ra   s
   nameFilterrb   r1   )r   rd   name_filterr    r#   s        r   list_policyIamClient.list_policy   sM     !,I%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ z
:type user_name: bytes
:type policy_name: bytes

:type policy_type: bytes
:param policy_type: None

:return:
    **HttpResponse**
   /user/r`   ra   rb   r%   r
   rJ   r	   r3   r   r4   r   	user_namerc   rd   r    r#   s         r   attach_policy_to_userIamClient.attach_policy_to_user  ^     9${2[@-%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ rw   rO   rz   s         r   detach_policy_from_user!IamClient.detach_policy_from_user  ^     9${2[@-%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ )7
:type user_name: bytes

:return:
    **HttpResponse**
rx   r[   r0   r1   r   r{   r    s      r   list_policies_from_user!IamClient.list_policies_from_user,  L     9$z1%%!..0B0G0GH & 
 	
r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ )
:type group_name: bytes
:type policy_name: bytes

:type policy_type: bytes
:param policy_type: None

:return:
    **HttpResponse**
   /group/r`   
policyTyperb   ry   r   
group_namerc   rd   r    r#   s         r   attach_policy_to_group IamClient.attach_policy_to_group:  s^     J&4{B,%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ )r   r   r`   ra   rb   rO   r   s         r   detach_policy_from_group"IamClient.detach_policy_from_groupN  s^     J&4{B-%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ )8
:type group_name: bytes

:return:
    **HttpResponse**
r   r[   r0   r1   r   r   r    s      r   list_policies_from_group"IamClient.list_policies_from_groupb  sL     J&3%%!..0B0G0GH & 
 	
r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ z
:type role_name: bytes
:type policy_name: bytes

:type policy_type: bytes
:param policy_type: None

:return:
    **HttpResponse**
r/   r`   ra   rb   ry   r   r6   rc   rd   r    r#   s         r   attach_policy_to_roleIamClient.attach_policy_to_rolep  r~   r   c                     SU-   S-   U-   nSU0nU R                  [        R                  [        R                  [
        R                  0UUS9$ r   rO   r   s         r   detach_policy_from_role!IamClient.detach_policy_from_role  r   r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ )r.   r/   r[   r0   r1   r5   s      r   list_policies_from_role!IamClient.list_policies_from_role  r   r   )	policy_id
grant_typec                 2   Un[        U[        5      (       a  UR                  S5      nUn[        U[        5      (       a  UR                  S5      nSU-   S-   U-   nU R                  [        R
                  [        R                  [        R                  0US9$ )zw
:type policy_id: bytes        :type grant_type:

: grant_type: UserPolicy, GroupPolicy

:return:
    **HttpResponse**
rh   r`   s   /grant/r0   )
r>   ri   rj   r%   r
   r2   r	   r3   r   r4   )r   r   r   policy_id_bytesgrant_type_bytesr    s         r   $list_attached_entities_by_grant_type.IamClient.list_attached_entities_by_grant_type  s     $i%%'..w7O%j#&&)009_,z9<LL%%!..0B0G0GH & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSnU R                  [        R                  [        R                  [        R                  0UUS9$ )z@
:type create_user_request: dict

:return:
    **HttpResponse**
Ns"   create_user_request should be dict   /userr<   r=   )r   create_user_requestr!   r    s       r   create_userIamClient.create_user  rG   r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   rx   r0   r1   r   s      r   get_userIamClient.get_user  r9   r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSU-   nU R                  [        R                  [        R                  [        R                  0UUS9$ )zV
:type user_name: bytes
:type update_user_request: dict
:return:
    **HttpResponse**
Ns"   update_user_request should be dictrx   r<   rI   )r   r{   update_user_requestr!   r    s        r   update_userIamClient.update_user  s~     &D1488 EFFzz"569$%%!..0B0G0GH	 & 
 	
r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   rO   r   s      r   delete_userIamClient.delete_user  rS   r   c                     SnU R                  [        R                  [        R                  [
        R                  0US9$ )rU   r   r0   r1   rV   s     r   	list_userIamClient.list_user  rY   r   c                    Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSU-   S-   nU R                  [        R                  [        R                  [        R                  0UUS9$ )ze
:type user_name: bytes
:type update_user_login_profile_request: dict

:return:
    **HttpResponse**
Ns0   update_user_login_profile_request should be dictrx      /loginProfiler<   rI   )r   r{   !update_user_login_profile_requestr!   r    s        r   update_user_login_profile#IamClient.update_user_login_profile  s     -4D?FF STTzz"CD9$'77%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   rx   r   r0   r1   r   s      r   get_user_login_profile IamClient.get_user_login_profile0  sM     9$'77%%!..0B0G0GH & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   rO   r   s      r   delete_user_login_profile#IamClient.delete_user_login_profile?  sM     9$'77%%!..0B0G0GH & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   rx   s
   /accesskeyr0   )r%   r
   rC   r	   r3   r   r4   r   s      r   create_user_accesskeyIamClient.create_user_accesskeyM  sL     9$}4%%!..0B0G0GH & 
 	
r   c                     SU-   S-   U-   nSS0nU R                  [        R                  [        R                  [
        R                  0UUS9$ )Q
:type user_name: bytes
:type accesskey_id: bytes

:return:
    **HttpResponse**
rx      /accesskey/disable rb   ry   r   r{   accesskey_idr    r#   s        r   disable_user_accesskey IamClient.disable_user_accesskey[  s]     9$~5DR%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   U-   nSS0nU R                  [        R                  [        R                  [
        R                  0UUS9$ )r   rx   r   enabler   rb   ry   r   s        r   enable_user_accesskeyIamClient.enable_user_accesskeyl  s]     9$~5DB%%!..0B0G0GH	 & 
 	
r   c                     SU-   S-   U-   nU R                  [        R                  [        R                  [
        R                  0US9$ )r   rx   r   r0   rO   )r   r{   r   r    s       r   delete_user_accesskeyIamClient.delete_user_accesskey}  sQ     9$~5D%%!..0B0G0GH & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ r   r1   r   s      r   list_user_accesskeyIamClient.list_user_accesskey  sL     9$}4%%!..0B0G0GH & 
 	
r   )r{   mfa_typec                 2   Un[        U[        5      (       a  UR                  S5      nUn[        U[        5      (       a  UR                  S5      nSU-   S-   U-   nU R                  [        R
                  [        R                  [        R                  0US9$ )zV
:type user_name: bytes            :type mfa_type:
:mfa_type: TOTP

:return:
    none
rh   rx   s	   /mfaType/r0   )
r>   ri   rj   r%   r
   rP   r	   r3   r   r4   )r   r{   r   user_name_bytesmfa_type_bytesr    s         r   unbind_user_mfa_device IamClient.unbind_user_mfa_device  s     $i%%'..w7O!h$$%__W5N?*\9NJ%%!..0B0G0GH & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSnU R                  [        R                  [        R                  [        R                  0UUS9$ )z@
:type create_group_request:dict

:return:
    **HttpResponse**
Ns#   create_group_request should be dict   /groupr<   r=   )r   create_group_requestr!   r    s       r   create_groupIamClient.create_group  sy      'D2D99 FGGzz"67%%!..0B0G0GH	 & 
 	
r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ )z7
:type group_name: bytes
:return:
    **HttpResponse**
r   r0   r1   r   s      r   	get_groupIamClient.get_group  sG     J&%%!..0B0G0GH & 
 	
r   c                     Uc  SnO6[        U[        5      (       d  [        S5      e[        R                  " U5      nSU-   nU R                  [        R                  [        R                  [        R                  0UUS9$ )zY
:type group_name: bytes
:type update_group_request: dict

:return:
    **HttpResponse**
Ns#   update_group_request should be dictr   r<   rI   )r   r   update_group_requestr!   r    s        r   update_groupIamClient.update_group  s~      'D2D99 FGGzz"67J&%%!..0B0G0GH	 & 
 	
r   c                     SU-   nU R                  [        R                  [        R                  [
        R                  0US9$ )r   r   r0   rO   r   s      r   delete_groupIamClient.delete_group  sG     J&%%!..0B0G0GH & 
 	
r   c                     SnU R                  [        R                  [        R                  [
        R                  0US9$ )rU   r   r0   r1   rV   s     r   
list_groupIamClient.list_group  sB    
 %%!..0B0G0GH & 
 	
r   c                     SU-   S-   U-   nU R                  [        R                  [        R                  [
        R                  0US9$ )zN
:type group_name: bytes
:type user_name: bytes
:return:
    **HttpResponse**
r   rx   r0   ry   r   r   r{   r    s       r   add_user_to_groupIamClient.add_user_to_group  sQ     J&2Y>%%!..0B0G0GH & 
 	
r   c                     SU-   S-   U-   nU R                  [        R                  [        R                  [
        R                  0US9$ )zO
:type group_name: bytes
:type user_name: bytes

:return:
    **HttpResponse**
r   rx   r0   rO   r   s       r   remove_user_from_group IamClient.remove_user_from_group  sQ     J&2Y>%%!..0B0G0GH & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ )r   rx   r   r0   r1   r   s      r   list_user_groupIamClient.list_user_group(  sL     9$y0%%!..0B0G0GH & 
 	
r   c                     SU-   S-   nU R                  [        R                  [        R                  [
        R                  0US9$ )r   r   r   r0   r1   r   s      r   list_group_userIamClient.list_group_user6  sL     J&1%%!..0B0G0GH & 
 	
r    r   )NNNNN)NN)7__name__
__module____qualname____firstlineno____doc__r   r%   r   r7   rE   rL   rQ   rW   r]   re   r   bytesri   rm   rp   rt   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  __static_attributes__r  r   r   r   r   $   sR   -  $"&!%!%&*6"

.
0



.
  5#,'
 (
4

&
(
(

(
(

(
(
 %>
 ?
4
.

.



0



"
"

 s|<
 =
2
.

2






r   r   )r  r(   rA   loggingfuture.utilsr   baidubce.authr   baidubce.bce_base_clientr   baidubce.httpr   r   r   r	   r
   baidubce.servicesr   baidubce.utilsr   	getLoggerr  _loggerr   r  r   r   <module>r     sQ       " ' 2 ) ! , & & ! #


H
%^
 ^
r   