aws_sdk_rbin/operation/create_rule/_create_rule_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 CreateRuleInput {
6 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
7 pub retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
8 /// <p>The retention rule description.</p>
9 pub description: ::std::option::Option<::std::string::String>,
10 /// <p>Information about the tags to assign to the retention rule.</p>
11 pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
12 /// <p>The resource type to be retained by the retention rule. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.</p>
13 /// <ul>
14 /// <li>
15 /// <p>To retain EBS volumes, specify <code>EBS_VOLUME</code>.</p></li>
16 /// <li>
17 /// <p>To retain EBS snapshots, specify <code>EBS_SNAPSHOT</code></p></li>
18 /// <li>
19 /// <p>To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p></li>
20 /// </ul>
21 pub resource_type: ::std::option::Option<crate::types::ResourceType>,
22 /// <p>\[Tag-level retention rules only\] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.</p>
23 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
24 /// <p>To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.</p>
25 pub resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
26 /// <p>Information about the retention rule lock configuration.</p>
27 pub lock_configuration: ::std::option::Option<crate::types::LockConfiguration>,
28 /// <p>\[Region-level retention rules only\] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.</p>
29 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
30 pub exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
31}
32impl CreateRuleInput {
33 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
34 pub fn retention_period(&self) -> ::std::option::Option<&crate::types::RetentionPeriod> {
35 self.retention_period.as_ref()
36 }
37 /// <p>The retention rule description.</p>
38 pub fn description(&self) -> ::std::option::Option<&str> {
39 self.description.as_deref()
40 }
41 /// <p>Information about the tags to assign to the retention rule.</p>
42 ///
43 /// 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()`.
44 pub fn tags(&self) -> &[crate::types::Tag] {
45 self.tags.as_deref().unwrap_or_default()
46 }
47 /// <p>The resource type to be retained by the retention rule. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.</p>
48 /// <ul>
49 /// <li>
50 /// <p>To retain EBS volumes, specify <code>EBS_VOLUME</code>.</p></li>
51 /// <li>
52 /// <p>To retain EBS snapshots, specify <code>EBS_SNAPSHOT</code></p></li>
53 /// <li>
54 /// <p>To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p></li>
55 /// </ul>
56 pub fn resource_type(&self) -> ::std::option::Option<&crate::types::ResourceType> {
57 self.resource_type.as_ref()
58 }
59 /// <p>\[Tag-level retention rules only\] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.</p>
60 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
61 /// <p>To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.</p>
62 ///
63 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.resource_tags.is_none()`.
64 pub fn resource_tags(&self) -> &[crate::types::ResourceTag] {
65 self.resource_tags.as_deref().unwrap_or_default()
66 }
67 /// <p>Information about the retention rule lock configuration.</p>
68 pub fn lock_configuration(&self) -> ::std::option::Option<&crate::types::LockConfiguration> {
69 self.lock_configuration.as_ref()
70 }
71 /// <p>\[Region-level retention rules only\] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.</p>
72 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
73 ///
74 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.exclude_resource_tags.is_none()`.
75 pub fn exclude_resource_tags(&self) -> &[crate::types::ResourceTag] {
76 self.exclude_resource_tags.as_deref().unwrap_or_default()
77 }
78}
79impl CreateRuleInput {
80 /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
81 pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
82 crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
83 }
84}
85
86/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
87#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
88#[non_exhaustive]
89pub struct CreateRuleInputBuilder {
90 pub(crate) retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
91 pub(crate) description: ::std::option::Option<::std::string::String>,
92 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
93 pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
94 pub(crate) resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
95 pub(crate) lock_configuration: ::std::option::Option<crate::types::LockConfiguration>,
96 pub(crate) exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
97}
98impl CreateRuleInputBuilder {
99 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
100 /// This field is required.
101 pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
102 self.retention_period = ::std::option::Option::Some(input);
103 self
104 }
105 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
106 pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
107 self.retention_period = input;
108 self
109 }
110 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
111 pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
112 &self.retention_period
113 }
114 /// <p>The retention rule description.</p>
115 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116 self.description = ::std::option::Option::Some(input.into());
117 self
118 }
119 /// <p>The retention rule description.</p>
120 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121 self.description = input;
122 self
123 }
124 /// <p>The retention rule description.</p>
125 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
126 &self.description
127 }
128 /// Appends an item to `tags`.
129 ///
130 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
131 ///
132 /// <p>Information about the tags to assign to the retention rule.</p>
133 pub fn tags(mut self, input: crate::types::Tag) -> Self {
134 let mut v = self.tags.unwrap_or_default();
135 v.push(input);
136 self.tags = ::std::option::Option::Some(v);
137 self
138 }
139 /// <p>Information about the tags to assign to the retention rule.</p>
140 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
141 self.tags = input;
142 self
143 }
144 /// <p>Information about the tags to assign to the retention rule.</p>
145 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
146 &self.tags
147 }
148 /// <p>The resource type to be retained by the retention rule. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.</p>
149 /// <ul>
150 /// <li>
151 /// <p>To retain EBS volumes, specify <code>EBS_VOLUME</code>.</p></li>
152 /// <li>
153 /// <p>To retain EBS snapshots, specify <code>EBS_SNAPSHOT</code></p></li>
154 /// <li>
155 /// <p>To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p></li>
156 /// </ul>
157 /// This field is required.
158 pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
159 self.resource_type = ::std::option::Option::Some(input);
160 self
161 }
162 /// <p>The resource type to be retained by the retention rule. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.</p>
163 /// <ul>
164 /// <li>
165 /// <p>To retain EBS volumes, specify <code>EBS_VOLUME</code>.</p></li>
166 /// <li>
167 /// <p>To retain EBS snapshots, specify <code>EBS_SNAPSHOT</code></p></li>
168 /// <li>
169 /// <p>To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p></li>
170 /// </ul>
171 pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
172 self.resource_type = input;
173 self
174 }
175 /// <p>The resource type to be retained by the retention rule. Currently, only EBS volumes, EBS snapshots, and EBS-backed AMIs are supported.</p>
176 /// <ul>
177 /// <li>
178 /// <p>To retain EBS volumes, specify <code>EBS_VOLUME</code>.</p></li>
179 /// <li>
180 /// <p>To retain EBS snapshots, specify <code>EBS_SNAPSHOT</code></p></li>
181 /// <li>
182 /// <p>To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p></li>
183 /// </ul>
184 pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
185 &self.resource_type
186 }
187 /// Appends an item to `resource_tags`.
188 ///
189 /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
190 ///
191 /// <p>\[Tag-level retention rules only\] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.</p>
192 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
193 /// <p>To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.</p>
194 pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
195 let mut v = self.resource_tags.unwrap_or_default();
196 v.push(input);
197 self.resource_tags = ::std::option::Option::Some(v);
198 self
199 }
200 /// <p>\[Tag-level retention rules only\] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.</p>
201 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
202 /// <p>To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.</p>
203 pub fn set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
204 self.resource_tags = input;
205 self
206 }
207 /// <p>\[Tag-level retention rules only\] Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.</p>
208 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
209 /// <p>To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.</p>
210 pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
211 &self.resource_tags
212 }
213 /// <p>Information about the retention rule lock configuration.</p>
214 pub fn lock_configuration(mut self, input: crate::types::LockConfiguration) -> Self {
215 self.lock_configuration = ::std::option::Option::Some(input);
216 self
217 }
218 /// <p>Information about the retention rule lock configuration.</p>
219 pub fn set_lock_configuration(mut self, input: ::std::option::Option<crate::types::LockConfiguration>) -> Self {
220 self.lock_configuration = input;
221 self
222 }
223 /// <p>Information about the retention rule lock configuration.</p>
224 pub fn get_lock_configuration(&self) -> &::std::option::Option<crate::types::LockConfiguration> {
225 &self.lock_configuration
226 }
227 /// Appends an item to `exclude_resource_tags`.
228 ///
229 /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
230 ///
231 /// <p>\[Region-level retention rules only\] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.</p>
232 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
233 pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
234 let mut v = self.exclude_resource_tags.unwrap_or_default();
235 v.push(input);
236 self.exclude_resource_tags = ::std::option::Option::Some(v);
237 self
238 }
239 /// <p>\[Region-level retention rules only\] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.</p>
240 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
241 pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
242 self.exclude_resource_tags = input;
243 self
244 }
245 /// <p>\[Region-level retention rules only\] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.</p>
246 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
247 pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
248 &self.exclude_resource_tags
249 }
250 /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
251 pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
252 ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
253 retention_period: self.retention_period,
254 description: self.description,
255 tags: self.tags,
256 resource_type: self.resource_type,
257 resource_tags: self.resource_tags,
258 lock_configuration: self.lock_configuration,
259 exclude_resource_tags: self.exclude_resource_tags,
260 })
261 }
262}