aws_sdk_proton/types/
_service_template_version.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Detailed data of an Proton service template version resource.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
6pub struct ServiceTemplateVersion {
7    /// <p>The name of the version of a service template.</p>
8    pub template_name: ::std::string::String,
9    /// <p>The latest major version that's associated with the version of a service template.</p>
10    pub major_version: ::std::string::String,
11    /// <p>The minor version of a service template.</p>
12    pub minor_version: ::std::string::String,
13    /// <p>The recommended minor version of the service template.</p>
14    pub recommended_minor_version: ::std::option::Option<::std::string::String>,
15    /// <p>The service template version status.</p>
16    pub status: crate::types::TemplateVersionStatus,
17    /// <p>A service template version status message.</p>
18    pub status_message: ::std::option::Option<::std::string::String>,
19    /// <p>A description of the version of a service template.</p>
20    pub description: ::std::option::Option<::std::string::String>,
21    /// <p>The Amazon Resource Name (ARN) of the version of a service template.</p>
22    pub arn: ::std::string::String,
23    /// <p>The time when the version of a service template was created.</p>
24    pub created_at: ::aws_smithy_types::DateTime,
25    /// <p>The time when the version of a service template was last modified.</p>
26    pub last_modified_at: ::aws_smithy_types::DateTime,
27    /// <p>An array of compatible environment template names for the major version of a service template.</p>
28    pub compatible_environment_templates: ::std::vec::Vec<crate::types::CompatibleEnvironmentTemplate>,
29    /// <p>The schema of the version of a service template.</p>
30    pub schema: ::std::option::Option<::std::string::String>,
31    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
32    /// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
33    pub supported_component_sources: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
34}
35impl ServiceTemplateVersion {
36    /// <p>The name of the version of a service template.</p>
37    pub fn template_name(&self) -> &str {
38        use std::ops::Deref;
39        self.template_name.deref()
40    }
41    /// <p>The latest major version that's associated with the version of a service template.</p>
42    pub fn major_version(&self) -> &str {
43        use std::ops::Deref;
44        self.major_version.deref()
45    }
46    /// <p>The minor version of a service template.</p>
47    pub fn minor_version(&self) -> &str {
48        use std::ops::Deref;
49        self.minor_version.deref()
50    }
51    /// <p>The recommended minor version of the service template.</p>
52    pub fn recommended_minor_version(&self) -> ::std::option::Option<&str> {
53        self.recommended_minor_version.as_deref()
54    }
55    /// <p>The service template version status.</p>
56    pub fn status(&self) -> &crate::types::TemplateVersionStatus {
57        &self.status
58    }
59    /// <p>A service template version status message.</p>
60    pub fn status_message(&self) -> ::std::option::Option<&str> {
61        self.status_message.as_deref()
62    }
63    /// <p>A description of the version of a service template.</p>
64    pub fn description(&self) -> ::std::option::Option<&str> {
65        self.description.as_deref()
66    }
67    /// <p>The Amazon Resource Name (ARN) of the version of a service template.</p>
68    pub fn arn(&self) -> &str {
69        use std::ops::Deref;
70        self.arn.deref()
71    }
72    /// <p>The time when the version of a service template was created.</p>
73    pub fn created_at(&self) -> &::aws_smithy_types::DateTime {
74        &self.created_at
75    }
76    /// <p>The time when the version of a service template was last modified.</p>
77    pub fn last_modified_at(&self) -> &::aws_smithy_types::DateTime {
78        &self.last_modified_at
79    }
80    /// <p>An array of compatible environment template names for the major version of a service template.</p>
81    pub fn compatible_environment_templates(&self) -> &[crate::types::CompatibleEnvironmentTemplate] {
82        use std::ops::Deref;
83        self.compatible_environment_templates.deref()
84    }
85    /// <p>The schema of the version of a service template.</p>
86    pub fn schema(&self) -> ::std::option::Option<&str> {
87        self.schema.as_deref()
88    }
89    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
90    /// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
91    ///
92    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.supported_component_sources.is_none()`.
93    pub fn supported_component_sources(&self) -> &[crate::types::ServiceTemplateSupportedComponentSourceType] {
94        self.supported_component_sources.as_deref().unwrap_or_default()
95    }
96}
97impl ::std::fmt::Debug for ServiceTemplateVersion {
98    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
99        let mut formatter = f.debug_struct("ServiceTemplateVersion");
100        formatter.field("template_name", &self.template_name);
101        formatter.field("major_version", &self.major_version);
102        formatter.field("minor_version", &self.minor_version);
103        formatter.field("recommended_minor_version", &self.recommended_minor_version);
104        formatter.field("status", &self.status);
105        formatter.field("status_message", &"*** Sensitive Data Redacted ***");
106        formatter.field("description", &"*** Sensitive Data Redacted ***");
107        formatter.field("arn", &self.arn);
108        formatter.field("created_at", &self.created_at);
109        formatter.field("last_modified_at", &self.last_modified_at);
110        formatter.field("compatible_environment_templates", &self.compatible_environment_templates);
111        formatter.field("schema", &"*** Sensitive Data Redacted ***");
112        formatter.field("supported_component_sources", &self.supported_component_sources);
113        formatter.finish()
114    }
115}
116impl ServiceTemplateVersion {
117    /// Creates a new builder-style object to manufacture [`ServiceTemplateVersion`](crate::types::ServiceTemplateVersion).
118    pub fn builder() -> crate::types::builders::ServiceTemplateVersionBuilder {
119        crate::types::builders::ServiceTemplateVersionBuilder::default()
120    }
121}
122
123/// A builder for [`ServiceTemplateVersion`](crate::types::ServiceTemplateVersion).
124#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
125#[non_exhaustive]
126pub struct ServiceTemplateVersionBuilder {
127    pub(crate) template_name: ::std::option::Option<::std::string::String>,
128    pub(crate) major_version: ::std::option::Option<::std::string::String>,
129    pub(crate) minor_version: ::std::option::Option<::std::string::String>,
130    pub(crate) recommended_minor_version: ::std::option::Option<::std::string::String>,
131    pub(crate) status: ::std::option::Option<crate::types::TemplateVersionStatus>,
132    pub(crate) status_message: ::std::option::Option<::std::string::String>,
133    pub(crate) description: ::std::option::Option<::std::string::String>,
134    pub(crate) arn: ::std::option::Option<::std::string::String>,
135    pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
136    pub(crate) last_modified_at: ::std::option::Option<::aws_smithy_types::DateTime>,
137    pub(crate) compatible_environment_templates: ::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplate>>,
138    pub(crate) schema: ::std::option::Option<::std::string::String>,
139    pub(crate) supported_component_sources: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
140}
141impl ServiceTemplateVersionBuilder {
142    /// <p>The name of the version of a service template.</p>
143    /// This field is required.
144    pub fn template_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.template_name = ::std::option::Option::Some(input.into());
146        self
147    }
148    /// <p>The name of the version of a service template.</p>
149    pub fn set_template_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.template_name = input;
151        self
152    }
153    /// <p>The name of the version of a service template.</p>
154    pub fn get_template_name(&self) -> &::std::option::Option<::std::string::String> {
155        &self.template_name
156    }
157    /// <p>The latest major version that's associated with the version of a service template.</p>
158    /// This field is required.
159    pub fn major_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.major_version = ::std::option::Option::Some(input.into());
161        self
162    }
163    /// <p>The latest major version that's associated with the version of a service template.</p>
164    pub fn set_major_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.major_version = input;
166        self
167    }
168    /// <p>The latest major version that's associated with the version of a service template.</p>
169    pub fn get_major_version(&self) -> &::std::option::Option<::std::string::String> {
170        &self.major_version
171    }
172    /// <p>The minor version of a service template.</p>
173    /// This field is required.
174    pub fn minor_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.minor_version = ::std::option::Option::Some(input.into());
176        self
177    }
178    /// <p>The minor version of a service template.</p>
179    pub fn set_minor_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.minor_version = input;
181        self
182    }
183    /// <p>The minor version of a service template.</p>
184    pub fn get_minor_version(&self) -> &::std::option::Option<::std::string::String> {
185        &self.minor_version
186    }
187    /// <p>The recommended minor version of the service template.</p>
188    pub fn recommended_minor_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.recommended_minor_version = ::std::option::Option::Some(input.into());
190        self
191    }
192    /// <p>The recommended minor version of the service template.</p>
193    pub fn set_recommended_minor_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.recommended_minor_version = input;
195        self
196    }
197    /// <p>The recommended minor version of the service template.</p>
198    pub fn get_recommended_minor_version(&self) -> &::std::option::Option<::std::string::String> {
199        &self.recommended_minor_version
200    }
201    /// <p>The service template version status.</p>
202    /// This field is required.
203    pub fn status(mut self, input: crate::types::TemplateVersionStatus) -> Self {
204        self.status = ::std::option::Option::Some(input);
205        self
206    }
207    /// <p>The service template version status.</p>
208    pub fn set_status(mut self, input: ::std::option::Option<crate::types::TemplateVersionStatus>) -> Self {
209        self.status = input;
210        self
211    }
212    /// <p>The service template version status.</p>
213    pub fn get_status(&self) -> &::std::option::Option<crate::types::TemplateVersionStatus> {
214        &self.status
215    }
216    /// <p>A service template version status message.</p>
217    pub fn status_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218        self.status_message = ::std::option::Option::Some(input.into());
219        self
220    }
221    /// <p>A service template version status message.</p>
222    pub fn set_status_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223        self.status_message = input;
224        self
225    }
226    /// <p>A service template version status message.</p>
227    pub fn get_status_message(&self) -> &::std::option::Option<::std::string::String> {
228        &self.status_message
229    }
230    /// <p>A description of the version of a service template.</p>
231    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232        self.description = ::std::option::Option::Some(input.into());
233        self
234    }
235    /// <p>A description of the version of a service template.</p>
236    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237        self.description = input;
238        self
239    }
240    /// <p>A description of the version of a service template.</p>
241    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
242        &self.description
243    }
244    /// <p>The Amazon Resource Name (ARN) of the version of a service template.</p>
245    /// This field is required.
246    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
247        self.arn = ::std::option::Option::Some(input.into());
248        self
249    }
250    /// <p>The Amazon Resource Name (ARN) of the version of a service template.</p>
251    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
252        self.arn = input;
253        self
254    }
255    /// <p>The Amazon Resource Name (ARN) of the version of a service template.</p>
256    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
257        &self.arn
258    }
259    /// <p>The time when the version of a service template was created.</p>
260    /// This field is required.
261    pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
262        self.created_at = ::std::option::Option::Some(input);
263        self
264    }
265    /// <p>The time when the version of a service template was created.</p>
266    pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
267        self.created_at = input;
268        self
269    }
270    /// <p>The time when the version of a service template was created.</p>
271    pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
272        &self.created_at
273    }
274    /// <p>The time when the version of a service template was last modified.</p>
275    /// This field is required.
276    pub fn last_modified_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
277        self.last_modified_at = ::std::option::Option::Some(input);
278        self
279    }
280    /// <p>The time when the version of a service template was last modified.</p>
281    pub fn set_last_modified_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
282        self.last_modified_at = input;
283        self
284    }
285    /// <p>The time when the version of a service template was last modified.</p>
286    pub fn get_last_modified_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
287        &self.last_modified_at
288    }
289    /// Appends an item to `compatible_environment_templates`.
290    ///
291    /// To override the contents of this collection use [`set_compatible_environment_templates`](Self::set_compatible_environment_templates).
292    ///
293    /// <p>An array of compatible environment template names for the major version of a service template.</p>
294    pub fn compatible_environment_templates(mut self, input: crate::types::CompatibleEnvironmentTemplate) -> Self {
295        let mut v = self.compatible_environment_templates.unwrap_or_default();
296        v.push(input);
297        self.compatible_environment_templates = ::std::option::Option::Some(v);
298        self
299    }
300    /// <p>An array of compatible environment template names for the major version of a service template.</p>
301    pub fn set_compatible_environment_templates(
302        mut self,
303        input: ::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplate>>,
304    ) -> Self {
305        self.compatible_environment_templates = input;
306        self
307    }
308    /// <p>An array of compatible environment template names for the major version of a service template.</p>
309    pub fn get_compatible_environment_templates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplate>> {
310        &self.compatible_environment_templates
311    }
312    /// <p>The schema of the version of a service template.</p>
313    pub fn schema(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
314        self.schema = ::std::option::Option::Some(input.into());
315        self
316    }
317    /// <p>The schema of the version of a service template.</p>
318    pub fn set_schema(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
319        self.schema = input;
320        self
321    }
322    /// <p>The schema of the version of a service template.</p>
323    pub fn get_schema(&self) -> &::std::option::Option<::std::string::String> {
324        &self.schema
325    }
326    /// Appends an item to `supported_component_sources`.
327    ///
328    /// To override the contents of this collection use [`set_supported_component_sources`](Self::set_supported_component_sources).
329    ///
330    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
331    /// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
332    pub fn supported_component_sources(mut self, input: crate::types::ServiceTemplateSupportedComponentSourceType) -> Self {
333        let mut v = self.supported_component_sources.unwrap_or_default();
334        v.push(input);
335        self.supported_component_sources = ::std::option::Option::Some(v);
336        self
337    }
338    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
339    /// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
340    pub fn set_supported_component_sources(
341        mut self,
342        input: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
343    ) -> Self {
344        self.supported_component_sources = input;
345        self
346    }
347    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
348    /// <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
349    pub fn get_supported_component_sources(
350        &self,
351    ) -> &::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>> {
352        &self.supported_component_sources
353    }
354    /// Consumes the builder and constructs a [`ServiceTemplateVersion`](crate::types::ServiceTemplateVersion).
355    /// This method will fail if any of the following fields are not set:
356    /// - [`template_name`](crate::types::builders::ServiceTemplateVersionBuilder::template_name)
357    /// - [`major_version`](crate::types::builders::ServiceTemplateVersionBuilder::major_version)
358    /// - [`minor_version`](crate::types::builders::ServiceTemplateVersionBuilder::minor_version)
359    /// - [`status`](crate::types::builders::ServiceTemplateVersionBuilder::status)
360    /// - [`arn`](crate::types::builders::ServiceTemplateVersionBuilder::arn)
361    /// - [`created_at`](crate::types::builders::ServiceTemplateVersionBuilder::created_at)
362    /// - [`last_modified_at`](crate::types::builders::ServiceTemplateVersionBuilder::last_modified_at)
363    /// - [`compatible_environment_templates`](crate::types::builders::ServiceTemplateVersionBuilder::compatible_environment_templates)
364    pub fn build(self) -> ::std::result::Result<crate::types::ServiceTemplateVersion, ::aws_smithy_types::error::operation::BuildError> {
365        ::std::result::Result::Ok(crate::types::ServiceTemplateVersion {
366            template_name: self.template_name.ok_or_else(|| {
367                ::aws_smithy_types::error::operation::BuildError::missing_field(
368                    "template_name",
369                    "template_name was not specified but it is required when building ServiceTemplateVersion",
370                )
371            })?,
372            major_version: self.major_version.ok_or_else(|| {
373                ::aws_smithy_types::error::operation::BuildError::missing_field(
374                    "major_version",
375                    "major_version was not specified but it is required when building ServiceTemplateVersion",
376                )
377            })?,
378            minor_version: self.minor_version.ok_or_else(|| {
379                ::aws_smithy_types::error::operation::BuildError::missing_field(
380                    "minor_version",
381                    "minor_version was not specified but it is required when building ServiceTemplateVersion",
382                )
383            })?,
384            recommended_minor_version: self.recommended_minor_version,
385            status: self.status.ok_or_else(|| {
386                ::aws_smithy_types::error::operation::BuildError::missing_field(
387                    "status",
388                    "status was not specified but it is required when building ServiceTemplateVersion",
389                )
390            })?,
391            status_message: self.status_message,
392            description: self.description,
393            arn: self.arn.ok_or_else(|| {
394                ::aws_smithy_types::error::operation::BuildError::missing_field(
395                    "arn",
396                    "arn was not specified but it is required when building ServiceTemplateVersion",
397                )
398            })?,
399            created_at: self.created_at.ok_or_else(|| {
400                ::aws_smithy_types::error::operation::BuildError::missing_field(
401                    "created_at",
402                    "created_at was not specified but it is required when building ServiceTemplateVersion",
403                )
404            })?,
405            last_modified_at: self.last_modified_at.ok_or_else(|| {
406                ::aws_smithy_types::error::operation::BuildError::missing_field(
407                    "last_modified_at",
408                    "last_modified_at was not specified but it is required when building ServiceTemplateVersion",
409                )
410            })?,
411            compatible_environment_templates: self.compatible_environment_templates.ok_or_else(|| {
412                ::aws_smithy_types::error::operation::BuildError::missing_field(
413                    "compatible_environment_templates",
414                    "compatible_environment_templates was not specified but it is required when building ServiceTemplateVersion",
415                )
416            })?,
417            schema: self.schema,
418            supported_component_sources: self.supported_component_sources,
419        })
420    }
421}
422impl ::std::fmt::Debug for ServiceTemplateVersionBuilder {
423    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
424        let mut formatter = f.debug_struct("ServiceTemplateVersionBuilder");
425        formatter.field("template_name", &self.template_name);
426        formatter.field("major_version", &self.major_version);
427        formatter.field("minor_version", &self.minor_version);
428        formatter.field("recommended_minor_version", &self.recommended_minor_version);
429        formatter.field("status", &self.status);
430        formatter.field("status_message", &"*** Sensitive Data Redacted ***");
431        formatter.field("description", &"*** Sensitive Data Redacted ***");
432        formatter.field("arn", &self.arn);
433        formatter.field("created_at", &self.created_at);
434        formatter.field("last_modified_at", &self.last_modified_at);
435        formatter.field("compatible_environment_templates", &self.compatible_environment_templates);
436        formatter.field("schema", &"*** Sensitive Data Redacted ***");
437        formatter.field("supported_component_sources", &self.supported_component_sources);
438        formatter.finish()
439    }
440}