added encrypted attribute to snapshots
This commit is contained in:
parent
e9af4c9065
commit
44195a9151
@ -1604,7 +1604,7 @@ class Volume(TaggedEC2Resource):
|
|||||||
|
|
||||||
|
|
||||||
class Snapshot(TaggedEC2Resource):
|
class Snapshot(TaggedEC2Resource):
|
||||||
def __init__(self, ec2_backend, snapshot_id, volume, description):
|
def __init__(self, ec2_backend, snapshot_id, volume, description, encrypted=False):
|
||||||
self.id = snapshot_id
|
self.id = snapshot_id
|
||||||
self.volume = volume
|
self.volume = volume
|
||||||
self.description = description
|
self.description = description
|
||||||
@ -1612,6 +1612,7 @@ class Snapshot(TaggedEC2Resource):
|
|||||||
self.create_volume_permission_groups = set()
|
self.create_volume_permission_groups = set()
|
||||||
self.ec2_backend = ec2_backend
|
self.ec2_backend = ec2_backend
|
||||||
self.status = 'completed'
|
self.status = 'completed'
|
||||||
|
self.encrypted = encrypted
|
||||||
|
|
||||||
def get_filter_value(self, filter_name):
|
def get_filter_value(self, filter_name):
|
||||||
|
|
||||||
@ -1630,6 +1631,9 @@ class Snapshot(TaggedEC2Resource):
|
|||||||
if filter_name == 'volume-size':
|
if filter_name == 'volume-size':
|
||||||
return self.volume.size
|
return self.volume.size
|
||||||
|
|
||||||
|
if filter_name == 'encrypted':
|
||||||
|
return str(self.encrypted).lower()
|
||||||
|
|
||||||
filter_value = super(Snapshot, self).get_filter_value(filter_name)
|
filter_value = super(Snapshot, self).get_filter_value(filter_name)
|
||||||
|
|
||||||
if filter_value is None:
|
if filter_value is None:
|
||||||
@ -1701,7 +1705,7 @@ class EBSBackend(object):
|
|||||||
def create_snapshot(self, volume_id, description):
|
def create_snapshot(self, volume_id, description):
|
||||||
snapshot_id = random_snapshot_id()
|
snapshot_id = random_snapshot_id()
|
||||||
volume = self.get_volume(volume_id)
|
volume = self.get_volume(volume_id)
|
||||||
snapshot = Snapshot(self, snapshot_id, volume, description)
|
snapshot = Snapshot(self, snapshot_id, volume, description, volume.encrypted)
|
||||||
self.snapshots[snapshot_id] = snapshot
|
self.snapshots[snapshot_id] = snapshot
|
||||||
return snapshot
|
return snapshot
|
||||||
|
|
||||||
|
@ -202,6 +202,7 @@ CREATE_SNAPSHOT_RESPONSE = """<CreateSnapshotResponse xmlns="http://ec2.amazonaw
|
|||||||
<ownerId>111122223333</ownerId>
|
<ownerId>111122223333</ownerId>
|
||||||
<volumeSize>{{ snapshot.volume.size }}</volumeSize>
|
<volumeSize>{{ snapshot.volume.size }}</volumeSize>
|
||||||
<description>{{ snapshot.description }}</description>
|
<description>{{ snapshot.description }}</description>
|
||||||
|
<encrypted>{{ snapshot.encrypted }}</encrypted>
|
||||||
</CreateSnapshotResponse>"""
|
</CreateSnapshotResponse>"""
|
||||||
|
|
||||||
DESCRIBE_SNAPSHOTS_RESPONSE = """<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
DESCRIBE_SNAPSHOTS_RESPONSE = """<DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||||
@ -217,6 +218,7 @@ DESCRIBE_SNAPSHOTS_RESPONSE = """<DescribeSnapshotsResponse xmlns="http://ec2.am
|
|||||||
<ownerId>111122223333</ownerId>
|
<ownerId>111122223333</ownerId>
|
||||||
<volumeSize>{{ snapshot.volume.size }}</volumeSize>
|
<volumeSize>{{ snapshot.volume.size }}</volumeSize>
|
||||||
<description>{{ snapshot.description }}</description>
|
<description>{{ snapshot.description }}</description>
|
||||||
|
<encrypted>{{ snapshot.encrypted }}</encrypted>
|
||||||
<tagSet>
|
<tagSet>
|
||||||
{% for tag in snapshot.get_tags() %}
|
{% for tag in snapshot.get_tags() %}
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user