U
    W+d                     @   sZ   d Z ddlmZ ddlmZmZmZ ddlmZ e di Z	dd Z
dd	 Zd
d ZdS )zX
This module provides an interface to the Elastic Compute Cloud (EC2)
service from AWS.
    )EC2Connection)
RegionInfoget_regionsload_regions)connectec2c                  K   s   t dtdS )a:  
    Get all available regions for the EC2 service.
    You may pass any of the arguments accepted by the EC2Connection
    object's constructor as keyword arguments and they will be
    passed along to the EC2Connection object.

    :rtype: list
    :return: A list of :class:`boto.ec2.regioninfo.RegionInfo`
    r   )connection_cls)r   r   )	kw_params r
   5/tmp/pip-unpacked-wheel-dlxw5sjy/boto/ec2/__init__.pyregions"   s    
r   c                 K   sD   d|kr.t |d tr.| |d jkr.tf |S td| fdti|S )a  
    Given a valid region name, return a
    :class:`boto.ec2.connection.EC2Connection`.
    Any additional parameters after the region_name are passed on to
    the connect method of the region object.

    :type: str
    :param region_name: The name of the region to connect to.

    :rtype: :class:`boto.ec2.connection.EC2Connection` or ``None``
    :return: A connection to the given region, or None if an invalid region
             name is given
    regionr   r   )
isinstancer   namer   r   )region_namer	   r
   r
   r   connect_to_region/   s    

r   c                 K   s&   t f |D ]}|j| kr
|  S q
dS )a@  
    Find and return a :class:`boto.ec2.regioninfo.RegionInfo` object
    given a region name.

    :type: str
    :param: The name of the region.

    :rtype: :class:`boto.ec2.regioninfo.RegionInfo`
    :return: The RegionInfo object for the given region or None if
             an invalid region name is provided.
    N)r   r   )r   r	   r   r
   r
   r   
get_regionE   s    

r   N)__doc__Zboto.ec2.connectionr   Zboto.regioninfor   r   r   r   getZ
RegionDatar   r   r   r
   r
   r
   r   <module>   s   