Skip to main content

aws_sdk_rds/types/
_db_security_group.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Contains the details for an Amazon RDS DB security group.</p>
4/// <p>This data type is used as a response element in the <code>DescribeDBSecurityGroups</code> action.</p>
5#[non_exhaustive]
6#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
7pub struct DbSecurityGroup {
8    /// <p>Provides the Amazon Web Services ID of the owner of a specific DB security group.</p>
9    pub owner_id: ::std::option::Option<::std::string::String>,
10    /// <p>Specifies the name of the DB security group.</p>
11    pub db_security_group_name: ::std::option::Option<::std::string::String>,
12    /// <p>Provides the description of the DB security group.</p>
13    pub db_security_group_description: ::std::option::Option<::std::string::String>,
14    /// <p>Provides the VpcId of the DB security group.</p>
15    pub vpc_id: ::std::option::Option<::std::string::String>,
16    /// <p>Contains a list of <code>EC2SecurityGroup</code> elements.</p>
17    pub ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
18    /// <p>Contains a list of <code>IPRange</code> elements.</p>
19    pub ip_ranges: ::std::option::Option<::std::vec::Vec<crate::types::IpRange>>,
20    /// <p>The Amazon Resource Name (ARN) for the DB security group.</p>
21    pub db_security_group_arn: ::std::option::Option<::std::string::String>,
22}
23impl DbSecurityGroup {
24    /// <p>Provides the Amazon Web Services ID of the owner of a specific DB security group.</p>
25    pub fn owner_id(&self) -> ::std::option::Option<&str> {
26        self.owner_id.as_deref()
27    }
28    /// <p>Specifies the name of the DB security group.</p>
29    pub fn db_security_group_name(&self) -> ::std::option::Option<&str> {
30        self.db_security_group_name.as_deref()
31    }
32    /// <p>Provides the description of the DB security group.</p>
33    pub fn db_security_group_description(&self) -> ::std::option::Option<&str> {
34        self.db_security_group_description.as_deref()
35    }
36    /// <p>Provides the VpcId of the DB security group.</p>
37    pub fn vpc_id(&self) -> ::std::option::Option<&str> {
38        self.vpc_id.as_deref()
39    }
40    /// <p>Contains a list of <code>EC2SecurityGroup</code> elements.</p>
41    ///
42    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.ec2_security_groups.is_none()`.
43    pub fn ec2_security_groups(&self) -> &[crate::types::Ec2SecurityGroup] {
44        self.ec2_security_groups.as_deref().unwrap_or_default()
45    }
46    /// <p>Contains a list of <code>IPRange</code> elements.</p>
47    ///
48    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.ip_ranges.is_none()`.
49    pub fn ip_ranges(&self) -> &[crate::types::IpRange] {
50        self.ip_ranges.as_deref().unwrap_or_default()
51    }
52    /// <p>The Amazon Resource Name (ARN) for the DB security group.</p>
53    pub fn db_security_group_arn(&self) -> ::std::option::Option<&str> {
54        self.db_security_group_arn.as_deref()
55    }
56}
57impl DbSecurityGroup {
58    /// Creates a new builder-style object to manufacture [`DbSecurityGroup`](crate::types::DbSecurityGroup).
59    pub fn builder() -> crate::types::builders::DbSecurityGroupBuilder {
60        crate::types::builders::DbSecurityGroupBuilder::default()
61    }
62}
63
64/// A builder for [`DbSecurityGroup`](crate::types::DbSecurityGroup).
65#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
66#[non_exhaustive]
67pub struct DbSecurityGroupBuilder {
68    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
69    pub(crate) db_security_group_name: ::std::option::Option<::std::string::String>,
70    pub(crate) db_security_group_description: ::std::option::Option<::std::string::String>,
71    pub(crate) vpc_id: ::std::option::Option<::std::string::String>,
72    pub(crate) ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
73    pub(crate) ip_ranges: ::std::option::Option<::std::vec::Vec<crate::types::IpRange>>,
74    pub(crate) db_security_group_arn: ::std::option::Option<::std::string::String>,
75}
76impl DbSecurityGroupBuilder {
77    /// <p>Provides the Amazon Web Services ID of the owner of a specific DB security group.</p>
78    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
79        self.owner_id = ::std::option::Option::Some(input.into());
80        self
81    }
82    /// <p>Provides the Amazon Web Services ID of the owner of a specific DB security group.</p>
83    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
84        self.owner_id = input;
85        self
86    }
87    /// <p>Provides the Amazon Web Services ID of the owner of a specific DB security group.</p>
88    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
89        &self.owner_id
90    }
91    /// <p>Specifies the name of the DB security group.</p>
92    pub fn db_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93        self.db_security_group_name = ::std::option::Option::Some(input.into());
94        self
95    }
96    /// <p>Specifies the name of the DB security group.</p>
97    pub fn set_db_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98        self.db_security_group_name = input;
99        self
100    }
101    /// <p>Specifies the name of the DB security group.</p>
102    pub fn get_db_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
103        &self.db_security_group_name
104    }
105    /// <p>Provides the description of the DB security group.</p>
106    pub fn db_security_group_description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
107        self.db_security_group_description = ::std::option::Option::Some(input.into());
108        self
109    }
110    /// <p>Provides the description of the DB security group.</p>
111    pub fn set_db_security_group_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
112        self.db_security_group_description = input;
113        self
114    }
115    /// <p>Provides the description of the DB security group.</p>
116    pub fn get_db_security_group_description(&self) -> &::std::option::Option<::std::string::String> {
117        &self.db_security_group_description
118    }
119    /// <p>Provides the VpcId of the DB security group.</p>
120    pub fn vpc_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
121        self.vpc_id = ::std::option::Option::Some(input.into());
122        self
123    }
124    /// <p>Provides the VpcId of the DB security group.</p>
125    pub fn set_vpc_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
126        self.vpc_id = input;
127        self
128    }
129    /// <p>Provides the VpcId of the DB security group.</p>
130    pub fn get_vpc_id(&self) -> &::std::option::Option<::std::string::String> {
131        &self.vpc_id
132    }
133    /// Appends an item to `ec2_security_groups`.
134    ///
135    /// To override the contents of this collection use [`set_ec2_security_groups`](Self::set_ec2_security_groups).
136    ///
137    /// <p>Contains a list of <code>EC2SecurityGroup</code> elements.</p>
138    pub fn ec2_security_groups(mut self, input: crate::types::Ec2SecurityGroup) -> Self {
139        let mut v = self.ec2_security_groups.unwrap_or_default();
140        v.push(input);
141        self.ec2_security_groups = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>Contains a list of <code>EC2SecurityGroup</code> elements.</p>
145    pub fn set_ec2_security_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>) -> Self {
146        self.ec2_security_groups = input;
147        self
148    }
149    /// <p>Contains a list of <code>EC2SecurityGroup</code> elements.</p>
150    pub fn get_ec2_security_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>> {
151        &self.ec2_security_groups
152    }
153    /// Appends an item to `ip_ranges`.
154    ///
155    /// To override the contents of this collection use [`set_ip_ranges`](Self::set_ip_ranges).
156    ///
157    /// <p>Contains a list of <code>IPRange</code> elements.</p>
158    pub fn ip_ranges(mut self, input: crate::types::IpRange) -> Self {
159        let mut v = self.ip_ranges.unwrap_or_default();
160        v.push(input);
161        self.ip_ranges = ::std::option::Option::Some(v);
162        self
163    }
164    /// <p>Contains a list of <code>IPRange</code> elements.</p>
165    pub fn set_ip_ranges(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IpRange>>) -> Self {
166        self.ip_ranges = input;
167        self
168    }
169    /// <p>Contains a list of <code>IPRange</code> elements.</p>
170    pub fn get_ip_ranges(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IpRange>> {
171        &self.ip_ranges
172    }
173    /// <p>The Amazon Resource Name (ARN) for the DB security group.</p>
174    pub fn db_security_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.db_security_group_arn = ::std::option::Option::Some(input.into());
176        self
177    }
178    /// <p>The Amazon Resource Name (ARN) for the DB security group.</p>
179    pub fn set_db_security_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.db_security_group_arn = input;
181        self
182    }
183    /// <p>The Amazon Resource Name (ARN) for the DB security group.</p>
184    pub fn get_db_security_group_arn(&self) -> &::std::option::Option<::std::string::String> {
185        &self.db_security_group_arn
186    }
187    /// Consumes the builder and constructs a [`DbSecurityGroup`](crate::types::DbSecurityGroup).
188    pub fn build(self) -> crate::types::DbSecurityGroup {
189        crate::types::DbSecurityGroup {
190            owner_id: self.owner_id,
191            db_security_group_name: self.db_security_group_name,
192            db_security_group_description: self.db_security_group_description,
193            vpc_id: self.vpc_id,
194            ec2_security_groups: self.ec2_security_groups,
195            ip_ranges: self.ip_ranges,
196            db_security_group_arn: self.db_security_group_arn,
197        }
198    }
199}