Skip to content

Commit

Permalink
Merge pull request #342 from mmojzis/delete_snapshot
Browse files Browse the repository at this point in the history
Added list_own_snapshots and delete_snapshot methods
  • Loading branch information
mshriver authored Nov 2, 2018
2 parents 0816cf4 + bcc698b commit 47166c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions wrapanapi/systems/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,3 +1127,15 @@ def list_router(self):
routers_names.append(route['RouteTableId'])

return routers_names

def list_own_snapshots(self):
self.logger.info("Attempting to List Own Snapshots")
return self.ec2_connection.describe_snapshots(OwnerIds=["self"]).get("Snapshots")

def delete_snapshot(self, snapshot_id):
# Deletes snapshot, impossible when as AMI root snapshot or as Volume root snapshot
try:
self.ec2_connection.delete_snapshot(SnapshotId=snapshot_id)
return True
except Exception:
return False

0 comments on commit 47166c2

Please sign in to comment.