aws-sdk-applicationsignals 1.89.0

AWS SDK for Amazon CloudWatch Application Signals
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The object that defines the time length of an exclusion window.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Window {
    /// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
    pub duration_unit: crate::types::DurationUnit,
    /// <p>The number of time units for the exclusion window length.</p>
    pub duration: i32,
}
impl Window {
    /// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
    pub fn duration_unit(&self) -> &crate::types::DurationUnit {
        &self.duration_unit
    }
    /// <p>The number of time units for the exclusion window length.</p>
    pub fn duration(&self) -> i32 {
        self.duration
    }
}
impl Window {
    /// Creates a new builder-style object to manufacture [`Window`](crate::types::Window).
    pub fn builder() -> crate::types::builders::WindowBuilder {
        crate::types::builders::WindowBuilder::default()
    }
}

/// A builder for [`Window`](crate::types::Window).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct WindowBuilder {
    pub(crate) duration_unit: ::std::option::Option<crate::types::DurationUnit>,
    pub(crate) duration: ::std::option::Option<i32>,
}
impl WindowBuilder {
    /// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
    /// This field is required.
    pub fn duration_unit(mut self, input: crate::types::DurationUnit) -> Self {
        self.duration_unit = ::std::option::Option::Some(input);
        self
    }
    /// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
    pub fn set_duration_unit(mut self, input: ::std::option::Option<crate::types::DurationUnit>) -> Self {
        self.duration_unit = input;
        self
    }
    /// <p>The unit of time for the exclusion window duration. Valid values: MINUTE, HOUR, DAY, MONTH.</p>
    pub fn get_duration_unit(&self) -> &::std::option::Option<crate::types::DurationUnit> {
        &self.duration_unit
    }
    /// <p>The number of time units for the exclusion window length.</p>
    /// This field is required.
    pub fn duration(mut self, input: i32) -> Self {
        self.duration = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of time units for the exclusion window length.</p>
    pub fn set_duration(mut self, input: ::std::option::Option<i32>) -> Self {
        self.duration = input;
        self
    }
    /// <p>The number of time units for the exclusion window length.</p>
    pub fn get_duration(&self) -> &::std::option::Option<i32> {
        &self.duration
    }
    /// Consumes the builder and constructs a [`Window`](crate::types::Window).
    /// This method will fail if any of the following fields are not set:
    /// - [`duration_unit`](crate::types::builders::WindowBuilder::duration_unit)
    /// - [`duration`](crate::types::builders::WindowBuilder::duration)
    pub fn build(self) -> ::std::result::Result<crate::types::Window, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Window {
            duration_unit: self.duration_unit.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "duration_unit",
                    "duration_unit was not specified but it is required when building Window",
                )
            })?,
            duration: self.duration.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "duration",
                    "duration was not specified but it is required when building Window",
                )
            })?,
        })
    }
}