
    9i^"                         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)z1
This module provides a client class for EIP TP.
    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S jr\S 5       r\SS j5       rS r  SS jrSrg)EipTpClient%   z
EIP_TP sdk client
s   /v1s   /eiptpNc                 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_tp_client.pyr   EipTpClient.__init__,   s    
 	t,    )reservation_lengthcapacityc                     UUS.nUb  X7S'   Ub  XGS'   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_tp with the specified options.

:type reservation_length: int
:param reservation_length: the reservation length of the eip_tp including 1, 6 and 12 months.

:type capacity: string
:param capacity: the capacity of the eip_tp.
When reservationLength = 1 => capacity: {"10G"/"50G"/"100G"/"500G"/"1T"/"5T"/"10T"/"50T"}
When reservationLength = 6 => capacity: {"60G"/"300G"/"600G"/"3T"/"6T"/"30T"/"60T"/"300T"}
When reservationLength = 12 => capacity: {"1T"/"10T"/"50T"/"100T"/"500T"/"1P"}

:type deduct_policy: string
:param deduct_policy: the deduct policy of the eip_tp including 'FullTimeDurationPackage'
and 'TimeDurationPackage'.
The default deduct policy is 'FullTimeDurationPackage', the optional parameter.

:type package_type: string
:param package_type: the eip_tp package type.
The default package type is 'WebOutBytes', 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_tp id, for example,{"id":"tp-xxxxxxxxxx"}
)reservationLengthr   deductPolicypackageTypes   clientToken)bodyparamsr   )	_get_path_generate_default_client_token_send_requestr   POSTjsondumps)
r   r   r   deduct_policypackage_typeclient_tokenr   r   pathr   s
             r   create_eip_tpEipTpClient.create_eip_tp3   s    F "4 
 $#0 #".~~>>@LL
 !!,"3"3T'+zz$'7)/ " 1 	1r   )idc                     [         R                  " U R                  5       U5      nU R                  [        R
                  USUS9$ )aZ  
get the eip_tp's detail owned by the authenticated user by the passed eip_tp_id.

:type id: string
:param id: eip_tp's id.

:type config: baidubce.BceClientConfiguration
:param config:

:return: detail of eip_tp, for example:
        {
          "id":"tp-87V5cnkwqO",
          "deductPolicy":"TimeDurationPackage",
          "packageType":"WebOutBytes",
          "status":"RUNNING",
          "capacity": 10737418240,
          "usedCapacity": 0,
          "createTime":"2021-04-10T11:40:57Z",
          "activeTime": "2021-04-10T11:41:16Z",
          "expireTime:" "2021-05-10T11:41:16Z"
        }
Nr   r   )r   
append_urir   r   r   GET)r   r(   r   r%   s       r   get_eip_tp_detailEipTpClient.get_eip_tp_detailg   sD    2  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_tp owned by the authenticated filtered by specific conditions.

:type id: string
:param id: eip_tp's id, the optional parameter.

:type deduct_policy: string
:param deduct_policy: eip_tp's deduct policy, 'FullTimeDurationPackage' or 'TimeDurationPackage', the optional parameter.

:type status: string
:param status: eip_tp's status, 'RUNNING', 'EXPIRED' or 'USED_UP', the optional parameter.

: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_tp model, for example:
        {
            "marker": "tp-87V5cnkwqO",
            "maxKeys": 1,
            "nextMarker": "tp-Qn65tYXAx3",
            "isTruncated": true,
            "packageList": [
                {
                   "id":"tp-87V5cnkwqO",
                   "deductPolicy":"TimeDurationPackage",
                   "packageType":"WebOutBytes",
                   "status":"RUNNING",
                   "capacity": 10737418240,
                   "usedCapacity": 0,
                   "createTime":"2021-04-10T11:40:57Z",
                   "activeTime": "2021-04-10T11:41:16Z",
                   "expireTime:" "2021-05-10T11:41:16Z"
                }
            ]
        }
s   ids   deductPolicys   statuss   markers   maxKeysr*   )r   r   r   r,   )	r   r(   r"   statusmarkermax_keysr   r%   r   s	            r   list_eip_tpsEipTpClient.list_eip_tps   s    ^ ~~>5M$&3?# &9 &9!):!!,"2"2D)/ " 1 	1r   c                  ,    [         R                  " 5       $ )z
default client token by uuid1
)uuiduuid1 r   r   r   *EipTpClient._generate_default_client_token   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)r;   s    r   r   EipTpClient._get_path   s-     > ''F 3 3V<<r   c                     Uc  U R                   $ [        R                  " U R                   5      nUR                  U5        U$ )zG
:type config: baidubce.BceClientConfiguration
:param config:
:return:
)r   copymerge_non_none_values)r   r   
new_configs      r   _merge_configEipTpClient._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)rB   r   
parse_jsonr   send_requestr   signparse_error)r   http_methodr%   r   headersr   r   body_parsers           r   r   EipTpClient._send_request   sm      ##F+!,,K?"((IKG ++FM4F4F-4-@-@+,N,7t,24 	4r   r8   )N)NNNN)NNNNi  N)NNNNN)__name__
__module____qualname____firstlineno____doc__r<   r;   r   r	   intstrr&   r-   r3   staticmethodr   r   rB   r   __static_attributes__r8   r   r   r   r   %   s     GF- [_040101d 1 18 @D8<<1|   = = CG<@4r   r   )rQ   r?   r    loggingr6   baidubcer   baidubce.authr   baidubce.bce_base_clientr   baidubce.httpr   r   r   baidubce.utilsr	   	getLoggerrM   _loggerr   r8   r   r   <module>r^      sK   "      ' 2 ) ! & #


H
%V4- V4r   