-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathopsgenie-alert-channel.ts
More file actions
74 lines (68 loc) · 1.87 KB
/
opsgenie-alert-channel.ts
File metadata and controls
74 lines (68 loc) · 1.87 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
import { AlertChannel, AlertChannelProps } from './alert-channel'
import { Session } from './project'
export type OpsgeniePriority = 'P1' | 'P2' | 'P3' | 'P4' | 'P5'
export type OpsgenieRegion = 'EU' | 'US'
export interface OpsgenieAlertChannelProps extends AlertChannelProps {
/**
* Friendly name to recognise the integration.
*/
name: string
/**
* An API key for your Opsgenie account. See our
* {@link https://www.checklyhq.com/docs/integrations/incident-management/opsgenie/
* docs on where to create this API key}
*/
apiKey: string
/**
* Configure the Opsgenie location, either `EU` or `US`.
*/
region: OpsgenieRegion
/**
* Configure the severity level, `P1` to `P5`.
*/
priority: OpsgeniePriority
}
/**
* Creates an Opsgenie Alert Channel
*
* @remarks
*
* This class make use of the Alert Channel endpoints.
*/
export class OpsgenieAlertChannel extends AlertChannel {
name: string
apiKey: string
region: OpsgenieRegion
priority: OpsgeniePriority
/**
* Constructs the Opsgenie Alert Channel instance
*
* @param logicalId unique project-scoped resource name identification
* @param props Opsgenie alert channel configuration properties
*
* {@link https://checklyhq.com/docs/cli/constructs-reference/#opsgeniealertchannel Read more in the docs}
*/
constructor (logicalId: string, props: OpsgenieAlertChannelProps) {
super(logicalId, props)
this.name = props.name
this.apiKey = props.apiKey
this.region = props.region
this.priority = props.priority
Session.registerConstruct(this)
}
describe (): string {
return `OpsgenieAlertChannel:${this.logicalId}`
}
synthesize () {
return {
...super.synthesize(),
type: 'OPSGENIE',
config: {
name: this.name,
apiKey: this.apiKey,
region: this.region,
priority: this.priority,
},
}
}
}