o
    lqiJ                     @   s   d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ ddl
mZ ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ejdk rZee ed eeZedZe ZG dd dejZdd ZeZ dS )z6
This module provides a client class for IPv6Gateway.
    N)bce_base_client)bce_v1_signer)bce_http_client)handler)http_methods)ipv6gateway_model)utils)required)compat3zutf-8ZPostpaidc                   @   s  e Zd ZdZdZd)ddZd)ddZ		d*dd	Zee	e
fe	e
fe	efd
		d+ddZee	e
fdd)ddZee	e
fdd,ddZee	e
fe	efdd,ddZee	e
fe	e
fd	d,ddZee	e
fdd+ddZee	e
fe	e
fdd,ddZee	e
fe	e
fe	efe	efd	d,dd Zee	e
fdd+d!d"Zee	e
fe	e
fd#d,d$d%Zee	e
fe	e
fe	efe	efd&	d,d'd(ZdS )-IPv6GatewayClientz 
    IPv6Gateway sdk client
    s   /v1Nc                 C   s   t j| | d S N)r   BceBaseClient__init__)selfconfig r   w/home/app/PaddleOCR-VL/.venv_paddleocr/lib/python3.10/site-packages/baidubce/services/ipv6gateway/ipv6gateway_client.pyr   3   s   zIPv6GatewayClient.__init__c                 C   s(   |du r| j S t| j }|| |S )zV
        :param config:
        :type config: baidubce.BceClientConfiguration
        N)r   copyZmerge_non_none_values)r   r   Z
new_configr   r   r   _merge_config6   s
   
zIPv6GatewayClient._merge_configc              
   C   sJ   |  |}|d u rtj}|d u rddd}t|tjtj|g|||||S )Ns   */*s   application/json;charset=utf-8)s   Accepts   Content-Type)r   r   Z
parse_jsonr   send_requestr   signZparse_error)r   Zhttp_methodpathbodyheadersparamsr   Zbody_parserr   r   r   _send_requestB   s   

zIPv6GatewayClient._send_request)namevpc_idbandwidthInMbpsc           
      C   sn   t | jd}|du rt }d|i}|du rt}t|t|t||jd}	| jt	j
|t|	||dS )a  
        Create a ipv6-gateway with the specified options.

        :param client_token:
            An ASCII string whose length is less than 64.
            The request will be idempotent if client token is provided.
        :type client_token: string

        :param name:
            The name of ipv6-gateway that will be created.
        :type name: string

        :param vpc_id:
            The id of VPC.
        :type vpc_id: string

        :param bandwidthInMbps:
            The number of bandwidth.
        :type bandwidthInMbps: int

        :param billing:
            Billing information.
        :type billing: nat_model.Billing

        :param config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        IPv6GatewayN   clientToken)r   ZvpcIdr   billingr   r   r   )r   
append_uriversiongenerate_client_token#default_billing_to_purchase_createdr
   convert_to_string__dict__r   r   POSTjsondumps)
r   r   r   r   r"   client_tokenr   r   r   r   r   r   r   create_ipv6_gatewayO   s   #
z%IPv6GatewayClient.create_ipv6_gateway)r   c                 C   s*   t | jd}d|i}| jtj|||dS )ad  
        Return a list of ipv6-gateways, according to the VPC ID,
        will return a full list of ipv6 gateways in VPC.

        :param vpc_id:
            The id of VPC.
        :type vpc_id: string

        :param config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        r    s   vpcIdr   r   r   r$   r%   r   r   GET)r   r   r   r   r   r   r   r   list_ipv6_gateways   s
   
z$IPv6GatewayClient.list_ipv6_gateways)
gateway_idc                 C   s:   t | jd|}|du rt }d|i}| jtj|||dS )as  
        delete a  specified ipv6-gateway.

        :param gateway_id:
            The id of specified ipv6-gateway.
        :type gateway_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 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
        r    Nr!   r/   r   r$   r%   r&   r   r   DELETE)r   r3   r-   r   r   r   r   r   r   delete_ipv6_gateway   s   z%IPv6GatewayClient.delete_ipv6_gateway)r3   r   c                 C   sR   t | jd|}|du rt }d|d}dt|i}| jtj|t	
|||dS )a  
        resize a specified ipv6-gateway bandwidth.

        :param gateway_id:
            The id of specified ipv6-gateway.
        :type gateway_id: string

        :param bandwidthInMbps:
            The number of bandwidth.
        :type bandwidthInMbps: 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 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
        r    N)s   resizer!   r   r#   r   r$   r%   r&   r
   r(   r   r   PUTr+   r,   )r   r3   r   r-   r   r   r   r   r   r   r   resize_ipv6_gateway   s   
z%IPv6GatewayClient.resize_ipv6_gateway)r3   cidrc                 C   sR   t | jd|d}|du rt }d|i}dt|i}| jtj|t	
|||dS )ad  
        Create a ipv6-gateway egress only rule with the specified options.

        :param client_token:
            An ASCII string whose length is less than 64.
            The request will be idempotent if client token is provided.
        :type client_token: string

        :param gateway_id:
            The id of ipv6 gateway.
        :type gateway_id: string

        :param cidr:
            The cidr of egress only rule.
        :type cidr: string

        :param config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        r    egressOnlyRuleNr!   r:   r#   r   r$   r%   r&   r
   r(   r   r   r*   r+   r,   )r   r3   r:   r-   r   r   r   r   r   r   r   $create_ipv6_gateway_egress_only_rule   s   

z6IPv6GatewayClient.create_ipv6_gateway_egress_only_rulec                 C   J   t | jd|d}i }|dur||d< |dur||d< | jtj|||dS )a  
        Return a list of ipv6-gateway egress only rules, according to the ipv6 gateway ID,
        will return a full list of ipv6 gateway egress only rules in ipv6 gateway.

        :param gateway_id:
            The id of ipv6 gateway.
        :type gateway_id: string

        :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 config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        r    r;   N   marker   maxKeysr/   r0   r   r3   markerZmax_keysr   r   r   r   r   r   #list_ipv6_gateway_egress_only_rules     
z5IPv6GatewayClient.list_ipv6_gateway_egress_only_rules)r3   egress_only_rule_idc                 C   >   t | jd|d|}|du rt }d|i}| jtj|||dS )a  
        delete a  specified ipv6-gateway egress only rule.

        :param gateway_id:
            The id of specified ipv6-gateway.
        :type gateway_id: string

        :param egress_only_rule_id:
            The id of specified ipv6-gateway egress only rule.
        :type egress_only_rule_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 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
        r    r;   Nr!   r/   r4   )r   r3   rE   r-   r   r   r   r   r   r   $delete_ipv6_gateway_egress_only_rule,     z6IPv6GatewayClient.delete_ipv6_gateway_egress_only_rule)r3   ipv6_addressingress_bandwidthInMbpsegress_bandwidthInMbpsc           
      C   sb   t | jd|d}|du rt }d|i}t|t|t|d}	| jtj|t	
|	||dS )a  
        Create a ipv6-gateway rate limit rule with the specified options.

        :param client_token:
            An ASCII string whose length is less than 64.
            The request will be idempotent if client token is provided.
        :type client_token: string

        :param gateway_id:
            The id of ipv6 gateway.
        :type gateway_id: string

        :param ipv6_address:
            The ipv6 addrss of rate limit rule.
        :type ipv6_address: string

        :param ingress_bandwidthInMbps:
            The ingress bandwidth of rate limit rule.
        :type ingress_bandwidthInMbps: int

        :param egress_bandwidthInMbps:
            The egress bandwidth of rate limit rule.
        :type egress_bandwidthInMbps: int

        :param config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        r    rateLimitRuleNr!   )Zipv6AddressingressBandwidthInMbpsegressBandwidthInMbpsr#   r<   )
r   r3   rI   rJ   rK   r-   r   r   r   r   r   r   r   #create_ipv6_gateway_rate_limit_ruleQ  s   %
z5IPv6GatewayClient.create_ipv6_gateway_rate_limit_rulec                 C   r>   )a  
        Return a list of ipv6-gateway rate limit rules, according to the ipv6 gateway ID,
        will return a full list of ipv6 gateway rate limit rules in ipv6 gateway.

        :param gateway_id:
            The id of ipv6 gateway.
        :type gateway_id: string

        :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 config:
        :type config: baidubce.BceClientConfiguration

        :return:
        :rtype baidubce.bce_response.BceResponse
        r    rL   Nr?   r@   r/   r0   rA   r   r   r   "list_ipv6_gateway_rate_limit_rules  rD   z4IPv6GatewayClient.list_ipv6_gateway_rate_limit_rules)r3   rate_limit_rule_idc                 C   rF   )a  
        delete a  specified ipv6-gateway rate limit rule.

        :param gateway_id:
            The id of specified ipv6-gateway.
        :type gateway_id: string

        :param rate_limit_rule_id:
            The id of specified ipv6-gateway rate limit rule.
        :type rate_limit_rule_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 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
        r    rL   Nr!   r/   r4   )r   r3   rQ   r-   r   r   r   r   r   r   #delete_ipv6_gateway_rate_limit_rule  rH   z5IPv6GatewayClient.delete_ipv6_gateway_rate_limit_rule)r3   rQ   rJ   rK   c           
      C   s\   t | jd|d|}|du rt }d|i}t|t|d}	| jtj|t	
|	||dS )a  
        update a  specified ipv6-gateway rate limit rule.

        :param gateway_id:
            The id of specified ipv6-gateway.
        :type gateway_id: string

        :param rate_limit_rule_id:
            The id of specified ipv6-gateway rate limit rule.
        :type rate_limit_rule_id: string

        :param ingress_bandwidthInMbps:
            The ingress bandwidth of rate limit rule.
        :type ingress_bandwidthInMbps: int

        :param egress_bandwidthInMbps:
            The egress bandwidth of rate limit rule.
        :type egress_bandwidthInMbps: 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 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
        r    rL   Nr!   )rM   rN   r#   r7   )
r   r3   rQ   rJ   rK   r-   r   r   r   r   r   r   r   #update_ipv6_gateway_rate_limit_rule  s   '
z5IPv6GatewayClient.update_ipv6_gateway_rate_limit_ruler   )NNNNN)NNN)NN)__name__
__module____qualname____doc__r%   r   r   r   r	   bytesstrintr.   r2   r6   r9   r=   rC   rG   rO   rP   rR   rS   r   r   r   r   r   -   sl    


0'#&#.&#r   c                   C   s   t t S )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
    )rY   uuiduuid4r   r   r   r   generate_client_token_by_uuid  s   r]   )!rW   r   r+   loggingr[   sysZbaidubcer   Zbaidubce.authr   Zbaidubce.httpr   r   r   Zbaidubce.services.ipv6gatewayr   r   Zbaidubce.utilsr	   r
   r%   reloadZsetdefaultencoding	getLoggerrT   Z_loggerZBillingr'   Z$default_billing_to_purchase_reservedr   r   r]   r&   r   r   r   r   <module>   s6   



   \