U
    3d                     @   s    d dl mZ G dd deZdS )    )	EC2Objectc                       sT   e Zd ZdZd fdd	Zdd Zdd Zdd
dZeZdddZ	dddZ
  ZS )Addressa  
    Represents an EC2 Elastic IP Address

    :ivar public_ip: The Elastic IP address.
    :ivar instance_id: The instance the address is associated with (if any).
    :ivar domain: Indicates whether the address is a EC2 address or a VPC address (standard|vpc).
    :ivar allocation_id: The allocation ID for the address (VPC addresses only).
    :ivar association_id: The association ID for the address (VPC addresses only).
    :ivar network_interface_id: The network interface (if any) that the address is associated with (VPC addresses only).
    :ivar network_interface_owner_id: The owner IID (VPC addresses only).
    :ivar private_ip_address: The private IP address associated with the Elastic IP address (VPC addresses only).
    Nc                    sJ   t t| | || _|| _|| _d | _d | _d | _d | _	d | _
d | _d S )N)superr   __init__
connection	public_ipinstance_iddomainallocation_idassociation_idnetwork_interface_idnetwork_interface_owner_idprivate_ip_address)selfr   r   r   	__class__ 4/tmp/pip-unpacked-wheel-d7dsrkjd/boto/ec2/address.pyr   (   s    zAddress.__init__c                 C   s
   d| j  S )Nz
Address:%s)r   )r   r   r   r   __repr__4   s    zAddress.__repr__c                 C   s   |dkr|| _ n||dkr || _nl|dkr0|| _n\|dkr@|| _nL|dkrP|| _n<|dkr`|| _n,|dkrp|| _n|dkr|| _nt| || d S )	NZpublicIpZ
instanceIdr	   ZallocationIdZassociationIdZnetworkInterfaceIdZnetworkInterfaceOwnerIdZprivateIpAddress)	r   r   r	   r
   r   r   r   r   setattr)r   namevaluer   r   r   r   
endElement7   s"    zAddress.endElementFc                 C   s.   | j r| jj| j |dS | jj| j|dS dS )zz
        Free up this Elastic IP address.
        :see: :meth:`boto.ec2.connection.EC2Connection.release_address`
        )r
   dry_runr   r   N)r
   r   Zrelease_addressr   r   r   r   r   r   releaseK   s    zAddress.releasec              	   C   s>   | j r$| jj|| j| j ||||dS | jj|| j||||dS )z
        Associate this Elastic IP address with a currently running instance.
        :see: :meth:`boto.ec2.connection.EC2Connection.associate_address`
        )r   r   r
   r   r   allow_reassociationr   )r   r   r   r   r   r   )r
   r   Zassociate_addressr   )r   r   r   r   r   r   r   r   r   	associate\   s$    	zAddress.associatec                 C   s.   | j r| jj| j |dS | jj| j|dS dS )z
        Disassociate this Elastic IP address from a currently running instance.
        :see: :meth:`boto.ec2.connection.EC2Connection.disassociate_address`
        )r   r   r   N)r   r   Zdisassociate_addressr   r   r   r   r   disassociatet   s    zAddress.disassociate)NNN)F)NNNFF)F)__name__
__module____qualname____doc__r   r   r   r   deleter   r   __classcell__r   r   r   r   r      s   

r   N)Zboto.ec2.ec2objectr   r   r   r   r   r   <module>   s   