
    9ik                         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 " S S\R(                  5      rS r\rg)z.
This module provides a client class for ENI.
    N)bce_base_client)bce_v1_signer)bce_http_client)handler)http_methods)utils)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\\\\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\
\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\	" \
\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\	" \
\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S 9S'S! j5       r\	" \
\4\
\4\
\4S 9S'S" j5       rS#rg)+	EniClient%   z
ENI base sdk client
s   /v1Nc                 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/eni/eni_client.pyr   EniClient.__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EniClient._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EniClient._send_request<   sv     ##F+!,,K?"(;\]G++M&&)<)<k(J))D0$I 	Ir   )name	subnet_idsecurity_group_idsenterprise_security_group_idseni_ip_address_listeni_ipv6_address_listc                    Sn0 nU	c  [        5       US'   OXS'   [        R                  " U5      [        R                  " U5      S.nUb  X=S'   Ub  XMS'   UbB  / nU H6  nUR                  UR                  UR
                  UR                  S.5        M8     XS'   UbC  / nU H6  nUR                  UR                  UR
                  UR                  S.5        M8     UUS'   Ub  [        R                  " U5      US	'   Ub  [        R                  " U5      US
'   U R                  [        R                  U[        R                  " U5      UU
S9$ )a  
:param name:
    The name of eni to be created.
:type name: string

:param subnet_id:
    The parameter to specify the id of subnet from vpc
:type subnet_id: string

:param security_group_ids:
    security_group_ids
:type security_group_ids: list<string>

:param enterprise_security_group_ids:
    enterprise_security_group_ids
:type enterprise_security_group_ids: list<string>

:param eni_ip_address_list:
    The parameter to specify the ipv4 address list of eni
:type eni_ip_address_list: eni_model.EniIPSet

:param eni_ipv6_address_list:
    The parameter to specify the ipv6 address list of eni
:type eni_ip_address_list: eni_model.EniIPSet

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

:param network_interface_traffic_mode:
    The traffic mode of the eni.
:type network_interface_traffic_mode: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    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
   /eni   clientToken)r+   subnetIdsecurityGroupIdsenterpriseSecurityGroupIds)publicIpAddressprimaryprivateIpAddressprivateIpSetipv6PrivateIpSetdescriptionnetworkInterfaceTrafficModer%   r'   r   )generate_client_tokenr
   convert_to_stringappend	public_ipr8   
private_ipr)   r   POSTjsondumps)r   r+   r,   r-   r.   r/   r0   r<   network_interface_traffic_modeclient_tokenr   r$   r'   r%   
pri_ip_setip_setpri_ipv6_sets                    r   
create_eniEniClient.create_eniH   sy   f %:%<F>"%1>" ,,T200;
 )'9#$(41N-.*J-!!V5E5EQWQ_Q_6<6G6G#I J . $.  ,L/##v7G7GSYSaSa8>8I8I%K L 0 (4D#$""(":":;"GD)5282J2JKi2jD./!!,"3"3T

4@PY_)/ " 1 	1r   )eni_idc                     S[         R                  " U5      -  nUc
  [        5       nSU0nU R                  [        R
                  XEUS9$ )a  
release the eni(delete operation)
if the eni has been bound, must unbind before releasing.

:type eni_id: string
:param eni_id: eni to be released

:type client_token: string
:param client_token: if the clientToken is not specified by the user,
 a random String generated by default algorithm will be used.

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
   /eni/%sr3   r'   r   )r
   convert_to_bytesr?   r)   r   DELETEr   rN   rH   r   r$   r'   s         r   
delete_eniEniClient.delete_eni   sZ    $ F33F;;02LL
 !!,"5"5t)/ " 1 	1r   )rN   r+   c                 6   S[         R                  " U5      -  nUc
  [        5       nSUS.n0 nUb  [         R                  " U5      US'   Ub  [         R                  " U5      US'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a&  
:param eni_id: eni to be updated
:type eni_id: string

:param name: eni name to be updated
:type name: string

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

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   modifyAttributer3   r+   r<   r>   	r
   rR   r?   r@   r)   r   PUTrE   rF   )	r   rN   r+   r<   rH   r   r$   r'   r%   s	            r   
update_eniEniClient.update_eni   s    0 F33F;;02L $(
 !33D9DL""(":":;"GD!!,"2"2Dtzz$?OX^)/ " 1 	1r   )vpc_idinstance_idr+   private_ip_address_listmarkermax_keysc	                    Sn	0 n
[         R                  " U5      U
S'   Ub  [         R                  " U5      U
S'   Ub  [         R                  " U5      U
S'   Ub  SR                  U5      U
S'   Ub  [         R                  " U5      U
S'   Uc  SU
S	'   OXjS	'   Uc  [        5       U
S
'   OXzS
'   U R	                  [
        R                  XUS9$ )a  
:param vpc_id: The parameter to specify the vpc id
:type vpc_id: string

:param instance_id: The parameter to specify the id of instance
:type instance_id: string

:param name: eni name to be updated
:type name: string

:param private_ip_address_list: The parameter to specify the private ip address list
:type private_ip_address_list: list

:param marker:
    The optional parameter marker specified in the original request to specify
    where in the results to begin listing.
    Together with the marker, specify 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 specify the max number of list result to return.
    The default value is 1000.
:type max_keys: int

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
r2   s   vpcIds
   instanceIds   name,s   privateIpAddresss   markeri  s   maxKeysr3   rQ   )r
   r@   joinr?   r)   r   GET)r   r\   r]   r+   r^   r_   r`   rH   r   r$   r'   s              r   list_eniEniClient.list_eni   s    P !33F;x"$*$<$<[$IF=!$66t<F7O".+.**5L*MF&' & 8 8 @F9!%F:!):%:%<F>"%1>"!!,"2"2D)/ " 1 	1r   )rN   is_ipv6private_ip_addressc                    S[         R                  " U5      -  nUc
  [        5       nSU0n0 n[         R                  " U5      US'   Ub  X8S'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param is_ipv6: The parameter to specify the ipv6 flag
:type is_ipv6: bool

:param private_ip_address:
    The parameter to specify the private ip address.
    if is_ipv6 is True, the private ip address must be a valid ipv6 address.
:type private_ip_address: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
s   /eni/%s/privateIpr3   r9   isIpv6r>   )	r
   rR   r?   r@   r)   r   rD   rE   rF   )	r   rN   rh   rg   rH   r   r$   r'   r%   s	            r   add_private_ipEniClient.add_private_ip  s    2 $f&=&=f&EE02LL
 #)#;#;<N#O $N!!,"3"3T

4@PY_)/ " 1 	1r   )rN   rh   c                     S[         R                  " U5      [        R                  " U5      4-  nUc
  [	        5       nSU0nU R                  [        R                  XVUS9$ )a&  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param private_ip_address:
    The parameter to specify the private ip address.
:type private_ip_address: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
s   /eni/%s/privateIp/%sr3   rQ   )r
   rR   r   normalize_stringr?   r)   r   rS   )r   rN   rh   rH   r   r$   r'   s          r   delete_private_ipEniClient.delete_private_ipE  sr    * '&*A*A&*I*/*@*@AS*T*V V02LL
 !!,"5"5t)/ " 1 	1r   c                     S[         R                  " U5      -  nUc
  [        5       nSU0nU R                  [        R
                  XEUS9$ )  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   r3   rQ   r
   rR   r?   r)   r   rd   rT   s         r   get_eni_detailsEniClient.get_eni_detailse  sZ    " F33F;;02LL
 !!,"2"2D)/ " 1 	1r   )rN   r]   c                     S[         R                  " U5      -  nUc
  [        5       nSUS.n0 nUb  [         R                  " U5      US'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param instance_id: The parameter to specify the id of instance
:type instance_id: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   attachr3   
instanceIdr>   rX   r   rN   r]   rH   r   r$   r'   r%   s           r   attach_eni_instanceEniClient.attach_eni_instance      ( F33F;;02L(
 "!'!9!9+!FD!!,"2"2Dtzz$?OX^)/ " 1 	1r   c                     S[         R                  " U5      -  nUc
  [        5       nSUS.n0 nUb  [         R                  " U5      US'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )rw   rP   N)s   detachr3   rx   r>   rX   ry   s           r   detach_eni_instanceEniClient.detach_eni_instance  r|   r   )rN   r-   c                     S[         R                  " U5      -  nUc
  [        5       nSUS.n0 nX'S'   U R                  [        R
                  U[        R                  " U5      UUS9$ )a  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param security_group_ids: security group ids
:type security_group_ids: list

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   bindSgr3   r5   r>   r
   rR   r?   r)   r   rY   rE   rF   )r   rN   r-   rH   r   r$   r'   r%   s           r   update_eni_security_group#EniClient.update_eni_security_group  sw    ( F33F;;02L(
 #5 !!,"2"2Dtzz$?OX^)/ " 1 	1r   c                     S[         R                  " U5      -  nUc
  [        5       nSUS.n0 nX'S'   U R                  [        R
                  U[        R                  " U5      UUS9$ )a#  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param enterprise_security_group_ids: enterprise security group ids
:type enterprise_security_group_ids: list

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   bindEsgr3   r6   r>   r   )r   rN   r.   rH   r   r$   r'   r%   s           r   $update_eni_enterprise_security_group.EniClient.update_eni_enterprise_security_group  sw    * F33F;;02L(
 -J)*!!,"2"2Dtzz$?OX^)/ " 1 	1r   )rN   rg   r^   private_ip_address_countc                     S[         R                  " U5      -  nUc
  [        5       nSU0n0 n	Ub  X9S'   Ub  X)S'   Ub  XIS'   U R                  [        R
                  U[        R                  " U	5      UUS9$ )a  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param is_ipv6: The parameter to specify the ipv6 flag
:type is_ipv6: bool

:param private_ip_address_list: 
    The parameter to specify the private ip address list.
    if is_ipv6 is True, the private ip address must be a valid ipv6 address.
:type private_ip_address_list: list

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
s   /eni/%s/privateIp/batchAddr3   privateIpAddressesrj   privateIpAddressCountr>   r
   rR   r?   r)   r   rD   rE   rF   )
r   rN   rg   r^   r   rH   r   r$   r'   r%   s
             r   batch_add_private_ipEniClient.batch_add_private_ip  s    4 -v/F/Fv/NN02LL
 ".)@%&$N#/,D()!!,"3"3T

4@PY_)/ " 1 	1r   )rN   r^   c                     S[         R                  " U5      -  nUc
  [        5       nSU0n0 nX'S'   U R                  [        R
                  U[        R                  " U5      UUS9$ )a  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param private_ip_address_list: 
    The parameter to specify the private ip address list.
    if is_ipv6 is True, the private ip address must be a valid ipv6 address.
:type private_ip_address_list: list

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
s   /eni/%s/privateIp/batchDelr3   r   r>   r   )r   rN   r^   rH   r   r$   r'   r%   s           r   batch_delete_private_ip!EniClient.batch_delete_private_ip,  sv    , -v/F/Fv/NN02LL
 %<!"!!,"3"3T

4@PY_)/ " 1 	1r   c                     S[         R                  " U5      -  nUc
  [        5       nSU0nU R                  [        R
                  XEUS9$ )rr   s   /eni/%s/statusr3   rQ   rs   rT   s         r   get_eni_statusEniClient.get_eni_statusM  sZ    " !6#:#:6#BB02LL
 !!,"2"2D)/ " 1 	1r   )rN   rh   public_ip_addressc                 *   S[         R                  " U5      -  nUc
  [        5       nSUS.n0 n[         R                  " U5      US'   [         R                  " U5      US'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param private_ip_address:
    The parameter to specify the private ip address.
:type private_ip_address: string

:param public_ip_address:
    The parameter to specify the public ip address.
:type public_ip_address: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   bindr3   r9   r7   r>   rX   )	r   rN   privat_ip_addressr   rH   r   r$   r'   r%   s	            r   bind_eni_public_ipEniClient.bind_eni_public_ipg  s    2 F33F;;02L(

 #)#;#;<M#N "(":":;L"M!!,"2"2Dtzz$?OX^)/ " 1 	1r   c                     S[         R                  " U5      -  nUc
  [        5       nSUS.n0 n[         R                  " U5      US'   U R	                  [
        R                  U[        R                  " U5      UUS9$ )a#  
:param eni_id: The parameter to specify the id of eni
:type eni_id: string

:param public_ip_address:
    The parameter to specify the public ip address.
:type public_ip_address: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if clientToken is provided.
    If the clientToken is not specified by the user, a random String generated by default algorithm will be used.
:type client_token: string

:type config: baidubce.BceClientConfiguration
:param config:

:return: BceResponse
rP   N)s   unBindr3   r7   r>   rX   )r   rN   r   rH   r   r$   r'   r%   s           r   unbind_eni_public_ipEniClient.unbind_eni_public_ip  s    * F33F;;02L(

 "(":":;L"M!!,"2"2Dtzz$?OX^)/ " 1 	1r    r   )NNNNN)NNNNNNNN)NN)NNNN)NNNNNNN)NNN) __name__
__module____qualname____firstlineno____doc__r"   r   r   r)   r	   bytesstrlistrL   rU   rZ   intre   boolrk   ro   rt   rz   r~   r   r   r   r   r   r   r   __static_attributes__r   r   r   r   r   %   s    F= 7;/3
I E3<E3<D,0dbfhaeUY26-1R1hR1h eS\"1 #14 eS\5$1 6$1L eS\s|5#,hlS\C1TXGK;11;1z eS\4UCLQ#1 R#1J eS\uclC1 D1> eS\"1 #12 eS\s|<1 =1@ eS\s|<1 =1@ eS\d;1 <1> eS\d;GK1 <1@ eS\4hklQUVZ'1 m'1R eS\4@1 A1@ eS\"1 #12 eS\uclW\^aVbc$1 d$1L eS\uclW\^aVbc1 d1r   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
)r   uuiduuid4r   r   r   generate_client_token_by_uuidr     s     tzz|r   )r   r   rE   loggingr   baidubcer   baidubce.authr   baidubce.httpr   r   r   r   baidubce.utilsr	   r
   	getLoggerr   _loggerr   r   r   r?   r   r   r   <module>r      sb         $ ' ) ! &  # 


H
%I
1-- I
1X 6 r   