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

Side by Side Diff: third_party/boto/boto/ec2/snapshot.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 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 | « third_party/boto/boto/ec2/regioninfo.py ('k') | third_party/boto/boto/ec2/vmtype.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) 2006-2010 Mitch Garnaat http://garnaat.org/ 1 # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2010, Eucalyptus Systems, Inc. 2 # Copyright (c) 2010, Eucalyptus Systems, Inc.
3 # 3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a 4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the 5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including 6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis- 7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit 8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol- 9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions: 10 # lowing conditions:
(...skipping 23 matching lines...) Expand all
34 super(Snapshot, self).__init__(connection) 34 super(Snapshot, self).__init__(connection)
35 self.id = None 35 self.id = None
36 self.volume_id = None 36 self.volume_id = None
37 self.status = None 37 self.status = None
38 self.progress = None 38 self.progress = None
39 self.start_time = None 39 self.start_time = None
40 self.owner_id = None 40 self.owner_id = None
41 self.owner_alias = None 41 self.owner_alias = None
42 self.volume_size = None 42 self.volume_size = None
43 self.description = None 43 self.description = None
44 self.encrypted = None
44 45
45 def __repr__(self): 46 def __repr__(self):
46 return 'Snapshot:%s' % self.id 47 return 'Snapshot:%s' % self.id
47 48
48 def endElement(self, name, value, connection): 49 def endElement(self, name, value, connection):
49 if name == 'snapshotId': 50 if name == 'snapshotId':
50 self.id = value 51 self.id = value
51 elif name == 'volumeId': 52 elif name == 'volumeId':
52 self.volume_id = value 53 self.volume_id = value
53 elif name == 'status': 54 elif name == 'status':
54 self.status = value 55 self.status = value
55 elif name == 'startTime': 56 elif name == 'startTime':
56 self.start_time = value 57 self.start_time = value
57 elif name == 'ownerId': 58 elif name == 'ownerId':
58 self.owner_id = value 59 self.owner_id = value
59 elif name == 'ownerAlias': 60 elif name == 'ownerAlias':
60 self.owner_alias = value 61 self.owner_alias = value
61 elif name == 'volumeSize': 62 elif name == 'volumeSize':
62 try: 63 try:
63 self.volume_size = int(value) 64 self.volume_size = int(value)
64 except: 65 except:
65 self.volume_size = value 66 self.volume_size = value
66 elif name == 'description': 67 elif name == 'description':
67 self.description = value 68 self.description = value
69 elif name == 'encrypted':
70 self.encrypted = (value.lower() == 'true')
68 else: 71 else:
69 setattr(self, name, value) 72 setattr(self, name, value)
70 73
71 def _update(self, updated): 74 def _update(self, updated):
72 self.progress = updated.progress 75 self.progress = updated.progress
73 self.status = updated.status 76 self.status = updated.status
74 77
75 def update(self, validate=False, dry_run=False): 78 def update(self, validate=False, dry_run=False):
76 """ 79 """
77 Update the data associated with this snapshot by querying EC2. 80 Update the data associated with this snapshot by querying EC2.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 this volume. (optional) 148 this volume. (optional)
146 """ 149 """
147 if isinstance(zone, Zone): 150 if isinstance(zone, Zone):
148 zone = zone.name 151 zone = zone.name
149 return self.connection.create_volume( 152 return self.connection.create_volume(
150 size, 153 size,
151 zone, 154 zone,
152 self.id, 155 self.id,
153 volume_type, 156 volume_type,
154 iops, 157 iops,
158 self.encrypted,
155 dry_run=dry_run 159 dry_run=dry_run
156 ) 160 )
157 161
158 162
159 class SnapshotAttribute(object): 163 class SnapshotAttribute(object):
160 def __init__(self, parent=None): 164 def __init__(self, parent=None):
161 self.snapshot_id = None 165 self.snapshot_id = None
162 self.attrs = {} 166 self.attrs = {}
163 167
164 def startElement(self, name, attrs, connection): 168 def startElement(self, name, attrs, connection):
(...skipping 12 matching lines...) Expand all
177 self.attrs['user_ids'].append(value) 181 self.attrs['user_ids'].append(value)
178 else: 182 else:
179 self.attrs['user_ids'] = [value] 183 self.attrs['user_ids'] = [value]
180 elif name == 'snapshotId': 184 elif name == 'snapshotId':
181 self.snapshot_id = value 185 self.snapshot_id = value
182 else: 186 else:
183 setattr(self, name, value) 187 setattr(self, name, value)
184 188
185 189
186 190
OLDNEW
« no previous file with comments | « third_party/boto/boto/ec2/regioninfo.py ('k') | third_party/boto/boto/ec2/vmtype.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698