~ubuntu-branches/ubuntu/trusty/python-boto/trusty

« back to all changes in this revision

Viewing changes to boto/ec2/regioninfo.py

  • Committer: Package Import Robot
  • Author(s): Eric Evans
  • Date: 2011-11-13 11:58:40 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20111113115840-ckzyt3h17uh8s41y
Tags: 2.0-2
Promote new upstream to unstable (Closes: #638931).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/
 
1
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
 
2
# Copyright (c) 2010, Eucalyptus Systems, Inc.
 
3
# All rights reserved.
2
4
#
3
5
# Permission is hereby granted, free of charge, to any person obtaining a
4
6
# copy of this software and associated documentation files (the
19
21
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20
22
# IN THE SOFTWARE.
21
23
 
22
 
class RegionInfo(object):
 
24
from boto.regioninfo import RegionInfo
 
25
 
 
26
class EC2RegionInfo(RegionInfo):
23
27
    """
24
28
    Represents an EC2 Region
25
29
    """
26
30
    
27
31
    def __init__(self, connection=None, name=None, endpoint=None):
28
 
        self.connection = connection
29
 
        self.name = name
30
 
        self.endpoint = endpoint
31
 
 
32
 
    def __repr__(self):
33
 
        return 'RegionInfo:%s' % self.name
34
 
 
35
 
    def startElement(self, name, attrs, connection):
36
 
        return None
37
 
 
38
 
    def endElement(self, name, value, connection):
39
 
        if name == 'regionName':
40
 
            self.name = value
41
 
        elif name == 'regionEndpoint':
42
 
            self.endpoint = value
43
 
        else:
44
 
            setattr(self, name, value)
45
 
 
46
 
    def connect(self, **kw_params):
47
 
        """
48
 
        Connect to this Region's endpoint. Returns an EC2Connection
49
 
        object pointing to the endpoint associated with this region.
50
 
        You may pass any of the arguments accepted by the EC2Connection
51
 
        object's constructor as keyword arguments and they will be
52
 
        passed along to the EC2Connection object.
53
 
        
54
 
        :rtype: :class:`boto.ec2.connection.EC2Connection`
55
 
        :return: The connection to this regions endpoint
56
 
        """
57
32
        from boto.ec2.connection import EC2Connection
58
 
        return EC2Connection(region=self, **kw_params)
59
 
 
60
 
 
 
33
        RegionInfo.__init__(self, connection, name, endpoint,
 
34
                            EC2Connection)