1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains a cache policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CachePolicySummary {
    /// <p>The type of cache policy, either <code>managed</code> (created by Amazon Web Services) or <code>custom</code> (created in this Amazon Web Services account).</p>
    pub r#type: crate::types::CachePolicyType,
    /// <p>The cache policy.</p>
    pub cache_policy: ::std::option::Option<crate::types::CachePolicy>,
}
impl CachePolicySummary {
    /// <p>The type of cache policy, either <code>managed</code> (created by Amazon Web Services) or <code>custom</code> (created in this Amazon Web Services account).</p>
    pub fn r#type(&self) -> &crate::types::CachePolicyType {
        &self.r#type
    }
    /// <p>The cache policy.</p>
    pub fn cache_policy(&self) -> ::std::option::Option<&crate::types::CachePolicy> {
        self.cache_policy.as_ref()
    }
}
impl CachePolicySummary {
    /// Creates a new builder-style object to manufacture [`CachePolicySummary`](crate::types::CachePolicySummary).
    pub fn builder() -> crate::types::builders::CachePolicySummaryBuilder {
        crate::types::builders::CachePolicySummaryBuilder::default()
    }
}

/// A builder for [`CachePolicySummary`](crate::types::CachePolicySummary).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CachePolicySummaryBuilder {
    pub(crate) r#type: ::std::option::Option<crate::types::CachePolicyType>,
    pub(crate) cache_policy: ::std::option::Option<crate::types::CachePolicy>,
}
impl CachePolicySummaryBuilder {
    /// <p>The type of cache policy, either <code>managed</code> (created by Amazon Web Services) or <code>custom</code> (created in this Amazon Web Services account).</p>
    /// This field is required.
    pub fn r#type(mut self, input: crate::types::CachePolicyType) -> Self {
        self.r#type = ::std::option::Option::Some(input);
        self
    }
    /// <p>The type of cache policy, either <code>managed</code> (created by Amazon Web Services) or <code>custom</code> (created in this Amazon Web Services account).</p>
    pub fn set_type(mut self, input: ::std::option::Option<crate::types::CachePolicyType>) -> Self {
        self.r#type = input;
        self
    }
    /// <p>The type of cache policy, either <code>managed</code> (created by Amazon Web Services) or <code>custom</code> (created in this Amazon Web Services account).</p>
    pub fn get_type(&self) -> &::std::option::Option<crate::types::CachePolicyType> {
        &self.r#type
    }
    /// <p>The cache policy.</p>
    /// This field is required.
    pub fn cache_policy(mut self, input: crate::types::CachePolicy) -> Self {
        self.cache_policy = ::std::option::Option::Some(input);
        self
    }
    /// <p>The cache policy.</p>
    pub fn set_cache_policy(mut self, input: ::std::option::Option<crate::types::CachePolicy>) -> Self {
        self.cache_policy = input;
        self
    }
    /// <p>The cache policy.</p>
    pub fn get_cache_policy(&self) -> &::std::option::Option<crate::types::CachePolicy> {
        &self.cache_policy
    }
    /// Consumes the builder and constructs a [`CachePolicySummary`](crate::types::CachePolicySummary).
    /// This method will fail if any of the following fields are not set:
    /// - [`r#type`](crate::types::builders::CachePolicySummaryBuilder::r#type)
    pub fn build(self) -> ::std::result::Result<crate::types::CachePolicySummary, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::types::CachePolicySummary {
            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 CachePolicySummary",
                )
            })?,
            cache_policy: self.cache_policy,
        })
    }
}