def eventDetailedDesc()

in shd-notifier/Health-Event-Chat-Post-LambdaFn.py [0:0]


def eventDetailedDesc(eventArn):
    # Load the AWS Health API
    health = boto3.client('health', region_name='us-east-1')

    # get the event details
    try:
        details = health.describe_event_details(
            eventArns=[eventArn]
        )
    except Exception as e:
        logger.error(e)
        eMessage = 'ERROR: Unable to retrieve events details'
        logger.error(eMessage)
        raise Exception(eMessage)
    # we expect one success result, otherwise raise an exception
    if (len(details['successfulSet']) is not 1):
        eMessage = "Unable to retrieve details for event ARN: %s" % eventArn
        logger.error(eMessage)
        raise Exception(eMessage)
    # since we know we only have one, return the 1 detail
    return details['successfulSet'][0]