feat(cloudwatch): add L2 construct for AlarmMuteRule#37297
Open
feat(cloudwatch): add L2 construct for AlarmMuteRule#37297
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
N/A
Reason for this change
AWS CloudWatch recently introduced Alarm Mute Rules, which allow users to temporarily suppress alarm actions during predefined time windows (e.g., maintenance windows, deployments). The L1 construct
CfnAlarmMuteRuleis already available, but there is no L2 construct to provide a higher-level, CDK-idiomatic experience.Description of changes
Added an L2 construct
AlarmMuteRuleforAWS::CloudWatch::AlarmMuteRulewith the followingAlarmMuteRuleclass extendingResource, supporting creation and import (fromAlarmMuteRuleArn,fromAlarmMuteRuleName)MuteScheduleclass withcron(),at(), andexpression()static methods for defining mute schedulesMuteDateTimeOptionsinterface for specifying start/expire dates with minute-level precisionaddAlarm()method for adding mute targets after constructionREADME.mdwith usage examples covering recurring mutes, one-time mutes, timezone, start/expire dates, and importindex.tsDesign decisions on date/time handling
MuteDateTimeOptionsis a custom type with individualyear,month,day,hour,minutefields instead of usingDateor ISO 8601 strings. This is because the AlarmMuteRule API interprets dates in the timezone specified by thetimezoneproperty (defaulting to UTC), so using JavaScriptDateobjects (which are always UTC-based) would be misleading and error-prone. By using plain numeric fields, users specify the date/time exactly as it will be interpreted in the configured timezone.yyyy-MM-ddTHH:mm) because the AlarmMuteRule API does not accept seconds and will reject requests that include them.Describe any new or updated permissions being added
None
Description of how you validated changes
Add both unit and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license