
    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 ROUTE.
    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\
\4S
9SS j5       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S9    SS j5       rSrg)RouteClient"   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/route/route_client.pyr   RouteClient.__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RouteClient._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RouteClient._send_request8   sv     ##F+!,,K?"(;\]G++M&&)<)<k(J++d2D6K 	Kr   )route_table_idsource_addressdestination_addressdescriptionc                 B   Sn0 nU	c  [        5       US'   OXS'   [        R                  " U5      [        R                  " U5      [        R                  " U5      [        R                  " U5      S.nUb  [        R                  " U5      US'   Ub  [        R                  " U5      US'   Ub  [        R                  " U5      US'   Ub  U Vs/ s H  oR                  PM     nnXS'   U R	                  [
        R                  U[        R                  " U5      UU
S9$ s  snf )	ac  
Create a route with the specified options.

:param route_table_id:
    The id of the route table.
:type route_table_id: string

:param source_address:
    The source address of the route.
:type source_address: string

:param destination_address:
    The destination address of the route
:type destination_address: string

:param next_hop_type:
    route type
    the Bcc type is "custom";
    the VPN type is "vpn";
    the NAT type is "nat";
    the dedicatedGateway type is "dcGateway"; Multi-line mode does not require
    the PeerConn type is "peerConn";
    the ENIC type is "enic";
    the HaVip type is "havip";
    the ipv6Gateway type is "ipv6gateway";
    the local gateway type is "defaultGateway"
:type next_hop_type: string

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

:param next_hop_id:
    The next hop id
    when the nexthopType is "defaultGateway",this field can be empty
:type next_hop_id: string
:param next_hop_id:
    The next hop id
    when the nexthopType is "defaultGateway",this field can be empty
:type next_hop_id: string

:param next_hop_list:
    The optional list of dcGateway Multi-line mode route to create.
        - NextHop.nexthopId next hop dcGateway ID
        - NextHop.nexthopType Route type. Currently only supports dedicatedGateway type: "dcGateway"
        - NextHop.pathType Multiline mode. The value of load balancing is ecmp; the values of active and
        standby modes are ha:active and ha:standby, which represent the active and standby routes respectively
:type next_hop_list: list<route_model.NextHop>

: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
   /route/rule   clientToken)routeTableIdsourceAddressdestinationAddressr-   nexthopType	nexthopId	ipVersionnextHopListr$   r&   r   )	generate_client_tokenr	   convert_to_string__dict__r(   r   POSTjsondumps)r   r*   r+   r,   next_hop_typer-   next_hop_id
ip_version	next_hopsclient_tokenr   r#   r&   r$   next_hopnext_hop_lists                   r   create_routeRouteClient.create_routeD   s   H %:%<F>"%1>" #44^D#55nE"(":":;N"O!33K@	
 $"(":":="ID" & 8 8 ED! & 8 8 DD ?HIy8..yMI"/!!,"3"3T

4@PY_)/ " 1 	1 Js   D)vpc_idr*   c                 d    Sn0 nUb  X%S'   Ub  XS'   U R                  [        R                  XEUS9$ )a  
Get the detail information of route table for specific route table or/and vpc.

:param vpc_id:
    the vpc id
    vpcId and routeTableId cannot be empty at the same time
:type vpc_id: string

:param route_table_id:
    the id of the route table
    vpcId and routeTableId cannot be empty at the same time
:type route_table_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
s   /route   routeTableId   vpcIdr&   r   r(   r   GET)r   rH   r*   r   r#   r&   s         r   	get_routeRouteClient.get_route   sI    * %&4?#%8!!,"2"2DPV!WWr   )versionr1   vpcIdmarkermaxKeysc                     Sn0 nUb  XS'   Ub  X'S'   Ub  X7S'   Ub  XGS'   U R                  [        R                  XgUS9$ )a  
Get the details of route rules in a specified route table or VPC.

:param version:
    API version.
:type version: string

:param routeTableId:
    The ID of the route table. Either `routeTableId` or `vpcId` must be provided.
:type routeTableId: string

:param vpcId:
    The ID of the VPC. Either `routeTableId` or `vpcId` must be provided.
:type vpcId: string

:param marker:
    The marker for the start position of batch retrieval.
:type marker: string

:param maxKeys:
    The maximum number of entries per page (up to 1000).
:type maxKeys: int

:param config:
    BceClientConfiguration object.
:type config: baidubce.BceClientConfiguration

:return:
    A BceResponse object.
:rtype: baidubce.bce_response.BceResponse
r/   rJ   rK   s   markers   maxKeysrL   rM   )r   r1   rR   rS   rT   r   r#   r&   s           r   get_route_ruleRouteClient.get_route_rule   sf    B #&2?#$8 &9!(:!!,"2"2DPV!WWr   )route_rule_idc                     S[         R                  " U5      -  nSS0nUc  [        5       US'   OX%S'   U R                  [        R
                  XEUS9$ )a  
Delete the  specific route rule.

:param route_rule_id:
    The id of the specified route table.
:type route_rule_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 route_table_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
   /route/rule/%sactionswitchRouteHAr0   rL   r	   convert_to_bytesr9   r(   r   DELETEr   rX   rC   r   r#   r&   s         r   delete_routeRouteClient.delete_route   sa    ( !6#:#:=#IIo
 %:%<F>"%1>"!!,"5"5tSY!ZZr   c                     S[         R                  " U5      -  n0 nUc  [        5       US'   OX%S'   U R                  [        R
                  XEUS9$ )a  
In a multi-line master-slave routing mode, switching the main route to the backup route.

:param route_rule_id:
    The id of the specified route table.
:type route_rule_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
rZ   r0   rL   r]   r`   s         r   switch_routeRouteClient.switch_route  sX    ( !6#:#:=#II%:%<F>"%1>"!!,"5"5tSY!ZZr   )rX   r-   c                 `   S[         R                  " U5      -  n0 nU	c  [        5       US'   OXS'   S[         R                  " U5      0nUb  [         R                  " U5      US'   Ub  [         R                  " U5      US'   Ub  [         R                  " U5      US'   Ub  U Vs/ s H  oR                  PM     nnXS'   Ub  [         R                  " U5      US'   Ub  [         R                  " U5      US	'   U R                  [        R                  U[        R                  " U5      XS
9$ s  snf )a  
Update a route with the specified options.

:param route_rule_id:
    The id of the route rule to be updated.
:type route_rule_id: string

:param source_address:
    The source address of the route.
:type source_address: string

:param destination_address:
    The destination address of the route.
:type destination_address: string

:param next_hop_type:
    Route type.
:type next_hop_type: string

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

:param next_hop_id:
    The next hop id.
:type next_hop_id: string

:param ip_version:
    IP version.
:type ip_version: string

:param next_hops:
    The optional list of next hops.
:type next_hops: list<route_model.NextHop>

: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
rZ   r0   r-   r4   r5   r6   r7   r3   r2   r8   )
r	   r^   r9   r:   r;   r(   r   PUTr=   r>   )r   rX   r+   r,   r?   r-   r@   rA   rB   rC   r   r#   r&   r$   rD   rE   s                   r   update_routeRouteClient.update_route)  s4   h !6#:#:=#II%:%<F>"%1>" 633K@
 $"(":":="ID" & 8 8 ED! & 8 8 DD ?HIy8..yMI"/*)/)A)ABU)VD%&%$*$<$<^$LD!!!,"2"2Dtzz$?OX^!nn Js   $D+ r   )NNNNN)N NNNNN)NNN)NN)	NNNrk   NNNNN)__name__
__module____qualname____firstlineno____doc__r!   r   r   r(   r   bytesstrrF   rO   intrV   ra   rd   rh   __static_attributes__rj   r   r   r   r   "   s=    F= 7;/3
K eS\#S\#(#, #,(
 W[26 Z1	(Z1x eS\5#,?X @X8 ucl%eS\[`beZfpst+X u+XZ UCL)[ *[: UCL)[ *[6 UCL #,(SWVZ26 Lo(L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
)rr   uuiduuid4rj   r   r   generate_client_token_by_uuidrx   z  s     tzz|r   )rp   r   r=   loggingrv   baidubcer   baidubce.authr   baidubce.httpr   r   r   baidubce.utilsr   r	   	getLoggerrl   _loggerr   r   rx   r9   rj   r   r   <module>r      sa        $ ' ) ! & # 


H
%Uo/// Uop
 6 r   