Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 64 lines (55 sloc) 2.441 kB
b3fc33b Checking in merged changes from googlemerge branch. This will hopefu…
Mitch.Garnaat authored
1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2010, Eucalyptus Systems, Inc.
3 # All rights reserved.
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish, dis-
9 # tribute, sublicense, and/or sell copies of the Software, and to permit
10 # persons to whom the Software is furnished to do so, subject to the fol-
11 # lowing conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
18 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
c8864be @garnaat WIP: This should be a complete set of changes to enable testing of ce…
garnaat authored
19 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
b3fc33b Checking in merged changes from googlemerge branch. This will hopefu…
Mitch.Garnaat authored
20 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 # IN THE SOFTWARE.
23
c8864be @garnaat WIP: This should be a complete set of changes to enable testing of ce…
garnaat authored
24
b3fc33b Checking in merged changes from googlemerge branch. This will hopefu…
Mitch.Garnaat authored
25 class RegionInfo(object):
26 """
27 Represents an AWS Region
28 """
c8864be @garnaat WIP: This should be a complete set of changes to enable testing of ce…
garnaat authored
29
b3fc33b Checking in merged changes from googlemerge branch. This will hopefu…
Mitch.Garnaat authored
30 def __init__(self, connection=None, name=None, endpoint=None,
31 connection_cls=None):
32 self.connection = connection
33 self.name = name
34 self.endpoint = endpoint
35 self.connection_cls = connection_cls
36
37 def __repr__(self):
38 return 'RegionInfo:%s' % self.name
39
40 def startElement(self, name, attrs, connection):
41 return None
42
43 def endElement(self, name, value, connection):
44 if name == 'regionName':
45 self.name = value
46 elif name == 'regionEndpoint':
47 self.endpoint = value
48 else:
49 setattr(self, name, value)
50
51 def connect(self, **kw_params):
52 """
53 Connect to this Region's endpoint. Returns an connection
54 object pointing to the endpoint associated with this region.
55 You may pass any of the arguments accepted by the connection
56 class's constructor as keyword arguments and they will be
57 passed along to the connection object.
c8864be @garnaat WIP: This should be a complete set of changes to enable testing of ce…
garnaat authored
58
b3fc33b Checking in merged changes from googlemerge branch. This will hopefu…
Mitch.Garnaat authored
59 :rtype: Connection object
60 :return: The connection to this regions endpoint
61 """
62 if self.connection_cls:
63 return self.connection_cls(region=self, **kw_params)
Something went wrong with that request. Please try again.