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 Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify <code>EBS_SNAPSHOT</code>. To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p>
13 pub resource_type: ::std::option::Option<crate::types::ResourceType>,
14 /// <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>
15 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
16 /// <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>
17 pub resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
18 /// <p>Information about the retention rule lock configuration.</p>
19 pub lock_configuration: ::std::option::Option<crate::types::LockConfiguration>,
20 /// <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>
21 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
22 pub exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
23}
24impl CreateRuleInput {
25 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
26 pub fn retention_period(&self) -> ::std::option::Option<&crate::types::RetentionPeriod> {
27 self.retention_period.as_ref()
28 }
29 /// <p>The retention rule description.</p>
30 pub fn description(&self) -> ::std::option::Option<&str> {
31 self.description.as_deref()
32 }
33 /// <p>Information about the tags to assign to the retention rule.</p>
34 ///
35 /// 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()`.
36 pub fn tags(&self) -> &[crate::types::Tag] {
37 self.tags.as_deref().unwrap_or_default()
38 }
39 /// <p>The resource type to be retained by the retention rule. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify <code>EBS_SNAPSHOT</code>. To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p>
40 pub fn resource_type(&self) -> ::std::option::Option<&crate::types::ResourceType> {
41 self.resource_type.as_ref()
42 }
43 /// <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>
44 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
45 /// <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>
46 ///
47 /// 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()`.
48 pub fn resource_tags(&self) -> &[crate::types::ResourceTag] {
49 self.resource_tags.as_deref().unwrap_or_default()
50 }
51 /// <p>Information about the retention rule lock configuration.</p>
52 pub fn lock_configuration(&self) -> ::std::option::Option<&crate::types::LockConfiguration> {
53 self.lock_configuration.as_ref()
54 }
55 /// <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>
56 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
57 ///
58 /// 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()`.
59 pub fn exclude_resource_tags(&self) -> &[crate::types::ResourceTag] {
60 self.exclude_resource_tags.as_deref().unwrap_or_default()
61 }
62}
63impl CreateRuleInput {
64 /// Creates a new builder-style object to manufacture [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
65 pub fn builder() -> crate::operation::create_rule::builders::CreateRuleInputBuilder {
66 crate::operation::create_rule::builders::CreateRuleInputBuilder::default()
67 }
68}
69
70/// A builder for [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
71#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
72#[non_exhaustive]
73pub struct CreateRuleInputBuilder {
74 pub(crate) retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
75 pub(crate) description: ::std::option::Option<::std::string::String>,
76 pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
77 pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
78 pub(crate) resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
79 pub(crate) lock_configuration: ::std::option::Option<crate::types::LockConfiguration>,
80 pub(crate) exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
81}
82impl CreateRuleInputBuilder {
83 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
84 /// This field is required.
85 pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
86 self.retention_period = ::std::option::Option::Some(input);
87 self
88 }
89 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
90 pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
91 self.retention_period = input;
92 self
93 }
94 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
95 pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
96 &self.retention_period
97 }
98 /// <p>The retention rule description.</p>
99 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100 self.description = ::std::option::Option::Some(input.into());
101 self
102 }
103 /// <p>The retention rule description.</p>
104 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105 self.description = input;
106 self
107 }
108 /// <p>The retention rule description.</p>
109 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
110 &self.description
111 }
112 /// Appends an item to `tags`.
113 ///
114 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
115 ///
116 /// <p>Information about the tags to assign to the retention rule.</p>
117 pub fn tags(mut self, input: crate::types::Tag) -> Self {
118 let mut v = self.tags.unwrap_or_default();
119 v.push(input);
120 self.tags = ::std::option::Option::Some(v);
121 self
122 }
123 /// <p>Information about the tags to assign to the retention rule.</p>
124 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
125 self.tags = input;
126 self
127 }
128 /// <p>Information about the tags to assign to the retention rule.</p>
129 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
130 &self.tags
131 }
132 /// <p>The resource type to be retained by the retention rule. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify <code>EBS_SNAPSHOT</code>. To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p>
133 /// This field is required.
134 pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
135 self.resource_type = ::std::option::Option::Some(input);
136 self
137 }
138 /// <p>The resource type to be retained by the retention rule. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify <code>EBS_SNAPSHOT</code>. To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p>
139 pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
140 self.resource_type = input;
141 self
142 }
143 /// <p>The resource type to be retained by the retention rule. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify <code>EBS_SNAPSHOT</code>. To retain EBS-backed AMIs, specify <code>EC2_IMAGE</code>.</p>
144 pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
145 &self.resource_type
146 }
147 /// Appends an item to `resource_tags`.
148 ///
149 /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
150 ///
151 /// <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>
152 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
153 /// <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>
154 pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
155 let mut v = self.resource_tags.unwrap_or_default();
156 v.push(input);
157 self.resource_tags = ::std::option::Option::Some(v);
158 self
159 }
160 /// <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>
161 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
162 /// <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>
163 pub fn set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
164 self.resource_tags = input;
165 self
166 }
167 /// <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>
168 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
169 /// <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>
170 pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
171 &self.resource_tags
172 }
173 /// <p>Information about the retention rule lock configuration.</p>
174 pub fn lock_configuration(mut self, input: crate::types::LockConfiguration) -> Self {
175 self.lock_configuration = ::std::option::Option::Some(input);
176 self
177 }
178 /// <p>Information about the retention rule lock configuration.</p>
179 pub fn set_lock_configuration(mut self, input: ::std::option::Option<crate::types::LockConfiguration>) -> Self {
180 self.lock_configuration = input;
181 self
182 }
183 /// <p>Information about the retention rule lock configuration.</p>
184 pub fn get_lock_configuration(&self) -> &::std::option::Option<crate::types::LockConfiguration> {
185 &self.lock_configuration
186 }
187 /// Appends an item to `exclude_resource_tags`.
188 ///
189 /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
190 ///
191 /// <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>
192 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
193 pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
194 let mut v = self.exclude_resource_tags.unwrap_or_default();
195 v.push(input);
196 self.exclude_resource_tags = ::std::option::Option::Some(v);
197 self
198 }
199 /// <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>
200 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
201 pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
202 self.exclude_resource_tags = input;
203 self
204 }
205 /// <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>
206 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
207 pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
208 &self.exclude_resource_tags
209 }
210 /// Consumes the builder and constructs a [`CreateRuleInput`](crate::operation::create_rule::CreateRuleInput).
211 pub fn build(self) -> ::std::result::Result<crate::operation::create_rule::CreateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
212 ::std::result::Result::Ok(crate::operation::create_rule::CreateRuleInput {
213 retention_period: self.retention_period,
214 description: self.description,
215 tags: self.tags,
216 resource_type: self.resource_type,
217 resource_tags: self.resource_tags,
218 lock_configuration: self.lock_configuration,
219 exclude_resource_tags: self.exclude_resource_tags,
220 })
221 }
222}