Skip to main content

aws_sdk_rds/operation/create_db_security_group/
_create_db_security_group_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p></p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateDbSecurityGroupInput {
7    /// <p>The name for the DB security group. This value is stored as a lowercase string.</p>
8    /// <p>Constraints:</p>
9    /// <ul>
10    /// <li>
11    /// <p>Must be 1 to 255 letters, numbers, or hyphens.</p></li>
12    /// <li>
13    /// <p>First character must be a letter</p></li>
14    /// <li>
15    /// <p>Can't end with a hyphen or contain two consecutive hyphens</p></li>
16    /// <li>
17    /// <p>Must not be "Default"</p></li>
18    /// </ul>
19    /// <p>Example: <code>mysecuritygroup</code></p>
20    pub db_security_group_name: ::std::option::Option<::std::string::String>,
21    /// <p>The description for the DB security group.</p>
22    pub db_security_group_description: ::std::option::Option<::std::string::String>,
23    /// <p>Tags to assign to the DB security group.</p>
24    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
25}
26impl CreateDbSecurityGroupInput {
27    /// <p>The name for the DB security group. This value is stored as a lowercase string.</p>
28    /// <p>Constraints:</p>
29    /// <ul>
30    /// <li>
31    /// <p>Must be 1 to 255 letters, numbers, or hyphens.</p></li>
32    /// <li>
33    /// <p>First character must be a letter</p></li>
34    /// <li>
35    /// <p>Can't end with a hyphen or contain two consecutive hyphens</p></li>
36    /// <li>
37    /// <p>Must not be "Default"</p></li>
38    /// </ul>
39    /// <p>Example: <code>mysecuritygroup</code></p>
40    pub fn db_security_group_name(&self) -> ::std::option::Option<&str> {
41        self.db_security_group_name.as_deref()
42    }
43    /// <p>The description for the DB security group.</p>
44    pub fn db_security_group_description(&self) -> ::std::option::Option<&str> {
45        self.db_security_group_description.as_deref()
46    }
47    /// <p>Tags to assign to the DB security group.</p>
48    ///
49    /// 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()`.
50    pub fn tags(&self) -> &[crate::types::Tag] {
51        self.tags.as_deref().unwrap_or_default()
52    }
53}
54impl CreateDbSecurityGroupInput {
55    /// Creates a new builder-style object to manufacture [`CreateDbSecurityGroupInput`](crate::operation::create_db_security_group::CreateDbSecurityGroupInput).
56    pub fn builder() -> crate::operation::create_db_security_group::builders::CreateDbSecurityGroupInputBuilder {
57        crate::operation::create_db_security_group::builders::CreateDbSecurityGroupInputBuilder::default()
58    }
59}
60
61/// A builder for [`CreateDbSecurityGroupInput`](crate::operation::create_db_security_group::CreateDbSecurityGroupInput).
62#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
63#[non_exhaustive]
64pub struct CreateDbSecurityGroupInputBuilder {
65    pub(crate) db_security_group_name: ::std::option::Option<::std::string::String>,
66    pub(crate) db_security_group_description: ::std::option::Option<::std::string::String>,
67    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
68}
69impl CreateDbSecurityGroupInputBuilder {
70    /// <p>The name for the DB security group. This value is stored as a lowercase string.</p>
71    /// <p>Constraints:</p>
72    /// <ul>
73    /// <li>
74    /// <p>Must be 1 to 255 letters, numbers, or hyphens.</p></li>
75    /// <li>
76    /// <p>First character must be a letter</p></li>
77    /// <li>
78    /// <p>Can't end with a hyphen or contain two consecutive hyphens</p></li>
79    /// <li>
80    /// <p>Must not be "Default"</p></li>
81    /// </ul>
82    /// <p>Example: <code>mysecuritygroup</code></p>
83    /// This field is required.
84    pub fn db_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
85        self.db_security_group_name = ::std::option::Option::Some(input.into());
86        self
87    }
88    /// <p>The name for the DB security group. This value is stored as a lowercase string.</p>
89    /// <p>Constraints:</p>
90    /// <ul>
91    /// <li>
92    /// <p>Must be 1 to 255 letters, numbers, or hyphens.</p></li>
93    /// <li>
94    /// <p>First character must be a letter</p></li>
95    /// <li>
96    /// <p>Can't end with a hyphen or contain two consecutive hyphens</p></li>
97    /// <li>
98    /// <p>Must not be "Default"</p></li>
99    /// </ul>
100    /// <p>Example: <code>mysecuritygroup</code></p>
101    pub fn set_db_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102        self.db_security_group_name = input;
103        self
104    }
105    /// <p>The name for the DB security group. This value is stored as a lowercase string.</p>
106    /// <p>Constraints:</p>
107    /// <ul>
108    /// <li>
109    /// <p>Must be 1 to 255 letters, numbers, or hyphens.</p></li>
110    /// <li>
111    /// <p>First character must be a letter</p></li>
112    /// <li>
113    /// <p>Can't end with a hyphen or contain two consecutive hyphens</p></li>
114    /// <li>
115    /// <p>Must not be "Default"</p></li>
116    /// </ul>
117    /// <p>Example: <code>mysecuritygroup</code></p>
118    pub fn get_db_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
119        &self.db_security_group_name
120    }
121    /// <p>The description for the DB security group.</p>
122    /// This field is required.
123    pub fn db_security_group_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.db_security_group_description = ::std::option::Option::Some(input.into());
125        self
126    }
127    /// <p>The description for the DB security group.</p>
128    pub fn set_db_security_group_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.db_security_group_description = input;
130        self
131    }
132    /// <p>The description for the DB security group.</p>
133    pub fn get_db_security_group_description(&self) -> &::std::option::Option<::std::string::String> {
134        &self.db_security_group_description
135    }
136    /// Appends an item to `tags`.
137    ///
138    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
139    ///
140    /// <p>Tags to assign to the DB security group.</p>
141    pub fn tags(mut self, input: crate::types::Tag) -> Self {
142        let mut v = self.tags.unwrap_or_default();
143        v.push(input);
144        self.tags = ::std::option::Option::Some(v);
145        self
146    }
147    /// <p>Tags to assign to the DB security group.</p>
148    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
149        self.tags = input;
150        self
151    }
152    /// <p>Tags to assign to the DB security group.</p>
153    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
154        &self.tags
155    }
156    /// Consumes the builder and constructs a [`CreateDbSecurityGroupInput`](crate::operation::create_db_security_group::CreateDbSecurityGroupInput).
157    pub fn build(
158        self,
159    ) -> ::std::result::Result<crate::operation::create_db_security_group::CreateDbSecurityGroupInput, ::aws_smithy_types::error::operation::BuildError>
160    {
161        ::std::result::Result::Ok(crate::operation::create_db_security_group::CreateDbSecurityGroupInput {
162            db_security_group_name: self.db_security_group_name,
163            db_security_group_description: self.db_security_group_description,
164            tags: self.tags,
165        })
166    }
167}