aws_sdk_rbin/operation/update_rule/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_rule::_update_rule_output::UpdateRuleOutputBuilder;
3
4pub use crate::operation::update_rule::_update_rule_input::UpdateRuleInputBuilder;
5
6impl crate::operation::update_rule::builders::UpdateRuleInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::update_rule::UpdateRuleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_rule::UpdateRuleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_rule();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateRule`.
24///
25/// <p>Updates an existing Recycle Bin retention rule. You can update a retention rule's description, resource tags, and retention period at any time after creation. You can't update a retention rule's resource type after creation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule"> Update Recycle Bin retention rules</a> in the <i>Amazon Elastic Compute Cloud User Guide</i>.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct UpdateRuleFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::update_rule::builders::UpdateRuleInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33 crate::client::customize::internal::CustomizableSend<
34 crate::operation::update_rule::UpdateRuleOutput,
35 crate::operation::update_rule::UpdateRuleError,
36 > for UpdateRuleFluentBuilder
37{
38 fn send(
39 self,
40 config_override: crate::config::Builder,
41 ) -> crate::client::customize::internal::BoxFuture<
42 crate::client::customize::internal::SendResult<
43 crate::operation::update_rule::UpdateRuleOutput,
44 crate::operation::update_rule::UpdateRuleError,
45 >,
46 > {
47 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48 }
49}
50impl UpdateRuleFluentBuilder {
51 /// Creates a new `UpdateRuleFluentBuilder`.
52 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53 Self {
54 handle,
55 inner: ::std::default::Default::default(),
56 config_override: ::std::option::Option::None,
57 }
58 }
59 /// Access the UpdateRule as a reference.
60 pub fn as_input(&self) -> &crate::operation::update_rule::builders::UpdateRuleInputBuilder {
61 &self.inner
62 }
63 /// Sends the request and returns the response.
64 ///
65 /// If an error occurs, an `SdkError` will be returned with additional details that
66 /// can be matched against.
67 ///
68 /// By default, any retryable failures will be retried twice. Retry behavior
69 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70 /// set when configuring the client.
71 pub async fn send(
72 self,
73 ) -> ::std::result::Result<
74 crate::operation::update_rule::UpdateRuleOutput,
75 ::aws_smithy_runtime_api::client::result::SdkError<
76 crate::operation::update_rule::UpdateRuleError,
77 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78 >,
79 > {
80 let input = self
81 .inner
82 .build()
83 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84 let runtime_plugins = crate::operation::update_rule::UpdateRule::operation_runtime_plugins(
85 self.handle.runtime_plugins.clone(),
86 &self.handle.conf,
87 self.config_override,
88 );
89 crate::operation::update_rule::UpdateRule::orchestrate(&runtime_plugins, input).await
90 }
91
92 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93 pub fn customize(
94 self,
95 ) -> crate::client::customize::CustomizableOperation<
96 crate::operation::update_rule::UpdateRuleOutput,
97 crate::operation::update_rule::UpdateRuleError,
98 Self,
99 > {
100 crate::client::customize::CustomizableOperation::new(self)
101 }
102 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103 self.set_config_override(::std::option::Option::Some(config_override.into()));
104 self
105 }
106
107 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108 self.config_override = config_override;
109 self
110 }
111 /// <p>The unique ID of the retention rule.</p>
112 pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113 self.inner = self.inner.identifier(input.into());
114 self
115 }
116 /// <p>The unique ID of the retention rule.</p>
117 pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118 self.inner = self.inner.set_identifier(input);
119 self
120 }
121 /// <p>The unique ID of the retention rule.</p>
122 pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
123 self.inner.get_identifier()
124 }
125 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
126 pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
127 self.inner = self.inner.retention_period(input);
128 self
129 }
130 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
131 pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
132 self.inner = self.inner.set_retention_period(input);
133 self
134 }
135 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
136 pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
137 self.inner.get_retention_period()
138 }
139 /// <p>The retention rule description.</p>
140 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141 self.inner = self.inner.description(input.into());
142 self
143 }
144 /// <p>The retention rule description.</p>
145 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146 self.inner = self.inner.set_description(input);
147 self
148 }
149 /// <p>The retention rule description.</p>
150 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
151 self.inner.get_description()
152 }
153 /// <note>
154 /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
155 /// </note>
156 pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
157 self.inner = self.inner.resource_type(input);
158 self
159 }
160 /// <note>
161 /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
162 /// </note>
163 pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
164 self.inner = self.inner.set_resource_type(input);
165 self
166 }
167 /// <note>
168 /// <p>This parameter is currently not supported. You can't update a retention rule's resource type after creation.</p>
169 /// </note>
170 pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
171 self.inner.get_resource_type()
172 }
173 ///
174 /// Appends an item to `ResourceTags`.
175 ///
176 /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
177 ///
178 /// <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>
179 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
180 /// <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>
181 pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
182 self.inner = self.inner.resource_tags(input);
183 self
184 }
185 /// <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>
186 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
187 /// <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>
188 pub fn set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
189 self.inner = self.inner.set_resource_tags(input);
190 self
191 }
192 /// <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>
193 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
194 /// <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>
195 pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
196 self.inner.get_resource_tags()
197 }
198 ///
199 /// Appends an item to `ExcludeResourceTags`.
200 ///
201 /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
202 ///
203 /// <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>
204 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
205 pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
206 self.inner = self.inner.exclude_resource_tags(input);
207 self
208 }
209 /// <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>
210 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
211 pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
212 self.inner = self.inner.set_exclude_resource_tags(input);
213 self
214 }
215 /// <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>
216 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
217 pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
218 self.inner.get_exclude_resource_tags()
219 }
220}