-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dzhuneyt/issue-16169
- Loading branch information
Showing
267 changed files
with
4,293 additions
and
747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import * as cloudwatch from '@aws-cdk/aws-cloudwatch'; | ||
import { Stack } from '@aws-cdk/core'; | ||
|
||
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main | ||
// eslint-disable-next-line no-duplicate-imports, import/order | ||
import { Construct } from '@aws-cdk/core'; | ||
|
||
/** | ||
* Types of OpsItem severity available | ||
*/ | ||
export enum OpsItemSeverity { | ||
/** | ||
* Set the severity to critical | ||
*/ | ||
CRITICAL = '1', | ||
/** | ||
* Set the severity to high | ||
*/ | ||
HIGH = '2', | ||
/** | ||
* Set the severity to medium | ||
*/ | ||
MEDIUM = '3', | ||
/** | ||
* Set the severity to low | ||
*/ | ||
LOW = '4' | ||
} | ||
|
||
/** | ||
* Types of OpsItem category available | ||
*/ | ||
export enum OpsItemCategory { | ||
/** | ||
* Set the category to availability | ||
*/ | ||
AVAILABILITY = 'Availability', | ||
/** | ||
* Set the category to cost | ||
*/ | ||
COST = 'Cost', | ||
/** | ||
* Set the category to performance | ||
*/ | ||
PERFORMANCE = 'Performance', | ||
/** | ||
* Set the category to recovery | ||
*/ | ||
RECOVERY = 'Recovery', | ||
/** | ||
* Set the category to security | ||
*/ | ||
SECURITY = 'Security' | ||
} | ||
|
||
/** | ||
* Use an SSM OpsItem action as an Alarm action | ||
*/ | ||
export class SsmAction implements cloudwatch.IAlarmAction { | ||
private severity: OpsItemSeverity; | ||
private category?: OpsItemCategory; | ||
|
||
constructor(severity: OpsItemSeverity, category?: OpsItemCategory) { | ||
this.severity = severity; | ||
this.category = category; | ||
} | ||
|
||
/** | ||
* Returns an alarm action configuration to use an SSM OpsItem action as an alarm action | ||
*/ | ||
bind(_scope: Construct, _alarm: cloudwatch.IAlarm): cloudwatch.AlarmActionConfig { | ||
if (this.category === undefined) { | ||
return { alarmActionArn: `arn:aws:ssm:${Stack.of(_scope).region}:${Stack.of(_scope).account}:opsitem:${this.severity}` }; | ||
} else { | ||
return { alarmActionArn: `arn:aws:ssm:${Stack.of(_scope).region}:${Stack.of(_scope).account}:opsitem:${this.severity}#CATEGORY=${this.category}` }; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.