Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cli/src/ai-context/context.fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@
"repeatInterval": 1,
"repeatUnit": "WEEK",
"repeatEndsAt": "2025-08-01T00:00:00.000Z",
"timezone": "America/New_York",
"pauseAllChecks": false,
"silenceAlertsTags": [
"app:webshop"
],
"silenceAllAlerts": false,
"created_at": "2025-07-07T08:43:03.466Z",
"updated_at": "2025-07-07T08:43:03.465Z"
}
Expand Down
27 changes: 27 additions & 0 deletions packages/cli/src/constructs/maintenance-window-codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export interface MaintenanceWindowResource {
repeatInterval?: number | null
repeatUnit?: string
repeatEndsAt?: string
timezone?: string | null
pauseAllChecks?: boolean
silenceAlertsTags?: Array<string>
silenceAllAlerts?: boolean
}

const construct = 'MaintenanceWindow'
Expand Down Expand Up @@ -67,6 +71,29 @@ export class MaintenanceWindowCodegen extends Codegen<MaintenanceWindowResource>
})
})
}

if (resource.timezone) {
builder.string('timezone', resource.timezone)
}

// The default value for pauseAllChecks is false, only include if true.
if (resource.pauseAllChecks !== undefined && resource.pauseAllChecks) {
builder.boolean('pauseAllChecks', resource.pauseAllChecks)
}

if (resource.silenceAlertsTags?.length) {
const silenceAlertsTags = resource.silenceAlertsTags
builder.array('silenceAlertsTags', builder => {
for (const tag of silenceAlertsTags) {
builder.string(tag)
}
})
}

// The default value for silenceAllAlerts is false, only include if true.
if (resource.silenceAllAlerts !== undefined && resource.silenceAllAlerts) {
builder.boolean('silenceAllAlerts', resource.silenceAllAlerts)
}
})
})
}))
Expand Down
36 changes: 34 additions & 2 deletions packages/cli/src/constructs/maintenance-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export interface MaintenanceWindowProps {
name: string
/**
* A list of one or more tags that filter which checks are affected by the maintenance window.
* Not needed when `pauseAllChecks` is true.
*/
tags: Array<string>
tags?: Array<string>
/**
* The start date and time of the maintenance window in ISO 8601 format, "YYYY-MM-DDTHH:mm:ss.sssZ" as returned by
* `new Date()`
Expand All @@ -34,6 +35,25 @@ export interface MaintenanceWindowProps {
* The end date and time when the maintenance window should stop repeating.
*/
repeatEndsAt?: Date
/**
* Named IANA time zone used for recurring maintenance scheduling, e.g. "America/New_York".
* UTC offset identifiers such as "+05:00" are not accepted. Defaults to UTC.
*/
timezone?: string
/**
* When true, checks are paused for every check in the account, regardless of `tags`.
*/
pauseAllChecks?: boolean
/**
* A list of tags that filter which checks have their alerts silenced. Ignored when
* `silenceAllAlerts` is true.
*/
silenceAlertsTags?: Array<string>
/**
* When true, alerts are silenced for every check in the account, overriding
* `silenceAlertsTags`.
*/
silenceAllAlerts?: boolean
}

/**
Expand All @@ -45,12 +65,16 @@ export interface MaintenanceWindowProps {
*/
export class MaintenanceWindow extends Construct {
name: string
tags: Array<string>
tags?: Array<string>
startsAt: Date
endsAt: Date
repeatInterval?: number
repeatUnit?: MaintenanceWindowRepeatUnit
repeatEndsAt?: Date
timezone?: string
pauseAllChecks?: boolean
silenceAlertsTags?: Array<string>
silenceAllAlerts?: boolean

static readonly __checklyType = 'maintenance-window'

Expand All @@ -71,6 +95,10 @@ export class MaintenanceWindow extends Construct {
this.repeatInterval = props.repeatInterval
this.repeatUnit = props.repeatUnit
this.repeatEndsAt = props.repeatEndsAt
this.timezone = props.timezone
this.pauseAllChecks = props.pauseAllChecks
this.silenceAlertsTags = props.silenceAlertsTags
this.silenceAllAlerts = props.silenceAllAlerts
Session.registerConstruct(this)
}

Expand All @@ -87,6 +115,10 @@ export class MaintenanceWindow extends Construct {
repeatInterval: this.repeatInterval,
repeatUnit: this.repeatUnit,
repeatEndsAt: this.repeatEndsAt,
timezone: this.timezone,
pauseAllChecks: this.pauseAllChecks,
silenceAlertsTags: this.silenceAlertsTags,
silenceAllAlerts: this.silenceAllAlerts,
}
}
}
Loading