
    9i2                         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\
5      rg)z.
This module provides a client class for EIP.
    N)utils)bce_v1_signer)BceBaseClient)bce_http_client)handler)http_methods)requiredc                   .   \ rS rSrSrSrSrSS jr\" \	S9  SS j5       r
\" \\	S	9  SS
 j5       r\" \S9SS j5       r  SS jr\" \\S9  SS j5       r\" \\S9  SS j5       r\" \S9SS j5       r\S 5       r\SS j5       rS r  SS jrSrg)EipBpClient%   z
EIP_BP sdk client
s   /v1s   /eipbpNc                 0    [         R                  " X5        g)z>
:type config: baidubce.BceClientConfiguration
:param config:
N)r   __init__)selfconfigs     c/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/eip/eip_bp_client.pyr   EipBpClient.__init__,   s    
 	t,    )bandwidth_in_mbpsc                    SU0nUc  Uc  [        S5      eUb  XS'   Ub  X(S'   Ub  XHS'   Ub  XXS'   U R                  5       n	Uc  U R                  5       nSU0n
U R                  [        R
                  U	[        R                  " U5      U
US9$ )	a  
Create an eip_bp with the specified options.

:type eip: string
:param eip: the eip address that the eip_bp attach.
Param "eip" and "eip_group_Id" will has only one param take effect.

:type eip_group_Id: string
:param eip_group_Id: the eipgroupId that the eip_bp attach.
Param "eip" and "eip_group_Id" will has only one param take effect.

:type bandwidth_in_mbps: int
:param bandwidth_in_mbps: the bandwidth of eip_bp in Mbps.

:type name: string
:param name:the name of eipbp. The optional parameter.

:type auto_release_time: string (UTC format,like yyyy:mm:ddThh:mm:ssZ)
:param autoReleaseTime: the autoReleaseTime of eipbp. The optional parameter.

: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: created eip_bp id, for example,{"id":"bw-xxxxxxxx"}
bandwidthInMbpss4   eip and eip_group_Id can't be none at the same time.eip
eipGroupIdnameautoReleaseTime   clientToken)bodyparamsr   )
ValueError	_get_path_generate_default_client_token_send_requestr   POSTjsondumps)r   r   eip_group_Idr   r   r   client_tokenr   r   pathr   s              r   create_eip_bpEipBpClient.create_eip_bp3   s    B 0
 ;</TUU?K#!-L&&5"#~~>>@LL
 !!,"3"3T'+zz$'7)/ " 1 	1r   )idnew_bandwidth_in_mbpsc                     SU0n[         R                  " U R                  5       U5      nUc  U R                  5       nSUS.nU R	                  [
        R                  Xg[        R                  " U5      US9$ )a  
Resizing eip_bp

:type id: string
:param id: eip_bp's id to be resized

:type new_bandwidth_in_mbps: int
:param new_bandwidth_in_mbps: specify new bandwidth in Mbps for eip_bp

: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
r   r   )s   resizer   r   r   r   	r   
append_urir   r    r!   r   PUTr#   r$   )r   r*   r+   r&   r   r   r'   r   s           r   resize_eip_bpEipBpClient.resize_eip_bpm   s    , 4
  0"5>>@L(
 !!,"2"2D'+zz$'7 " H 	Hr   )r*   c                     [         R                  " U R                  5       U5      nU R                  [        R
                  USUS9$ )a~  
get eip_bp's detail owned by the authenticated user and givened eip_bp_id.

:type id: string
:param eip: eip_bp's id.

:type config: baidubce.BceClientConfiguration
:param config:

:return: detail of eip_bp, for example:
        {
            "autoReleaseTime": "2020-05-30T06:46:44Z",
            "name": "EIP_BP1588821183401",
            "instanceId": "ip-9340430e",
            "createTime": "2020-05-07T03:13:03Z",
            "id": "bw-5fb3ce39",
            "eips": [
                "100.88.9.120"
            ],
            "instanceBandwidthInMbps": 1,
            "bandwidthInMbps": 2,
            "bindType": "eip"
        }
Nr   r   )r   r/   r   r!   r   GET)r   r*   r   r'   s       r   get_eip_bp_detailEipBpClient.get_eip_bp_detail   sD    6  0"5!!,"2"2D)/ " 1 	1r   c                     U R                  5       n0 nUb  XS'   Ub  X(S'   Ub  X8S'   Ub  XHS'   Ub  XXS'   U R                  [        R                  XxUS9$ )a  
get a list of eip_bp owned by the authenticated user and specified
conditions. we can Also get a single eip_bp function  through this
interface by eip_bp condition

:type id: string
:param id: eip_bp 's id conditions

:type name: string
:param name: eip_bp 's name condition

:type bind_type: string
:param bind_type: eip_bp 's bind_type condition, 'eip' or 'eipgroup'

:type marker: string
:param marker: The optional parameter marker specified in the original
 request to specify where in the results to begin listing.

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

:type config: baidubce.BceClientConfiguration
:param config:

:return: list of eip_bp model, for example:
        {
            "marker": "bw-5fb3ce39",
            "maxKeys": 1000,
            "nextMarker": null,
            "bpList": [
                {
                    "autoReleaseTime": "2020-05-30T06:46:44Z",
                    "name": "EIP_BP1588821183401",
                    "instanceId": "ip-9340430e",
                    "createTime": "2020-05-07T03:13:03Z",
                    "id": "bw-5fb3ce39",
                    "eips": [
                        "100.88.9.120"
                    ],
                    "bandwidthInMbps": 2,
                    "bindType": "eip"
                }
            ],
            "isTruncated": false
        }
s   ids   names   bindTypes   markers   maxKeysr4   )r   r!   r   r5   )	r   r*   r   	bind_typemarkermax_keysr   r'   r   s	            r   list_eip_bpsEipBpClient.list_eip_bps   s~    d ~~>5M"7O "+; &9!):!!,"2"2D)/ " 1 	1r   )r*   auto_release_timec                     SU0n[         R                  " U R                  5       U5      nUc  U R                  5       nSUS.nU R	                  [
        R                  Xg[        R                  " U5      US9$ )a  
Update eip_bp's auto_release_time

:type id: string
:param id: eip_bp's id

:type auto_release_time: string (UTC format,like yyyy:mm:ddThh:mm:ssZ)
:param auto_release_time: specify auto_release_time for eip_bp

: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
r   r   )s   retimer   r-   r.   )r   r*   r>   r&   r   r   r'   r   s           r   update_eip_bp_autoReleaseTime)EipBpClient.update_eip_bp_autoReleaseTime   s    , 0
  0"5>>@L(
 !!,"2"2D'+zz$'7 " H 	Hr   )r*   r   c                     SU0n[         R                  " U R                  5       U5      nUc  U R                  5       nSUS.nU R	                  [
        R                  Xg[        R                  " U5      US9$ )ab  
Update eip_bp's name

:type id: string
:param id: eip_bp's id

:type name: string
:param name: eip_bp's name

: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
r   r   )s   renamer   r-   r.   )r   r*   r   r&   r   r   r'   r   s           r   rename_eip_bpEipBpClient.rename_eip_bp  s    , D
  0"5>>@L(
 !!,"2"2D'+zz$'7 " H 	Hr   c                     [         R                  " U R                  5       U5      nUc  U R                  5       nSU0nU R	                  [
        R                  XEUS9$ )aR  
release the eip_bp(delete operation)

:type id: string
:param id: eip_bp's id 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
r   r4   )r   r/   r   r    r!   r   DELETE)r   r*   r&   r   r'   r   s         r   release_eip_bpEipBpClient.release_eip_bp3  sd    "  0"5>>@LL
 !!,"5"5t)/ " 1 	1r   c                  ,    [         R                  " 5       $ )z
default client token by uuid1
)uuiduuid1 r   r   r    *EipBpClient._generate_default_client_tokenM  s    
 zz|r   c                 r    U c  [         R                  n [        R                  " [         R                  U 5      $ )z1
:type prefix: string
:param prefix: path prefix
)r   prefixr   r/   version)rO   s    r   r   EipBpClient._get_pathT  s-     > ''F 3 3V<<r   c                     Uc  U R                   $ [        R                  " U R                   5      nUR                  U5        U$ )zH

:type config: baidubce.BceClientConfiguration
:param config:
:return:
)r   copymerge_non_none_values)r   r   
new_configs      r   _merge_configEipBpClient._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      $ )z

:param http_method:
:param path:
:param body:
:param headers:
:param params:

:type config: baidubce.BceClientConfiguration
:param config:

:param body_parser:

:return: baidubce.BceResponse
s   */*s   application/json;charset=utf-8)s   Accepts   Content-Type)rV   r   
parse_jsonr   send_requestr   signparse_error)r   http_methodr'   r   headersr   r   body_parsers           r   r!   EipBpClient._send_requestl  sm    " ##F+!,,K?"((IKG ++FM4F4F-4-@-@+,N,7t,24 	4r   rL   )N)NNNN)NN)NNNNi  N)NNNNN)__name__
__module____qualname____firstlineno____doc__rP   rO   r   r	   intr(   strr1   r6   r<   r@   rC   rG   staticmethodr    r   rV   r!   __static_attributes__rL   r   r   r   r   %   s     GF- $]a0471 %71r C0DH!H 1HB 1 1< :>8<?1B ,PT-1H -HB 337!H  HB 1 12   = = CG<@4r   r   )re   rS   r#   loggingrJ   baidubcer   baidubce.authr   baidubce.bce_base_clientr   baidubce.httpr   r   r   baidubce.utilsr	   	getLoggerra   _loggerr   rL   r   r   <module>rr      sK   "      ' 2 ) ! & #


H
%c4- c4r   