alertmanager/notify/pagerduty
Benoît Knecht 59a96579cc
notify/pagerduty: Filter out empty images and links (#2379)
PagerDuty Event API v2 [1] requires images to have an `src` property, and links
to have an `href` property.

This commit filters out images and links that don't satisfy those conditions,
to avoid getting an HTTP 400 error in response.

This also adds flexibilty when using templates to configure images and links,
as it's now possible to omit images or links by letting the template return an
empty string for the `src` or `href` property, respectively.

[1]: https://developer.pagerduty.com/docs/events-api-v2/trigger-events/#context-properties

Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
2020-09-25 17:31:22 +02:00
..
pagerduty.go notify/pagerduty: Filter out empty images and links (#2379) 2020-09-25 17:31:22 +02:00
pagerduty_test.go notify/pagerduty: Filter out empty images and links (#2379) 2020-09-25 17:31:22 +02:00