Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: third_party/gsutil/boto/regioninfo.py

Issue 12042069: Scripts to download files from google storage based on sha1 sums (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Removed gsutil/tests and gsutil/docs Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
19 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
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
24
25 class RegionInfo(object):
26 """
27 Represents an AWS Region
28 """
29
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.
58
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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698