aws_sdk_s3/types/
_inventory_filter.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Specifies an S3 Inventory filter. The inventory only includes objects that meet the filter's criteria.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct InventoryFilter {
7    /// <p>The prefix that an object must have to be included in the inventory results.</p>
8    pub prefix: ::std::string::String,
9}
10impl InventoryFilter {
11    /// <p>The prefix that an object must have to be included in the inventory results.</p>
12    pub fn prefix(&self) -> &str {
13        use std::ops::Deref;
14        self.prefix.deref()
15    }
16}
17impl InventoryFilter {
18    /// Creates a new builder-style object to manufacture [`InventoryFilter`](crate::types::InventoryFilter).
19    pub fn builder() -> crate::types::builders::InventoryFilterBuilder {
20        crate::types::builders::InventoryFilterBuilder::default()
21    }
22}
23
24/// A builder for [`InventoryFilter`](crate::types::InventoryFilter).
25#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
26#[non_exhaustive]
27pub struct InventoryFilterBuilder {
28    pub(crate) prefix: ::std::option::Option<::std::string::String>,
29}
30impl InventoryFilterBuilder {
31    /// <p>The prefix that an object must have to be included in the inventory results.</p>
32    /// This field is required.
33    pub fn prefix(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
34        self.prefix = ::std::option::Option::Some(input.into());
35        self
36    }
37    /// <p>The prefix that an object must have to be included in the inventory results.</p>
38    pub fn set_prefix(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
39        self.prefix = input;
40        self
41    }
42    /// <p>The prefix that an object must have to be included in the inventory results.</p>
43    pub fn get_prefix(&self) -> &::std::option::Option<::std::string::String> {
44        &self.prefix
45    }
46    /// Consumes the builder and constructs a [`InventoryFilter`](crate::types::InventoryFilter).
47    /// This method will fail if any of the following fields are not set:
48    /// - [`prefix`](crate::types::builders::InventoryFilterBuilder::prefix)
49    pub fn build(self) -> ::std::result::Result<crate::types::InventoryFilter, ::aws_smithy_types::error::operation::BuildError> {
50        ::std::result::Result::Ok(crate::types::InventoryFilter {
51            prefix: self.prefix.ok_or_else(|| {
52                ::aws_smithy_types::error::operation::BuildError::missing_field(
53                    "prefix",
54                    "prefix was not specified but it is required when building InventoryFilter",
55                )
56            })?,
57        })
58    }
59}