
    9if=                         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)z1
This module provides a client class for SUBNET.
    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\
\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\
\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)SubnetClient"   z
Subnet base sdk client
s   /v1Nc                 B    [         R                  R                  X5        g N)r   BceBaseClient__init__)selfconfigs     f/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/subnet/subnet_client.pyr   SubnetClient.__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SubnetClient._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SubnetClient._send_request8   sv     ##F+!,,K?"(;\]G++M&&)<)<k(J,,t3TFL 	Lr   )name	zone_namecidrvpc_idc                    Sn0 nUc  [        5       US'   OX}S'   [        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  XS'   Ub  XS'   U	b  [        R                  " U	5      US'   U R                  [        R
                  U[        R                  " U5      UU
S	9$ )
aI  
Create a subnet with the specified options.

:param name:
    The name of subnet that will be created.
type name: string

:param zone_name:
    The name of available zone which the subnet belong
    through listZones, we can get all available zone info at current region
    ee.g. "cn-gz-a"  "cn-gz-b"
type zone_name: string

:param cidr:
    The CIDR of this subnet.
type cidr: string

:param vpc_id:
    The id of vpc which this subnet belongs.
type vpc_id: string

:param subnet_type:
    The option param to describe the type of subnet create
type subnet_type: string

:param description:
    The option param to describe the subnet
type description: string

:param enable_ipv6:
    The option param to enable or disable ipv6 for the subnet
:type enable_ipv6: boolean

:param vpc_secondary_cidr:
    The secondary CIDR block of the VPC that the subnet belongs to.
:type vpc_secondary_cidr: 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

:param tags:
    List of tags to be bind
:type tags: list

:return:
:rtype baidubce.bce_response.BceResponse
   /subnet   clientToken)r*   zoneNamer,   vpcId
subnetTypedescriptiontags
enableIpv6vpcSecondaryCidrr$   r&   r   generate_client_tokenr	   convert_to_stringr(   r   POSTjsondumps)r   r*   r+   r,   r-   subnet_typer4   client_tokenenable_ipv6vpc_secondary_cidrr   r5   r#   r&   r$   s                  r   create_subnetSubnetClient.create_subnetD   s   x %:%<F>"%1>" ,,T200;,,T2--f5	
 "!'!9!9+!FD""(":":;"GDL"!,)'-'?'?@R'SD#$!!,"3"3T

4@PY_)/ " 1 	1r   )markermax_Keysr-   r+   r?   c                     Sn0 n	Ub  XS'   Ub  X)S'   Ub  X9S'   Ub  XIS'   Ub  XYS'   Ub  XiS'   U R                  [        R                  XUS9$ )	a1  
Return a list of subnets owned by the authenticated user.

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

:param vpc_id:
    The id of the vpc
:type vpc_id: string

:param subnet_ids:
    The ids of the subnet

:param zone_name:
    The name of available zone which the subnet belong
    through listZones, we can get all available zone info at current region
    ee.g. "cn-gz-a"  "cn-gz-b"
:type zone_name: string

:param subnet_type:
    The option param to describe the type of subnet to be created
:type subnet_type: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
r/      marker   maxKeyss   vpcIds	   subnetIdss   zoneNames
   subnetTyper&   r   r(   r   GET)
r   rE   max_keysr-   
subnet_idsr+   r?   r   r#   r&   s
             r   list_subnetsSubnetClient.list_subnets   s    Z  &9!):%8!#-<  "+;"$/=!!!,"2"2DPV!WWr   )	subnet_idc                 p    S[         R                  " U5      -  nU R                  [        R                  X2S9$ )z
Get the detail information of a specified subnet.

:param subnet_id:
    The id of the subnet.
:type subnet_id: string

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse

   /subnet/%s)r   )r	   convert_to_bytesr(   r   rL   )r   rQ   r   r#   s       r   
get_subnetSubnetClient.get_subnet   s5     v66yAA!!,"2"2D!HHr   c                     S[         R                  " U5      -  n0 nUc  [        5       US'   OX%S'   U R                  [        R
                  XEUS9$ )a  
Delete the specified subnet owned by the user.
:param subnet_id:
    The id of the subnet to be deleted.
:type subnet_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

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
rS   r0   rJ   r	   rT   r:   r(   r   DELETE)r   rQ   r@   r   r#   r&   s         r   delete_subnetSubnetClient.delete_subnet   sX    * v66yAA%:%<F>"%1>"!!,"5"5tSY!ZZr   )rQ   r*   r4   c                 D   S[         R                  " U5      -  nSS0nS[         R                  " U5      0n	Uc  [        5       US'   OXXS'   Ub  [         R                  " U5      U	S'   Ub  XIS'   U R	                  [
        R                  U[        R                  " U	5      XS9$ )	a7  
Modify the special attribute to new value of the subnet owned by the user.

:param subnet_id:
    The id of the specific subnet to be updated.
:type subnet_id: string

:param name:
    The name of the subnet
:type name: string

:param description:
    The option param to describe the subnet
:type description: string

:param enable_ipv6: 
    The option param to enable or disable ipv6 for the subnet
:type enable_ipv6: boolean

: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
rS   s   modifyAttributeNr*   r0   r4   r6   rJ   )	r	   rT   r;   r:   r(   r   PUTr=   r>   )
r   rQ   r*   r4   rA   r@   r   r#   r&   r$   s
             r   update_subnetSubnetClient.update_subnet  s    D v66yAA
 F,,T2
 %:%<F>"%1>"""(":":;"GD"!,!!,"2"2D$**T:J)/ " @ 	@r   )rQ   ip_cidr
ip_versionr4   c                 *   SnUc  S[        5       0OSU0n[        R                  " U5      [        R                  " U5      US.n	Ub  [        R                  " U5      U	S'   U R                  [        R
                  U[        R                  " U	5      UUS9$ )a1  
Create a ipreserve segment with the specified options.

:param subnet_id:
    The id of the subnet that the reserved subnet belongs to.
:type subnet_id: string

:param ip_cidr:
    The IP or CIDR of the reserved subnet.
:type ip_cidr: string

:param ip_version:
    The IP version, supports IPv4 and IPv6.
:type ip_version: int

:param description:
    The description of the reserved subnet.
:type description: string

:param client_token:
    An ASCII string whose length is less than 64.
    The request will be idempotent if the 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
   /subnet/ipreserveclientToken)subnetIdipCidr	ipVersionr4   r8   r9   )
r   rQ   r`   ra   r4   r@   r   r#   r&   r$   s
             r   create_subnet_ipreserve$SubnetClient.create_subnet_ipreserveH  s    L $=I=Q-!6!89XegsWt 00;..w7#
 ""(":":;"GD!!,"3"3T

4@PY_)/ " 1 	1r   )rQ   rE   rM   c                 r    Sn0 nUb  XS'   Ub  X&S'   Ub  X6S'   U R                  [        R                  XVUS9$ )a  
List reserved within subnets.

:param subnet_id:
    The id of the subnet.
:type subnet_id: string

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

:param max_keys:
    The optional parameter to specify the max number of list results to return.
:type max_keys: int

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
rc   s   subnetIdrH   rI   rJ   rK   )r   rQ   rE   rM   r   r#   r&   s          r   list_subnet_ipreserve"SubnetClient.list_subnet_ipreserve}  sW    4 $ "+; &9!):!!,"2"2DPV!WWr   )ip_reserve_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 specified reserved subnet segment.

:param ip_reserve_id:
    The ID of the reserved subnet to be deleted.
:type ip_reserve_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

:param config:
:type config: baidubce.BceClientConfiguration

:return:
:rtype baidubce.bce_response.BceResponse
s   /subnet/ipreserve/%sr0   rJ   rX   )r   rm   r@   r   r#   r&   s         r   delete_subnet_ipreserve$SubnetClient.delete_subnet_ipreserve  sX    , ')@)@)OO%:%<F>"%1>"!!,"5"5tSY!ZZr    r   )NNNNN)NNNNNNN)NN)NNNN)NNN)__name__
__module____qualname____firstlineno____doc__r!   r   r   r(   r   bytesstrrC   intrO   rU   rZ   r^   rh   rk   ro   __static_attributes__rq   r   r   r   r   "   s    F= 7;/3
L E3<3<S\# Z^fjV1	#V1p eS\S\ #,	(
 PT>B7X(
7Xr %I &I$ %[ &[< E3<eS\R5@ S5@n cl #,( SW9=/1	(/1b S\ X XD UCL)[ *[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
)rx   uuiduuid4rq   r   r   generate_client_token_by_uuidr~     s     tzz|r   )rv   r   r=   loggingr|   baidubcer   baidubce.authr   baidubce.httpr   r   r   baidubce.utilsr   r	   	getLoggerrr   _loggerr   r   r~   r:   rq   r   r   <module>r      sa        $ ' ) ! & # 


H
%^[?00 ^[B 6 r   