Skip to main content

aws_sdk_elasticache/types/
_cache_security_group.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents the output of one of the following operations:</p>
4/// <ul>
5/// <li>
6/// <p><code>AuthorizeCacheSecurityGroupIngress</code></p></li>
7/// <li>
8/// <p><code>CreateCacheSecurityGroup</code></p></li>
9/// <li>
10/// <p><code>RevokeCacheSecurityGroupIngress</code></p></li>
11/// </ul>
12#[non_exhaustive]
13#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
14pub struct CacheSecurityGroup {
15    /// <p>The Amazon account ID of the cache security group owner.</p>
16    pub owner_id: ::std::option::Option<::std::string::String>,
17    /// <p>The name of the cache security group.</p>
18    pub cache_security_group_name: ::std::option::Option<::std::string::String>,
19    /// <p>The description of the cache security group.</p>
20    pub description: ::std::option::Option<::std::string::String>,
21    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
22    pub ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
23    /// <p>The ARN of the cache security group,</p>
24    pub arn: ::std::option::Option<::std::string::String>,
25}
26impl CacheSecurityGroup {
27    /// <p>The Amazon account ID of the cache security group owner.</p>
28    pub fn owner_id(&self) -> ::std::option::Option<&str> {
29        self.owner_id.as_deref()
30    }
31    /// <p>The name of the cache security group.</p>
32    pub fn cache_security_group_name(&self) -> ::std::option::Option<&str> {
33        self.cache_security_group_name.as_deref()
34    }
35    /// <p>The description of the cache security group.</p>
36    pub fn description(&self) -> ::std::option::Option<&str> {
37        self.description.as_deref()
38    }
39    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
40    ///
41    /// 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()`.
42    pub fn ec2_security_groups(&self) -> &[crate::types::Ec2SecurityGroup] {
43        self.ec2_security_groups.as_deref().unwrap_or_default()
44    }
45    /// <p>The ARN of the cache security group,</p>
46    pub fn arn(&self) -> ::std::option::Option<&str> {
47        self.arn.as_deref()
48    }
49}
50impl CacheSecurityGroup {
51    /// Creates a new builder-style object to manufacture [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
52    pub fn builder() -> crate::types::builders::CacheSecurityGroupBuilder {
53        crate::types::builders::CacheSecurityGroupBuilder::default()
54    }
55}
56
57/// A builder for [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
58#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
59#[non_exhaustive]
60pub struct CacheSecurityGroupBuilder {
61    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
62    pub(crate) cache_security_group_name: ::std::option::Option<::std::string::String>,
63    pub(crate) description: ::std::option::Option<::std::string::String>,
64    pub(crate) ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
65    pub(crate) arn: ::std::option::Option<::std::string::String>,
66}
67impl CacheSecurityGroupBuilder {
68    /// <p>The Amazon account ID of the cache security group owner.</p>
69    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
70        self.owner_id = ::std::option::Option::Some(input.into());
71        self
72    }
73    /// <p>The Amazon account ID of the cache security group owner.</p>
74    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
75        self.owner_id = input;
76        self
77    }
78    /// <p>The Amazon account ID of the cache security group owner.</p>
79    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
80        &self.owner_id
81    }
82    /// <p>The name of the cache security group.</p>
83    pub fn cache_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
84        self.cache_security_group_name = ::std::option::Option::Some(input.into());
85        self
86    }
87    /// <p>The name of the cache security group.</p>
88    pub fn set_cache_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
89        self.cache_security_group_name = input;
90        self
91    }
92    /// <p>The name of the cache security group.</p>
93    pub fn get_cache_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
94        &self.cache_security_group_name
95    }
96    /// <p>The description of the cache security group.</p>
97    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.description = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The description of the cache security group.</p>
102    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.description = input;
104        self
105    }
106    /// <p>The description of the cache security group.</p>
107    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
108        &self.description
109    }
110    /// Appends an item to `ec2_security_groups`.
111    ///
112    /// To override the contents of this collection use [`set_ec2_security_groups`](Self::set_ec2_security_groups).
113    ///
114    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
115    pub fn ec2_security_groups(mut self, input: crate::types::Ec2SecurityGroup) -> Self {
116        let mut v = self.ec2_security_groups.unwrap_or_default();
117        v.push(input);
118        self.ec2_security_groups = ::std::option::Option::Some(v);
119        self
120    }
121    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
122    pub fn set_ec2_security_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>) -> Self {
123        self.ec2_security_groups = input;
124        self
125    }
126    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
127    pub fn get_ec2_security_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>> {
128        &self.ec2_security_groups
129    }
130    /// <p>The ARN of the cache security group,</p>
131    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.arn = ::std::option::Option::Some(input.into());
133        self
134    }
135    /// <p>The ARN of the cache security group,</p>
136    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.arn = input;
138        self
139    }
140    /// <p>The ARN of the cache security group,</p>
141    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
142        &self.arn
143    }
144    /// Consumes the builder and constructs a [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
145    pub fn build(self) -> crate::types::CacheSecurityGroup {
146        crate::types::CacheSecurityGroup {
147            owner_id: self.owner_id,
148            cache_security_group_name: self.cache_security_group_name,
149            description: self.description,
150            ec2_security_groups: self.ec2_security_groups,
151            arn: self.arn,
152        }
153    }
154}