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

Side by Side Diff: third_party/boto/boto/ec2/networkinterface.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/instancetype.py ('k') | third_party/boto/boto/ec2/regioninfo.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) 2011 Mitch Garnaat http://garnaat.org/ 1 # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/
2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved 2 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 elif name == 'privateIpAddress': 160 elif name == 'privateIpAddress':
161 self.private_ip_address = value 161 self.private_ip_address = value
162 elif name == 'sourceDestCheck': 162 elif name == 'sourceDestCheck':
163 if value.lower() == 'true': 163 if value.lower() == 'true':
164 self.source_dest_check = True 164 self.source_dest_check = True
165 else: 165 else:
166 self.source_dest_check = False 166 self.source_dest_check = False
167 else: 167 else:
168 setattr(self, name, value) 168 setattr(self, name, value)
169 169
170 def _update(self, updated):
171 self.__dict__.update(updated.__dict__)
172
173 def update(self, validate=False, dry_run=False):
174 """
175 Update the data associated with this ENI by querying EC2.
176
177 :type validate: bool
178 :param validate: By default, if EC2 returns no data about the
179 ENI the update method returns quietly. If
180 the validate param is True, however, it will
181 raise a ValueError exception if no data is
182 returned from EC2.
183 """
184 rs = self.connection.get_all_network_interfaces(
185 [self.id],
186 dry_run=dry_run
187 )
188 if len(rs) > 0:
189 self._update(rs[0])
190 elif validate:
191 raise ValueError('%s is not a valid ENI ID' % self.id)
192 return self.status
193
194 def attach(self, instance_id, device_index, dry_run=False):
195 """
196 Attach this ENI to an EC2 instance.
197
198 :type instance_id: str
199 :param instance_id: The ID of the EC2 instance to which it will
200 be attached.
201
202 :type device_index: int
203 :param device_index: The interface nunber, N, on the instance (eg. ethN)
204
205 :rtype: bool
206 :return: True if successful
207 """
208 return self.connection.attach_network_interface(
209 self.id,
210 instance_id,
211 device_index,
212 dry_run=dry_run
213 )
214
215 def detach(self, force=False, dry_run=False):
216 """
217 Detach this ENI from an EC2 instance.
218
219 :type force: bool
220 :param force: Forces detachment if the previous detachment
221 attempt did not occur cleanly.
222
223 :rtype: bool
224 :return: True if successful
225 """
226 attachment_id = getattr(self.attachment, 'id', None)
227
228 return self.connection.detach_network_interface(
229 attachment_id,
230 force,
231 dry_run=dry_run
232 )
233
170 def delete(self, dry_run=False): 234 def delete(self, dry_run=False):
171 return self.connection.delete_network_interface( 235 return self.connection.delete_network_interface(
172 self.id, 236 self.id,
173 dry_run=dry_run 237 dry_run=dry_run
174 ) 238 )
175 239
176 240
177 class PrivateIPAddress(object): 241 class PrivateIPAddress(object):
178 def __init__(self, connection=None, private_ip_address=None, 242 def __init__(self, connection=None, private_ip_address=None,
179 primary=None): 243 primary=None):
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 self.device_index = device_index 343 self.device_index = device_index
280 self.subnet_id = subnet_id 344 self.subnet_id = subnet_id
281 self.description = description 345 self.description = description
282 self.private_ip_address = private_ip_address 346 self.private_ip_address = private_ip_address
283 self.groups = groups 347 self.groups = groups
284 self.delete_on_termination = delete_on_termination 348 self.delete_on_termination = delete_on_termination
285 self.private_ip_addresses = private_ip_addresses 349 self.private_ip_addresses = private_ip_addresses
286 self.secondary_private_ip_address_count = \ 350 self.secondary_private_ip_address_count = \
287 secondary_private_ip_address_count 351 secondary_private_ip_address_count
288 self.associate_public_ip_address = associate_public_ip_address 352 self.associate_public_ip_address = associate_public_ip_address
OLDNEW
« no previous file with comments | « third_party/boto/boto/ec2/instancetype.py ('k') | third_party/boto/boto/ec2/regioninfo.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698