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

Side by Side Diff: boto/ec2/autoscale/activity.py

Issue 8386013: Merging in latest boto. (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Redoing vendor drop by deleting and then merging. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « boto/ec2/autoscale/__init__.py ('k') | boto/ec2/autoscale/group.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 Reza Lotun http://reza.lotun.name/ 1 # Copyright (c) 2009-2011 Reza Lotun http://reza.lotun.name/
2 # 2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a 3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the 4 # copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including 5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish, dis- 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 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- 8 # persons to whom the Software is furnished to do so, subject to the fol-
9 # lowing conditions: 9 # lowing conditions:
10 # 10 #
11 # The above copyright notice and this permission notice shall be included 11 # The above copyright notice and this permission notice shall be included
12 # in all copies or substantial portions of the Software. 12 # in all copies or substantial portions of the Software.
13 # 13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 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- 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 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, 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, 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 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE. 20 # IN THE SOFTWARE.
21 21
22 from datetime import datetime
23
22 24
23 class Activity(object): 25 class Activity(object):
24 def __init__(self, connection=None): 26 def __init__(self, connection=None):
25 self.connection = connection 27 self.connection = connection
26 self.start_time = None 28 self.start_time = None
29 self.end_time = None
27 self.activity_id = None 30 self.activity_id = None
28 self.progress = None 31 self.progress = None
29 self.status_code = None 32 self.status_code = None
30 self.cause = None 33 self.cause = None
31 self.description = None 34 self.description = None
35 self.status_message = None
36 self.group_name = None
32 37
33 def __repr__(self): 38 def __repr__(self):
34 return 'Activity:%s status:%s progress:%s' % (self.description, 39 return 'Activity<%s>: For group:%s, progress:%s, cause:%s' % (self.activ ity_id,
35 self.status_code, 40 self.group _name,
36 self.progress) 41 self.statu s_message,
42 self.cause )
43
37 def startElement(self, name, attrs, connection): 44 def startElement(self, name, attrs, connection):
38 return None 45 return None
39 46
40 def endElement(self, name, value, connection): 47 def endElement(self, name, value, connection):
41 if name == 'ActivityId': 48 if name == 'ActivityId':
42 self.activity_id = value 49 self.activity_id = value
50 elif name == 'AutoScalingGroupName':
51 self.group_name = value
43 elif name == 'StartTime': 52 elif name == 'StartTime':
44 self.start_time = value 53 try:
54 self.start_time = datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%f Z')
55 except ValueError:
56 self.start_time = datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')
57 elif name == 'EndTime':
58 try:
59 self.end_time = datetime.strptime(value, '%Y-%m-%dT%H:%M:%S.%fZ' )
60 except ValueError:
61 self.end_time = datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')
45 elif name == 'Progress': 62 elif name == 'Progress':
46 self.progress = value 63 self.progress = value
47 elif name == 'Cause': 64 elif name == 'Cause':
48 self.cause = value 65 self.cause = value
49 elif name == 'Description': 66 elif name == 'Description':
50 self.description = value 67 self.description = value
68 elif name == 'StatusMessage':
69 self.status_message = value
51 elif name == 'StatusCode': 70 elif name == 'StatusCode':
52 self.status_code = value 71 self.status_code = value
53 else: 72 else:
54 setattr(self, name, value) 73 setattr(self, name, value)
55 74
OLDNEW
« no previous file with comments | « boto/ec2/autoscale/__init__.py ('k') | boto/ec2/autoscale/group.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698