//native
/**
* Resolve Event (Events API v2)
* Resolve an alert previously triggered via the Events API v2, identified by its dedup_key. Resolving closes the corresponding incident if no other alerts keep it open.
*/
export async function main(auth: RT.PagerdutyEvents, dedup_key: string) {
const response = await fetch("https://events.pagerduty.com/v2/enqueue", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
routing_key: auth.routing_key,
event_action: "resolve",
dedup_key,
}),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 days ago