#[non_exhaustive]pub struct Schedule {
pub expression: Option<String>,
pub duration: Option<String>,
pub timezone: Option<String>,
}Expand description
Specifies when and how long an alarm mute rule is active.
The schedule uses either a cron expression for recurring mute windows or an at expression for one-time mute windows. When the schedule activates, the mute rule mutes alarm actions for the specified duration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.expression: Option<String>The schedule expression that defines when the mute rule activates. The expression must be between 1 and 256 characters in length.
You can use one of two expression formats:
-
Cron expressions - For recurring mute windows. Format:
cron(Minutes Hours Day-of-month Month Day-of-week)Examples:
-
cron(0 2 * * *)- Activates daily at 2:00 AM -
cron(0 2 * * SUN)- Activates every Sunday at 2:00 AM for weekly system maintenance -
cron(0 1 1 * *)- Activates on the first day of each month at 1:00 AM for monthly database maintenance -
cron(0 18 * * FRI)- Activates every Friday at 6:00 PM -
cron(0 23 * * *)- Activates every day at 11:00 PM during nightly backup operations
The characters
*,-, and,are supported in all fields. English names can be used for the month (JAN-DEC) and day of week (SUN-SAT) fields. -
-
At expressions - For one-time mute windows. Format:
at(yyyy-MM-ddThh:mm)Examples:
-
at(2024-05-10T14:00)- Activates once on May 10, 2024 at 2:00 PM during an active incident response session -
at(2024-12-23T00:00)- Activates once on December 23, 2024 at midnight during annual company shutdown
-
duration: Option<String>The length of time that alarms remain muted when the schedule activates. The duration must be between 1 and 50 characters in length.
Specify the duration using ISO 8601 duration format with a minimum of 1 minute (PT1M) and maximum of 15 days (P15D).
Examples:
-
PT4H- 4 hours for weekly system maintenance -
P2DT12H- 2 days and 12 hours for weekend muting from Friday 6:00 PM to Monday 6:00 AM -
PT6H- 6 hours for monthly database maintenance -
PT2H- 2 hours for nightly backup operations -
P7D- 7 days for annual company shutdown
The duration begins when the schedule expression time is reached. For recurring schedules, the duration applies to each occurrence.
timezone: Option<String>The time zone to use when evaluating the schedule expression. The time zone must be between 1 and 50 characters in length.
Specify the time zone using standard timezone identifiers (for example, America/New_York, Europe/London, or Asia/Tokyo).
If you don't specify a time zone, UTC is used by default. The time zone affects how cron and at expressions are interpreted, as well as start and expire dates you specify
Examples:
-
America/New_York- Eastern Time (US) -
America/Los_Angeles- Pacific Time (US) -
Europe/London- British Time -
Asia/Tokyo- Japan Standard Time -
UTC- Coordinated Universal Time
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn expression(&self) -> Option<&str>
pub fn expression(&self) -> Option<&str>
The schedule expression that defines when the mute rule activates. The expression must be between 1 and 256 characters in length.
You can use one of two expression formats:
-
Cron expressions - For recurring mute windows. Format:
cron(Minutes Hours Day-of-month Month Day-of-week)Examples:
-
cron(0 2 * * *)- Activates daily at 2:00 AM -
cron(0 2 * * SUN)- Activates every Sunday at 2:00 AM for weekly system maintenance -
cron(0 1 1 * *)- Activates on the first day of each month at 1:00 AM for monthly database maintenance -
cron(0 18 * * FRI)- Activates every Friday at 6:00 PM -
cron(0 23 * * *)- Activates every day at 11:00 PM during nightly backup operations
The characters
*,-, and,are supported in all fields. English names can be used for the month (JAN-DEC) and day of week (SUN-SAT) fields. -
-
At expressions - For one-time mute windows. Format:
at(yyyy-MM-ddThh:mm)Examples:
-
at(2024-05-10T14:00)- Activates once on May 10, 2024 at 2:00 PM during an active incident response session -
at(2024-12-23T00:00)- Activates once on December 23, 2024 at midnight during annual company shutdown
-
Sourcepub fn duration(&self) -> Option<&str>
pub fn duration(&self) -> Option<&str>
The length of time that alarms remain muted when the schedule activates. The duration must be between 1 and 50 characters in length.
Specify the duration using ISO 8601 duration format with a minimum of 1 minute (PT1M) and maximum of 15 days (P15D).
Examples:
-
PT4H- 4 hours for weekly system maintenance -
P2DT12H- 2 days and 12 hours for weekend muting from Friday 6:00 PM to Monday 6:00 AM -
PT6H- 6 hours for monthly database maintenance -
PT2H- 2 hours for nightly backup operations -
P7D- 7 days for annual company shutdown
The duration begins when the schedule expression time is reached. For recurring schedules, the duration applies to each occurrence.
Sourcepub fn timezone(&self) -> Option<&str>
pub fn timezone(&self) -> Option<&str>
The time zone to use when evaluating the schedule expression. The time zone must be between 1 and 50 characters in length.
Specify the time zone using standard timezone identifiers (for example, America/New_York, Europe/London, or Asia/Tokyo).
If you don't specify a time zone, UTC is used by default. The time zone affects how cron and at expressions are interpreted, as well as start and expire dates you specify
Examples:
-
America/New_York- Eastern Time (US) -
America/Los_Angeles- Pacific Time (US) -
Europe/London- British Time -
Asia/Tokyo- Japan Standard Time -
UTC- Coordinated Universal Time
Trait Implementations§
impl StructuralPartialEq for Schedule
Auto Trait Implementations§
impl Freeze for Schedule
impl RefUnwindSafe for Schedule
impl Send for Schedule
impl Sync for Schedule
impl Unpin for Schedule
impl UnsafeUnpin for Schedule
impl UnwindSafe for Schedule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);