aws_sdk_rbin/operation/update_rule/
_update_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 UpdateRuleInput {
6    /// <p>The unique ID of the retention rule.</p>
7    pub identifier: ::std::option::Option<::std::string::String>,
8    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
9    pub retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
10    /// <p>The retention rule description.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <note>
13    /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
14    /// </note>
15    pub resource_type: ::std::option::Option<crate::types::ResourceType>,
16    /// <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>
17    /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
18    /// <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>
19    pub resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
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 UpdateRuleInput {
25    /// <p>The unique ID of the retention rule.</p>
26    pub fn identifier(&self) -> ::std::option::Option<&str> {
27        self.identifier.as_deref()
28    }
29    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
30    pub fn retention_period(&self) -> ::std::option::Option<&crate::types::RetentionPeriod> {
31        self.retention_period.as_ref()
32    }
33    /// <p>The retention rule description.</p>
34    pub fn description(&self) -> ::std::option::Option<&str> {
35        self.description.as_deref()
36    }
37    /// <note>
38    /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
39    /// </note>
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>\[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>
52    /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
53    ///
54    /// 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()`.
55    pub fn exclude_resource_tags(&self) -> &[crate::types::ResourceTag] {
56        self.exclude_resource_tags.as_deref().unwrap_or_default()
57    }
58}
59impl UpdateRuleInput {
60    /// Creates a new builder-style object to manufacture [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
61    pub fn builder() -> crate::operation::update_rule::builders::UpdateRuleInputBuilder {
62        crate::operation::update_rule::builders::UpdateRuleInputBuilder::default()
63    }
64}
65
66/// A builder for [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct UpdateRuleInputBuilder {
70    pub(crate) identifier: ::std::option::Option<::std::string::String>,
71    pub(crate) retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
72    pub(crate) description: ::std::option::Option<::std::string::String>,
73    pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
74    pub(crate) resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
75    pub(crate) exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
76}
77impl UpdateRuleInputBuilder {
78    /// <p>The unique ID of the retention rule.</p>
79    /// This field is required.
80    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
81        self.identifier = ::std::option::Option::Some(input.into());
82        self
83    }
84    /// <p>The unique ID of the retention rule.</p>
85    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
86        self.identifier = input;
87        self
88    }
89    /// <p>The unique ID of the retention rule.</p>
90    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
91        &self.identifier
92    }
93    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
94    pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
95        self.retention_period = ::std::option::Option::Some(input);
96        self
97    }
98    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
99    pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
100        self.retention_period = input;
101        self
102    }
103    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
104    pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
105        &self.retention_period
106    }
107    /// <p>The retention rule description.</p>
108    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.description = ::std::option::Option::Some(input.into());
110        self
111    }
112    /// <p>The retention rule description.</p>
113    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.description = input;
115        self
116    }
117    /// <p>The retention rule description.</p>
118    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
119        &self.description
120    }
121    /// <note>
122    /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
123    /// </note>
124    pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
125        self.resource_type = ::std::option::Option::Some(input);
126        self
127    }
128    /// <note>
129    /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
130    /// </note>
131    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
132        self.resource_type = input;
133        self
134    }
135    /// <note>
136    /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
137    /// </note>
138    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
139        &self.resource_type
140    }
141    /// Appends an item to `resource_tags`.
142    ///
143    /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
144    ///
145    /// <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>
146    /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
147    /// <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>
148    pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
149        let mut v = self.resource_tags.unwrap_or_default();
150        v.push(input);
151        self.resource_tags = ::std::option::Option::Some(v);
152        self
153    }
154    /// <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>
155    /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
156    /// <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>
157    pub fn set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
158        self.resource_tags = input;
159        self
160    }
161    /// <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>
162    /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
163    /// <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>
164    pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
165        &self.resource_tags
166    }
167    /// Appends an item to `exclude_resource_tags`.
168    ///
169    /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
170    ///
171    /// <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>
172    /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
173    pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
174        let mut v = self.exclude_resource_tags.unwrap_or_default();
175        v.push(input);
176        self.exclude_resource_tags = ::std::option::Option::Some(v);
177        self
178    }
179    /// <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>
180    /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
181    pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
182        self.exclude_resource_tags = input;
183        self
184    }
185    /// <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>
186    /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
187    pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
188        &self.exclude_resource_tags
189    }
190    /// Consumes the builder and constructs a [`UpdateRuleInput`](crate::operation::update_rule::UpdateRuleInput).
191    pub fn build(self) -> ::std::result::Result<crate::operation::update_rule::UpdateRuleInput, ::aws_smithy_types::error::operation::BuildError> {
192        ::std::result::Result::Ok(crate::operation::update_rule::UpdateRuleInput {
193            identifier: self.identifier,
194            retention_period: self.retention_period,
195            description: self.description,
196            resource_type: self.resource_type,
197            resource_tags: self.resource_tags,
198            exclude_resource_tags: self.exclude_resource_tags,
199        })
200    }
201}