Skip to main content

aws_sdk_proton/operation/create_service_template_version/
_create_service_template_version_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)]
5pub struct CreateServiceTemplateVersionInput {
6    /// <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
7    pub client_token: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the service template.</p>
9    pub template_name: ::std::option::Option<::std::string::String>,
10    /// <p>A description of the new version of a service template.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>To create a new minor version of the service template, include a <code>major Version</code>.</p>
13    /// <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
14    pub major_version: ::std::option::Option<::std::string::String>,
15    /// <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
16    pub source: ::std::option::Option<crate::types::TemplateVersionSourceInput>,
17    /// <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
18    pub compatible_environment_templates: ::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplateInput>>,
19    /// <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p>
20    /// <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
21    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
22    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
23    /// <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>
24    pub supported_component_sources: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
25}
26impl CreateServiceTemplateVersionInput {
27    /// <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
28    pub fn client_token(&self) -> ::std::option::Option<&str> {
29        self.client_token.as_deref()
30    }
31    /// <p>The name of the service template.</p>
32    pub fn template_name(&self) -> ::std::option::Option<&str> {
33        self.template_name.as_deref()
34    }
35    /// <p>A description of the new version of a service template.</p>
36    pub fn description(&self) -> ::std::option::Option<&str> {
37        self.description.as_deref()
38    }
39    /// <p>To create a new minor version of the service template, include a <code>major Version</code>.</p>
40    /// <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
41    pub fn major_version(&self) -> ::std::option::Option<&str> {
42        self.major_version.as_deref()
43    }
44    /// <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
45    pub fn source(&self) -> ::std::option::Option<&crate::types::TemplateVersionSourceInput> {
46        self.source.as_ref()
47    }
48    /// <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
49    ///
50    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.compatible_environment_templates.is_none()`.
51    pub fn compatible_environment_templates(&self) -> &[crate::types::CompatibleEnvironmentTemplateInput] {
52        self.compatible_environment_templates.as_deref().unwrap_or_default()
53    }
54    /// <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p>
55    /// <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
56    ///
57    /// 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()`.
58    pub fn tags(&self) -> &[crate::types::Tag] {
59        self.tags.as_deref().unwrap_or_default()
60    }
61    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
62    /// <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>
63    ///
64    /// 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()`.
65    pub fn supported_component_sources(&self) -> &[crate::types::ServiceTemplateSupportedComponentSourceType] {
66        self.supported_component_sources.as_deref().unwrap_or_default()
67    }
68}
69impl ::std::fmt::Debug for CreateServiceTemplateVersionInput {
70    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
71        let mut formatter = f.debug_struct("CreateServiceTemplateVersionInput");
72        formatter.field("client_token", &self.client_token);
73        formatter.field("template_name", &self.template_name);
74        formatter.field("description", &"*** Sensitive Data Redacted ***");
75        formatter.field("major_version", &self.major_version);
76        formatter.field("source", &self.source);
77        formatter.field("compatible_environment_templates", &self.compatible_environment_templates);
78        formatter.field("tags", &self.tags);
79        formatter.field("supported_component_sources", &self.supported_component_sources);
80        formatter.finish()
81    }
82}
83impl CreateServiceTemplateVersionInput {
84    /// Creates a new builder-style object to manufacture [`CreateServiceTemplateVersionInput`](crate::operation::create_service_template_version::CreateServiceTemplateVersionInput).
85    pub fn builder() -> crate::operation::create_service_template_version::builders::CreateServiceTemplateVersionInputBuilder {
86        crate::operation::create_service_template_version::builders::CreateServiceTemplateVersionInputBuilder::default()
87    }
88}
89
90/// A builder for [`CreateServiceTemplateVersionInput`](crate::operation::create_service_template_version::CreateServiceTemplateVersionInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
92#[non_exhaustive]
93pub struct CreateServiceTemplateVersionInputBuilder {
94    pub(crate) client_token: ::std::option::Option<::std::string::String>,
95    pub(crate) template_name: ::std::option::Option<::std::string::String>,
96    pub(crate) description: ::std::option::Option<::std::string::String>,
97    pub(crate) major_version: ::std::option::Option<::std::string::String>,
98    pub(crate) source: ::std::option::Option<crate::types::TemplateVersionSourceInput>,
99    pub(crate) compatible_environment_templates: ::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplateInput>>,
100    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
101    pub(crate) supported_component_sources: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
102}
103impl CreateServiceTemplateVersionInputBuilder {
104    /// <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
105    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106        self.client_token = ::std::option::Option::Some(input.into());
107        self
108    }
109    /// <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
110    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111        self.client_token = input;
112        self
113    }
114    /// <p>When included, if two identical requests are made with the same client token, Proton returns the service template version that the first request created.</p>
115    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
116        &self.client_token
117    }
118    /// <p>The name of the service template.</p>
119    /// This field is required.
120    pub fn template_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.template_name = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>The name of the service template.</p>
125    pub fn set_template_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.template_name = input;
127        self
128    }
129    /// <p>The name of the service template.</p>
130    pub fn get_template_name(&self) -> &::std::option::Option<::std::string::String> {
131        &self.template_name
132    }
133    /// <p>A description of the new version of a service template.</p>
134    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
135        self.description = ::std::option::Option::Some(input.into());
136        self
137    }
138    /// <p>A description of the new version of a service template.</p>
139    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
140        self.description = input;
141        self
142    }
143    /// <p>A description of the new version of a service template.</p>
144    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
145        &self.description
146    }
147    /// <p>To create a new minor version of the service template, include a <code>major Version</code>.</p>
148    /// <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
149    pub fn major_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
150        self.major_version = ::std::option::Option::Some(input.into());
151        self
152    }
153    /// <p>To create a new minor version of the service template, include a <code>major Version</code>.</p>
154    /// <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
155    pub fn set_major_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
156        self.major_version = input;
157        self
158    }
159    /// <p>To create a new minor version of the service template, include a <code>major Version</code>.</p>
160    /// <p>To create a new major and minor version of the service template, <i>exclude</i> <code>major Version</code>.</p>
161    pub fn get_major_version(&self) -> &::std::option::Option<::std::string::String> {
162        &self.major_version
163    }
164    /// <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
165    /// This field is required.
166    pub fn source(mut self, input: crate::types::TemplateVersionSourceInput) -> Self {
167        self.source = ::std::option::Option::Some(input);
168        self
169    }
170    /// <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
171    pub fn set_source(mut self, input: ::std::option::Option<crate::types::TemplateVersionSourceInput>) -> Self {
172        self.source = input;
173        self
174    }
175    /// <p>An object that includes the template bundle S3 bucket path and name for the new version of a service template.</p>
176    pub fn get_source(&self) -> &::std::option::Option<crate::types::TemplateVersionSourceInput> {
177        &self.source
178    }
179    /// Appends an item to `compatible_environment_templates`.
180    ///
181    /// To override the contents of this collection use [`set_compatible_environment_templates`](Self::set_compatible_environment_templates).
182    ///
183    /// <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
184    pub fn compatible_environment_templates(mut self, input: crate::types::CompatibleEnvironmentTemplateInput) -> Self {
185        let mut v = self.compatible_environment_templates.unwrap_or_default();
186        v.push(input);
187        self.compatible_environment_templates = ::std::option::Option::Some(v);
188        self
189    }
190    /// <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
191    pub fn set_compatible_environment_templates(
192        mut self,
193        input: ::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplateInput>>,
194    ) -> Self {
195        self.compatible_environment_templates = input;
196        self
197    }
198    /// <p>An array of environment template objects that are compatible with the new service template version. A service instance based on this service template version can run in environments based on compatible templates.</p>
199    pub fn get_compatible_environment_templates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CompatibleEnvironmentTemplateInput>> {
200        &self.compatible_environment_templates
201    }
202    /// Appends an item to `tags`.
203    ///
204    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
205    ///
206    /// <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p>
207    /// <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
208    pub fn tags(mut self, input: crate::types::Tag) -> Self {
209        let mut v = self.tags.unwrap_or_default();
210        v.push(input);
211        self.tags = ::std::option::Option::Some(v);
212        self
213    }
214    /// <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p>
215    /// <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
216    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
217        self.tags = input;
218        self
219    }
220    /// <p>An optional list of metadata items that you can associate with the Proton service template version. A tag is a key-value pair.</p>
221    /// <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
222    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
223        &self.tags
224    }
225    /// Appends an item to `supported_component_sources`.
226    ///
227    /// To override the contents of this collection use [`set_supported_component_sources`](Self::set_supported_component_sources).
228    ///
229    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
230    /// <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>
231    pub fn supported_component_sources(mut self, input: crate::types::ServiceTemplateSupportedComponentSourceType) -> Self {
232        let mut v = self.supported_component_sources.unwrap_or_default();
233        v.push(input);
234        self.supported_component_sources = ::std::option::Option::Some(v);
235        self
236    }
237    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
238    /// <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>
239    pub fn set_supported_component_sources(
240        mut self,
241        input: ::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>>,
242    ) -> Self {
243        self.supported_component_sources = input;
244        self
245    }
246    /// <p>An array of supported component sources. Components with supported sources can be attached to service instances based on this service template version.</p>
247    /// <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>
248    pub fn get_supported_component_sources(
249        &self,
250    ) -> &::std::option::Option<::std::vec::Vec<crate::types::ServiceTemplateSupportedComponentSourceType>> {
251        &self.supported_component_sources
252    }
253    /// Consumes the builder and constructs a [`CreateServiceTemplateVersionInput`](crate::operation::create_service_template_version::CreateServiceTemplateVersionInput).
254    pub fn build(
255        self,
256    ) -> ::std::result::Result<
257        crate::operation::create_service_template_version::CreateServiceTemplateVersionInput,
258        ::aws_smithy_types::error::operation::BuildError,
259    > {
260        ::std::result::Result::Ok(crate::operation::create_service_template_version::CreateServiceTemplateVersionInput {
261            client_token: self.client_token,
262            template_name: self.template_name,
263            description: self.description,
264            major_version: self.major_version,
265            source: self.source,
266            compatible_environment_templates: self.compatible_environment_templates,
267            tags: self.tags,
268            supported_component_sources: self.supported_component_sources,
269        })
270    }
271}
272impl ::std::fmt::Debug for CreateServiceTemplateVersionInputBuilder {
273    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
274        let mut formatter = f.debug_struct("CreateServiceTemplateVersionInputBuilder");
275        formatter.field("client_token", &self.client_token);
276        formatter.field("template_name", &self.template_name);
277        formatter.field("description", &"*** Sensitive Data Redacted ***");
278        formatter.field("major_version", &self.major_version);
279        formatter.field("source", &self.source);
280        formatter.field("compatible_environment_templates", &self.compatible_environment_templates);
281        formatter.field("tags", &self.tags);
282        formatter.field("supported_component_sources", &self.supported_component_sources);
283        formatter.finish()
284    }
285}