aws_sdk_rbin/operation/create_rule/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_rule::_create_rule_output::CreateRuleOutputBuilder;
3
4pub use crate::operation::create_rule::_create_rule_input::CreateRuleInputBuilder;
5
6impl crate::operation::create_rule::builders::CreateRuleInputBuilder {
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::create_rule::CreateRuleOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_rule::CreateRuleError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_rule();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateRule`.
24///
25/// <p>Creates a Recycle Bin retention rule. You can create two types of retention rules:</p>
26/// <ul>
27/// <li>
28/// <p><b>Tag-level retention rules</b> - These retention rules use resource tags to identify the resources to protect. For each retention rule, you specify one or more tag key and value pairs. Resources (of the specified type) that have at least one of these tag key and value pairs are automatically retained in the Recycle Bin upon deletion. Use this type of retention rule to protect specific resources in your account based on their tags.</p></li>
29/// <li>
30/// <p><b>Region-level retention rules</b> - These retention rules, by default, apply to all of the resources (of the specified type) in the Region, even if the resources are not tagged. However, you can specify exclusion tags to exclude resources that have specific tags. Use this type of retention rule to protect all resources of a specific type in a Region.</p></li>
31/// </ul>
32/// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/recycle-bin.html"> Create Recycle Bin retention rules</a> in the <i>Amazon EBS User Guide</i>.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct CreateRuleFluentBuilder {
35 handle: ::std::sync::Arc<crate::client::Handle>,
36 inner: crate::operation::create_rule::builders::CreateRuleInputBuilder,
37 config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40 crate::client::customize::internal::CustomizableSend<
41 crate::operation::create_rule::CreateRuleOutput,
42 crate::operation::create_rule::CreateRuleError,
43 > for CreateRuleFluentBuilder
44{
45 fn send(
46 self,
47 config_override: crate::config::Builder,
48 ) -> crate::client::customize::internal::BoxFuture<
49 crate::client::customize::internal::SendResult<
50 crate::operation::create_rule::CreateRuleOutput,
51 crate::operation::create_rule::CreateRuleError,
52 >,
53 > {
54 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55 }
56}
57impl CreateRuleFluentBuilder {
58 /// Creates a new `CreateRuleFluentBuilder`.
59 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60 Self {
61 handle,
62 inner: ::std::default::Default::default(),
63 config_override: ::std::option::Option::None,
64 }
65 }
66 /// Access the CreateRule as a reference.
67 pub fn as_input(&self) -> &crate::operation::create_rule::builders::CreateRuleInputBuilder {
68 &self.inner
69 }
70 /// Sends the request and returns the response.
71 ///
72 /// If an error occurs, an `SdkError` will be returned with additional details that
73 /// can be matched against.
74 ///
75 /// By default, any retryable failures will be retried twice. Retry behavior
76 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77 /// set when configuring the client.
78 pub async fn send(
79 self,
80 ) -> ::std::result::Result<
81 crate::operation::create_rule::CreateRuleOutput,
82 ::aws_smithy_runtime_api::client::result::SdkError<
83 crate::operation::create_rule::CreateRuleError,
84 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85 >,
86 > {
87 let input = self
88 .inner
89 .build()
90 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91 let runtime_plugins = crate::operation::create_rule::CreateRule::operation_runtime_plugins(
92 self.handle.runtime_plugins.clone(),
93 &self.handle.conf,
94 self.config_override,
95 );
96 crate::operation::create_rule::CreateRule::orchestrate(&runtime_plugins, input).await
97 }
98
99 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100 pub fn customize(
101 self,
102 ) -> crate::client::customize::CustomizableOperation<
103 crate::operation::create_rule::CreateRuleOutput,
104 crate::operation::create_rule::CreateRuleError,
105 Self,
106 > {
107 crate::client::customize::CustomizableOperation::new(self)
108 }
109 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110 self.set_config_override(::std::option::Option::Some(config_override.into()));
111 self
112 }
113
114 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115 self.config_override = config_override;
116 self
117 }
118 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
119 pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
120 self.inner = self.inner.retention_period(input);
121 self
122 }
123 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
124 pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
125 self.inner = self.inner.set_retention_period(input);
126 self
127 }
128 /// <p>Information about the retention period for which the retention rule is to retain resources.</p>
129 pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
130 self.inner.get_retention_period()
131 }
132 /// <p>The retention rule description.</p>
133 pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.description(input.into());
135 self
136 }
137 /// <p>The retention rule description.</p>
138 pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_description(input);
140 self
141 }
142 /// <p>The retention rule description.</p>
143 pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_description()
145 }
146 ///
147 /// Appends an item to `Tags`.
148 ///
149 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
150 ///
151 /// <p>Information about the tags to assign to the retention rule.</p>
152 pub fn tags(mut self, input: crate::types::Tag) -> Self {
153 self.inner = self.inner.tags(input);
154 self
155 }
156 /// <p>Information about the tags to assign to the retention rule.</p>
157 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
158 self.inner = self.inner.set_tags(input);
159 self
160 }
161 /// <p>Information about the tags to assign to the retention rule.</p>
162 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
163 self.inner.get_tags()
164 }
165 /// <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>
166 pub fn resource_type(mut self, input: crate::types::ResourceType) -> Self {
167 self.inner = self.inner.resource_type(input);
168 self
169 }
170 /// <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>
171 pub fn set_resource_type(mut self, input: ::std::option::Option<crate::types::ResourceType>) -> Self {
172 self.inner = self.inner.set_resource_type(input);
173 self
174 }
175 /// <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>
176 pub fn get_resource_type(&self) -> &::std::option::Option<crate::types::ResourceType> {
177 self.inner.get_resource_type()
178 }
179 ///
180 /// Appends an item to `ResourceTags`.
181 ///
182 /// To override the contents of this collection use [`set_resource_tags`](Self::set_resource_tags).
183 ///
184 /// <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>
185 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
186 /// <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>
187 pub fn resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
188 self.inner = self.inner.resource_tags(input);
189 self
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 set_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
195 self.inner = self.inner.set_resource_tags(input);
196 self
197 }
198 /// <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>
199 /// <p>You can add the same tag key and value pair to a maximum or five retention rules.</p>
200 /// <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>
201 pub fn get_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
202 self.inner.get_resource_tags()
203 }
204 /// <p>Information about the retention rule lock configuration.</p>
205 pub fn lock_configuration(mut self, input: crate::types::LockConfiguration) -> Self {
206 self.inner = self.inner.lock_configuration(input);
207 self
208 }
209 /// <p>Information about the retention rule lock configuration.</p>
210 pub fn set_lock_configuration(mut self, input: ::std::option::Option<crate::types::LockConfiguration>) -> Self {
211 self.inner = self.inner.set_lock_configuration(input);
212 self
213 }
214 /// <p>Information about the retention rule lock configuration.</p>
215 pub fn get_lock_configuration(&self) -> &::std::option::Option<crate::types::LockConfiguration> {
216 self.inner.get_lock_configuration()
217 }
218 ///
219 /// Appends an item to `ExcludeResourceTags`.
220 ///
221 /// To override the contents of this collection use [`set_exclude_resource_tags`](Self::set_exclude_resource_tags).
222 ///
223 /// <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>
224 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
225 pub fn exclude_resource_tags(mut self, input: crate::types::ResourceTag) -> Self {
226 self.inner = self.inner.exclude_resource_tags(input);
227 self
228 }
229 /// <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>
230 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
231 pub fn set_exclude_resource_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>>) -> Self {
232 self.inner = self.inner.set_exclude_resource_tags(input);
233 self
234 }
235 /// <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>
236 /// <p>You can't specify exclusion tags for tag-level retention rules.</p>
237 pub fn get_exclude_resource_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ResourceTag>> {
238 self.inner.get_exclude_resource_tags()
239 }
240}