
    9i6                         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\	" \
\4S
9SS j5       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\
\4S9SS j5       r\	" \
\4/\
\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     d/var/www/html/land-doc-ocr/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XYS'   [        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_tokenversionr   r#   r&   r$   s              r   create_havipHavipClient.create_havipD   s    J %:%<F>"%1>" ,,T200; & 8 89K L!33K@	
 !!,"3"3T

4@PY_)/ " 1 	1r   )vpc_idc                 V    Sn0 nUb  XS'   U R                  [        R                  X4US9$ )z
Get the detail information of havip list.

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

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r/   s   vpcIdr&   r   )r(   r   GET)r   r=   r   r#   r&   s        r   get_havip_detail_list!HavipClient.get_havip_detail_list{   s;     %8!!,"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   rC   r9   r   r#   r&   s         r   delete_havipHavipClient.delete_havip   sX    ( f55h??%:%<F>"%1>"!!,"5"5tSY!ZZr   r*   rC   r-   c                 R   S[         R                  " U5      -  nSS0nUc  [        5       US'   OXXS'   [         R                  " U5      [         R                  " U5      [         R                  " U5      S.n	U R	                  [
        R                  U[        R                  " U	5      XS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
rE   s   modifyAttributeNr0   rJ   r3   	r	   rF   r4   r5   r(   r   PUTr7   r8   )
r   r*   rC   r-   r:   r9   r   r#   r&   r$   s
             r   update_havipHavipClient.update_havip   s    P f55h??
 %:%<F>"%1>" ,,T200:!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
rE   r?   )r	   rF   r(   r   r@   )r   rC   r   r#   r&   s        r   get_havip_detailHavipClient.get_havip_detail   s=     f55h??!!,"2"2DPV!WWr   instance_idsinstance_typerC   c                 (   S[         R                  " U5      -  nSS0nUc  [        5       US'   OXWS'   [         R                  " U5      [         R                  " U5      [         R                  " U5      S.nU R	                  [
        R                  XgUS9$ )a  
Get the detail information of havip list.

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

:param instance_type:
    Binding instance type
:type instance_type: string

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

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
rE   s   attachNr0   )instanceIdsinstanceTypehaVipIdr?   )r	   rF   r4   r5   r(   r   r@   )	r   rT   rU   rC   r   r9   r#   r&   r$   s	            r   havip_attach_instance!HavipClient.havip_attach_instance   s    2 f55h??t
 %:%<F>"%1>" "33LA"44]C//9
 !!,"2"2DPV!WWr   c                 (   S[         R                  " U5      -  nSS0nUc  [        5       US'   OXGS'   [         R                  " U5      [         R                  " U5      [         R                  " U5      S.nU R	                  [
        R                  XgUS9$ )a  
havip detach instance.

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

:param instance_type:
    Binding instance type
: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
rE   s   detachNr0   rS   r?   )r	   rF   r4   r5   r(   r   rG   )	r   rT   rU   rC   r9   r   r#   r&   r$   s	            r   havip_detach_instance!HavipClient.havip_detach_instance&  s    < f55h??T"%:%<F>"%1>" #44\B#55mD00:
 !!,"5"5tSY!ZZr   )rC   public_ip_addressc                 (   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  
havip bind public_ip.

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

:param public_ip_address:
    The option param to describe public_ip.
:type description: string

: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
rE   s   bindPublicIpNr0   )rY   publicIpAddressr3   rL   )	r   rC   r_   r:   r9   r   r#   r&   r$   s	            r   havip_bind_public_ip HavipClient.havip_bind_public_ipU  s    < f55h??T
 %:%<F>"%1>" //9%778IJ

 !!,"2"2Dtzz$?OX^!nnr   c                     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 unbind public_ip.

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

: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
rE   s   unbindPublicIpNr0   rC   r3   rL   )r   rC   r:   r9   r   r#   r&   r$   s           r   havip_unbind_public_ip"HavipClient.havip_unbind_public_ip  s    0 f55h??t
 %:%<F>"%1>" 00:
 !!,"2"2Dtzz$?OX^!nnr    r   )NNNNN) NNN)NN)NNN)__name__
__module____qualname____firstlineno____doc__r!   r   r   r(   r   bytesstrr;   rA   rH   rN   rQ   rZ   r]   rb   re   __static_attributes__rg   r   r   r   r   "   s    F= 7;/3
K E3<"' #,(
 AE 11	(11f eS\"X #X* s|$[ %[6 E3<s| #,( DH"& 5o(5on s|$X %X& UCL>"CLs|%&X%&XP UCL>"CLs|%*[%*[X s|!&.HL7;+o.+oZ s|$%o %%o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
)ro   uuiduuid4rg   r   r   generate_client_token_by_uuidrt     s     tzz|r   )rm   r   r7   loggingrr   baidubcer   baidubce.authr   baidubce.httpr   r   r   baidubce.utilsr   r	   	getLoggerri   _loggerr   r   rt   r4   rg   r   r   <module>r|      sa        $ ' ) ! & # 


H
%Ho/// HoT 6 r   