in src/org_setup/resources/organizations.py [0:0]
def register_delegated_administrators(self, account_id: str) -> None:
"""
Register delegated administrators
"""
for principal in DELEGATED_ADMINISTRATOR_PRINCIPALS:
logger.info(
f"[{self.region}] Delegating {principal} administration to account {account_id}"
)
try:
self.client.register_delegated_administrator(
AccountId=account_id, ServicePrincipal=principal
)
logger.debug(
f"[{self.region}] Delegated {principal} administration to account {account_id}"
)
except botocore.exceptions.ClientError as error:
if (
error.response["Error"]["Code"]
!= "AccountAlreadyRegisteredException"
):
logger.exception(
f"[{self.region}] Unable to delegate {principal} administration to account {account_id}"
)
raise error