-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchannels.go
More file actions
412 lines (373 loc) · 14 KB
/
Copy pathchannels.go
File metadata and controls
412 lines (373 loc) · 14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
// Code generated by internal/cmd/gen; DO NOT EDIT.
package flashduty
import "context"
// ChannelsService handles the "On-call/Channels" API resource.
type ChannelsService service
// Create channel.
//
// Create a new channel for incident management.
//
// API: POST /channel/create (channelCreate).
func (s *ChannelsService) ChannelCreate(ctx context.Context, req *CreateChannelRequest) (*ChannelCreateResponse, *Response, error) {
out := new(ChannelCreateResponse)
resp, err := s.client.do(ctx, "/channel/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete channel.
//
// Delete a channel and all associated configuration.
//
// API: POST /channel/delete (channelDelete).
func (s *ChannelsService) ChannelDelete(ctx context.Context, req *ChannelIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/delete", req, nil)
}
// Disable channel.
//
// Disable a channel to stop incident routing without deleting it.
//
// API: POST /channel/disable (channelDisable).
func (s *ChannelsService) ChannelDisable(ctx context.Context, req *ChannelIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/disable", req, nil)
}
// Enable channel.
//
// Enable a disabled channel to resume incident routing.
//
// API: POST /channel/enable (channelEnable).
func (s *ChannelsService) ChannelEnable(ctx context.Context, req *ChannelIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/enable", req, nil)
}
// Create escalation rule.
//
// Create an escalation rule defining who gets notified and when during an incident.
//
// API: POST /channel/escalate/rule/create (channelEscalateRuleCreate).
func (s *ChannelsService) ChannelEscalateRuleCreate(ctx context.Context, req *CreateEscalationRuleRequest) (*RuleCreateResponse, *Response, error) {
out := new(RuleCreateResponse)
resp, err := s.client.do(ctx, "/channel/escalate/rule/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete escalation rule.
//
// Delete an escalation rule.
//
// API: POST /channel/escalate/rule/delete (channelEscalateRuleDelete).
func (s *ChannelsService) ChannelEscalateRuleDelete(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/escalate/rule/delete", req, nil)
}
// Disable escalation rule.
//
// Disable an escalation rule without deleting it.
//
// API: POST /channel/escalate/rule/disable (channelEscalateRuleDisable).
func (s *ChannelsService) ChannelEscalateRuleDisable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/escalate/rule/disable", req, nil)
}
// Enable escalation rule.
//
// Enable a disabled escalation rule.
//
// API: POST /channel/escalate/rule/enable (channelEscalateRuleEnable).
func (s *ChannelsService) ChannelEscalateRuleEnable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/escalate/rule/enable", req, nil)
}
// Get escalation rule detail.
//
// Retrieve detailed information for a specific escalation rule.
//
// API: POST /channel/escalate/rule/info (channelEscalateRuleInfo).
func (s *ChannelsService) ChannelEscalateRuleInfo(ctx context.Context, req *ChannelRuleIDRequest) (*EscalateRuleItem, *Response, error) {
out := new(EscalateRuleItem)
resp, err := s.client.do(ctx, "/channel/escalate/rule/info", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List escalation rules.
//
// List all escalation rules for a channel.
//
// API: POST /channel/escalate/rule/list (channelEscalateRuleList).
func (s *ChannelsService) ChannelEscalateRuleList(ctx context.Context, req *ChannelScopedListRequest) (*ListEscalationRulesResponse, *Response, error) {
out := new(ListEscalationRulesResponse)
resp, err := s.client.do(ctx, "/channel/escalate/rule/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update escalation rule.
//
// Update an existing escalation rule configuration.
//
// API: POST /channel/escalate/rule/update (channelEscalateRuleUpdate).
func (s *ChannelsService) ChannelEscalateRuleUpdate(ctx context.Context, req *UpdateEscalationRuleRequest) (*Response, error) {
return s.client.do(ctx, "/channel/escalate/rule/update", req, nil)
}
// Get channel detail.
//
// Retrieve detailed information for a specific channel.
//
// API: POST /channel/info (channelInfo).
func (s *ChannelsService) ChannelInfo(ctx context.Context, req *ChannelInfoRequest) (*ChannelItem, *Response, error) {
out := new(ChannelItem)
resp, err := s.client.do(ctx, "/channel/info", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Batch get channels.
//
// Retrieve multiple channels by their IDs.
//
// API: POST /channel/infos (channelInfos).
func (s *ChannelsService) ChannelInfos(ctx context.Context, req *ChannelInfosRequest) (*ChannelInfosResponse, *Response, error) {
out := new(ChannelInfosResponse)
resp, err := s.client.do(ctx, "/channel/infos", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Create inhibit rule.
//
// Create an inhibit rule to suppress lower-priority alerts when higher-priority ones are firing.
//
// API: POST /channel/inhibit/rule/create (channelInhibitRuleCreate).
func (s *ChannelsService) ChannelInhibitRuleCreate(ctx context.Context, req *CreateInhibitRuleRequest) (*RuleCreateResponse, *Response, error) {
out := new(RuleCreateResponse)
resp, err := s.client.do(ctx, "/channel/inhibit/rule/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete inhibit rule.
//
// Delete an inhibit rule.
//
// API: POST /channel/inhibit/rule/delete (channelInhibitRuleDelete).
func (s *ChannelsService) ChannelInhibitRuleDelete(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/inhibit/rule/delete", req, nil)
}
// Disable inhibit rule.
//
// Disable an inhibit rule without deleting it.
//
// API: POST /channel/inhibit/rule/disable (channelInhibitRuleDisable).
func (s *ChannelsService) ChannelInhibitRuleDisable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/inhibit/rule/disable", req, nil)
}
// Enable inhibit rule.
//
// Enable a disabled inhibit rule.
//
// API: POST /channel/inhibit/rule/enable (channelInhibitRuleEnable).
func (s *ChannelsService) ChannelInhibitRuleEnable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/inhibit/rule/enable", req, nil)
}
// List inhibit rules.
//
// List all inhibit rules configured for a channel.
//
// API: POST /channel/inhibit/rule/list (channelInhibitRuleList).
func (s *ChannelsService) ChannelInhibitRuleList(ctx context.Context, req *ChannelScopedListRequest) (*ListInhibitRulesResponse, *Response, error) {
out := new(ListInhibitRulesResponse)
resp, err := s.client.do(ctx, "/channel/inhibit/rule/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update inhibit rule.
//
// Update an existing inhibit rule configuration.
//
// API: POST /channel/inhibit/rule/update (channelInhibitRuleUpdate).
func (s *ChannelsService) ChannelInhibitRuleUpdate(ctx context.Context, req *UpdateInhibitRuleRequest) (*Response, error) {
return s.client.do(ctx, "/channel/inhibit/rule/update", req, nil)
}
// List channels.
//
// List channels accessible to the current user with optional filters.
//
// API: POST /channel/list (channelList).
func (s *ChannelsService) ChannelList(ctx context.Context, req *ListChannelsRequest) (*ListChannelsResponse, *Response, error) {
out := new(ListChannelsResponse)
resp, err := s.client.do(ctx, "/channel/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Create silence rule.
//
// Create a silence rule to suppress notifications matching specified conditions.
//
// API: POST /channel/silence/rule/create (channelSilenceRuleCreate).
func (s *ChannelsService) ChannelSilenceRuleCreate(ctx context.Context, req *CreateSilenceRuleRequest) (*RuleCreateResponse, *Response, error) {
out := new(RuleCreateResponse)
resp, err := s.client.do(ctx, "/channel/silence/rule/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete silence rule.
//
// Delete a silence rule.
//
// API: POST /channel/silence/rule/delete (channelSilenceRuleDelete).
func (s *ChannelsService) ChannelSilenceRuleDelete(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/silence/rule/delete", req, nil)
}
// Disable silence rule.
//
// Disable a silence rule without deleting it.
//
// API: POST /channel/silence/rule/disable (channelSilenceRuleDisable).
func (s *ChannelsService) ChannelSilenceRuleDisable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/silence/rule/disable", req, nil)
}
// Enable silence rule.
//
// Enable a disabled silence rule.
//
// API: POST /channel/silence/rule/enable (channelSilenceRuleEnable).
func (s *ChannelsService) ChannelSilenceRuleEnable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/silence/rule/enable", req, nil)
}
// List silence rules.
//
// List all silence rules configured for a channel.
//
// API: POST /channel/silence/rule/list (channelSilenceRuleList).
func (s *ChannelsService) ChannelSilenceRuleList(ctx context.Context, req *ChannelScopedListRequest) (*ListSilenceRulesResponse, *Response, error) {
out := new(ListSilenceRulesResponse)
resp, err := s.client.do(ctx, "/channel/silence/rule/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update silence rule.
//
// Update an existing silence rule configuration.
//
// API: POST /channel/silence/rule/update (channelSilenceRuleUpdate).
func (s *ChannelsService) ChannelSilenceRuleUpdate(ctx context.Context, req *UpdateSilenceRuleRequest) (*Response, error) {
return s.client.do(ctx, "/channel/silence/rule/update", req, nil)
}
// Create drop rule.
//
// Create a drop rule to filter out unwanted alerts before they become incidents.
//
// API: POST /channel/unsubscribe/rule/create (channelUnsubscribeRuleCreate).
func (s *ChannelsService) ChannelUnsubscribeRuleCreate(ctx context.Context, req *CreateDropRuleRequest) (*RuleCreateResponse, *Response, error) {
out := new(RuleCreateResponse)
resp, err := s.client.do(ctx, "/channel/unsubscribe/rule/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete drop rule.
//
// Delete a drop rule.
//
// API: POST /channel/unsubscribe/rule/delete (channelUnsubscribeRuleDelete).
func (s *ChannelsService) ChannelUnsubscribeRuleDelete(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/unsubscribe/rule/delete", req, nil)
}
// Disable drop rule.
//
// Disable a drop rule without deleting it.
//
// API: POST /channel/unsubscribe/rule/disable (channelUnsubscribeRuleDisable).
func (s *ChannelsService) ChannelUnsubscribeRuleDisable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/unsubscribe/rule/disable", req, nil)
}
// Enable drop rule.
//
// Enable a disabled drop rule.
//
// API: POST /channel/unsubscribe/rule/enable (channelUnsubscribeRuleEnable).
func (s *ChannelsService) ChannelUnsubscribeRuleEnable(ctx context.Context, req *ChannelRuleIDRequest) (*Response, error) {
return s.client.do(ctx, "/channel/unsubscribe/rule/enable", req, nil)
}
// List drop rules.
//
// List drop rules for a channel.
//
// API: POST /channel/unsubscribe/rule/list (channelUnsubscribeRuleList).
func (s *ChannelsService) ChannelUnsubscribeRuleList(ctx context.Context, req *ChannelScopedListRequest) (*ListDropRulesResponse, *Response, error) {
out := new(ListDropRulesResponse)
resp, err := s.client.do(ctx, "/channel/unsubscribe/rule/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update drop rule.
//
// Update an existing drop rule configuration.
//
// API: POST /channel/unsubscribe/rule/update (channelUnsubscribeRuleUpdate).
func (s *ChannelsService) ChannelUnsubscribeRuleUpdate(ctx context.Context, req *UpdateDropRuleRequest) (*Response, error) {
return s.client.do(ctx, "/channel/unsubscribe/rule/update", req, nil)
}
// Update channel.
//
// Update an existing channel's configuration and settings.
//
// API: POST /channel/update (channelUpdate).
func (s *ChannelsService) ChannelUpdate(ctx context.Context, req *UpdateChannelRequest) (*UpdateChannelResponse, *Response, error) {
out := new(UpdateChannelResponse)
resp, err := s.client.do(ctx, "/channel/update", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Get routing rule detail.
//
// Retrieve the routing rule configuration for a specific integration. Returns null when the integration has no routing rule configured.
//
// API: POST /route/info (routeInfo).
func (s *ChannelsService) RouteInfo(ctx context.Context, req *RouteInfoRequest) (*RouteItem, *Response, error) {
out := new(RouteItem)
resp, err := s.client.do(ctx, "/route/info", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List routing rules.
//
// Return routing rules for the specified integrations. Integrations without a configured rule are omitted from the response.
//
// API: POST /route/list (routeList).
func (s *ChannelsService) RouteList(ctx context.Context, req *ListRoutesRequest) (*ListRoutesResponse, *Response, error) {
out := new(ListRoutesResponse)
resp, err := s.client.do(ctx, "/route/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Upsert routing rule.
//
// Create or update routing rules for an integration to direct alerts to specific channels. At least one of `cases` or `default` must be provided.
//
// API: POST /route/upsert (routeUpsert).
func (s *ChannelsService) RouteUpsert(ctx context.Context, req *UpsertRouteRequest) (*Response, error) {
return s.client.do(ctx, "/route/upsert", req, nil)
}