o
    ȷe*                     @   sr   d dl Z d dlmZ d dlmZ 	 d dlmZ G dd deZG dd deZG d	d
 d
eZ	G dd deZ
dS )    N)datetime)	ResultSet)TaggedEC2Objectc                   @   2   e Zd ZdZdddZdd Zdd Zd	d
 ZdS )VpnConnectionOptionsz
    Represents VPN connection options

    :ivar static_routes_only: Indicates whether the VPN connection uses static
        routes only.  Static routes must be used for devices that don't support
        BGP.

    Nc                 C   s
   || _ d S N)static_routes_only)selfr    r
   M/var/www/ideatree/venv/lib/python3.10/site-packages/boto/vpc/vpnconnection.py__init__(      
zVpnConnectionOptions.__init__c                 C   s   dS )Nr   r
   r	   r
   r
   r   __repr__+      zVpnConnectionOptions.__repr__c                 C      d S r   r
   r	   nameattrs
connectionr
   r
   r   startElement.   r   z!VpnConnectionOptions.startElementc                 C   s4   |dkr|dkrd| _ d S d| _ d S t| || d S )NstaticRoutesOnlytrueTF)r   setattrr	   r   valuer   r
   r
   r   
endElement1   s   zVpnConnectionOptions.endElementr   __name__
__module____qualname____doc__r   r   r   r   r
   r
   r
   r   r      s    
r   c                   @   r   )VpnStaticRoutea#  
    Represents a static route for a VPN connection.

    :ivar destination_cidr_block: The CIDR block associated with the local
        subnet of the customer data center.
    :ivar source: Indicates how the routes were provided.
    :ivar state: The current state of the static route.
    Nc                 C   s   || _ || _|| _d S r   )destination_cidr_blocksource	available)r	   r#   r$   stater
   r
   r   r   @   s   
zVpnStaticRoute.__init__c                 C   
   d| j  S )NzVpnStaticRoute: %s)r#   r   r
   r
   r   r   E   r   zVpnStaticRoute.__repr__c                 C   r   r   r
   r   r
   r
   r   r   H   r   zVpnStaticRoute.startElementc                 C   sF   |dkr	|| _ d S |dkr|| _d S |dkr|| _d S t| || d S )NdestinationCidrBlockr$   r&   )r#   r$   r&   r   r   r
   r
   r   r   K   s   


zVpnStaticRoute.endElement)NNNr   r
   r
   r
   r   r"   7   s    
r"   c                   @   s6   e Zd ZdZ		dddZdd Zdd Zd	d
 ZdS )	VpnTunnela  
    Represents telemetry for a VPN tunnel

    :ivar outside_ip_address: The Internet-routable IP address of the
        virtual private gateway's outside interface.
    :ivar status: The status of the VPN tunnel. Valid values: UP | DOWN
    :ivar last_status_change: The date and time of the last change in status.
    :ivar status_message: If an error occurs, a description of the error.
    :ivar accepted_route_count: The number of accepted routes.
    Nc                 C   s"   || _ || _|| _|| _|| _d S r   )outside_ip_addressstatuslast_status_changestatus_messageaccepted_route_count)r	   r*   r+   r,   r-   r.   r
   r
   r   r   `   s
   
zVpnTunnel.__init__c                 C   r'   )NzVpnTunnel: %s)r*   r   r
   r
   r   r   h   r   zVpnTunnel.__repr__c                 C   r   r   r
   r   r
   r
   r   r   k   r   zVpnTunnel.startElementc                 C   s   |dkr	|| _ d S |dkr|| _d S |dkrt|d| _d S |dkr(|| _d S |dkrIzt|}W n tyC   tj	
d|  Y nw || _d S t| || d S )NoutsideIpAddressr+   lastStatusChangez%Y-%m-%dT%H:%M:%S.%fZstatusMessageacceptedRouteCountz!Error converting code (%s) to int)r*   r+   r   strptimer,   r-   int
ValueErrorbotologwarningr.   r   r   r
   r
   r   r   n   s$   




zVpnTunnel.endElement)NNNNNr   r
   r
   r
   r   r)   U   s    

r)   c                       sH   e Zd ZdZd fdd	Zdd Z fddZd	d
 ZdddZ  Z	S )VpnConnectionaq  
    Represents a VPN Connection

    :ivar id: The ID of the VPN connection.
    :ivar state: The current state of the VPN connection.
        Valid values: pending | available | deleting | deleted
    :ivar customer_gateway_configuration: The configuration information for the
        VPN connection's customer gateway (in the native XML format). This
        element is always present in the
        :class:`boto.vpc.VPCConnection.create_vpn_connection` response;
        however, it's present in the
        :class:`boto.vpc.VPCConnection.get_all_vpn_connections` response only
        if the VPN connection is in the pending or available state.
    :ivar type: The type of VPN connection (ipsec.1).
    :ivar customer_gateway_id: The ID of the customer gateway at your end of
        the VPN connection.
    :ivar vpn_gateway_id: The ID of the virtual private gateway
        at the AWS side of the VPN connection.
    :ivar tunnels: A list of the vpn tunnels (always 2)
    :ivar options: The option set describing the VPN connection.
    :ivar static_routes: A list of static routes associated with a VPN
        connection.

    Nc                    sJ   t t| | d | _d | _d | _d | _d | _d | _g | _	d | _
g | _d S r   )superr9   r   idr&   customer_gateway_configurationtypecustomer_gateway_idvpn_gateway_idtunnelsoptionsstatic_routes)r	   r   	__class__r
   r   r      s   
zVpnConnection.__init__c                 C   r'   )NzVpnConnection:%s)r;   r   r
   r
   r   r      r   zVpnConnection.__repr__c                    sv   t t| |||}|d ur|S |dkrtdtfg| _| jS |dkr.tdtfg| _| jS |dkr9t | _	| j	S d S )NvgwTelemetryitemroutesrA   )
r:   r9   r   r   r)   r@   r"   rB   r   rA   )r	   r   r   r   retvalrC   r
   r   r      s   zVpnConnection.startElementc                 C   s|   |dkr	|| _ d S |dkr|| _d S |dkr|| _d S |dkr$|| _d S |dkr-|| _d S |dkr6|| _d S t| || d S )NvpnConnectionIdr&   customerGatewayConfigurationr=   customerGatewayIdvpnGatewayId)r;   r&   r<   r=   r>   r?   r   r   r
   r
   r   r      s   





zVpnConnection.endElementFc                 C   s   | j j| j|dS )N)dry_run)r   delete_vpn_connectionr;   )r	   rM   r
   r
   r   delete   s   zVpnConnection.deleter   )F)
r   r   r    r!   r   r   r   r   rO   __classcell__r
   r
   rC   r   r9      s    r9   )r6   r   boto.resultsetr   boto.ec2.ec2objectr   objectr   r"   r)   r9   r
   r
   r
   r   <module>   s   ,