in lambda/snapshots_tool_utils.py [0:0]
def get_own_snapshots_dest(pattern, response):
# Returns a dict with local snapshots, filtered by pattern, with DBSnapshotIdentifier as key and Arn, Status as attributes
filtered = {}
for snapshot in response['DBSnapshots']:
if snapshot['SnapshotType'] == 'manual' and re.search(pattern, snapshot['DBInstanceIdentifier']) and snapshot['Engine'] in _SUPPORTED_ENGINES:
filtered[snapshot['DBSnapshotIdentifier']] = {
'Arn': snapshot['DBSnapshotArn'], 'Status': snapshot['Status'], 'Encrypted': snapshot['Encrypted'], 'DBInstanceIdentifier': snapshot['DBInstanceIdentifier']}
if snapshot['Encrypted'] is True:
filtered[snapshot['DBSnapshotIdentifier']]['KmsKeyId'] = snapshot['KmsKeyId']
elif snapshot['SnapshotType'] == 'manual' and pattern == 'ALL_SNAPSHOTS' and snapshot['Engine'] in _SUPPORTED_ENGINES:
filtered[snapshot['DBSnapshotIdentifier']] = {
'Arn': snapshot['DBSnapshotArn'], 'Status': snapshot['Status'], 'Encrypted': snapshot['Encrypted'], 'DBInstanceIdentifier': snapshot['DBInstanceIdentifier'] }
if snapshot['Encrypted'] is True:
filtered[snapshot['DBSnapshotIdentifier']]['KmsKeyId'] = snapshot['KmsKeyId']
return filtered