
    9iB                     <   S r SSKrSSK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  \R$                  S:  a  \" \5        \R(                  " S5        \R*                  " \5      r " S S\R0                  5      rS r\rg)z7
This module provides a client class for User Service.
    N)bce_base_client)bce_v1_signer)bce_http_client)handler)http_methods)utils)required)compat3zutf-8c                      \ rS rSrSrSrSS jrSS jr  SS jr\	" \
\4\
\4\
\4S9  SS	 j5       r\	" \
\4S
9  SS j5       r\	" \
\4\
\4S9 SS j5       r\	" \
\4S
9 SS j5       r\	" \
\4\S9 SS j5       r\	" \
\4\S9 SS j5       r\	" \
\4\S9 SS j5       r  SS jr\	" \
\4S
9 SS j5       r\	" \
\4S
9 SS j5       rSrg)UserServiceClient)   z
BLB base sdk client
s   /v1Nc                 B    [         R                  R                  X5        g)uu   初始化BceClient对象。

Args:
    config (dict，可选参数，默认值为None): BceClient的配置字典。

N)r   BceBaseClient__init__)selfconfigs     i/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/blb/user_service_client.pyr   UserServiceClient.__init__/   s     	%%..t<    c                     Uc  U R                   $ [        R                  " U R                   5      nUR                  U5        U$ )zG
:param config:
:type config: baidubce.BceClientConfiguration
:return:
)r   copymerge_non_none_values)r   r   
new_configs      r   _merge_configUserServiceClient._merge_config8   s9     >;;4;;/J,,V4r   c           
          U R                  U5      nUc  [        R                  nUc  SSS.n[        R                  " U[
        R                  [        R                  U/XX4U5      $ )u  
发送请求方法

Args:
    http_method (str): 请求的方法，可选值包括"GET", "POST", "PUT", "DELETE"。
    path (str): 请求路径。
    body (Any, optional): 请求体内容，可以是任意类型。默认值为None。
    headers (dict[bytes, bytes], optional): 请求头信息，以键值对形式存储。默认值为None。
    params (dict[str, str], optional): 请求参数，以键值对形式存储。默认值为None。
    config (dict, optional): 配置信息。
    body_parser (func, optional): 解析响应体的函数。如果为空则默认使用parse_json方法。

Returns:
    Any: 返回请求返回的内容。
s   */*s   application/json;charset=utf-8)s   Accepts   Content-Type)r   r   
parse_jsonr   send_requestr   signparse_error)r   http_methodpathbodyheadersparamsr   body_parsers           r   _send_requestUserServiceClient._send_requestE   sj    $ ##F+!,,K?"((IKG++M&&)<)<k(Jtf6 	6r   )nameserviceName
instanceIdc                 R   [         R                  " U R                  S5      n0 n	Uc  [        5       U	S'   OXYS'   0 n
Ub  [        R
                  " U5      U
S'   XS'   X:S'   XJS'   Ub  XjS'   O	SS	S
./U
S'   U R                  [        R                  U[        R                  " U
5      U	US9$ )a  
Create user service for specified LoadBalancer

:param name:
        name of user service
:type name: string

:param desc:
        description of user service
:type desc: string

:param serviceName:
        The name of service
:type serviceName: string

:param instanceId:
        The id of LoadBalancer
:type instanceId: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param authList:
        List of Auth information
:type service: list<Auth>

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
service   clientTokendescriptionr*   r+   r,   authList*deny)uidauthr$   r&   r   )r   
append_uriversiongenerate_client_tokenr
   convert_to_stringr(   r   POSTjsondumps)r   r*   descr+   r,   client_tokenr1   r   r#   r&   r$   s              r   create_user_service%UserServiceClient.create_user_servicea   s    P i8%:%<F>"%1>""(":":4"@DV)]'\'(+V <=D!!,"3"3T'+zz$'7)/ " 1 	1r   )r.   c                 2   [         R                  " U R                  SU5      n0 nUc  [        5       US'   OXGS'   SUS'   0 nUb  [        R
                  " U5      US'   Ub  XS'   U R                  [        R                  U[        R                  " U5      UUS9$ )a  
Update user service for specified LoadBalancer

:param name:
        name of user service
:type name: string

:param desc:
        description of user service
:type desc: string

:param service:
        domain name of the service
:type service: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s   modifyAttributer0   r*   r6   )r   r7   r8   r9   r
   r:   r(   r   PUTr<   r=   )	r   r*   r>   r.   r?   r   r#   r&   r$   s	            r   update_user_service%UserServiceClient.update_user_service   s    : iA%:%<F>"%1>"%)!""(":":4"@DL!!,"2"2D'+zz$'7)/ " 1 	1r   )r.   r,   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX6S'   SUS'   0 nXS'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Bind a specified LoadBalancer to user service

:param instanceId:
        The id of LoadBalancer
:type instanceId: string

:param service:
        domain name of the service
:type service: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s   bindr,   r6   	r   r7   r8   r9   r(   r   rC   r<   r=   )r   r,   r.   r?   r   r#   r&   r$   s           r   user_service_bind_instance,UserServiceClient.user_service_bind_instance   s    6 iA%:%<F>"%1>"w'\!!,"2"2D'+zz$'7)/ " 1 	1r   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX%S'   SUS'   0 nU R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Unbind a specified LoadBalancer from user service

:param service:
        domain name of the service
:type service: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s   unbindr6   rG   r   r.   r?   r   r#   r&   r$   s          r   user_service_unbind_instance.UserServiceClient.user_service_unbind_instance   s~    , iA%:%<F>"%1>" y!!,"2"2D'+zz$'7)/ " 1 	1r   )r.   r1   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX6S'   SUS'   0 nX'S'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Add a new auth information to user service

:param service:
        domain name of the service
:type service: string

:param authList:
        List of Auth information
:type service: list<Auth>

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s   addAuthr1   r6   rG   r   r.   r1   r?   r   r#   r&   r$   s           r   user_service_add_auth'UserServiceClient.user_service_add_auth#  s    0 iA%:%<F>"%1>"!z#Z!!,"2"2D'+zz$'7)/ " 1 	1r   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX6S'   SUS'   0 nX'S'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Edit auth information to user service
:param service:
        domain name of the service
:type service: string

:param authList:
        List of Auth information
:type service: list<Auth>

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s   editAuthr1   r6   rG   rO   s           r   user_service_edit_auth(UserServiceClient.user_service_edit_authK  s    4 iA%:%<F>"%1>""{#Z!!,"2"2D'+zz$'7)/ " 1 	1r   )r.   uidListc                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX6S'   SUS'   0 nX'S'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Remove auth information from user service

:param service:
        domain name of the service
:type service: string

:param uidList:
        List of uid
:type service: list<String>

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   Nr/   s
   removeAuthrU   r6   rG   )r   r.   rU   r?   r   r#   r&   r$   s           r   user_service_remove_auth*UserServiceClient.user_service_remove_authv  s    6 iA%:%<F>"%1>" $}!Y!!,"2"2D'+zz$'7)/ " 1 	1r   c                    [         R                  " U R                  S5      n0 nUc  [        5       US'   OX6S'   Ub  XS'   Ub  X&S'   OSUS'   0 nU R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Get list of user service

:param marker:
        Mark the start position of query
:type service: string

:param maxKeys:
       Max number of one page, default number is 1000
:type service: integer

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
   servicer/   s   markers   maxKeysi  r6   	r   r7   r8   r9   r(   r   GETr<   r=   )r   markermaxKeysr?   r   r#   r&   r$   s           r   get_user_service_list'UserServiceClient.get_user_service_list  s    2 j9%:%<F>"%1>" &9!(:!%F:!!,"2"2D'+zz$'7)/ " 1 	1r   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX%S'   0 nU R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Get user service detail information

:param service:
        domain name of the service
:type service: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
rZ   r/   r6   r[   rK   s          r   get_user_service_detail)UserServiceClient.get_user_service_detail  st    , j'B%:%<F>"%1>"!!,"2"2D'+zz$'7)/ " 1 	1r   c                     [         R                  " U R                  SU5      n0 nUc  [        5       US'   OX%S'   0 nU R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
Delete user service

:param service:
        domain name of the service
:type service: string

:param client_token:
        If the clientToken is not specified by the user,
        a random String generated by default algorithm will be used.
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r.   r/   r6   )	r   r7   r8   r9   r(   r   DELETEr<   r=   rK   s          r   delete_user_service%UserServiceClient.delete_user_service  st    , iA%:%<F>"%1>"!!,"5"5t'+zz$'7)/ " 1 	1r    )N)NNNNN)NNN)NN)NNNN)__name__
__module____qualname____firstlineno____doc__r8   r   r   r(   r	   bytesstrr@   rD   rH   rL   listrP   rS   rW   r_   rb   rf   __static_attributes__rh   r   r   r   r   )   s    G= 7;/368 E3< #,' 6:26:1':1x ucl#@D6:.1 $.1` ucl' >B(1'(1T ucl#?C#1 $#1J ucl CG$1$1L ucl DH'1'1R ucl EI(1(1T ,0FJ,1\ ucl#:> 1 $ 1D ucl#6: 1 $ 1r   r   c                  >    [        [        R                  " 5       5      $ )z
The default method to generate the random string for client_token
if the optional parameter client_token is not specified by the user.

:return:
:rtype string
)ro   uuiduuid4rh   r   r   generate_client_token_by_uuidru     s     tzz|r   )rm   r   r<   loggingrs   sysbaidubcer   baidubce.authr   baidubce.httpr   r   r   r   baidubce.utilsr	   r
   r8   reloadsetdefaultencoding	getLoggerri   _loggerr   r   ru   r9   rh   r   r   <module>r      s        
 $ ' ) ! &  # ;;
3K7#


H
%k155 k1\ 6 r   