aws_sdk_lightsail/operation/update_distribution/
_update_distribution_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct UpdateDistributionInput {
6    /// <p>The name of the distribution to update.</p>
7    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
8    pub distribution_name: ::std::option::Option<::std::string::String>,
9    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
10    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
11    pub origin: ::std::option::Option<crate::types::InputOrigin>,
12    /// <p>An object that describes the default cache behavior for the distribution.</p>
13    pub default_cache_behavior: ::std::option::Option<crate::types::CacheBehavior>,
14    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
15    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
16    /// </note>
17    pub cache_behavior_settings: ::std::option::Option<crate::types::CacheSettings>,
18    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
19    pub cache_behaviors: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>,
20    /// <p>Indicates whether to enable the distribution.</p>
21    pub is_enabled: ::std::option::Option<bool>,
22    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
23    pub viewer_minimum_tls_protocol_version: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
24    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
25    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
26    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetCertificates.html">GetCertificates</a> action to get a list of certificate names that you can specify.</p>
27    pub certificate_name: ::std::option::Option<::std::string::String>,
28    /// <p>Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is <code>true</code>. When <code>true</code>, the distribution uses the default domain name such as <code>d111111abcdef8.cloudfront.net</code>.</p>
29    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
30    pub use_default_certificate: ::std::option::Option<bool>,
31}
32impl UpdateDistributionInput {
33    /// <p>The name of the distribution to update.</p>
34    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
35    pub fn distribution_name(&self) -> ::std::option::Option<&str> {
36        self.distribution_name.as_deref()
37    }
38    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
39    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
40    pub fn origin(&self) -> ::std::option::Option<&crate::types::InputOrigin> {
41        self.origin.as_ref()
42    }
43    /// <p>An object that describes the default cache behavior for the distribution.</p>
44    pub fn default_cache_behavior(&self) -> ::std::option::Option<&crate::types::CacheBehavior> {
45        self.default_cache_behavior.as_ref()
46    }
47    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
48    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
49    /// </note>
50    pub fn cache_behavior_settings(&self) -> ::std::option::Option<&crate::types::CacheSettings> {
51        self.cache_behavior_settings.as_ref()
52    }
53    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
54    ///
55    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.cache_behaviors.is_none()`.
56    pub fn cache_behaviors(&self) -> &[crate::types::CacheBehaviorPerPath] {
57        self.cache_behaviors.as_deref().unwrap_or_default()
58    }
59    /// <p>Indicates whether to enable the distribution.</p>
60    pub fn is_enabled(&self) -> ::std::option::Option<bool> {
61        self.is_enabled
62    }
63    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
64    pub fn viewer_minimum_tls_protocol_version(&self) -> ::std::option::Option<&crate::types::ViewerMinimumTlsProtocolVersionEnum> {
65        self.viewer_minimum_tls_protocol_version.as_ref()
66    }
67    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
68    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
69    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetCertificates.html">GetCertificates</a> action to get a list of certificate names that you can specify.</p>
70    pub fn certificate_name(&self) -> ::std::option::Option<&str> {
71        self.certificate_name.as_deref()
72    }
73    /// <p>Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is <code>true</code>. When <code>true</code>, the distribution uses the default domain name such as <code>d111111abcdef8.cloudfront.net</code>.</p>
74    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
75    pub fn use_default_certificate(&self) -> ::std::option::Option<bool> {
76        self.use_default_certificate
77    }
78}
79impl UpdateDistributionInput {
80    /// Creates a new builder-style object to manufacture [`UpdateDistributionInput`](crate::operation::update_distribution::UpdateDistributionInput).
81    pub fn builder() -> crate::operation::update_distribution::builders::UpdateDistributionInputBuilder {
82        crate::operation::update_distribution::builders::UpdateDistributionInputBuilder::default()
83    }
84}
85
86/// A builder for [`UpdateDistributionInput`](crate::operation::update_distribution::UpdateDistributionInput).
87#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
88#[non_exhaustive]
89pub struct UpdateDistributionInputBuilder {
90    pub(crate) distribution_name: ::std::option::Option<::std::string::String>,
91    pub(crate) origin: ::std::option::Option<crate::types::InputOrigin>,
92    pub(crate) default_cache_behavior: ::std::option::Option<crate::types::CacheBehavior>,
93    pub(crate) cache_behavior_settings: ::std::option::Option<crate::types::CacheSettings>,
94    pub(crate) cache_behaviors: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>,
95    pub(crate) is_enabled: ::std::option::Option<bool>,
96    pub(crate) viewer_minimum_tls_protocol_version: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
97    pub(crate) certificate_name: ::std::option::Option<::std::string::String>,
98    pub(crate) use_default_certificate: ::std::option::Option<bool>,
99}
100impl UpdateDistributionInputBuilder {
101    /// <p>The name of the distribution to update.</p>
102    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
103    /// This field is required.
104    pub fn distribution_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
105        self.distribution_name = ::std::option::Option::Some(input.into());
106        self
107    }
108    /// <p>The name of the distribution to update.</p>
109    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
110    pub fn set_distribution_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.distribution_name = input;
112        self
113    }
114    /// <p>The name of the distribution to update.</p>
115    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
116    pub fn get_distribution_name(&self) -> &::std::option::Option<::std::string::String> {
117        &self.distribution_name
118    }
119    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
120    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
121    pub fn origin(mut self, input: crate::types::InputOrigin) -> Self {
122        self.origin = ::std::option::Option::Some(input);
123        self
124    }
125    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
126    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
127    pub fn set_origin(mut self, input: ::std::option::Option<crate::types::InputOrigin>) -> Self {
128        self.origin = input;
129        self
130    }
131    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
132    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
133    pub fn get_origin(&self) -> &::std::option::Option<crate::types::InputOrigin> {
134        &self.origin
135    }
136    /// <p>An object that describes the default cache behavior for the distribution.</p>
137    pub fn default_cache_behavior(mut self, input: crate::types::CacheBehavior) -> Self {
138        self.default_cache_behavior = ::std::option::Option::Some(input);
139        self
140    }
141    /// <p>An object that describes the default cache behavior for the distribution.</p>
142    pub fn set_default_cache_behavior(mut self, input: ::std::option::Option<crate::types::CacheBehavior>) -> Self {
143        self.default_cache_behavior = input;
144        self
145    }
146    /// <p>An object that describes the default cache behavior for the distribution.</p>
147    pub fn get_default_cache_behavior(&self) -> &::std::option::Option<crate::types::CacheBehavior> {
148        &self.default_cache_behavior
149    }
150    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
151    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
152    /// </note>
153    pub fn cache_behavior_settings(mut self, input: crate::types::CacheSettings) -> Self {
154        self.cache_behavior_settings = ::std::option::Option::Some(input);
155        self
156    }
157    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
158    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
159    /// </note>
160    pub fn set_cache_behavior_settings(mut self, input: ::std::option::Option<crate::types::CacheSettings>) -> Self {
161        self.cache_behavior_settings = input;
162        self
163    }
164    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
165    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
166    /// </note>
167    pub fn get_cache_behavior_settings(&self) -> &::std::option::Option<crate::types::CacheSettings> {
168        &self.cache_behavior_settings
169    }
170    /// Appends an item to `cache_behaviors`.
171    ///
172    /// To override the contents of this collection use [`set_cache_behaviors`](Self::set_cache_behaviors).
173    ///
174    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
175    pub fn cache_behaviors(mut self, input: crate::types::CacheBehaviorPerPath) -> Self {
176        let mut v = self.cache_behaviors.unwrap_or_default();
177        v.push(input);
178        self.cache_behaviors = ::std::option::Option::Some(v);
179        self
180    }
181    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
182    pub fn set_cache_behaviors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>) -> Self {
183        self.cache_behaviors = input;
184        self
185    }
186    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
187    pub fn get_cache_behaviors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>> {
188        &self.cache_behaviors
189    }
190    /// <p>Indicates whether to enable the distribution.</p>
191    pub fn is_enabled(mut self, input: bool) -> Self {
192        self.is_enabled = ::std::option::Option::Some(input);
193        self
194    }
195    /// <p>Indicates whether to enable the distribution.</p>
196    pub fn set_is_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
197        self.is_enabled = input;
198        self
199    }
200    /// <p>Indicates whether to enable the distribution.</p>
201    pub fn get_is_enabled(&self) -> &::std::option::Option<bool> {
202        &self.is_enabled
203    }
204    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
205    pub fn viewer_minimum_tls_protocol_version(mut self, input: crate::types::ViewerMinimumTlsProtocolVersionEnum) -> Self {
206        self.viewer_minimum_tls_protocol_version = ::std::option::Option::Some(input);
207        self
208    }
209    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
210    pub fn set_viewer_minimum_tls_protocol_version(
211        mut self,
212        input: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
213    ) -> Self {
214        self.viewer_minimum_tls_protocol_version = input;
215        self
216    }
217    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
218    pub fn get_viewer_minimum_tls_protocol_version(&self) -> &::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum> {
219        &self.viewer_minimum_tls_protocol_version
220    }
221    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
222    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
223    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetCertificates.html">GetCertificates</a> action to get a list of certificate names that you can specify.</p>
224    pub fn certificate_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
225        self.certificate_name = ::std::option::Option::Some(input.into());
226        self
227    }
228    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
229    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
230    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetCertificates.html">GetCertificates</a> action to get a list of certificate names that you can specify.</p>
231    pub fn set_certificate_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
232        self.certificate_name = input;
233        self
234    }
235    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
236    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
237    /// <p>Use the <a href="https://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetCertificates.html">GetCertificates</a> action to get a list of certificate names that you can specify.</p>
238    pub fn get_certificate_name(&self) -> &::std::option::Option<::std::string::String> {
239        &self.certificate_name
240    }
241    /// <p>Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is <code>true</code>. When <code>true</code>, the distribution uses the default domain name such as <code>d111111abcdef8.cloudfront.net</code>.</p>
242    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
243    pub fn use_default_certificate(mut self, input: bool) -> Self {
244        self.use_default_certificate = ::std::option::Option::Some(input);
245        self
246    }
247    /// <p>Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is <code>true</code>. When <code>true</code>, the distribution uses the default domain name such as <code>d111111abcdef8.cloudfront.net</code>.</p>
248    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
249    pub fn set_use_default_certificate(mut self, input: ::std::option::Option<bool>) -> Self {
250        self.use_default_certificate = input;
251        self
252    }
253    /// <p>Indicates whether the default SSL/TLS certificate is attached to the distribution. The default value is <code>true</code>. When <code>true</code>, the distribution uses the default domain name such as <code>d111111abcdef8.cloudfront.net</code>.</p>
254    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
255    pub fn get_use_default_certificate(&self) -> &::std::option::Option<bool> {
256        &self.use_default_certificate
257    }
258    /// Consumes the builder and constructs a [`UpdateDistributionInput`](crate::operation::update_distribution::UpdateDistributionInput).
259    pub fn build(
260        self,
261    ) -> ::std::result::Result<crate::operation::update_distribution::UpdateDistributionInput, ::aws_smithy_types::error::operation::BuildError> {
262        ::std::result::Result::Ok(crate::operation::update_distribution::UpdateDistributionInput {
263            distribution_name: self.distribution_name,
264            origin: self.origin,
265            default_cache_behavior: self.default_cache_behavior,
266            cache_behavior_settings: self.cache_behavior_settings,
267            cache_behaviors: self.cache_behaviors,
268            is_enabled: self.is_enabled,
269            viewer_minimum_tls_protocol_version: self.viewer_minimum_tls_protocol_version,
270            certificate_name: self.certificate_name,
271            use_default_certificate: self.use_default_certificate,
272        })
273    }
274}