in src/org_setup/resources/guardduty.py [0:0]
def enable_organization_admin_account(self, account_id: str) -> None:
"""
Delegate GuardDuty administration to an account
Executes in: management account in all regions
"""
logger.info(
f"[{self.region}] Delegating GuardDuty administration to account {account_id}"
)
try:
self.client.enable_organization_admin_account(AdminAccountId=account_id)
logger.debug(
f"[{self.region}] Delegated GuardDuty administration to account {account_id}"
)
except botocore.exceptions.ClientError as error:
if error.response["Error"]["Code"] != "BadRequestException":
logger.exception(
f"[{self.region}] Unable to delegate GuardDuty administration to account {account_id}"
)
raise error