aws_sdk_lightsail/operation/create_distribution/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_distribution::_create_distribution_output::CreateDistributionOutputBuilder;
3
4pub use crate::operation::create_distribution::_create_distribution_input::CreateDistributionInputBuilder;
5
6impl crate::operation::create_distribution::builders::CreateDistributionInputBuilder {
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::create_distribution::CreateDistributionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_distribution::CreateDistributionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_distribution();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateDistribution`.
24///
25/// <p>Creates an Amazon Lightsail content delivery network (CDN) distribution.</p>
26/// <p>A distribution is a globally distributed network of caching servers that improve the performance of your website or web application hosted on a Lightsail instance. For more information, see <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-content-delivery-network-distributions">Content delivery networks in Amazon Lightsail</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateDistributionFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::create_distribution::builders::CreateDistributionInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::create_distribution::CreateDistributionOutput,
36        crate::operation::create_distribution::CreateDistributionError,
37    > for CreateDistributionFluentBuilder
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::create_distribution::CreateDistributionOutput,
45            crate::operation::create_distribution::CreateDistributionError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl CreateDistributionFluentBuilder {
52    /// Creates a new `CreateDistributionFluentBuilder`.
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 CreateDistribution as a reference.
61    pub fn as_input(&self) -> &crate::operation::create_distribution::builders::CreateDistributionInputBuilder {
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::create_distribution::CreateDistributionOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::create_distribution::CreateDistributionError,
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::create_distribution::CreateDistribution::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::create_distribution::CreateDistribution::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::create_distribution::CreateDistributionOutput,
98        crate::operation::create_distribution::CreateDistributionError,
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 for the distribution.</p>
113    pub fn distribution_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.distribution_name(input.into());
115        self
116    }
117    /// <p>The name for the distribution.</p>
118    pub fn set_distribution_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_distribution_name(input);
120        self
121    }
122    /// <p>The name for the distribution.</p>
123    pub fn get_distribution_name(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_distribution_name()
125    }
126    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
127    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
128    pub fn origin(mut self, input: crate::types::InputOrigin) -> Self {
129        self.inner = self.inner.origin(input);
130        self
131    }
132    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
133    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
134    pub fn set_origin(mut self, input: ::std::option::Option<crate::types::InputOrigin>) -> Self {
135        self.inner = self.inner.set_origin(input);
136        self
137    }
138    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
139    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
140    pub fn get_origin(&self) -> &::std::option::Option<crate::types::InputOrigin> {
141        self.inner.get_origin()
142    }
143    /// <p>An object that describes the default cache behavior for the distribution.</p>
144    pub fn default_cache_behavior(mut self, input: crate::types::CacheBehavior) -> Self {
145        self.inner = self.inner.default_cache_behavior(input);
146        self
147    }
148    /// <p>An object that describes the default cache behavior for the distribution.</p>
149    pub fn set_default_cache_behavior(mut self, input: ::std::option::Option<crate::types::CacheBehavior>) -> Self {
150        self.inner = self.inner.set_default_cache_behavior(input);
151        self
152    }
153    /// <p>An object that describes the default cache behavior for the distribution.</p>
154    pub fn get_default_cache_behavior(&self) -> &::std::option::Option<crate::types::CacheBehavior> {
155        self.inner.get_default_cache_behavior()
156    }
157    /// <p>An object that describes the cache behavior settings for the distribution.</p>
158    pub fn cache_behavior_settings(mut self, input: crate::types::CacheSettings) -> Self {
159        self.inner = self.inner.cache_behavior_settings(input);
160        self
161    }
162    /// <p>An object that describes the cache behavior settings for the distribution.</p>
163    pub fn set_cache_behavior_settings(mut self, input: ::std::option::Option<crate::types::CacheSettings>) -> Self {
164        self.inner = self.inner.set_cache_behavior_settings(input);
165        self
166    }
167    /// <p>An object that describes the cache behavior settings for the distribution.</p>
168    pub fn get_cache_behavior_settings(&self) -> &::std::option::Option<crate::types::CacheSettings> {
169        self.inner.get_cache_behavior_settings()
170    }
171    ///
172    /// Appends an item to `cacheBehaviors`.
173    ///
174    /// To override the contents of this collection use [`set_cache_behaviors`](Self::set_cache_behaviors).
175    ///
176    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
177    pub fn cache_behaviors(mut self, input: crate::types::CacheBehaviorPerPath) -> Self {
178        self.inner = self.inner.cache_behaviors(input);
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.inner = self.inner.set_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.inner.get_cache_behaviors()
189    }
190    /// <p>The bundle ID to use for the distribution.</p>
191    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
192    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
193    pub fn bundle_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194        self.inner = self.inner.bundle_id(input.into());
195        self
196    }
197    /// <p>The bundle ID to use for the distribution.</p>
198    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
199    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
200    pub fn set_bundle_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
201        self.inner = self.inner.set_bundle_id(input);
202        self
203    }
204    /// <p>The bundle ID to use for the distribution.</p>
205    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
206    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
207    pub fn get_bundle_id(&self) -> &::std::option::Option<::std::string::String> {
208        self.inner.get_bundle_id()
209    }
210    /// <p>The IP address type for the distribution.</p>
211    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
212    /// <p>The default value is <code>dualstack</code>.</p>
213    pub fn ip_address_type(mut self, input: crate::types::IpAddressType) -> Self {
214        self.inner = self.inner.ip_address_type(input);
215        self
216    }
217    /// <p>The IP address type for the distribution.</p>
218    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
219    /// <p>The default value is <code>dualstack</code>.</p>
220    pub fn set_ip_address_type(mut self, input: ::std::option::Option<crate::types::IpAddressType>) -> Self {
221        self.inner = self.inner.set_ip_address_type(input);
222        self
223    }
224    /// <p>The IP address type for the distribution.</p>
225    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
226    /// <p>The default value is <code>dualstack</code>.</p>
227    pub fn get_ip_address_type(&self) -> &::std::option::Option<crate::types::IpAddressType> {
228        self.inner.get_ip_address_type()
229    }
230    ///
231    /// Appends an item to `tags`.
232    ///
233    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
234    ///
235    /// <p>The tag keys and optional values to add to the distribution during create.</p>
236    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
237    pub fn tags(mut self, input: crate::types::Tag) -> Self {
238        self.inner = self.inner.tags(input);
239        self
240    }
241    /// <p>The tag keys and optional values to add to the distribution during create.</p>
242    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
243    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
244        self.inner = self.inner.set_tags(input);
245        self
246    }
247    /// <p>The tag keys and optional values to add to the distribution during create.</p>
248    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
249    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
250        self.inner.get_tags()
251    }
252    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
253    /// <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>
254    pub fn certificate_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
255        self.inner = self.inner.certificate_name(input.into());
256        self
257    }
258    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
259    /// <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>
260    pub fn set_certificate_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
261        self.inner = self.inner.set_certificate_name(input);
262        self
263    }
264    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
265    /// <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>
266    pub fn get_certificate_name(&self) -> &::std::option::Option<::std::string::String> {
267        self.inner.get_certificate_name()
268    }
269    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
270    pub fn viewer_minimum_tls_protocol_version(mut self, input: crate::types::ViewerMinimumTlsProtocolVersionEnum) -> Self {
271        self.inner = self.inner.viewer_minimum_tls_protocol_version(input);
272        self
273    }
274    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
275    pub fn set_viewer_minimum_tls_protocol_version(
276        mut self,
277        input: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
278    ) -> Self {
279        self.inner = self.inner.set_viewer_minimum_tls_protocol_version(input);
280        self
281    }
282    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
283    pub fn get_viewer_minimum_tls_protocol_version(&self) -> &::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum> {
284        self.inner.get_viewer_minimum_tls_protocol_version()
285    }
286}