Skip to main content

aws_sdk_imagebuilder/types/
_distribution_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A distribution configuration.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DistributionConfiguration {
7    /// <p>The Amazon Resource Name (ARN) of the distribution configuration.</p>
8    pub arn: ::std::option::Option<::std::string::String>,
9    /// <p>The name of the distribution configuration.</p>
10    pub name: ::std::option::Option<::std::string::String>,
11    /// <p>The description of the distribution configuration.</p>
12    pub description: ::std::option::Option<::std::string::String>,
13    /// <p>The distribution objects that apply Region-specific settings for the deployment of the image to targeted Regions.</p>
14    pub distributions: ::std::option::Option<::std::vec::Vec<crate::types::Distribution>>,
15    /// <p>The maximum duration in minutes for this distribution configuration.</p>
16    pub timeout_minutes: i32,
17    /// <p>The date on which this distribution configuration was created.</p>
18    pub date_created: ::std::option::Option<::std::string::String>,
19    /// <p>The date on which this distribution configuration was last updated.</p>
20    pub date_updated: ::std::option::Option<::std::string::String>,
21    /// <p>The tags of the distribution configuration.</p>
22    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
23}
24impl DistributionConfiguration {
25    /// <p>The Amazon Resource Name (ARN) of the distribution configuration.</p>
26    pub fn arn(&self) -> ::std::option::Option<&str> {
27        self.arn.as_deref()
28    }
29    /// <p>The name of the distribution configuration.</p>
30    pub fn name(&self) -> ::std::option::Option<&str> {
31        self.name.as_deref()
32    }
33    /// <p>The description of the distribution configuration.</p>
34    pub fn description(&self) -> ::std::option::Option<&str> {
35        self.description.as_deref()
36    }
37    /// <p>The distribution objects that apply Region-specific settings for the deployment of the image to targeted Regions.</p>
38    ///
39    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.distributions.is_none()`.
40    pub fn distributions(&self) -> &[crate::types::Distribution] {
41        self.distributions.as_deref().unwrap_or_default()
42    }
43    /// <p>The maximum duration in minutes for this distribution configuration.</p>
44    pub fn timeout_minutes(&self) -> i32 {
45        self.timeout_minutes
46    }
47    /// <p>The date on which this distribution configuration was created.</p>
48    pub fn date_created(&self) -> ::std::option::Option<&str> {
49        self.date_created.as_deref()
50    }
51    /// <p>The date on which this distribution configuration was last updated.</p>
52    pub fn date_updated(&self) -> ::std::option::Option<&str> {
53        self.date_updated.as_deref()
54    }
55    /// <p>The tags of the distribution configuration.</p>
56    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
57        self.tags.as_ref()
58    }
59}
60impl DistributionConfiguration {
61    /// Creates a new builder-style object to manufacture [`DistributionConfiguration`](crate::types::DistributionConfiguration).
62    pub fn builder() -> crate::types::builders::DistributionConfigurationBuilder {
63        crate::types::builders::DistributionConfigurationBuilder::default()
64    }
65}
66
67/// A builder for [`DistributionConfiguration`](crate::types::DistributionConfiguration).
68#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
69#[non_exhaustive]
70pub struct DistributionConfigurationBuilder {
71    pub(crate) arn: ::std::option::Option<::std::string::String>,
72    pub(crate) name: ::std::option::Option<::std::string::String>,
73    pub(crate) description: ::std::option::Option<::std::string::String>,
74    pub(crate) distributions: ::std::option::Option<::std::vec::Vec<crate::types::Distribution>>,
75    pub(crate) timeout_minutes: ::std::option::Option<i32>,
76    pub(crate) date_created: ::std::option::Option<::std::string::String>,
77    pub(crate) date_updated: ::std::option::Option<::std::string::String>,
78    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
79}
80impl DistributionConfigurationBuilder {
81    /// <p>The Amazon Resource Name (ARN) of the distribution configuration.</p>
82    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83        self.arn = ::std::option::Option::Some(input.into());
84        self
85    }
86    /// <p>The Amazon Resource Name (ARN) of the distribution configuration.</p>
87    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88        self.arn = input;
89        self
90    }
91    /// <p>The Amazon Resource Name (ARN) of the distribution configuration.</p>
92    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
93        &self.arn
94    }
95    /// <p>The name of the distribution configuration.</p>
96    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97        self.name = ::std::option::Option::Some(input.into());
98        self
99    }
100    /// <p>The name of the distribution configuration.</p>
101    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.name = input;
103        self
104    }
105    /// <p>The name of the distribution configuration.</p>
106    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
107        &self.name
108    }
109    /// <p>The description of the distribution configuration.</p>
110    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.description = ::std::option::Option::Some(input.into());
112        self
113    }
114    /// <p>The description of the distribution configuration.</p>
115    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.description = input;
117        self
118    }
119    /// <p>The description of the distribution configuration.</p>
120    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
121        &self.description
122    }
123    /// Appends an item to `distributions`.
124    ///
125    /// To override the contents of this collection use [`set_distributions`](Self::set_distributions).
126    ///
127    /// <p>The distribution objects that apply Region-specific settings for the deployment of the image to targeted Regions.</p>
128    pub fn distributions(mut self, input: crate::types::Distribution) -> Self {
129        let mut v = self.distributions.unwrap_or_default();
130        v.push(input);
131        self.distributions = ::std::option::Option::Some(v);
132        self
133    }
134    /// <p>The distribution objects that apply Region-specific settings for the deployment of the image to targeted Regions.</p>
135    pub fn set_distributions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Distribution>>) -> Self {
136        self.distributions = input;
137        self
138    }
139    /// <p>The distribution objects that apply Region-specific settings for the deployment of the image to targeted Regions.</p>
140    pub fn get_distributions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Distribution>> {
141        &self.distributions
142    }
143    /// <p>The maximum duration in minutes for this distribution configuration.</p>
144    /// This field is required.
145    pub fn timeout_minutes(mut self, input: i32) -> Self {
146        self.timeout_minutes = ::std::option::Option::Some(input);
147        self
148    }
149    /// <p>The maximum duration in minutes for this distribution configuration.</p>
150    pub fn set_timeout_minutes(mut self, input: ::std::option::Option<i32>) -> Self {
151        self.timeout_minutes = input;
152        self
153    }
154    /// <p>The maximum duration in minutes for this distribution configuration.</p>
155    pub fn get_timeout_minutes(&self) -> &::std::option::Option<i32> {
156        &self.timeout_minutes
157    }
158    /// <p>The date on which this distribution configuration was created.</p>
159    pub fn date_created(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.date_created = ::std::option::Option::Some(input.into());
161        self
162    }
163    /// <p>The date on which this distribution configuration was created.</p>
164    pub fn set_date_created(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.date_created = input;
166        self
167    }
168    /// <p>The date on which this distribution configuration was created.</p>
169    pub fn get_date_created(&self) -> &::std::option::Option<::std::string::String> {
170        &self.date_created
171    }
172    /// <p>The date on which this distribution configuration was last updated.</p>
173    pub fn date_updated(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
174        self.date_updated = ::std::option::Option::Some(input.into());
175        self
176    }
177    /// <p>The date on which this distribution configuration was last updated.</p>
178    pub fn set_date_updated(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
179        self.date_updated = input;
180        self
181    }
182    /// <p>The date on which this distribution configuration was last updated.</p>
183    pub fn get_date_updated(&self) -> &::std::option::Option<::std::string::String> {
184        &self.date_updated
185    }
186    /// Adds a key-value pair to `tags`.
187    ///
188    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
189    ///
190    /// <p>The tags of the distribution configuration.</p>
191    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
192        let mut hash_map = self.tags.unwrap_or_default();
193        hash_map.insert(k.into(), v.into());
194        self.tags = ::std::option::Option::Some(hash_map);
195        self
196    }
197    /// <p>The tags of the distribution configuration.</p>
198    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
199        self.tags = input;
200        self
201    }
202    /// <p>The tags of the distribution configuration.</p>
203    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
204        &self.tags
205    }
206    /// Consumes the builder and constructs a [`DistributionConfiguration`](crate::types::DistributionConfiguration).
207    /// This method will fail if any of the following fields are not set:
208    /// - [`timeout_minutes`](crate::types::builders::DistributionConfigurationBuilder::timeout_minutes)
209    pub fn build(self) -> ::std::result::Result<crate::types::DistributionConfiguration, ::aws_smithy_types::error::operation::BuildError> {
210        ::std::result::Result::Ok(crate::types::DistributionConfiguration {
211            arn: self.arn,
212            name: self.name,
213            description: self.description,
214            distributions: self.distributions,
215            timeout_minutes: self.timeout_minutes.ok_or_else(|| {
216                ::aws_smithy_types::error::operation::BuildError::missing_field(
217                    "timeout_minutes",
218                    "timeout_minutes was not specified but it is required when building DistributionConfiguration",
219                )
220            })?,
221            date_created: self.date_created,
222            date_updated: self.date_updated,
223            tags: self.tags,
224        })
225    }
226}