
    -pj5                         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  \R                   " \5      r " S
 S\R&                  5      rS r\rg)z0
This module provides a client class for HAVIP.
    N)bce_base_client)bce_v1_signer)bce_http_client)handler)http_methods)required)compatc                      \ 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\	" \
\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\
\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Srg)HavipClient"   z
Route base sdk client
s   /v1Nc                 B    [         R                  R                  X5        g N)r   BceBaseClient__init__)selfconfigs     `/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/baidubce/services/havip/havip_client.pyr   HavipClient.__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HavipClient._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/U[        R                  U-   X4U5      $ )Ns   */*s   application/json;charset=utf-8)s   Accepts   Content-Type)
r   r   
parse_jsonr   send_requestr   signparse_errorr   prefix)r   http_methodpathbodyheadersparamsr   body_parsers           r   _send_requestHavipClient._send_request8   sv     ##F+!,,K?"(;\]G++M&&)<)<k(J++d2D6K 	Kr   )name	subnet_idprivate_ip_addressdescriptionc                 L   Sn0 nUc  [        5       US'   OXXS'   [        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.n	U R                  [        R
                  U[        R                  " U	5      UUS9$ )a  
Create a havip with the specified options.

:param name:
    The name of havip.
:type name: string

:param subnet_id:
    The subnet ID to which the havip belongs.
:type subnet_id: string

:param private_ip_address:
    The private_ip_address of the havip
:type private_ip_address: string

:param description:
    The option param to describe the havip.
:type description: 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
   /havip   clientToken)r*   subnetIdprivateIpAddressr-   r$   r&   r   )generate_client_tokenr	   convert_to_stringr(   r   POSTjsondumps)
r   r*   r+   r,   r-   client_tokenr   r#   r&   r$   s
             r   create_havipHavipClient.create_havipD   s    H %:%<F>"%1>" ,,T200; & 8 89K L!33K@	
 !!,"3"3T

4@PY_)/ " 1 	1r   c                 r    Sn0 nUb  XS'   Ub  X&S'   Ub  X6S'   U R                  [        R                  XVUS9$ )u  
Get the detail information of havip list.

:param vpc_id:
    the vpc id to which the havip belongs
:type vpc_id: string

:param marker:
    批量获取列表的查询的起始位置，是一个由系统生成的字符串
:type marker: string

:param max_keys:
    每页包含的最大数量，最大数量不超过1000，缺省值为1000
:type max_keys: int

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r/   s   vpcIds   markers   maxKeysr&   r   )r(   r   GET)r   vpc_idmarkermax_keysr   r#   r&   s          r   get_havip_detail_list!HavipClient.get_havip_detail_listz   sW    , %8 &9!):!!,"2"2DPV!WWr   )havip_idc                     S[         R                  " U5      -  n0 nUc  [        5       US'   OX%S'   U R                  [        R
                  XEUS9$ )a  
Delete the  specific havip.

:param havip_id:
    The id of the specified havip.
:type havip_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
	   /havip/%sr0   r=   )r	   convert_to_bytesr4   r(   r   DELETEr   rD   r9   r   r#   r&   s         r   delete_havipHavipClient.delete_havip   sX    ( f55h??%:%<F>"%1>"!!,"5"5tSY!ZZr   )r*   rD   r-   c                 (   S[         R                  " U5      -  nSS0nUc  [        5       US'   OXGS'   [         R                  " U5      [         R                  " U5      S.nU R	                  [
        R                  U[        R                  " U5      XuS9$ )a  
Update a havip with the specified options.

:param name:
    The name of the havip to be updated.
:type route_rule_id: string

:param havip_id:
    The id of the specified havip.
:type havip_id: string

:param description:
    The option param to describe the route rule.
:type description: string

:param action:
    Action.
:type action: string, default: modifyAttribute

:param version:
    API version.
:type version: 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
rF   s   modifyAttributeNr0   )r*   r-   r3   	r	   rG   r4   r5   r(   r   PUTr7   r8   )	r   r*   rD   r-   r9   r   r#   r&   r$   s	            r   update_havipHavipClient.update_havip   s    N f55h??
 %:%<F>"%1>" ,,T2!33K@

 !!,"2"2Dtzz$?OX^!nnr   c                 v    S[         R                  " U5      -  n0 nU R                  [        R                  X4US9$ )z
Get the detail information of a specific havip.

:param havip_id:
    The id of the havip.
:type havip_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
rF   r=   )r	   rG   r(   r   r>   )r   rD   r   r#   r&   s        r   get_havip_detailHavipClient.get_havip_detail   s=     f55h??!!,"2"2DPV!WWr   )instance_idsinstance_typerD   c                     S[         R                  " U5      -  nSS0nUc  [        5       US'   OXGS'   U[         R                  " U5      S.nU R	                  [
        R                  U[        R                  " U5      XuS9$ )a2  
Attach instances to havip.

:param instance_ids:
    the instance ids of havip binding
:type instance_ids: list

:param instance_type:
    Binding instance type (SERVER or ENI)
:type instance_type: string

:param havip_id:
    The id of the specified havip.
:type havip_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
rF   s   attachNr0   instanceIdsinstanceTyper3   rM   	r   rT   rU   rD   r9   r   r#   r&   r$   s	            r   havip_attach_instance!HavipClient.havip_attach_instance  s    < f55h??t
 %:%<F>"%1>" ("44]C

 !!,"2"2Dtzz$?OX^!nnr   c                     S[         R                  " U5      -  nSS0nUc  [        5       US'   OXGS'   U[         R                  " U5      S.nU R	                  [
        R                  U[        R                  " U5      XuS9$ )a.  
havip detach instance.

:param instance_ids:
    the instance ids of havip binding
:type instance_ids: list

:param instance_type:
    Binding instance type (SERVER or ENI)
:type instance_type: string

:param havip_id:
    The id of the specified havip.
:type havip_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
rF   s   detachNr0   rW   r3   rM   rZ   s	            r   havip_detach_instance!HavipClient.havip_detach_instance2  s    < f55h??T"%:%<F>"%1>" ("44]C

 !!,"2"2Dtzz$?OX^!nnr   )rD   public_ip_addressc                     S[         R                  " U5      -  nSS0nUc  [        5       US'   OX6S'   S[         R                  " U5      0nU R	                  [
        R                  U[        R                  " U5      XdS9$ )a  
havip bind public_ip.

:param havip_id:
    The id of the specified havip.
:type havip_id: string

:param public_ip_address:
    The public IP address to bind.
:type public_ip_address: 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
rF   s   bindPublicIpNr0   publicIpAddressr3   rM   )r   rD   r`   r9   r   r#   r&   r$   s           r   havip_bind_public_ip HavipClient.havip_bind_public_ip`  s    2 f55h??T
 %:%<F>"%1>" v778IJ
 !!,"2"2Dtzz$?OX^!nnr   c                     S[         R                  " U5      -  nSS0nUc  [        5       US'   OX%S'   U R                  [        R
                  XEUS9$ )a}  
havip unbind public_ip.

:param havip_id:
    The id of the specified havip.
:type havip_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
rF   s   unbindPublicIpNr0   r=   )r	   rG   r4   r(   r   rN   rI   s         r   havip_unbind_public_ip"HavipClient.havip_unbind_public_ip  sa    ( f55h??t
 %:%<F>"%1>"!!,"2"2DPV!WWr    r   )NNNNN) NN)NNNN)NN)__name__
__module____qualname____firstlineno____doc__r!   r   r   r(   r   bytesstrr:   rB   rJ   rO   rR   listr[   r^   rc   rf   __static_attributes__rh   r   r   r   r   "   s    F= 7;/3
K E3<"' #,(
 @D01	(01dXB s|$[ %[6 E3<s| #,( 8:/33o(3oj s|$X %X& 4"CLs|%*o%*oX 4"CLs|%)o%)oV s|!&.%o.%oN s|$X %X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
)rp   uuiduuid4rh   r   r   generate_client_token_by_uuidrv     s     tzz|r   )rn   r   r7   loggingrt   baidubcer   baidubce.authr   baidubce.httpr   r   r   baidubce.utilsr   r	   	getLoggerrj   _loggerr   r   rv   r4   rh   r   r   <module>r~      sa        $ ' ) ! & # 


H
%EX/// EXN 6 r   