Skip to content

Commit

Permalink
Merge pull request #78 from gdougaws/issue_72_account_loop
Browse files Browse the repository at this point in the history
Issue 72 Fix Moving Account Name Lookup
  • Loading branch information
andrewcr7 authored Mar 12, 2024
2 parents 9a7ac43 + 70482a5 commit 4deb4d3
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 4deb4d3

Please sign in to comment.