1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Represents the output of one of the following operations:</p>
/// <ul>
/// <li>
/// <p><code>AuthorizeCacheSecurityGroupIngress</code></p></li>
/// <li>
/// <p><code>CreateCacheSecurityGroup</code></p></li>
/// <li>
/// <p><code>RevokeCacheSecurityGroupIngress</code></p></li>
/// </ul>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CacheSecurityGroup {
    /// <p>The Amazon account ID of the cache security group owner.</p>
    pub owner_id: ::std::option::Option<::std::string::String>,
    /// <p>The name of the cache security group.</p>
    pub cache_security_group_name: ::std::option::Option<::std::string::String>,
    /// <p>The description of the cache security group.</p>
    pub description: ::std::option::Option<::std::string::String>,
    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
    pub ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
    /// <p>The ARN of the cache security group,</p>
    pub arn: ::std::option::Option<::std::string::String>,
}
impl CacheSecurityGroup {
    /// <p>The Amazon account ID of the cache security group owner.</p>
    pub fn owner_id(&self) -> ::std::option::Option<&str> {
        self.owner_id.as_deref()
    }
    /// <p>The name of the cache security group.</p>
    pub fn cache_security_group_name(&self) -> ::std::option::Option<&str> {
        self.cache_security_group_name.as_deref()
    }
    /// <p>The description of the cache security group.</p>
    pub fn description(&self) -> ::std::option::Option<&str> {
        self.description.as_deref()
    }
    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
    ///
    /// 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()`.
    pub fn ec2_security_groups(&self) -> &[crate::types::Ec2SecurityGroup] {
        self.ec2_security_groups.as_deref().unwrap_or_default()
    }
    /// <p>The ARN of the cache security group,</p>
    pub fn arn(&self) -> ::std::option::Option<&str> {
        self.arn.as_deref()
    }
}
impl CacheSecurityGroup {
    /// Creates a new builder-style object to manufacture [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
    pub fn builder() -> crate::types::builders::CacheSecurityGroupBuilder {
        crate::types::builders::CacheSecurityGroupBuilder::default()
    }
}

/// A builder for [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CacheSecurityGroupBuilder {
    pub(crate) owner_id: ::std::option::Option<::std::string::String>,
    pub(crate) cache_security_group_name: ::std::option::Option<::std::string::String>,
    pub(crate) description: ::std::option::Option<::std::string::String>,
    pub(crate) ec2_security_groups: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>,
    pub(crate) arn: ::std::option::Option<::std::string::String>,
}
impl CacheSecurityGroupBuilder {
    /// <p>The Amazon account ID of the cache security group owner.</p>
    pub fn owner_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.owner_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The Amazon account ID of the cache security group owner.</p>
    pub fn set_owner_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.owner_id = input;
        self
    }
    /// <p>The Amazon account ID of the cache security group owner.</p>
    pub fn get_owner_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.owner_id
    }
    /// <p>The name of the cache security group.</p>
    pub fn cache_security_group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.cache_security_group_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the cache security group.</p>
    pub fn set_cache_security_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.cache_security_group_name = input;
        self
    }
    /// <p>The name of the cache security group.</p>
    pub fn get_cache_security_group_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.cache_security_group_name
    }
    /// <p>The description of the cache security group.</p>
    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.description = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The description of the cache security group.</p>
    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.description = input;
        self
    }
    /// <p>The description of the cache security group.</p>
    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
        &self.description
    }
    /// Appends an item to `ec2_security_groups`.
    ///
    /// To override the contents of this collection use [`set_ec2_security_groups`](Self::set_ec2_security_groups).
    ///
    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
    pub fn ec2_security_groups(mut self, input: crate::types::Ec2SecurityGroup) -> Self {
        let mut v = self.ec2_security_groups.unwrap_or_default();
        v.push(input);
        self.ec2_security_groups = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
    pub fn set_ec2_security_groups(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>>) -> Self {
        self.ec2_security_groups = input;
        self
    }
    /// <p>A list of Amazon EC2 security groups that are associated with this cache security group.</p>
    pub fn get_ec2_security_groups(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Ec2SecurityGroup>> {
        &self.ec2_security_groups
    }
    /// <p>The ARN of the cache security group,</p>
    pub fn arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.arn = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ARN of the cache security group,</p>
    pub fn set_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.arn = input;
        self
    }
    /// <p>The ARN of the cache security group,</p>
    pub fn get_arn(&self) -> &::std::option::Option<::std::string::String> {
        &self.arn
    }
    /// Consumes the builder and constructs a [`CacheSecurityGroup`](crate::types::CacheSecurityGroup).
    pub fn build(self) -> crate::types::CacheSecurityGroup {
        crate::types::CacheSecurityGroup {
            owner_id: self.owner_id,
            cache_security_group_name: self.cache_security_group_name,
            description: self.description,
            ec2_security_groups: self.ec2_security_groups,
            arn: self.arn,
        }
    }
}