aws_sdk_appconfig/operation/create_environment/
_create_environment_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 CreateEnvironmentInput {
6    /// <p>The application ID.</p>
7    pub application_id: ::std::option::Option<::std::string::String>,
8    /// <p>A name for the environment.</p>
9    pub name: ::std::option::Option<::std::string::String>,
10    /// <p>A description of the environment.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
13    pub monitors: ::std::option::Option<::std::vec::Vec<crate::types::Monitor>>,
14    /// <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
15    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
16}
17impl CreateEnvironmentInput {
18    /// <p>The application ID.</p>
19    pub fn application_id(&self) -> ::std::option::Option<&str> {
20        self.application_id.as_deref()
21    }
22    /// <p>A name for the environment.</p>
23    pub fn name(&self) -> ::std::option::Option<&str> {
24        self.name.as_deref()
25    }
26    /// <p>A description of the environment.</p>
27    pub fn description(&self) -> ::std::option::Option<&str> {
28        self.description.as_deref()
29    }
30    /// <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
31    ///
32    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.monitors.is_none()`.
33    pub fn monitors(&self) -> &[crate::types::Monitor] {
34        self.monitors.as_deref().unwrap_or_default()
35    }
36    /// <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
37    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
38        self.tags.as_ref()
39    }
40}
41impl CreateEnvironmentInput {
42    /// Creates a new builder-style object to manufacture [`CreateEnvironmentInput`](crate::operation::create_environment::CreateEnvironmentInput).
43    pub fn builder() -> crate::operation::create_environment::builders::CreateEnvironmentInputBuilder {
44        crate::operation::create_environment::builders::CreateEnvironmentInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateEnvironmentInput`](crate::operation::create_environment::CreateEnvironmentInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateEnvironmentInputBuilder {
52    pub(crate) application_id: ::std::option::Option<::std::string::String>,
53    pub(crate) name: ::std::option::Option<::std::string::String>,
54    pub(crate) description: ::std::option::Option<::std::string::String>,
55    pub(crate) monitors: ::std::option::Option<::std::vec::Vec<crate::types::Monitor>>,
56    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
57}
58impl CreateEnvironmentInputBuilder {
59    /// <p>The application ID.</p>
60    /// This field is required.
61    pub fn application_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.application_id = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The application ID.</p>
66    pub fn set_application_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.application_id = input;
68        self
69    }
70    /// <p>The application ID.</p>
71    pub fn get_application_id(&self) -> &::std::option::Option<::std::string::String> {
72        &self.application_id
73    }
74    /// <p>A name for the environment.</p>
75    /// This field is required.
76    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
77        self.name = ::std::option::Option::Some(input.into());
78        self
79    }
80    /// <p>A name for the environment.</p>
81    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
82        self.name = input;
83        self
84    }
85    /// <p>A name for the environment.</p>
86    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
87        &self.name
88    }
89    /// <p>A description of the environment.</p>
90    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
91        self.description = ::std::option::Option::Some(input.into());
92        self
93    }
94    /// <p>A description of the environment.</p>
95    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
96        self.description = input;
97        self
98    }
99    /// <p>A description of the environment.</p>
100    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
101        &self.description
102    }
103    /// Appends an item to `monitors`.
104    ///
105    /// To override the contents of this collection use [`set_monitors`](Self::set_monitors).
106    ///
107    /// <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
108    pub fn monitors(mut self, input: crate::types::Monitor) -> Self {
109        let mut v = self.monitors.unwrap_or_default();
110        v.push(input);
111        self.monitors = ::std::option::Option::Some(v);
112        self
113    }
114    /// <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
115    pub fn set_monitors(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Monitor>>) -> Self {
116        self.monitors = input;
117        self
118    }
119    /// <p>Amazon CloudWatch alarms to monitor during the deployment process.</p>
120    pub fn get_monitors(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Monitor>> {
121        &self.monitors
122    }
123    /// Adds a key-value pair to `tags`.
124    ///
125    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
126    ///
127    /// <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
128    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
129        let mut hash_map = self.tags.unwrap_or_default();
130        hash_map.insert(k.into(), v.into());
131        self.tags = ::std::option::Option::Some(hash_map);
132        self
133    }
134    /// <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
135    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
136        self.tags = input;
137        self
138    }
139    /// <p>Metadata to assign to the environment. Tags help organize and categorize your AppConfig resources. Each tag consists of a key and an optional value, both of which you define.</p>
140    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
141        &self.tags
142    }
143    /// Consumes the builder and constructs a [`CreateEnvironmentInput`](crate::operation::create_environment::CreateEnvironmentInput).
144    pub fn build(
145        self,
146    ) -> ::std::result::Result<crate::operation::create_environment::CreateEnvironmentInput, ::aws_smithy_types::error::operation::BuildError> {
147        ::std::result::Result::Ok(crate::operation::create_environment::CreateEnvironmentInput {
148            application_id: self.application_id,
149            name: self.name,
150            description: self.description,
151            monitors: self.monitors,
152            tags: self.tags,
153        })
154    }
155}