Skip to content

Commit

Permalink
Merge pull request boto#1242 from phobologic/vpc_update
Browse files Browse the repository at this point in the history
Give vpc objects an update method to update state
  • Loading branch information
garnaat committed Feb 21, 2013
2 parents 0f48d02 + 0713bcd commit cc7469c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions boto/vpc/vpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,14 @@ def endElement(self, name, value, connection):
def delete(self):
return self.connection.delete_vpc(self.id)

def _update(self, updated):
self.__dict__.update(updated.__dict__)

def update(self, validate=False):
vpc_list = self.connection.get_all_vpcs([self.id])
if len(vpc_list):
updated_vpc = vpc_list[0]
self._update(updated_vpc)
elif validate:
raise ValueError('%s is not a valid VPC ID' % (self.id,))
return self.state

0 comments on commit cc7469c

Please sign in to comment.