aws-sdk-cloudfront 1.115.0

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

/// <p>A complex type that contains information about the objects that you want to invalidate. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#invalidation-specifying-objects">Specifying the Objects to Invalidate</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Paths {
    /// <p>The number of invalidation paths specified for the objects that you want to invalidate.</p>
    pub quantity: i32,
    /// <p>A complex type that contains a list of the paths that you want to invalidate.</p>
    pub items: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl Paths {
    /// <p>The number of invalidation paths specified for the objects that you want to invalidate.</p>
    pub fn quantity(&self) -> i32 {
        self.quantity
    }
    /// <p>A complex type that contains a list of the paths that you want to invalidate.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.items.is_none()`.
    pub fn items(&self) -> &[::std::string::String] {
        self.items.as_deref().unwrap_or_default()
    }
}
impl Paths {
    /// Creates a new builder-style object to manufacture [`Paths`](crate::types::Paths).
    pub fn builder() -> crate::types::builders::PathsBuilder {
        crate::types::builders::PathsBuilder::default()
    }
}

/// A builder for [`Paths`](crate::types::Paths).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct PathsBuilder {
    pub(crate) quantity: ::std::option::Option<i32>,
    pub(crate) items: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl PathsBuilder {
    /// <p>The number of invalidation paths specified for the objects that you want to invalidate.</p>
    /// This field is required.
    pub fn quantity(mut self, input: i32) -> Self {
        self.quantity = ::std::option::Option::Some(input);
        self
    }
    /// <p>The number of invalidation paths specified for the objects that you want to invalidate.</p>
    pub fn set_quantity(mut self, input: ::std::option::Option<i32>) -> Self {
        self.quantity = input;
        self
    }
    /// <p>The number of invalidation paths specified for the objects that you want to invalidate.</p>
    pub fn get_quantity(&self) -> &::std::option::Option<i32> {
        &self.quantity
    }
    /// Appends an item to `items`.
    ///
    /// To override the contents of this collection use [`set_items`](Self::set_items).
    ///
    /// <p>A complex type that contains a list of the paths that you want to invalidate.</p>
    pub fn items(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        let mut v = self.items.unwrap_or_default();
        v.push(input.into());
        self.items = ::std::option::Option::Some(v);
        self
    }
    /// <p>A complex type that contains a list of the paths that you want to invalidate.</p>
    pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.items = input;
        self
    }
    /// <p>A complex type that contains a list of the paths that you want to invalidate.</p>
    pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        &self.items
    }
    /// Consumes the builder and constructs a [`Paths`](crate::types::Paths).
    /// This method will fail if any of the following fields are not set:
    /// - [`quantity`](crate::types::builders::PathsBuilder::quantity)
    pub fn build(self) -> ::std::result::Result<crate::types::Paths, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::Paths {
            quantity: self.quantity.ok_or_else(|| {
                ::aws_smithy_types::error::operation::BuildError::missing_field(
                    "quantity",
                    "quantity was not specified but it is required when building Paths",
                )
            })?,
            items: self.items,
        })
    }
}