1 | |
2 | |
3 | * Update Index Rate Alert |
4 | * Use this method to update an index rate alert. You can change the alert's configuration details. |
5 | */ |
6 | export async function main(auth: RT.Mezmo, body: Body) { |
7 | const url = new URL(`https://api.mezmo.com/v1/config/index-rate`) |
8 |
|
9 | const response = await fetch(url, { |
10 | method: 'PUT', |
11 | headers: { |
12 | 'Content-Type': 'application/json', |
13 | Authorization: 'Token ' + auth.apiKey |
14 | }, |
15 | body: JSON.stringify(body) |
16 | }) |
17 | if (!response.ok) { |
18 | const text = await response.text() |
19 | throw new Error(`${response.status} ${text}`) |
20 | } |
21 | return await response.json() |
22 | } |
23 |
|
24 | |
25 | |
26 | * This file was automatically generated by json-schema-to-typescript. |
27 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
28 | * and run json-schema-to-typescript to regenerate this file. |
29 | */ |
30 |
|
31 | export interface Body { |
32 | |
33 | * The number of lines required in order to trigger the alert. |
34 | */ |
35 | max_lines?: number |
36 | |
37 | * The number of standard deviations above the 30 day average lines in order to trigger the alert. |
38 | */ |
39 | max_z_score?: number |
40 | |
41 | * Determines if you want alerts to be triggered if both the max lines and standard deviation have been triggered, or if one of the thresholds has been reached. |
42 | */ |
43 | threshold_alert?: 'separate' | 'both' |
44 | |
45 | * Notify recipients once per hour, or once per day, (starting when the threshold is passed the first time) until the index rate drops below the thresholds. When the index rate drops below the thresholds, alerting stops. |
46 | */ |
47 | frequency?: 'hourly' | 'daily' |
48 | channels?: { |
49 | email?: string[] |
50 | pagerduty?: string[] |
51 | slack?: string[] |
52 | webhook?: { |
53 | |
54 | * Webhook URL. |
55 | */ |
56 | url?: string |
57 | |
58 | * WebHook method such as POST. |
59 | */ |
60 | method?: 'POST' | 'PUT' | 'PATCH' |
61 | headers?: { |
62 | |
63 | * Header value |
64 | */ |
65 | timestamp?: string |
66 | [k: string]: unknown |
67 | } |
68 | bodyTemplate?: string |
69 | [k: string]: unknown |
70 | }[] |
71 | [k: string]: unknown |
72 | } |
73 | enabled?: boolean |
74 | [k: string]: unknown |
75 | } |
76 |
|