
    9i*                     <   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$                  " \5      r\R*                  S:  a  \" \5        \R.                  " S5         " S S\R0                  5      rS r\rg)z0
This module provides a client class for probe.
    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\
\4\\\S9    SS	 j5       rSS
 jr\	" \
\4S9SS j5       r   SS jr\	" \
\4S9SS j5       rSrg)ProbeClient(   z
Probe base sdk client
s   /v1Nc                 B    [         R                  R                  X5        g N)r   BceBaseClient__init__)selfconfigs     d/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/probe/probe_client.pyr   ProbeClient.__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ProbeClient._merge_config1   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      $ )Ns   */*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ProbeClient._send_request>   sk     ##F+!,,K?"(13G ++M&&)<)<k(Jtf6 	6r   )namevpc_id	subnet_idprotocol	frequency
source_ipssource_ip_numc                 .   [         R                  " U R                  S5      nUc
  [        5       nSU0nUc  / nUUUUUUU	S.nU
b  U
US'   Ub  UUS'   Ub  UUS'   Ub  UUS'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )	aW  
The method to create a probe.

:param name:
    The name of the probe.
    The name must be 1 to 64 characters in length,
    and can contain numbers, letters and underscores (_).
:type name: string

:param vpc_id:
    The id of the vpc to create the probe in.
:type vpc_id: string

:param subnet_id:
    The id of the subnet to create the probe in.
:type subnet_id: string

:param protocol:
    The protocol of the probe, TCP, UDP, ICMP or DNS.
:type protocol: string

:param frequency:
    The number of the probing per minute, 10, 20 or 30.
    Default value is 20.
:type frequency: int

:param dst_ip:
    The destination ip of the probe.
:type dst_ip: string

:param dst_port:
    The destination port of the probe.
    Must be specified when the protocol is TCP, UDP or DNS.
:type dst_port: string

:param source_ips:
    The specified list of source ips of the probe.
:type source_ips: list

:param source_ip_num:
    The number of the source ips to be auto generated.
    When source_ip_num is not specified,
    source_ips must at least contain one ip.
:type source_ip_num: int

:param description:
    The description of the probe.
:type description: string

:param payload:
    The probe string of the UDP probe
    or the domain of the DNS probe.
    Must be specified when the protocol is TCP, UDP or DNS.
:type payload: 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
   probe   clientToken)r+   vpcIdsubnetIdr.   r/   	sourceIpssourceIpNumdescriptiondestIpdestPortpayloadr%   r'   r   )	r   
append_uriversiongenerate_client_tokenr)   r   POSTjsondumps)r   r+   r,   r-   r.   r/   dst_ipdst_portr0   r1   r9   r<   client_tokenr   r$   r'   r%   s                    r   create_probeProbeClient.create_probeL   s    \ h702L ,/J! "#(
 ""-D#DN'D%DO!!,"3"3T'+zz$'7)/ " 1 	1r   c                     [         R                  " U R                  S5      n0 nUb  XS'   Ub  X%S'   U R                  [        R
                  XEUS9$ )a  
The method to list all probes owned by the authenticated user.

: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 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 config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r3   s   markers   maxKeysr'   r   r   r>   r?   r)   r   GET)r   markermax_keysr   r$   r'   s         r   list_probesProbeClient.list_probes   s`    , h7 &9!):!!,"2"2D)/ " 1 	1r   )probe_idc                     [         R                  " U R                  SU5      nU R                  [        R
                  X2S9$ )z
The method to get the detail informations of a probe.

:param probe_id:
    The id of the probe.
:type probe_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r3   )r   rK   )r   rQ   r   r$   s       r   	get_probeProbeClient.get_probe   s8     hA!!,"2"2D!HHr   c
                 (   [         R                  " U R                  SU5      n
Uc
  [        5       nSU0n0 nUb  X,S'   Ub  X<S'   Ub  XLS'   Ub  X\S'   Ub  XlS'   Ub  X|S'   U R	                  [
        R                  U
[        R                  " U5      XS	9$ )
a  
The method to update a probe.

:param probe_id:
    The id of the probe.
:type probe_id: string

:param name:
    The name of the probe.
:type name: string

:param description:
    The description of the probe.
:type description: string

:param dst_ip:
    The destination ip of the probe.
:type dst_ip: string

:param dst_port:
    The destination port of the probe.
:type dst_port: string

:param frequency:
    The number of the probing per minute, 10, 20 or 30.
:type frequency: int

:param payload:
    The probe string of the UDP probe and the TCP probe,
    or the domain of the DNS probe.
:type payload: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
r3   r4   r+   r9   r:   r;   r/   r<   r=   )	r   r>   r?   r@   r)   r   PUTrB   rC   )r   rQ   r+   r9   rD   rE   r/   r<   rF   r   r$   r'   r%   s                r   update_probeProbeClient.update_probe   s    \ hA02L ,/L""-#N'  )%O!!,"2"2Dtzz$?O)/ " @ 	@r   c                     [         R                  " U R                  SU5      nUc
  [        5       nSU0nU R	                  [
        R                  UXSS9$ )az  
The method to delete a probe.

:param probe_id:
    The id of the probe.
:type probe_id: 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
r3   r4   rJ   )r   r>   r?   r@   r)   r   DELETE)r   rQ   rF   r   r$   r'   s         r   delete_probeProbeClient.delete_probe(  s[    ( hA02L ,/!!,"5"5t)/ " @ 	@r    r   )NNNNN)NNNNNNN)NNN)NNNNNNNN)NN)__name__
__module____qualname____firstlineno____doc__r?   r   r   r)   r	   bytesstrintlistrG   rO   rS   rW   r[   __static_attributes__r]   r   r   r   r   (   s     G= 7;/36 E3<S\s|! 2648!%=A	`1!`1D1> s|$I %I" =A;?=A@@D s|$@ %@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
)rd   uuiduuid4r]   r   r   generate_client_token_by_uuidrk   D  s     tzz|r   )rb   r   rB   loggingri   sysbaidubcer   baidubce.authr   baidubce.httpr   r   r   r   baidubce.utilsr	   r
   	getLoggerr^   _loggerr?   reloadsetdefaultencodingr   r   rk   r@   r]   r   r   <module>rv      s        
 $ ' ) ! &  # 


H
%;;
3K7#Y@/// Y@x 6 r   