INNER CODE UNIT · Python
describe_org_events
aws-samples/aws-health-aware · handler.py:828
def describe_org_events(health_client):
str_ddb_format_sec = "%s"
# set hours to search back in time for events
delta_hours = os.environ["EVENT_SEARCH_BACK"]
health_event_type = os.environ["HEALTH_EVENT_TYPE"]
dict_regions = os.environ["REGIONS"]
delta_hours = int(delta_hours)
time_delta = datetime.now() - timedelta(hours=delta_hours)
print("Searching for events and updates made after: ", time_delta)
str_filter = {"lastUpdatedTime": {"from": time_delta}}
if health_event_type == "issue":
event_type_filter = {"eventTypeCategories": ["issue", "investigation"]}
print(
"AHA will be monitoring events with event type categories as 'issue' only!"
)
str_filter.update(event_type_filter)