aws_sdk_rbin/operation/get_rule/
_get_rule_output.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 GetRuleOutput {
6    /// <p>The unique ID of the retention rule.</p>
7    pub identifier: ::std::option::Option<::std::string::String>,
8    /// <p>The retention rule description.</p>
9    pub description: ::std::option::Option<::std::string::String>,
10    /// <p>The resource type retained by the retention rule.</p>
11    pub resource_type: ::std::option::Option<crate::types::ResourceType>,
12    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
13    pub retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
14    /// <p>\[Tag-level retention rules only\] Information about the resource tags used to identify resources that are retained by the retention rule.</p>
15    pub resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
16    /// <p>The state of the retention rule. Only retention rules that are in the <code>available</code> state retain resources.</p>
17    pub status: ::std::option::Option<crate::types::RuleStatus>,
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\] The lock state for the retention rule.</p>
21    /// <ul>
22    /// <li>
23    /// <p><code>locked</code> - The retention rule is locked and can't be modified or deleted.</p></li>
24    /// <li>
25    /// <p><code>pending_unlock</code> - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.</p></li>
26    /// <li>
27    /// <p><code>unlocked</code> - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.</p></li>
28    /// <li>
29    /// <p><code>null</code> - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the <code>locked</code> and <code>unlocked</code> states only; it can never transition back to <code>null</code>.</p></li>
30    /// </ul>
31    pub lock_state: ::std::option::Option<crate::types::LockState>,
32    /// <p>The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.</p>
33    pub lock_end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
34    /// <p>The Amazon Resource Name (ARN) of the retention rule.</p>
35    pub rule_arn: ::std::option::Option<::std::string::String>,
36    /// <p>\[Region-level retention rules only\] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.</p>
37    pub exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
38    _request_id: Option<String>,
39}
40impl GetRuleOutput {
41    /// <p>The unique ID of the retention rule.</p>
42    pub fn identifier(&self) -> ::std::option::Option<&str> {
43        self.identifier.as_deref()
44    }
45    /// <p>The retention rule description.</p>
46    pub fn description(&self) -> ::std::option::Option<&str> {
47        self.description.as_deref()
48    }
49    /// <p>The resource type retained by the retention rule.</p>
50    pub fn resource_type(&self) -> ::std::option::Option<&crate::types::ResourceType> {
51        self.resource_type.as_ref()
52    }
53    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
54    pub fn retention_period(&self) -> ::std::option::Option<&crate::types::RetentionPeriod> {
55        self.retention_period.as_ref()
56    }
57    /// <p>\[Tag-level retention rules only\] Information about the resource tags used to identify resources that are retained by the retention rule.</p>
58    ///
59    /// 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()`.
60    pub fn resource_tags(&self) -> &[crate::types::ResourceTag] {
61        self.resource_tags.as_deref().unwrap_or_default()
62    }
63    /// <p>The state of the retention rule. Only retention rules that are in the <code>available</code> state retain resources.</p>
64    pub fn status(&self) -> ::std::option::Option<&crate::types::RuleStatus> {
65        self.status.as_ref()
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\] The lock state for the retention rule.</p>
72    /// <ul>
73    /// <li>
74    /// <p><code>locked</code> - The retention rule is locked and can't be modified or deleted.</p></li>
75    /// <li>
76    /// <p><code>pending_unlock</code> - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.</p></li>
77    /// <li>
78    /// <p><code>unlocked</code> - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.</p></li>
79    /// <li>
80    /// <p><code>null</code> - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the <code>locked</code> and <code>unlocked</code> states only; it can never transition back to <code>null</code>.</p></li>
81    /// </ul>
82    pub fn lock_state(&self) -> ::std::option::Option<&crate::types::LockState> {
83        self.lock_state.as_ref()
84    }
85    /// <p>The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.</p>
86    pub fn lock_end_time(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
87        self.lock_end_time.as_ref()
88    }
89    /// <p>The Amazon Resource Name (ARN) of the retention rule.</p>
90    pub fn rule_arn(&self) -> ::std::option::Option<&str> {
91        self.rule_arn.as_deref()
92    }
93    /// <p>\[Region-level retention rules only\] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.</p>
94    ///
95    /// 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()`.
96    pub fn exclude_resource_tags(&self) -> &[crate::types::ResourceTag] {
97        self.exclude_resource_tags.as_deref().unwrap_or_default()
98    }
99}
100impl ::aws_types::request_id::RequestId for GetRuleOutput {
101    fn request_id(&self) -> Option<&str> {
102        self._request_id.as_deref()
103    }
104}
105impl GetRuleOutput {
106    /// Creates a new builder-style object to manufacture [`GetRuleOutput`](crate::operation::get_rule::GetRuleOutput).
107    pub fn builder() -> crate::operation::get_rule::builders::GetRuleOutputBuilder {
108        crate::operation::get_rule::builders::GetRuleOutputBuilder::default()
109    }
110}
111
112/// A builder for [`GetRuleOutput`](crate::operation::get_rule::GetRuleOutput).
113#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
114#[non_exhaustive]
115pub struct GetRuleOutputBuilder {
116    pub(crate) identifier: ::std::option::Option<::std::string::String>,
117    pub(crate) description: ::std::option::Option<::std::string::String>,
118    pub(crate) resource_type: ::std::option::Option<crate::types::ResourceType>,
119    pub(crate) retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
120    pub(crate) resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
121    pub(crate) status: ::std::option::Option<crate::types::RuleStatus>,
122    pub(crate) lock_configuration: ::std::option::Option<crate::types::LockConfiguration>,
123    pub(crate) lock_state: ::std::option::Option<crate::types::LockState>,
124    pub(crate) lock_end_time: ::std::option::Option<::aws_smithy_types::DateTime>,
125    pub(crate) rule_arn: ::std::option::Option<::std::string::String>,
126    pub(crate) exclude_resource_tags: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>,
127    _request_id: Option<String>,
128}
129impl GetRuleOutputBuilder {
130    /// <p>The unique ID of the retention rule.</p>
131    pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.identifier = ::std::option::Option::Some(input.into());
133        self
134    }
135    /// <p>The unique ID of the retention rule.</p>
136    pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.identifier = input;
138        self
139    }
140    /// <p>The unique ID of the retention rule.</p>
141    pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
142        &self.identifier
143    }
144    /// <p>The retention rule description.</p>
145    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.description = ::std::option::Option::Some(input.into());
147        self
148    }
149    /// <p>The retention rule description.</p>
150    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.description = input;
152        self
153    }
154    /// <p>The retention rule description.</p>
155    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
156        &self.description
157    }
158    /// <p>The resource type retained by the retention rule.</p>
159    pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
160        self.resource_type = ::std::option::Option::Some(input);
161        self
162    }
163    /// <p>The resource type retained by the retention rule.</p>
164    pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
165        self.resource_type = input;
166        self
167    }
168    /// <p>The resource type retained by the retention rule.</p>
169    pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
170        &self.resource_type
171    }
172    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
173    pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
174        self.retention_period = ::std::option::Option::Some(input);
175        self
176    }
177    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
178    pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
179        self.retention_period = input;
180        self
181    }
182    /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
183    pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
184        &self.retention_period
185    }
186    /// Appends an item to `resource_tags`.
187    ///
188    /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
189    ///
190    /// <p>\[Tag-level retention rules only\] Information about the resource tags used to identify resources that are retained by the retention rule.</p>
191    pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
192        let mut v = self.resource_tags.unwrap_or_default();
193        v.push(input);
194        self.resource_tags = ::std::option::Option::Some(v);
195        self
196    }
197    /// <p>\[Tag-level retention rules only\] Information about the resource tags used to identify resources that are retained by the retention rule.</p>
198    pub fn set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
199        self.resource_tags = input;
200        self
201    }
202    /// <p>\[Tag-level retention rules only\] Information about the resource tags used to identify resources that are retained by the retention rule.</p>
203    pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
204        &self.resource_tags
205    }
206    /// <p>The state of the retention rule. Only retention rules that are in the <code>available</code> state retain resources.</p>
207    pub fn status(mut self, input: crate::types::RuleStatus) -> Self {
208        self.status = ::std::option::Option::Some(input);
209        self
210    }
211    /// <p>The state of the retention rule. Only retention rules that are in the <code>available</code> state retain resources.</p>
212    pub fn set_status(mut self, input: ::std::option::Option<crate::types::RuleStatus>) -> Self {
213        self.status = input;
214        self
215    }
216    /// <p>The state of the retention rule. Only retention rules that are in the <code>available</code> state retain resources.</p>
217    pub fn get_status(&self) -> &::std::option::Option<crate::types::RuleStatus> {
218        &self.status
219    }
220    /// <p>Information about the retention rule lock configuration.</p>
221    pub fn lock_configuration(mut self, input: crate::types::LockConfiguration) -> Self {
222        self.lock_configuration = ::std::option::Option::Some(input);
223        self
224    }
225    /// <p>Information about the retention rule lock configuration.</p>
226    pub fn set_lock_configuration(mut self, input: ::std::option::Option<crate::types::LockConfiguration>) -> Self {
227        self.lock_configuration = input;
228        self
229    }
230    /// <p>Information about the retention rule lock configuration.</p>
231    pub fn get_lock_configuration(&self) -> &::std::option::Option<crate::types::LockConfiguration> {
232        &self.lock_configuration
233    }
234    /// <p>\[Region-level retention rules only\] The lock state for the retention rule.</p>
235    /// <ul>
236    /// <li>
237    /// <p><code>locked</code> - The retention rule is locked and can't be modified or deleted.</p></li>
238    /// <li>
239    /// <p><code>pending_unlock</code> - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.</p></li>
240    /// <li>
241    /// <p><code>unlocked</code> - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.</p></li>
242    /// <li>
243    /// <p><code>null</code> - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the <code>locked</code> and <code>unlocked</code> states only; it can never transition back to <code>null</code>.</p></li>
244    /// </ul>
245    pub fn lock_state(mut self, input: crate::types::LockState) -> Self {
246        self.lock_state = ::std::option::Option::Some(input);
247        self
248    }
249    /// <p>\[Region-level retention rules only\] The lock state for the retention rule.</p>
250    /// <ul>
251    /// <li>
252    /// <p><code>locked</code> - The retention rule is locked and can't be modified or deleted.</p></li>
253    /// <li>
254    /// <p><code>pending_unlock</code> - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.</p></li>
255    /// <li>
256    /// <p><code>unlocked</code> - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.</p></li>
257    /// <li>
258    /// <p><code>null</code> - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the <code>locked</code> and <code>unlocked</code> states only; it can never transition back to <code>null</code>.</p></li>
259    /// </ul>
260    pub fn set_lock_state(mut self, input: ::std::option::Option<crate::types::LockState>) -> Self {
261        self.lock_state = input;
262        self
263    }
264    /// <p>\[Region-level retention rules only\] The lock state for the retention rule.</p>
265    /// <ul>
266    /// <li>
267    /// <p><code>locked</code> - The retention rule is locked and can't be modified or deleted.</p></li>
268    /// <li>
269    /// <p><code>pending_unlock</code> - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired.</p></li>
270    /// <li>
271    /// <p><code>unlocked</code> - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions.</p></li>
272    /// <li>
273    /// <p><code>null</code> - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the <code>locked</code> and <code>unlocked</code> states only; it can never transition back to <code>null</code>.</p></li>
274    /// </ul>
275    pub fn get_lock_state(&self) -> &::std::option::Option<crate::types::LockState> {
276        &self.lock_state
277    }
278    /// <p>The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.</p>
279    pub fn lock_end_time(mut self, input: ::aws_smithy_types::DateTime) -> Self {
280        self.lock_end_time = ::std::option::Option::Some(input);
281        self
282    }
283    /// <p>The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.</p>
284    pub fn set_lock_end_time(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
285        self.lock_end_time = input;
286        self
287    }
288    /// <p>The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.</p>
289    pub fn get_lock_end_time(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
290        &self.lock_end_time
291    }
292    /// <p>The Amazon Resource Name (ARN) of the retention rule.</p>
293    pub fn rule_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
294        self.rule_arn = ::std::option::Option::Some(input.into());
295        self
296    }
297    /// <p>The Amazon Resource Name (ARN) of the retention rule.</p>
298    pub fn set_rule_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
299        self.rule_arn = input;
300        self
301    }
302    /// <p>The Amazon Resource Name (ARN) of the retention rule.</p>
303    pub fn get_rule_arn(&self) -> &::std::option::Option<::std::string::String> {
304        &self.rule_arn
305    }
306    /// Appends an item to `exclude_resource_tags`.
307    ///
308    /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
309    ///
310    /// <p>\[Region-level retention rules only\] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.</p>
311    pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
312        let mut v = self.exclude_resource_tags.unwrap_or_default();
313        v.push(input);
314        self.exclude_resource_tags = ::std::option::Option::Some(v);
315        self
316    }
317    /// <p>\[Region-level retention rules only\] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.</p>
318    pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
319        self.exclude_resource_tags = input;
320        self
321    }
322    /// <p>\[Region-level retention rules only\] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.</p>
323    pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
324        &self.exclude_resource_tags
325    }
326    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
327        self._request_id = Some(request_id.into());
328        self
329    }
330
331    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
332        self._request_id = request_id;
333        self
334    }
335    /// Consumes the builder and constructs a [`GetRuleOutput`](crate::operation::get_rule::GetRuleOutput).
336    pub fn build(self) -> crate::operation::get_rule::GetRuleOutput {
337        crate::operation::get_rule::GetRuleOutput {
338            identifier: self.identifier,
339            description: self.description,
340            resource_type: self.resource_type,
341            retention_period: self.retention_period,
342            resource_tags: self.resource_tags,
343            status: self.status,
344            lock_configuration: self.lock_configuration,
345            lock_state: self.lock_state,
346            lock_end_time: self.lock_end_time,
347            rule_arn: self.rule_arn,
348            exclude_resource_tags: self.exclude_resource_tags,
349            _request_id: self._request_id,
350        }
351    }
352}