aws_sdk_lightsail/operation/update_distribution/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_distribution::_update_distribution_output::UpdateDistributionOutputBuilder;
3
4pub use crate::operation::update_distribution::_update_distribution_input::UpdateDistributionInputBuilder;
5
6impl crate::operation::update_distribution::builders::UpdateDistributionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::update_distribution::UpdateDistributionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_distribution::UpdateDistributionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_distribution();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateDistribution`.
24///
25/// <p>Updates an existing Amazon Lightsail content delivery network (CDN) distribution.</p>
26/// <p>Use this action to update the configuration of your existing distribution.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct UpdateDistributionFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::update_distribution::builders::UpdateDistributionInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::update_distribution::UpdateDistributionOutput,
36        crate::operation::update_distribution::UpdateDistributionError,
37    > for UpdateDistributionFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::update_distribution::UpdateDistributionOutput,
45            crate::operation::update_distribution::UpdateDistributionError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl UpdateDistributionFluentBuilder {
52    /// Creates a new `UpdateDistributionFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the UpdateDistribution as a reference.
61    pub fn as_input(&self) -> &crate::operation::update_distribution::builders::UpdateDistributionInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::update_distribution::UpdateDistributionOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::update_distribution::UpdateDistributionError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::update_distribution::UpdateDistribution::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::update_distribution::UpdateDistribution::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::update_distribution::UpdateDistributionOutput,
98        crate::operation::update_distribution::UpdateDistributionError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The name of the distribution to update.</p>
113    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
114    pub fn distribution_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
115        self.inner = self.inner.distribution_name(input.into());
116        self
117    }
118    /// <p>The name of the distribution to update.</p>
119    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
120    pub fn set_distribution_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.inner = self.inner.set_distribution_name(input);
122        self
123    }
124    /// <p>The name of the distribution to update.</p>
125    /// <p>Use the <code>GetDistributions</code> action to get a list of distribution names that you can specify.</p>
126    pub fn get_distribution_name(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_distribution_name()
128    }
129    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
130    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
131    pub fn origin(mut self, input: crate::types::InputOrigin) -> Self {
132        self.inner = self.inner.origin(input);
133        self
134    }
135    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
136    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
137    pub fn set_origin(mut self, input: ::std::option::Option<crate::types::InputOrigin>) -> Self {
138        self.inner = self.inner.set_origin(input);
139        self
140    }
141    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
142    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
143    pub fn get_origin(&self) -> &::std::option::Option<crate::types::InputOrigin> {
144        self.inner.get_origin()
145    }
146    /// <p>An object that describes the default cache behavior for the distribution.</p>
147    pub fn default_cache_behavior(mut self, input: crate::types::CacheBehavior) -> Self {
148        self.inner = self.inner.default_cache_behavior(input);
149        self
150    }
151    /// <p>An object that describes the default cache behavior for the distribution.</p>
152    pub fn set_default_cache_behavior(mut self, input: ::std::option::Option<crate::types::CacheBehavior>) -> Self {
153        self.inner = self.inner.set_default_cache_behavior(input);
154        self
155    }
156    /// <p>An object that describes the default cache behavior for the distribution.</p>
157    pub fn get_default_cache_behavior(&self) -> &::std::option::Option<crate::types::CacheBehavior> {
158        self.inner.get_default_cache_behavior()
159    }
160    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
161    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
162    /// </note>
163    pub fn cache_behavior_settings(mut self, input: crate::types::CacheSettings) -> Self {
164        self.inner = self.inner.cache_behavior_settings(input);
165        self
166    }
167    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
168    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
169    /// </note>
170    pub fn set_cache_behavior_settings(mut self, input: ::std::option::Option<crate::types::CacheSettings>) -> Self {
171        self.inner = self.inner.set_cache_behavior_settings(input);
172        self
173    }
174    /// <p>An object that describes the cache behavior settings for the distribution.</p><note>
175    /// <p>The <code>cacheBehaviorSettings</code> specified in your <code>UpdateDistributionRequest</code> will replace your distribution's existing settings.</p>
176    /// </note>
177    pub fn get_cache_behavior_settings(&self) -> &::std::option::Option<crate::types::CacheSettings> {
178        self.inner.get_cache_behavior_settings()
179    }
180    ///
181    /// Appends an item to `cacheBehaviors`.
182    ///
183    /// To override the contents of this collection use [`set_cache_behaviors`](Self::set_cache_behaviors).
184    ///
185    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
186    pub fn cache_behaviors(mut self, input: crate::types::CacheBehaviorPerPath) -> Self {
187        self.inner = self.inner.cache_behaviors(input);
188        self
189    }
190    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
191    pub fn set_cache_behaviors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>) -> Self {
192        self.inner = self.inner.set_cache_behaviors(input);
193        self
194    }
195    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
196    pub fn get_cache_behaviors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>> {
197        self.inner.get_cache_behaviors()
198    }
199    /// <p>Indicates whether to enable the distribution.</p>
200    pub fn is_enabled(mut self, input: bool) -> Self {
201        self.inner = self.inner.is_enabled(input);
202        self
203    }
204    /// <p>Indicates whether to enable the distribution.</p>
205    pub fn set_is_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
206        self.inner = self.inner.set_is_enabled(input);
207        self
208    }
209    /// <p>Indicates whether to enable the distribution.</p>
210    pub fn get_is_enabled(&self) -> &::std::option::Option<bool> {
211        self.inner.get_is_enabled()
212    }
213    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
214    pub fn viewer_minimum_tls_protocol_version(mut self, input: crate::types::ViewerMinimumTlsProtocolVersionEnum) -> Self {
215        self.inner = self.inner.viewer_minimum_tls_protocol_version(input);
216        self
217    }
218    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
219    pub fn set_viewer_minimum_tls_protocol_version(
220        mut self,
221        input: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
222    ) -> Self {
223        self.inner = self.inner.set_viewer_minimum_tls_protocol_version(input);
224        self
225    }
226    /// <p>Use this parameter to update the minimum TLS protocol version for the SSL/TLS certificate that's attached to the distribution.</p>
227    pub fn get_viewer_minimum_tls_protocol_version(&self) -> &::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum> {
228        self.inner.get_viewer_minimum_tls_protocol_version()
229    }
230    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
231    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
232    /// <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>
233    pub fn certificate_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
234        self.inner = self.inner.certificate_name(input.into());
235        self
236    }
237    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
238    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
239    /// <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>
240    pub fn set_certificate_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
241        self.inner = self.inner.set_certificate_name(input);
242        self
243    }
244    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
245    /// <p>Only certificates with a status of <code>ISSUED</code> can be attached to a distribution.</p>
246    /// <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>
247    pub fn get_certificate_name(&self) -> &::std::option::Option<::std::string::String> {
248        self.inner.get_certificate_name()
249    }
250    /// <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>
251    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
252    pub fn use_default_certificate(mut self, input: bool) -> Self {
253        self.inner = self.inner.use_default_certificate(input);
254        self
255    }
256    /// <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>
257    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
258    pub fn set_use_default_certificate(mut self, input: ::std::option::Option<bool>) -> Self {
259        self.inner = self.inner.set_use_default_certificate(input);
260        self
261    }
262    /// <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>
263    /// <p>Set this value to <code>false</code> to attach a new certificate to the distribution.</p>
264    pub fn get_use_default_certificate(&self) -> &::std::option::Option<bool> {
265        self.inner.get_use_default_certificate()
266    }
267}