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

Side by Side Diff: third_party/gsutil/boto/ec2/zone.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-2008 Mitch Garnaat http://garnaat.org/
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish, dis-
7 # tribute, sublicense, and/or sell copies of the Software, and to permit
8 # persons to whom the Software is furnished to do so, subject to the fol-
9 # lowing conditions:
10 #
11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE.
21
22 """
23 Represents an EC2 Availability Zone
24 """
25 from boto.ec2.ec2object import EC2Object
26
27 class MessageSet(list):
28 """
29 A list object that contains messages associated with
30 an availability zone.
31 """
32
33 def startElement(self, name, attrs, connection):
34 return None
35
36 def endElement(self, name, value, connection):
37 if name == 'message':
38 self.append(value)
39 else:
40 setattr(self, name, value)
41
42 class Zone(EC2Object):
43 """
44 Represents an Availability Zone.
45
46 :ivar name: The name of the zone.
47 :ivar state: The current state of the zone.
48 :ivar region_name: The name of the region the zone is associated with.
49 :ivar messages: A list of messages related to the zone.
50 """
51
52 def __init__(self, connection=None):
53 EC2Object.__init__(self, connection)
54 self.name = None
55 self.state = None
56 self.region_name = None
57 self.messages = None
58
59 def __repr__(self):
60 return 'Zone:%s' % self.name
61
62 def startElement(self, name, attrs, connection):
63 if name == 'messageSet':
64 self.messages = MessageSet()
65 return self.messages
66 return None
67
68 def endElement(self, name, value, connection):
69 if name == 'zoneName':
70 self.name = value
71 elif name == 'zoneState':
72 self.state = value
73 elif name == 'regionName':
74 self.region_name = value
75 else:
76 setattr(self, name, value)
77
78
79
80
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698