Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
usr
/
lib
/
python2.7
/
site-packages
/
boto
/
File Content:
regioninfo.pyc
� �Wc @ s| d d l Z d d l Z d d l m Z d d l m Z d � Z d � Z d � Z d d d � Z d e f d � � YZ d S( i����N( t json( t BotoClientErrorc C s) t | d � � } t j | � SWd QXd S( s� Loads a given JSON file & returns it. :param path: The path to the JSON file :type path: string :returns: The loaded data t rN( t openR t load( t patht endpoints_file( ( s3 /usr/lib/python2.7/site-packages/boto/regioninfo.pyt load_endpoint_json s c C sB x; | j � D]- \ } } | j | i � | | j | � q W| S( sW Given an existing set of endpoint data, this will deep-update it with any similarly structured data in the additions. :param defaults: The existing endpoints data :type defaults: dict :param defaults: The additional endpoints data :type defaults: dict :returns: The modified endpoints data :rtype: dict ( t itemst setdefaultt update( t defaultst additionst servicet region_info( ( s3 /usr/lib/python2.7/site-packages/boto/regioninfo.pyt merge_endpoints+ s c C s� t t j � } d } t j j d � r7 t j d } n- t j j d d � rd t j j d d � } n | r� t | � } t | | � } n | S( s� Actually load the region/endpoint information from the JSON files. By default, this loads from the default included ``boto/endpoints.json`` file. Users can override/extend this by supplying either a ``BOTO_ENDPOINTS`` environment variable or a ``endpoints_path`` config variable, either of which should be an absolute path to the user's JSON file. :returns: The endpoints data :rtype: dict t BOTO_ENDPOINTSt Botot endpoints_pathN( R t botot ENDPOINTS_PATHt Nonet ost environt gett configR ( t endpointst additional_patht additional( ( s3 /usr/lib/python2.7/site-packages/boto/regioninfo.pyt load_regionsD s c C s� t � } | | k r( t d | � � n | d k r= t } n g } xH | j | i � j � D]. \ } } | j | d | d | d | � � q\ W| S( se Given a service name (like ``ec2``), returns a list of ``RegionInfo`` objects for that service. This leverages the ``endpoints.json`` file (+ optional user overrides) to configure/construct all the objects. :param service_name: The name of the service to construct the ``RegionInfo`` objects for. Ex: ``ec2``, ``s3``, ``sns``, etc. :type service_name: string :param region_cls: (Optional) The class to use when constructing. By default, this is ``RegionInfo``. :type region_cls: class :param connection_cls: (Optional) The connection class for the ``RegionInfo`` object. Providing this allows the ``connect`` method on the ``RegionInfo`` to work. Default is ``None`` (no connection). :type connection_cls: class :returns: A list of configured ``RegionInfo`` objects :rtype: list s$ Service '%s' not found in endpoints.t namet endpointt connection_clsN( R R R t RegionInfoR R t append( t service_namet region_clsR R t region_objst region_nameR ( ( s3 /usr/lib/python2.7/site-packages/boto/regioninfo.pyt get_regionse s %R! c B sG e Z d Z d d d d d � Z d � Z d � Z d � Z d � Z RS( s"