aws_sdk_lightsail/operation/create_distribution/
_create_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 CreateDistributionInput {
6    /// <p>The name for the distribution.</p>
7    pub distribution_name: ::std::option::Option<::std::string::String>,
8    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
9    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
10    pub origin: ::std::option::Option<crate::types::InputOrigin>,
11    /// <p>An object that describes the default cache behavior for the distribution.</p>
12    pub default_cache_behavior: ::std::option::Option<crate::types::CacheBehavior>,
13    /// <p>An object that describes the cache behavior settings for the distribution.</p>
14    pub cache_behavior_settings: ::std::option::Option<crate::types::CacheSettings>,
15    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
16    pub cache_behaviors: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>,
17    /// <p>The bundle ID to use for the distribution.</p>
18    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
19    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
20    pub bundle_id: ::std::option::Option<::std::string::String>,
21    /// <p>The IP address type for the distribution.</p>
22    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
23    /// <p>The default value is <code>dualstack</code>.</p>
24    pub ip_address_type: ::std::option::Option<crate::types::IpAddressType>,
25    /// <p>The tag keys and optional values to add to the distribution during create.</p>
26    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
27    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
28    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
29    /// <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>
30    pub certificate_name: ::std::option::Option<::std::string::String>,
31    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
32    pub viewer_minimum_tls_protocol_version: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
33}
34impl CreateDistributionInput {
35    /// <p>The name for the distribution.</p>
36    pub fn distribution_name(&self) -> ::std::option::Option<&str> {
37        self.distribution_name.as_deref()
38    }
39    /// <p>An object that describes the origin resource for the distribution, such as a Lightsail instance, bucket, or load balancer.</p>
40    /// <p>The distribution pulls, caches, and serves content from the origin.</p>
41    pub fn origin(&self) -> ::std::option::Option<&crate::types::InputOrigin> {
42        self.origin.as_ref()
43    }
44    /// <p>An object that describes the default cache behavior for the distribution.</p>
45    pub fn default_cache_behavior(&self) -> ::std::option::Option<&crate::types::CacheBehavior> {
46        self.default_cache_behavior.as_ref()
47    }
48    /// <p>An object that describes the cache behavior settings for the distribution.</p>
49    pub fn cache_behavior_settings(&self) -> ::std::option::Option<&crate::types::CacheSettings> {
50        self.cache_behavior_settings.as_ref()
51    }
52    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
53    ///
54    /// 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()`.
55    pub fn cache_behaviors(&self) -> &[crate::types::CacheBehaviorPerPath] {
56        self.cache_behaviors.as_deref().unwrap_or_default()
57    }
58    /// <p>The bundle ID to use for the distribution.</p>
59    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
60    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
61    pub fn bundle_id(&self) -> ::std::option::Option<&str> {
62        self.bundle_id.as_deref()
63    }
64    /// <p>The IP address type for the distribution.</p>
65    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
66    /// <p>The default value is <code>dualstack</code>.</p>
67    pub fn ip_address_type(&self) -> ::std::option::Option<&crate::types::IpAddressType> {
68        self.ip_address_type.as_ref()
69    }
70    /// <p>The tag keys and optional values to add to the distribution during create.</p>
71    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
72    ///
73    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
74    pub fn tags(&self) -> &[crate::types::Tag] {
75        self.tags.as_deref().unwrap_or_default()
76    }
77    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
78    /// <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>
79    pub fn certificate_name(&self) -> ::std::option::Option<&str> {
80        self.certificate_name.as_deref()
81    }
82    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
83    pub fn viewer_minimum_tls_protocol_version(&self) -> ::std::option::Option<&crate::types::ViewerMinimumTlsProtocolVersionEnum> {
84        self.viewer_minimum_tls_protocol_version.as_ref()
85    }
86}
87impl CreateDistributionInput {
88    /// Creates a new builder-style object to manufacture [`CreateDistributionInput`](crate::operation::create_distribution::CreateDistributionInput).
89    pub fn builder() -> crate::operation::create_distribution::builders::CreateDistributionInputBuilder {
90        crate::operation::create_distribution::builders::CreateDistributionInputBuilder::default()
91    }
92}
93
94/// A builder for [`CreateDistributionInput`](crate::operation::create_distribution::CreateDistributionInput).
95#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
96#[non_exhaustive]
97pub struct CreateDistributionInputBuilder {
98    pub(crate) distribution_name: ::std::option::Option<::std::string::String>,
99    pub(crate) origin: ::std::option::Option<crate::types::InputOrigin>,
100    pub(crate) default_cache_behavior: ::std::option::Option<crate::types::CacheBehavior>,
101    pub(crate) cache_behavior_settings: ::std::option::Option<crate::types::CacheSettings>,
102    pub(crate) cache_behaviors: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>,
103    pub(crate) bundle_id: ::std::option::Option<::std::string::String>,
104    pub(crate) ip_address_type: ::std::option::Option<crate::types::IpAddressType>,
105    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
106    pub(crate) certificate_name: ::std::option::Option<::std::string::String>,
107    pub(crate) viewer_minimum_tls_protocol_version: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
108}
109impl CreateDistributionInputBuilder {
110    /// <p>The name for the distribution.</p>
111    /// This field is required.
112    pub fn distribution_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.distribution_name = ::std::option::Option::Some(input.into());
114        self
115    }
116    /// <p>The name for the distribution.</p>
117    pub fn set_distribution_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.distribution_name = input;
119        self
120    }
121    /// <p>The name for the distribution.</p>
122    pub fn get_distribution_name(&self) -> &::std::option::Option<::std::string::String> {
123        &self.distribution_name
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    /// This field is required.
128    pub fn origin(mut self, input: crate::types::InputOrigin) -> Self {
129        self.origin = ::std::option::Option::Some(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.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.origin
142    }
143    /// <p>An object that describes the default cache behavior for the distribution.</p>
144    /// This field is required.
145    pub fn default_cache_behavior(mut self, input: crate::types::CacheBehavior) -> Self {
146        self.default_cache_behavior = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>An object that describes the default cache behavior for the distribution.</p>
150    pub fn set_default_cache_behavior(mut self, input: ::std::option::Option<crate::types::CacheBehavior>) -> Self {
151        self.default_cache_behavior = input;
152        self
153    }
154    /// <p>An object that describes the default cache behavior for the distribution.</p>
155    pub fn get_default_cache_behavior(&self) -> &::std::option::Option<crate::types::CacheBehavior> {
156        &self.default_cache_behavior
157    }
158    /// <p>An object that describes the cache behavior settings for the distribution.</p>
159    pub fn cache_behavior_settings(mut self, input: crate::types::CacheSettings) -> Self {
160        self.cache_behavior_settings = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>An object that describes the cache behavior settings for the distribution.</p>
164    pub fn set_cache_behavior_settings(mut self, input: ::std::option::Option<crate::types::CacheSettings>) -> Self {
165        self.cache_behavior_settings = input;
166        self
167    }
168    /// <p>An object that describes the cache behavior settings for the distribution.</p>
169    pub fn get_cache_behavior_settings(&self) -> &::std::option::Option<crate::types::CacheSettings> {
170        &self.cache_behavior_settings
171    }
172    /// Appends an item to `cache_behaviors`.
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        let mut v = self.cache_behaviors.unwrap_or_default();
179        v.push(input);
180        self.cache_behaviors = ::std::option::Option::Some(v);
181        self
182    }
183    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
184    pub fn set_cache_behaviors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>>) -> Self {
185        self.cache_behaviors = input;
186        self
187    }
188    /// <p>An array of objects that describe the per-path cache behavior for the distribution.</p>
189    pub fn get_cache_behaviors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CacheBehaviorPerPath>> {
190        &self.cache_behaviors
191    }
192    /// <p>The bundle ID to use for the distribution.</p>
193    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
194    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
195    /// This field is required.
196    pub fn bundle_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
197        self.bundle_id = ::std::option::Option::Some(input.into());
198        self
199    }
200    /// <p>The bundle ID to use for the distribution.</p>
201    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
202    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
203    pub fn set_bundle_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
204        self.bundle_id = input;
205        self
206    }
207    /// <p>The bundle ID to use for the distribution.</p>
208    /// <p>A distribution bundle describes the specifications of your distribution, such as the monthly cost and monthly network transfer quota.</p>
209    /// <p>Use the <code>GetDistributionBundles</code> action to get a list of distribution bundle IDs that you can specify.</p>
210    pub fn get_bundle_id(&self) -> &::std::option::Option<::std::string::String> {
211        &self.bundle_id
212    }
213    /// <p>The IP address type for the distribution.</p>
214    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
215    /// <p>The default value is <code>dualstack</code>.</p>
216    pub fn ip_address_type(mut self, input: crate::types::IpAddressType) -> Self {
217        self.ip_address_type = ::std::option::Option::Some(input);
218        self
219    }
220    /// <p>The IP address type for the distribution.</p>
221    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
222    /// <p>The default value is <code>dualstack</code>.</p>
223    pub fn set_ip_address_type(mut self, input: ::std::option::Option<crate::types::IpAddressType>) -> Self {
224        self.ip_address_type = input;
225        self
226    }
227    /// <p>The IP address type for the distribution.</p>
228    /// <p>The possible values are <code>ipv4</code> for IPv4 only, and <code>dualstack</code> for IPv4 and IPv6.</p>
229    /// <p>The default value is <code>dualstack</code>.</p>
230    pub fn get_ip_address_type(&self) -> &::std::option::Option<crate::types::IpAddressType> {
231        &self.ip_address_type
232    }
233    /// Appends an item to `tags`.
234    ///
235    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
236    ///
237    /// <p>The tag keys and optional values to add to the distribution during create.</p>
238    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
239    pub fn tags(mut self, input: crate::types::Tag) -> Self {
240        let mut v = self.tags.unwrap_or_default();
241        v.push(input);
242        self.tags = ::std::option::Option::Some(v);
243        self
244    }
245    /// <p>The tag keys and optional values to add to the distribution during create.</p>
246    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
247    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
248        self.tags = input;
249        self
250    }
251    /// <p>The tag keys and optional values to add to the distribution during create.</p>
252    /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
253    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
254        &self.tags
255    }
256    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
257    /// <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>
258    pub fn certificate_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
259        self.certificate_name = ::std::option::Option::Some(input.into());
260        self
261    }
262    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
263    /// <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>
264    pub fn set_certificate_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
265        self.certificate_name = input;
266        self
267    }
268    /// <p>The name of the SSL/TLS certificate that you want to attach to the distribution.</p>
269    /// <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>
270    pub fn get_certificate_name(&self) -> &::std::option::Option<::std::string::String> {
271        &self.certificate_name
272    }
273    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
274    pub fn viewer_minimum_tls_protocol_version(mut self, input: crate::types::ViewerMinimumTlsProtocolVersionEnum) -> Self {
275        self.viewer_minimum_tls_protocol_version = ::std::option::Option::Some(input);
276        self
277    }
278    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
279    pub fn set_viewer_minimum_tls_protocol_version(
280        mut self,
281        input: ::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum>,
282    ) -> Self {
283        self.viewer_minimum_tls_protocol_version = input;
284        self
285    }
286    /// <p>The minimum TLS protocol version for the SSL/TLS certificate.</p>
287    pub fn get_viewer_minimum_tls_protocol_version(&self) -> &::std::option::Option<crate::types::ViewerMinimumTlsProtocolVersionEnum> {
288        &self.viewer_minimum_tls_protocol_version
289    }
290    /// Consumes the builder and constructs a [`CreateDistributionInput`](crate::operation::create_distribution::CreateDistributionInput).
291    pub fn build(
292        self,
293    ) -> ::std::result::Result<crate::operation::create_distribution::CreateDistributionInput, ::aws_smithy_types::error::operation::BuildError> {
294        ::std::result::Result::Ok(crate::operation::create_distribution::CreateDistributionInput {
295            distribution_name: self.distribution_name,
296            origin: self.origin,
297            default_cache_behavior: self.default_cache_behavior,
298            cache_behavior_settings: self.cache_behavior_settings,
299            cache_behaviors: self.cache_behaviors,
300            bundle_id: self.bundle_id,
301            ip_address_type: self.ip_address_type,
302            tags: self.tags,
303            certificate_name: self.certificate_name,
304            viewer_minimum_tls_protocol_version: self.viewer_minimum_tls_protocol_version,
305        })
306    }
307}