aws-sdk-acm 1.117.0

AWS SDK for AWS Certificate Manager
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Specifies an expiration configuration.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Expiration {
    /// <p>The numeric value of the expiration.</p>
    pub value: i64,
    /// <p>The time unit for the expiration value.</p>
    pub r#type: crate::types::TimeType,
}
impl Expiration {
    /// <p>The numeric value of the expiration.</p>
    pub fn value(&self) -> i64 {
        self.value
    }
    /// <p>The time unit for the expiration value.</p>
    pub fn r#type(&self) -> &crate::types::TimeType {
        &self.r#type
    }
}
impl Expiration {
    /// Creates a new builder-style object to manufacture [`Expiration`](crate::types::Expiration).
    pub fn builder() -> crate::types::builders::ExpirationBuilder {
        crate::types::builders::ExpirationBuilder::default()
    }
}

/// A builder for [`Expiration`](crate::types::Expiration).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ExpirationBuilder {
    pub(crate) value: ::std::option::Option<i64>,
    pub(crate) r#type: ::std::option::Option<crate::types::TimeType>,
}
impl ExpirationBuilder {
    /// <p>The numeric value of the expiration.</p>
    /// This field is required.
    pub fn value(mut self, input: i64) -> Self {
        self.value = ::std::option::Option::Some(input);
        self
    }
    /// <p>The numeric value of the expiration.</p>
    pub fn set_value(mut self, input: ::std::option::Option<i64>) -> Self {
        self.value = input;
        self
    }
    /// <p>The numeric value of the expiration.</p>
    pub fn get_value(&self) -> &::std::option::Option<i64> {
        &self.value
    }
    /// <p>The time unit for the expiration value.</p>
    /// This field is required.
    pub fn r#type(mut self, input: crate::types::TimeType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The time unit for the expiration value.</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::TimeType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The time unit for the expiration value.</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::TimeType> {
        &self.r#type
    }
    /// Consumes the builder and constructs a [`Expiration`](crate::types::Expiration).
    /// This method will fail if any of the following fields are not set:
    /// - [`value`](crate::types::builders::ExpirationBuilder::value)
    /// - [`r#type`](crate::types::builders::ExpirationBuilder::type)
    pub fn build(self) -> ::std::result::Result<crate::types::Expiration, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Expiration {
            value: self.value.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "value",
                    "value was not specified but it is required when building Expiration",
                )
            })?,
            r#type: self.r#type.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "r#type",
                    "r#type was not specified but it is required when building Expiration",
                )
            })?,
        })
    }
}