aws-sdk-devopsagent 1.25.0

AWS SDK for AWS DevOps Agent Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Recurrence cadence for a time-range schedule</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Recurrence {
    /// <p>The window recurs every day</p>
    Daily(crate::types::DailyRecurrence),
    /// <p>The window recurs once per month</p>
    Monthly(crate::types::MonthlyRecurrence),
    /// <p>The window recurs once per week</p>
    Weekly(crate::types::WeeklyRecurrence),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl Recurrence {
    /// Tries to convert the enum instance into [`Daily`](crate::types::Recurrence::Daily), extracting the inner [`DailyRecurrence`](crate::types::DailyRecurrence).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_daily(&self) -> ::std::result::Result<&crate::types::DailyRecurrence, &Self> {
        if let Recurrence::Daily(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`Daily`](crate::types::Recurrence::Daily).
    pub fn is_daily(&self) -> bool {
        self.as_daily().is_ok()
    }
    /// Tries to convert the enum instance into [`Monthly`](crate::types::Recurrence::Monthly), extracting the inner [`MonthlyRecurrence`](crate::types::MonthlyRecurrence).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_monthly(&self) -> ::std::result::Result<&crate::types::MonthlyRecurrence, &Self> {
        if let Recurrence::Monthly(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`Monthly`](crate::types::Recurrence::Monthly).
    pub fn is_monthly(&self) -> bool {
        self.as_monthly().is_ok()
    }
    /// Tries to convert the enum instance into [`Weekly`](crate::types::Recurrence::Weekly), extracting the inner [`WeeklyRecurrence`](crate::types::WeeklyRecurrence).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_weekly(&self) -> ::std::result::Result<&crate::types::WeeklyRecurrence, &Self> {
        if let Recurrence::Weekly(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`Weekly`](crate::types::Recurrence::Weekly).
    pub fn is_weekly(&self) -> bool {
        self.as_weekly().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}