
    9iz:                         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\R                   5      rS r\rg)z5
This module provides a client class for Et Gateway.
    N)bce_base_client)compat)utils)bce_v1_signer)bce_http_client)handler)http_methods)requiredc                      \ rS rSrSrSrSrSrSS jrS r	  SS	 jr
\" \\4\\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\\4\\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\\4\\4\\4S9  SS j5       r\SS j5       rSrg)EtGatewayClient!   z
Et Gateway Client
s   /v1s
   /etGateways   /healthCheckNc                 B    [         R                  R                  X5        g)z/
:type config: baidubce.BceClientConfiguration
N)r   BceBaseClient__init__)selfconfigs     m/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/etGateway/et_gateway_client.pyr   EtGatewayClient.__init__)   s     	%%..t<    c                     Uc  U R                   $ [        R                  " U R                   5      nUR                  U5        U$ )zG
:type config: baidubce.BceClientConfiguration
:param config:
:return:
)r   copymerge_non_none_values)r   r   
new_configs      r   _merge_configEtGatewayClient._merge_config/   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      $ )zz
:param http_method:
:param path:
:param body:
:param headers:
:param params:
:param config:
:param body_parser:
:return:
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EtGatewayClient._send_request<   sk     ##F+!,,K?!1G
 ++M&&)<)<k(Jtf6 	6r   )namevpc_idspeedc
                     U R                  5       n
0 nUc  [        5       US'   OX{S'   UUUS.nUb  XLS'   Ub  X\S'   Ub  XlS'   Ub  XS'   U R                  [        R                  U
[
        R                  " U5      XS9$ )a  
Create a ET Gateway.

:param name:
    the name of ET Gateway
:type name: string

:param vpc_id:
    the id of VPC
:type vpc_id: string

:param speed:
    the bandwidth of ET Gateway
:type speed: int

:param et_id:
    the id of ET
:type et_id: string

:param channel_id:
    the id of Channel
:type channel_id: string

:param local_cidrs:
    the list of CIDRs
:type local_cidrs: list

: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 description:
    the description of ET Gateway
:type description: string

:type config:
    baidubce.BceClientConfiguration
:param config:

:return: created ET Gateway ID
   clientToken)r)   vpcIdr+   s   etIds	   channelId
   localCidrs   descriptionr#   r%   r   )	_get_pathgenerate_client_tokenr'   r	   POSTjsondumps)r   r)   r*   r+   et_id
channel_idlocal_cidrsclient_tokendescriptionr   r"   r%   r#   s                r   create_et_gateway!EtGatewayClient.create_et_gatewayV   s    ` ~~%:%<F>"%1>" 
 !M!!+""-"#. !!,"3"3T

4@PY_!oor   )et_gateway_idc                    [         R                  " U R                  5       U5      nUc
  [        5       nSU0n	0 n
Ub  X*S'   Ub  X:S'   Ub  XJS'   Ub  XZS'   U R	                  [
        R                  U[        R                  " U
5      XS9$ )af  
Update a ET Gateway.
:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param name:
    the name of ET Gateway
:type name: string

:param description:
    the description of ET Gateway
:type description: string

:param speed:
    the bandwidth of ET Gateway
:type speed: int

:param local_cidrs:
    the list of CIDRs
:type local_cidrs: list

:param client_token:
    If the clientToken is not specified by the user, a random String
:type client_token: string

:description:
    the description of ET Gateway
:type description: string

:return:
:rtype baidubce.bce_response.BceResponse

r-      namer0   s   speedr/   r1   	r   
append_urir2   r3   r'   r	   PUTr5   r6   )r   r>   r)   r;   r+   r9   r:   r   r"   r%   r#   s              r   update_et_gateway!EtGatewayClient.update_et_gateway   s    L  0-@02LL
  M"#. "N""-!!,"2"2"&TZZ-=)/ " @ 	@r   c                     [         R                  " U R                  5       U5      nUc
  [        5       nSU0nU R	                  [
        R                  XEUS9$ )a  
Delete a ET Gateway.
:param et_gateway_id: the id of ET Gateway
:type et_gateway_id: string

:param client_token:
    If the clientToken is not specified by the user, a random String
:type client_token: string

:return:
rtype baidubce.bce_response.BceResponse
r-   r%   r   )r   rB   r2   r3   r'   r	   DELETE)r   r>   r:   r   r"   r%   s         r   delete_et_gateway!EtGatewayClient.delete_et_gateway   s`      0-@02LL
 !!,"5"5"&f " F 	Fr   )r>   r7   actionr8   c                     [         R                  " U R                  5       U5      nUc
  [        5       nSUS.nUUS.n	Ub  XIS'   U R	                  [
        R                  U[        R                  " U	5      XS9$ )a	  
Bind a ET to an ET Gateway.
:param et_id:
    the id of ET
:type et_id: string

:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param channel_id:
    the id of channel
:type channel_id: string

:param local_cidrs:
    the list of CIDRs
:type local_cidrs: list

:param config:
:type config: baidubce.BceClientConfiguration

:param client_token:
    If the clientToken is not specified by the user, a random String
:type client_token: string

:return:
:rtype baidubce.bce_response.BceResponse
N)s   bindr-   )etId	channelIdr/   r1   rA   )
r   r7   r>   r8   r9   r:   r   r"   r%   r#   s
             r   bind_etEtGatewayClient.bind_et   s    >  0-@02L(

 #
 ""-!!,"2"2Dtzz$?OX^!nnr   c                     [         R                  " U R                  5       U5      nUc
  [        5       nSUS.nU R	                  [
        R                  XEUS9$ )aS  
Unbind a ET from an ET Gateway.
:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param client_token:
    If the clientToken is not specified by the user, a random String
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
N)s   unbindr-   rG   )r   rB   r2   r3   r'   r	   rC   )r   r>   r:   r   r"   params         r   	unbind_etEtGatewayClient.unbind_et  sX    &  0-@02L(
 !!,"2"2Dv!VVr   )r*   c                     U R                  5       nSU0n	Ub  X)S'   Ub  X9S'   Ub  XIS'   Ub  XYS'   Ub  XiS'   U R                  [        R                  XUS9$ )a  
List ET Gateway.
:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param max_keys:
    The optional parameter to specifies the max number of
    list result to return.
    The default value is 1000.
:type max_keys: int

:param marker:
    The optional parameter marker specified in the original
    request to specify where in the results to begin listing.
    Together with the marker, specifies the list result which
    listing should begin. If the marker is not specified,
    the list result will listing from the first one.
:type marker: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
s   vpcIds   etGatewayIdr@   s   statuss   markers   maxKeysrG   )r2   r'   r	   GET)
r   r*   r>   r)   statusmarkermax_keysr   r"   rR   s
             r   list_et_gatewayEtGatewayClient.list_et_gateway7  s    : ~~f
 $$1.!!'N%)%) (*!!,"2"2Dv!VVr   c                     [         R                  " U R                  5       U5      nU R                  [        R
                  X2S9$ )z
Get ET Gateway.
:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
)r   )r   rB   r2   r'   r	   rV   )r   r>   r   r"   s       r   get_et_gatewayEtGatewayClient.get_et_gatewayd  s9      0-@!!,"2"2D!HHr   )r>   health_check_intervalhealth_check_thresholdunhealth_thresholdc                 .   [         R                  " U R                  5       XR                  5      nU	c
  [	        5       n	SU	0nUUUS.nUb  X]S'   Ub  XmS'   Ub  X}S'   Ub  XS'   U R                  [        R                  X[        R                  " U5      U
S9$ )a  
Create Health Check.
:param et_gateway_id:
    the id of ET Gateway
:type et_gateway_id: string

:param health_check_source_ip:
    the source ip of health check
:type health_check_source_ip: string

:param health_check_type:
    the type of health check
:type health_check_type: string

:param health_check_port:
    the port of health check
:type health_check_port: int

:param health_check_interval:
    the interval of health check
:type health_check_interval: int

:param health_check_threshold:
    the threshold of health check
:type health_check_threshold: int

:param unhealth_threshold:
    the unhealth threshold of health check
:type unhealth_threshold: int

:param auto_generate_route_rule:
    the optional parameter to specifies whether auto generate route rule
:type auto_generate_route_rule: bool

:param client_token:
    the optional parameter to specify a unique client token
:type client_token: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r-   )s   healthCheckIntervals   healthThresholds   unhealthThresholds   healthCheckSourceIps   healthCheckTypes   healthCheckPorts   autoGenerateRouteRule)r%   r#   r   )
r   rB   r2   health_checkr3   r'   r	   r4   r5   r6   )r   r>   r_   r`   ra   health_check_source_iphealth_check_typehealth_check_portauto_generate_route_ruler:   r   r"   rR   r#   s                 r   create_health_check#EtGatewayClient.create_health_checku  s    b NNm->->@02LL
 %: 6"4

 "-+A'(('8#$('8#$#/-E)*!!,"3"3TdjjY]N^gm!nnr   c                 r    U c  [         R                  n [        R                  " [         R                  U 5      $ )z1
:type prefix: string
:param prefix: path prefix
)r   prefixr   rB   version)rk   s    r   r2   EtGatewayClient._get_path  s-     >$++F 7 7@@r    )N)NNNNN)NNNNNN)NN)NNN)__name__
__module____qualname____firstlineno____doc__rl   rk   rc   r   r   r'   r
   bytesstrintlongr<   rD   rI   rO   rS   rZ   r]   rh   staticmethodr2   __static_attributes__rn   r   r   r   r   !   s    GF"L= 7;/364 E3<S\$K! MQX\Bp!BpH UCL)FJRV6@ *6@p UCL)F *F, UCLS\ucl<*o<*oX UCL)W *W6 eS\"?CHL*W #*WX UCL)I *I  UCLdehjndo"%t. dhUYCo.CoJ A Ar   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
)ru   uuiduuid4rn   r   r   generate_client_token_by_uuidr}     s     tzz|r   )rs   r   r5   r{   baidubcer   r   r   baidubce.authr   baidubce.httpr   r   r	   baidubce.utilsr
   r   r   r}   r3   rn   r   r   <module>r      sQ       $   ' ) ! & #cAo33 cAL 6 r   