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 DBClusterSnapshotIdentifier as key and Arn, Status as attributes
filtered = {}
for snapshot in response['DBClusterSnapshots']:
if snapshot['SnapshotType'] == 'manual' and re.search(pattern, snapshot['DBClusterIdentifier']) and snapshot['Engine'] in _SUPPORTED_ENGINES:
filtered[snapshot['DBClusterSnapshotIdentifier']] = {
'Arn': snapshot['DBClusterSnapshotArn'], 'Status': snapshot['Status'], 'StorageEncrypted': snapshot['StorageEncrypted'], 'DBClusterIdentifier': snapshot['DBClusterIdentifier']}
if snapshot['StorageEncrypted'] is True:
filtered[snapshot['DBClusterSnapshotIdentifier']
]['KmsKeyId'] = snapshot['KmsKeyId']
elif snapshot['SnapshotType'] == 'manual' and pattern == 'ALL_SNAPSHOTS' and snapshot['Engine'] in _SUPPORTED_ENGINES:
filtered[snapshot['DBClusterSnapshotIdentifier']] = {
'Arn': snapshot['DBClusterSnapshotArn'], 'Status': snapshot['Status'], 'StorageEncrypted': snapshot['StorageEncrypted'], 'DBClusterIdentifier': snapshot['DBClusterIdentifier']}
if snapshot['StorageEncrypted'] is True:
filtered[snapshot['DBClusterSnapshotIdentifier']
]['KmsKeyId'] = snapshot['KmsKeyId']
return filtered