in lambda/snapshots_tool_utils.py [0:0]
def get_own_snapshots_no_x_account(pattern, response, REGION):
# Filters our own snapshots
filtered = {}
for snapshot in response['DBSnapshots']:
if snapshot['SnapshotType'] == 'manual' and re.search(pattern, snapshot['DBInstanceIdentifier']) and snapshot['Engine'] in _SUPPORTED_ENGINES:
client = boto3.client('rds', region_name=REGION)
response_tags = client.list_tags_for_resource(
ResourceName=snapshot['DBSnapshotArn'])
if search_tag_created(response_tags):
filtered[snapshot['DBSnapshotIdentifier']] = {
'Arn': snapshot['DBSnapshotArn'], 'Status': snapshot['Status'], 'DBInstanceIdentifier': snapshot['DBInstanceIdentifier']}
#Changed the next line to search for ALL_CLUSTERS or ALL_SNAPSHOTS so it will work with no-x-account
elif snapshot['SnapshotType'] == 'manual' and pattern == 'ALL_SNAPSHOTS' and snapshot['Engine'] in _SUPPORTED_ENGINES:
client = boto3.client('rds', region_name=REGION)
response_tags = client.list_tags_for_resource(
ResourceName=snapshot['DBSnapshotArn'])
if search_tag_created(response_tags):
filtered[snapshot['DBSnapshotIdentifier']] = {
'Arn': snapshot['DBSnapshotArn'], 'Status': snapshot['Status'], 'DBInstanceIdentifier': snapshot['DBInstanceIdentifier']}
return filtered