aws_sdk_cloudfront/types/_cache_policy_headers_config.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object that determines whether any HTTP headers (and if so, which headers) are included in the cache key and in requests that CloudFront sends to the origin.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CachePolicyHeadersConfig {
7 /// <p>Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:</p>
8 /// <ul>
9 /// <li>
10 /// <p><code>none</code> – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to <code>none</code>, any headers that are listed in an <code>OriginRequestPolicy</code> <i>are</i> included in origin requests.</p></li>
11 /// <li>
12 /// <p><code>whitelist</code> – Only the HTTP headers that are listed in the <code>Headers</code> type are included in the cache key and in requests that CloudFront sends to the origin.</p></li>
13 /// </ul>
14 pub header_behavior: crate::types::CachePolicyHeaderBehavior,
15 /// <p>Contains a list of HTTP header names.</p>
16 pub headers: ::std::option::Option<crate::types::Headers>,
17}
18impl CachePolicyHeadersConfig {
19 /// <p>Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:</p>
20 /// <ul>
21 /// <li>
22 /// <p><code>none</code> – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to <code>none</code>, any headers that are listed in an <code>OriginRequestPolicy</code> <i>are</i> included in origin requests.</p></li>
23 /// <li>
24 /// <p><code>whitelist</code> – Only the HTTP headers that are listed in the <code>Headers</code> type are included in the cache key and in requests that CloudFront sends to the origin.</p></li>
25 /// </ul>
26 pub fn header_behavior(&self) -> &crate::types::CachePolicyHeaderBehavior {
27 &self.header_behavior
28 }
29 /// <p>Contains a list of HTTP header names.</p>
30 pub fn headers(&self) -> ::std::option::Option<&crate::types::Headers> {
31 self.headers.as_ref()
32 }
33}
34impl CachePolicyHeadersConfig {
35 /// Creates a new builder-style object to manufacture [`CachePolicyHeadersConfig`](crate::types::CachePolicyHeadersConfig).
36 pub fn builder() -> crate::types::builders::CachePolicyHeadersConfigBuilder {
37 crate::types::builders::CachePolicyHeadersConfigBuilder::default()
38 }
39}
40
41/// A builder for [`CachePolicyHeadersConfig`](crate::types::CachePolicyHeadersConfig).
42#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
43#[non_exhaustive]
44pub struct CachePolicyHeadersConfigBuilder {
45 pub(crate) header_behavior: ::std::option::Option<crate::types::CachePolicyHeaderBehavior>,
46 pub(crate) headers: ::std::option::Option<crate::types::Headers>,
47}
48impl CachePolicyHeadersConfigBuilder {
49 /// <p>Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:</p>
50 /// <ul>
51 /// <li>
52 /// <p><code>none</code> – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to <code>none</code>, any headers that are listed in an <code>OriginRequestPolicy</code> <i>are</i> included in origin requests.</p></li>
53 /// <li>
54 /// <p><code>whitelist</code> – Only the HTTP headers that are listed in the <code>Headers</code> type are included in the cache key and in requests that CloudFront sends to the origin.</p></li>
55 /// </ul>
56 /// This field is required.
57 pub fn header_behavior(mut self, input: crate::types::CachePolicyHeaderBehavior) -> Self {
58 self.header_behavior = ::std::option::Option::Some(input);
59 self
60 }
61 /// <p>Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:</p>
62 /// <ul>
63 /// <li>
64 /// <p><code>none</code> – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to <code>none</code>, any headers that are listed in an <code>OriginRequestPolicy</code> <i>are</i> included in origin requests.</p></li>
65 /// <li>
66 /// <p><code>whitelist</code> – Only the HTTP headers that are listed in the <code>Headers</code> type are included in the cache key and in requests that CloudFront sends to the origin.</p></li>
67 /// </ul>
68 pub fn set_header_behavior(mut self, input: ::std::option::Option<crate::types::CachePolicyHeaderBehavior>) -> Self {
69 self.header_behavior = input;
70 self
71 }
72 /// <p>Determines whether any HTTP headers are included in the cache key and in requests that CloudFront sends to the origin. Valid values are:</p>
73 /// <ul>
74 /// <li>
75 /// <p><code>none</code> – No HTTP headers are included in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to <code>none</code>, any headers that are listed in an <code>OriginRequestPolicy</code> <i>are</i> included in origin requests.</p></li>
76 /// <li>
77 /// <p><code>whitelist</code> – Only the HTTP headers that are listed in the <code>Headers</code> type are included in the cache key and in requests that CloudFront sends to the origin.</p></li>
78 /// </ul>
79 pub fn get_header_behavior(&self) -> &::std::option::Option<crate::types::CachePolicyHeaderBehavior> {
80 &self.header_behavior
81 }
82 /// <p>Contains a list of HTTP header names.</p>
83 pub fn headers(mut self, input: crate::types::Headers) -> Self {
84 self.headers = ::std::option::Option::Some(input);
85 self
86 }
87 /// <p>Contains a list of HTTP header names.</p>
88 pub fn set_headers(mut self, input: ::std::option::Option<crate::types::Headers>) -> Self {
89 self.headers = input;
90 self
91 }
92 /// <p>Contains a list of HTTP header names.</p>
93 pub fn get_headers(&self) -> &::std::option::Option<crate::types::Headers> {
94 &self.headers
95 }
96 /// Consumes the builder and constructs a [`CachePolicyHeadersConfig`](crate::types::CachePolicyHeadersConfig).
97 /// This method will fail if any of the following fields are not set:
98 /// - [`header_behavior`](crate::types::builders::CachePolicyHeadersConfigBuilder::header_behavior)
99 pub fn build(self) -> ::std::result::Result<crate::types::CachePolicyHeadersConfig, ::aws_smithy_types::error::operation::BuildError> {
100 ::std::result::Result::Ok(crate::types::CachePolicyHeadersConfig {
101 header_behavior: self.header_behavior.ok_or_else(|| {
102 ::aws_smithy_types::error::operation::BuildError::missing_field(
103 "header_behavior",
104 "header_behavior was not specified but it is required when building CachePolicyHeadersConfig",
105 )
106 })?,
107 headers: self.headers,
108 })
109 }
110}