Skip to content

Commit

Permalink
Issue 72 Fix Moving Account Name Lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
gdougaws committed Mar 8, 2024
1 parent 9a7ac43 commit 70482a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ def get_affected_entities(health_client, event_arn, affected_accounts, is_org_mo
affected_entity_array = []

for account in affected_accounts:
account_name = ""
if is_org_mode:
event_entities_paginator = health_client.get_paginator(
"describe_affected_entities_for_organization"
Expand All @@ -415,6 +416,7 @@ def get_affected_entities(health_client, event_arn, affected_accounts, is_org_mo
{"awsAccountId": account, "eventArn": event_arn}
]
)
account_name = get_account_name(account)
else:
event_entities_paginator = health_client.get_paginator(
"describe_affected_entities"
Expand All @@ -433,7 +435,7 @@ def get_affected_entities(health_client, event_arn, affected_accounts, is_org_mo
entity.pop("eventArn") # remove eventArn duplicate of detail.arn
entity.pop("lastUpdatedTime") # remove for brevity
if is_org_mode:
entity["awsAccountName"] = get_account_name(entity["awsAccountId"])
entity["awsAccountName"] = account_name
affected_entity_array.append(entity)

return affected_entity_array
Expand Down

0 comments on commit 70482a5

Please sign in to comment.