Skip to content

Commit

Permalink
fix(backup): modify list recovery points call (#5996)
Browse files Browse the repository at this point in the history
(cherry picked from commit 2ce8e1f)
  • Loading branch information
danibarranqueroo committed Dec 9, 2024
1 parent 649ec19 commit 4eaa666
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions prowler/providers/aws/services/backup/backup_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,26 @@ def _list_tags(self, resource):
def _list_recovery_points(self, regional_client):
logger.info("Backup - Listing Recovery Points...")
try:
for backup_vault in self.backup_vaults:
paginator = regional_client.get_paginator(
"list_recovery_points_by_backup_vault"
)
for page in paginator.paginate(BackupVaultName=backup_vault.name):
for recovery_point in page.get("RecoveryPoints", []):
self.recovery_points.append(
RecoveryPoint(
arn=recovery_point.get("RecoveryPointArn"),
backup_vault_name=backup_vault.name,
encrypted=recovery_point.get("IsEncrypted", False),
backup_vault_region=backup_vault.region,
tags=[],
)
)
if self.backup_vaults:
for backup_vault in self.backup_vaults:
paginator = regional_client.get_paginator(
"list_recovery_points_by_backup_vault"
)
for page in paginator.paginate(BackupVaultName=backup_vault.name):
for recovery_point in page.get("RecoveryPoints", []):
arn = recovery_point.get("RecoveryPointArn")
if arn:
self.recovery_points.append(
RecoveryPoint(
arn=arn,
backup_vault_name=backup_vault.name,
encrypted=recovery_point.get(
"IsEncrypted", False
),
backup_vault_region=backup_vault.region,
tags=[],
)
)
except ClientError as error:
logger.error(
f"{regional_client.region} -- {error.__class__.__name__}[{error.__traceback__.tb_lineno}]: {error}"
Expand Down

0 comments on commit 4eaa666

Please # to comment.