aws_sdk_cloudfront/types/
_content_type_profiles.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Field-level encryption content type-profile.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ContentTypeProfiles {
7    /// <p>The number of field-level encryption content type-profile mappings.</p>
8    pub quantity: i32,
9    /// <p>Items in a field-level encryption content type-profile mapping.</p>
10    pub items: ::std::option::Option<::std::vec::Vec<crate::types::ContentTypeProfile>>,
11}
12impl ContentTypeProfiles {
13    /// <p>The number of field-level encryption content type-profile mappings.</p>
14    pub fn quantity(&self) -> i32 {
15        self.quantity
16    }
17    /// <p>Items in a field-level encryption content type-profile mapping.</p>
18    ///
19    /// 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()`.
20    pub fn items(&self) -> &[crate::types::ContentTypeProfile] {
21        self.items.as_deref().unwrap_or_default()
22    }
23}
24impl ContentTypeProfiles {
25    /// Creates a new builder-style object to manufacture [`ContentTypeProfiles`](crate::types::ContentTypeProfiles).
26    pub fn builder() -> crate::types::builders::ContentTypeProfilesBuilder {
27        crate::types::builders::ContentTypeProfilesBuilder::default()
28    }
29}
30
31/// A builder for [`ContentTypeProfiles`](crate::types::ContentTypeProfiles).
32#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
33#[non_exhaustive]
34pub struct ContentTypeProfilesBuilder {
35    pub(crate) quantity: ::std::option::Option<i32>,
36    pub(crate) items: ::std::option::Option<::std::vec::Vec<crate::types::ContentTypeProfile>>,
37}
38impl ContentTypeProfilesBuilder {
39    /// <p>The number of field-level encryption content type-profile mappings.</p>
40    /// This field is required.
41    pub fn quantity(mut self, input: i32) -> Self {
42        self.quantity = ::std::option::Option::Some(input);
43        self
44    }
45    /// <p>The number of field-level encryption content type-profile mappings.</p>
46    pub fn set_quantity(mut self, input: ::std::option::Option<i32>) -> Self {
47        self.quantity = input;
48        self
49    }
50    /// <p>The number of field-level encryption content type-profile mappings.</p>
51    pub fn get_quantity(&self) -> &::std::option::Option<i32> {
52        &self.quantity
53    }
54    /// Appends an item to `items`.
55    ///
56    /// To override the contents of this collection use [`set_items`](Self::set_items).
57    ///
58    /// <p>Items in a field-level encryption content type-profile mapping.</p>
59    pub fn items(mut self, input: crate::types::ContentTypeProfile) -> Self {
60        let mut v = self.items.unwrap_or_default();
61        v.push(input);
62        self.items = ::std::option::Option::Some(v);
63        self
64    }
65    /// <p>Items in a field-level encryption content type-profile mapping.</p>
66    pub fn set_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ContentTypeProfile>>) -> Self {
67        self.items = input;
68        self
69    }
70    /// <p>Items in a field-level encryption content type-profile mapping.</p>
71    pub fn get_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ContentTypeProfile>> {
72        &self.items
73    }
74    /// Consumes the builder and constructs a [`ContentTypeProfiles`](crate::types::ContentTypeProfiles).
75    /// This method will fail if any of the following fields are not set:
76    /// - [`quantity`](crate::types::builders::ContentTypeProfilesBuilder::quantity)
77    pub fn build(self) -> ::std::result::Result<crate::types::ContentTypeProfiles, ::aws_smithy_types::error::operation::BuildError> {
78        ::std::result::Result::Ok(crate::types::ContentTypeProfiles {
79            quantity: self.quantity.ok_or_else(|| {
80                ::aws_smithy_types::error::operation::BuildError::missing_field(
81                    "quantity",
82                    "quantity was not specified but it is required when building ContentTypeProfiles",
83                )
84            })?,
85            items: self.items,
86        })
87    }
88}