
    9iY                        S 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$                  " \5      r\R*                  S   S:X  a  \\4rO\\4r " S S\R4                  5      rg)z.
This module provides a client class for BES.
    N)bce_base_client)compat)bce_v1_signer)bce_http_client)handler)http_methods)	bes_model)required   c                   @   \ rS rSrSrSrS!S jr\" \\\	\\
\\\\\R                  S9
 S!S j5       r\" \\\\\	S9 S!S	 j5       r\" \\S
9 S!S j5       r\" \S9 S!S j5       r\" \S9 S!S j5       r\" \S9 S!S j5       r\" \S9 S!S j5       r\" \\S9 S!S j5       r\" \\S9 S!S j5       r\" \\\\\S9 S!S j5       r\" \\\S9 S!S j5       r\" \	\\\\	\\S9 S!S j5       r S!S jr\" \\\\S9 S!S j5       r\" \S9 S!S j5       rS!S jr  S"S jrS rg)#	BesClient'   z
Bes sdk client
s   /api/bes/clusterNc                 B    [         R                  R                  X5        g N)r   BceBaseClient__init__)selfconfigs     `/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/bes/bes_client.pyr   BesClient.__init__-   s    %%..t<    )
namepasswordmodulesversionis_old_packageavailable_zonesecurity_group_idsubnet_uuidvpc_idbillingc                 0   SnSnUb  SU0n/ nU H  nUR                  UR                  5        M      UUUUUUUUU	U
R                  S.
nU R                  R                  nUSS.nU R	                  [
        R                  X[        R                  " U5      US9$ )a  
Create cluster

:param name: The parameter to specify es cluster name.
:type name: string

:param password: The parameter to specify password for manage cluster.
:type password: string

:param modules: The parameter to specify modules for cluster.
:type modules: array

:param version: The parameter to specify es cluster version.
:type version: string

:param is_old_package: The parameter to specify is old package
:type is_old_package: bool

:param available_zone: he parameter to specify security zone.
:type available_zone: string

:param security_group_id: The parameter to specify id of the securityGroup.
:type security_group_id: string

:param subnet_uuid: The parameter to specify id of the subnet.
:type subnet_uuid: string

:param vpc_id: The parameter to specify id of the vpc.
:type vpc_id: string

:param billing: The parameter to specify id of billing info.
:type billing: xxx

:return:
:rtype baidubce.bce_response.BceResponse
s   /createNclientToken)
r   r   r   r   isOldPackageavailableZonesecurityGroupId
subnetUuidvpcIdr!      application/json;charset=UTF-8s   x-Regions   content-typeparamsbodyheaders	append__dict__r   region_send_requestr   POSTjsondumps)r   r   r   r   r   r   r   r   r   r    r!   client_tokenpathr,   module_json_arraymoduler-   r2   r.   s                      r   create_clusterBesClient.create_cluster0   s    t  #|F F$$V__5   (*+0%''
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )r   payment_type
cluster_idr2   r   c                    SnSS0n/ n	U H  n
U	R                  U
R                  5        M      UUU	UUS.nU R                  R                  nUSS.nU R	                  [
        R                  Xx[        R                  " U5      US9$ )a  
resize cluster

:param name: The parameter to specify es cluster name.
:type name: string

:param payment_type: The parameter to specify mode of payment.
:type payment_type: string

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: array

:param region: The parameter to specify region.
:type region: string

:param modules: The parameter to specify the type of es cluster node resource.
:type modules: list

:return:
:rtype baidubce.bce_response.BceResponse
s   /resize	orderTypeRESIZE)r   paymentTyper   	clusterIdr2   r)   r*   r+   r/   )r   r   r=   r>   r2   r   r7   r8   r,   r9   r:   r-   r.   s                r   resize_clusterBesClient.resize_cluster   s    B 
 F$$V__5  '(#
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )page_no	page_sizec                     SnSnUb  SU0nUUS.nU R                   R                  nUSS.nU R                  [        R                  XE[
        R                  " U5      US9$ )z
get es cluster list
:param page_no: The parameter to specify cluster list pageNo.
:type page_no: int

:param page_size: The parameter to specify cluster list pageSize.
:type page_size: int

:return:
:rtype baidubce.bce_response.BceResponse
s   /listNr#   )pageNopageSizer)   r*   r+   r   r2   r3   r   r4   r5   r6   )	r   rF   rG   r7   r8   r,   r-   r2   r.   s	            r   get_cluster_listBesClient.get_cluster_list   s{    "  #|F !
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )r>   c                     SnSnUb  SU0nSU0nU R                   R                  nUSS.nU R                  [        R                  X4[
        R                  " U5      US9$ )z
get cluster detail info

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /detailNr#   rC   r)   r*   r+   rK   r   r>   r7   r8   r,   r-   r2   r.   s           r   get_cluster_detailBesClient.get_cluster_detail   z      #|F 
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nSU0nU R                   R                  nUSS.nU R                  [        R                  X4[
        R                  " U5      US9$ )z
start es cluster

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /startNr#   rC   r)   r*   r+   rK   rO   s           r   start_clusterBesClient.start_cluster  sz      #|F 
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nSU0nU R                   R                  nUSS.nU R                  [        R                  X4[
        R                  " U5      US9$ )z
stop es cluster

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /stopNr#   rC   r)   r*   r+   rK   rO   s           r   stop_clusterBesClient.stop_cluster+  sz      #|F 
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nSU0nU R                   R                  nUSS.nU R                  [        R                  X4[
        R                  " U5      US9$ )z
delete es cluster

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /deleteNr#   rC   r)   r*   r+   rK   rO   s           r   delete_clusterBesClient.delete_clusterK  rR   r   )r>   instance_idc                     SnSnUb  SU0nUUS.nU R                   R                  nUSS.nU R                  [        R                  XE[
        R                  " U5      US9$ )z
start instance of es cluster

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:param instance_id: The parameter to specify cluster id.
:type instance_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /instance/startNr#   rC   
instanceIdr)   r*   r+   rK   	r   r>   r\   r7   r8   r,   r-   r2   r.   s	            r   start_instanceBesClient.start_instancek  s{    $ " #|F $%
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nUUS.nU R                   R                  nUSS.nU R                  [        R                  XE[
        R                  " U5      US9$ )z
stop instance of es cluster

:param cluster_id: The parameter to specify cluster id.
:type cluster_id: string

:param instance_id: The parameter to specify cluster id.
:type instance_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /instance/stopNr#   r^   r)   r*   r+   rK   r`   s	            r   stop_instanceBesClient.stop_instance  s{    $ ! #|F $%
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )orderorder_byrF   rG   days_to_expirationc                     SnSnUb  SU0nUUUUUS.n	U R                   R                  n
U
SS.nU R                  [        R                  Xx[
        R                  " U	5      US9$ )a  
get es cluster renew list

:param order: The parameter to specify order rule.
:type order: string

:param order_by: The parameter to specify order field.
:type order_by: string

:param page_no: The parameter to specify renew cluster list pageNo.
:type page_no: int

:param page_size: The parameter to specify renew cluster list pageSize.
:type page_size: int

:param days_to_expiration: The parameter to specify how many days expire.
:type days_to_expiration: int

:return:
:rtype baidubce.bce_response.BceResponse
s   /renew/listNr#   )rI   rJ   daysToExpirationrf   orderByr)   r*   r+   rK   )r   rf   rg   rF   rG   rh   r7   r8   r,   r-   r2   r.   s               r   get_renew_listBesClient.get_renew_list  s    B #|F ! 2
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )rf   r>   timec                     SnSnSS0nUb  X5S'   SUUS.nU R                   R                  nUSS	.nU R                  [        R                  XE[
        R                  " U5      US
9$ )z
renew es cluster

:param cluster_id: The parameter to specify order cluster id.
:type cluster_id: string

:param time: The parameter to specify renew time, unit month.
:type time: int

:return:
:rtype baidubce.bce_response.BceResponse
s   /renewNr@   RENEWr#   BES)serviceTypern   rC   r)   r*   r+   rK   )	r   r>   rn   r7   r8   r,   r-   r2   r.   s	            r   renew_clusterBesClient.renew_cluster  s    & 
 #$0=! #

 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )cluster_idsuser_idr2   service_typeservice_idsrenew_time_unit
renew_timec                     SnSnUb  SU0nUUUSUUS.n	U R                   R                  nUSS.n
U R                  [        R                  Xx[
        R                  " U	5      U
S9$ )	a  
create cluster auto renew rule

:param cluster_ids: The parameter to cluster id list.
:type cluster_ids: list

:param user_id: The parameter to specify account id.
:type user_id: string

:param region: The parameter to specify region.
:type region: string

:param renew_time_unit: The parameter to specify renew time unit.
:type renew_time_unit: string

:param renew_time: The parameter to specify renew time.
:type renew_time: int

:return:
:rtype baidubce.bce_response.BceResponse
s   /auto_renew_rule/createNr#   rq   )
clusterIdsuserIdr2   rr   renewTimeUnit	renewTimer)   r*   r+   rK   )r   ru   rv   r2   ry   rz   r7   r8   r,   r-   r.   s              r   create_auto_renew_rule BesClient.create_auto_renew_rule  s    F *#|F & ,#
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nSS0nU R                   R                  nUSS.nU R                  [        R                  X#[
        R                  " U5      US9$ )	zU
get cluster auto renew rule list

:return:
:rtype baidubce.bce_response.BceResponse
s   /auto_renew_rule/listNr#   rr   rq   r)   r*   r+   rK   )r   r7   r8   r,   r-   r2   r.   s          r   get_auto_renew_rule_list"BesClient.get_auto_renew_rule_listF  sx     (#|F 5
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   )r>   
account_idry   rz   c                     SnSnUb  SU0nUUUS.nU R                   R                  nUSS.n	U R                  [        R                  XV[
        R                  " U5      U	S9$ )aR  
update cluster auto renew rule

:param cluster_id: The parameter to cluster id list.
:type cluster_id: string

:param renew_time_unit: The parameter to specify renew time unit.
:type renew_time_unit: string

:param renew_time: The parameter to specify renew time.
:type renew_time: int

:return:
:rtype baidubce.bce_response.BceResponse
s   /auto_renew_rule/updateNr#   )rC   r~   r   r)   r*   r+   rK   )
r   r>   ry   rz   r7   r8   r,   r-   r2   r.   s
             r   update_auto_renew_rule BesClient.update_auto_renew_rule\  s|    0 *#|F $,#

 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   c                     SnSnUb  SU0nSU0nU R                   R                  nUSS.nU R                  [        R                  X4[
        R                  " U5      US9$ )z
delete cluster auto renew rule

:param cluster_id: The parameter to cluster id list.
:type cluster_id: string

:return:
:rtype baidubce.bce_response.BceResponse
s   /auto_renew_rule/deleteNr#   rC   r)   r*   r+   rK   rO   s           r   delete_auto_renew_rule BesClient.delete_auto_renew_rule  sx     *#|F 
 ## &$EG!!,"3"3TtzzZ^O_ip!qqr   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   _merge_configBesClient._merge_config  s7    >;;4;;/J,,V4r   c           
      *   U R                  U5      nUc  [        R                  n[        R                  " UR
                  5      Ul        [        R                  " U[        R                  [        R                  U/U[        R                  U-   X4U5      $ r   )r   r   
parse_jsonr   convert_to_bytesendpointr   send_requestr   signparse_errorr   prefix)r   http_methodr8   r-   r.   r,   r   body_parsers           r   r3   BesClient._send_request  s~     ##F+!,,K 11&//B
 ++M&&)<)<k(J))D0$I 	Ir    r   )NNNNN) __name__
__module____qualname____firstlineno____doc__r   r   r
   
value_typelistboolr	   Billingr;   rD   intrL   rP   rT   rW   rZ   ra   rd   rl   rs   r   r   r   r   r   r3   __static_attributes__r   r   r   r   r   '   sq    !F= :! !' *$''	)* %)Mr	)Mr^ :%#	 %)6r
6rp c
 '+!r!rF $ )-r %r> $ $(r %r> $ #'r %r> $ %)r %r> $&
 %)"r&"rH $&
 $("r&"rH J!!$	& %)-r&
-r^ J# $(rrB $ %( -1.r.rb /3r, #( -1	"r	"rH $ -1r %r4 7;/3Ir   r   )r   r   r5   loggingsysbaidubcer   r   baidubce.authr   baidubce.httpr   r   r   baidubce.services.besr	   baidubce.utilsr
   	getLoggerr   _loggerversion_infostrunicoder   bytesr   r   r   r   r   <module>r      s{       
 $  ' ) ! & + #


H
%A!wJuJN
I-- N
Ir   