aws_sdk_dlm/operation/update_lifecycle_policy/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_lifecycle_policy::_update_lifecycle_policy_output::UpdateLifecyclePolicyOutputBuilder;
3
4pub use crate::operation::update_lifecycle_policy::_update_lifecycle_policy_input::UpdateLifecyclePolicyInputBuilder;
5
6impl crate::operation::update_lifecycle_policy::builders::UpdateLifecyclePolicyInputBuilder {
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_lifecycle_policy::UpdateLifecyclePolicyOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.update_lifecycle_policy();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `UpdateLifecyclePolicy`.
24///
25/// <p>Updates the specified lifecycle policy.</p>
26/// <p>For more information about updating a policy, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/view-modify-delete.html#modify">Modify lifecycle policies</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct UpdateLifecyclePolicyFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::update_lifecycle_policy::builders::UpdateLifecyclePolicyInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyOutput,
36        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyError,
37    > for UpdateLifecyclePolicyFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyOutput,
45            crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl UpdateLifecyclePolicyFluentBuilder {
52    /// Creates a new `UpdateLifecyclePolicyFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the UpdateLifecyclePolicy as a reference.
61    pub fn as_input(&self) -> &crate::operation::update_lifecycle_policy::builders::UpdateLifecyclePolicyInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::update_lifecycle_policy::UpdateLifecyclePolicy::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicy::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyOutput,
98        crate::operation::update_lifecycle_policy::UpdateLifecyclePolicyError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The identifier of the lifecycle policy.</p>
113    pub fn policy_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.policy_id(input.into());
115        self
116    }
117    /// <p>The identifier of the lifecycle policy.</p>
118    pub fn set_policy_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_policy_id(input);
120        self
121    }
122    /// <p>The identifier of the lifecycle policy.</p>
123    pub fn get_policy_id(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_policy_id()
125    }
126    /// <p>The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.</p>
127    pub fn execution_role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.execution_role_arn(input.into());
129        self
130    }
131    /// <p>The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.</p>
132    pub fn set_execution_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_execution_role_arn(input);
134        self
135    }
136    /// <p>The Amazon Resource Name (ARN) of the IAM role used to run the operations specified by the lifecycle policy.</p>
137    pub fn get_execution_role_arn(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_execution_role_arn()
139    }
140    /// <p>The desired activation state of the lifecycle policy after creation.</p>
141    pub fn state(mut self, input: crate::types::SettablePolicyStateValues) -> Self {
142        self.inner = self.inner.state(input);
143        self
144    }
145    /// <p>The desired activation state of the lifecycle policy after creation.</p>
146    pub fn set_state(mut self, input: ::std::option::Option<crate::types::SettablePolicyStateValues>) -> Self {
147        self.inner = self.inner.set_state(input);
148        self
149    }
150    /// <p>The desired activation state of the lifecycle policy after creation.</p>
151    pub fn get_state(&self) -> &::std::option::Option<crate::types::SettablePolicyStateValues> {
152        self.inner.get_state()
153    }
154    /// <p>A description of the lifecycle policy.</p>
155    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.inner = self.inner.description(input.into());
157        self
158    }
159    /// <p>A description of the lifecycle policy.</p>
160    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.inner = self.inner.set_description(input);
162        self
163    }
164    /// <p>A description of the lifecycle policy.</p>
165    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
166        self.inner.get_description()
167    }
168    /// <p>The configuration of the lifecycle policy. You cannot update the policy type or the resource type.</p>
169    pub fn policy_details(mut self, input: crate::types::PolicyDetails) -> Self {
170        self.inner = self.inner.policy_details(input);
171        self
172    }
173    /// <p>The configuration of the lifecycle policy. You cannot update the policy type or the resource type.</p>
174    pub fn set_policy_details(mut self, input: ::std::option::Option<crate::types::PolicyDetails>) -> Self {
175        self.inner = self.inner.set_policy_details(input);
176        self
177    }
178    /// <p>The configuration of the lifecycle policy. You cannot update the policy type or the resource type.</p>
179    pub fn get_policy_details(&self) -> &::std::option::Option<crate::types::PolicyDetails> {
180        self.inner.get_policy_details()
181    }
182    /// <p><b>\[Default policies only\]</b> Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days.</p>
183    pub fn create_interval(mut self, input: i32) -> Self {
184        self.inner = self.inner.create_interval(input);
185        self
186    }
187    /// <p><b>\[Default policies only\]</b> Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days.</p>
188    pub fn set_create_interval(mut self, input: ::std::option::Option<i32>) -> Self {
189        self.inner = self.inner.set_create_interval(input);
190        self
191    }
192    /// <p><b>\[Default policies only\]</b> Specifies how often the policy should run and create snapshots or AMIs. The creation frequency can range from 1 to 7 days.</p>
193    pub fn get_create_interval(&self) -> &::std::option::Option<i32> {
194        self.inner.get_create_interval()
195    }
196    /// <p><b>\[Default policies only\]</b> Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time.</p>
197    pub fn retain_interval(mut self, input: i32) -> Self {
198        self.inner = self.inner.retain_interval(input);
199        self
200    }
201    /// <p><b>\[Default policies only\]</b> Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time.</p>
202    pub fn set_retain_interval(mut self, input: ::std::option::Option<i32>) -> Self {
203        self.inner = self.inner.set_retain_interval(input);
204        self
205    }
206    /// <p><b>\[Default policies only\]</b> Specifies how long the policy should retain snapshots or AMIs before deleting them. The retention period can range from 2 to 14 days, but it must be greater than the creation frequency to ensure that the policy retains at least 1 snapshot or AMI at any given time.</p>
207    pub fn get_retain_interval(&self) -> &::std::option::Option<i32> {
208        self.inner.get_retain_interval()
209    }
210    /// <p><b>\[Default policies only\]</b> Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.</p>
211    pub fn copy_tags(mut self, input: bool) -> Self {
212        self.inner = self.inner.copy_tags(input);
213        self
214    }
215    /// <p><b>\[Default policies only\]</b> Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.</p>
216    pub fn set_copy_tags(mut self, input: ::std::option::Option<bool>) -> Self {
217        self.inner = self.inner.set_copy_tags(input);
218        self
219    }
220    /// <p><b>\[Default policies only\]</b> Indicates whether the policy should copy tags from the source resource to the snapshot or AMI.</p>
221    pub fn get_copy_tags(&self) -> &::std::option::Option<bool> {
222        self.inner.get_copy_tags()
223    }
224    /// <p><b>\[Default policies only\]</b> Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.</p>
225    /// <p>By default (<b>ExtendDeletion=false</b>):</p>
226    /// <ul>
227    /// <li>
228    /// <p>If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify <code>true</code>.</p></li>
229    /// <li>
230    /// <p>If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify <code>true</code>.</p></li>
231    /// </ul>
232    /// <p>If you enable extended deletion (<b>ExtendDeletion=true</b>), you override both default behaviors simultaneously.</p>
233    /// <p>Default: false</p>
234    pub fn extend_deletion(mut self, input: bool) -> Self {
235        self.inner = self.inner.extend_deletion(input);
236        self
237    }
238    /// <p><b>\[Default policies only\]</b> Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.</p>
239    /// <p>By default (<b>ExtendDeletion=false</b>):</p>
240    /// <ul>
241    /// <li>
242    /// <p>If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify <code>true</code>.</p></li>
243    /// <li>
244    /// <p>If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify <code>true</code>.</p></li>
245    /// </ul>
246    /// <p>If you enable extended deletion (<b>ExtendDeletion=true</b>), you override both default behaviors simultaneously.</p>
247    /// <p>Default: false</p>
248    pub fn set_extend_deletion(mut self, input: ::std::option::Option<bool>) -> Self {
249        self.inner = self.inner.set_extend_deletion(input);
250        self
251    }
252    /// <p><b>\[Default policies only\]</b> Defines the snapshot or AMI retention behavior for the policy if the source volume or instance is deleted, or if the policy enters the error, disabled, or deleted state.</p>
253    /// <p>By default (<b>ExtendDeletion=false</b>):</p>
254    /// <ul>
255    /// <li>
256    /// <p>If a source resource is deleted, Amazon Data Lifecycle Manager will continue to delete previously created snapshots or AMIs, up to but not including the last one, based on the specified retention period. If you want Amazon Data Lifecycle Manager to delete all snapshots or AMIs, including the last one, specify <code>true</code>.</p></li>
257    /// <li>
258    /// <p>If a policy enters the error, disabled, or deleted state, Amazon Data Lifecycle Manager stops deleting snapshots and AMIs. If you want Amazon Data Lifecycle Manager to continue deleting snapshots or AMIs, including the last one, if the policy enters one of these states, specify <code>true</code>.</p></li>
259    /// </ul>
260    /// <p>If you enable extended deletion (<b>ExtendDeletion=true</b>), you override both default behaviors simultaneously.</p>
261    /// <p>Default: false</p>
262    pub fn get_extend_deletion(&self) -> &::std::option::Option<bool> {
263        self.inner.get_extend_deletion()
264    }
265    ///
266    /// Appends an item to `CrossRegionCopyTargets`.
267    ///
268    /// To override the contents of this collection use [`set_cross_region_copy_targets`](Self::set_cross_region_copy_targets).
269    ///
270    /// <p><b>\[Default policies only\]</b> Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.</p>
271    pub fn cross_region_copy_targets(mut self, input: crate::types::CrossRegionCopyTarget) -> Self {
272        self.inner = self.inner.cross_region_copy_targets(input);
273        self
274    }
275    /// <p><b>\[Default policies only\]</b> Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.</p>
276    pub fn set_cross_region_copy_targets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyTarget>>) -> Self {
277        self.inner = self.inner.set_cross_region_copy_targets(input);
278        self
279    }
280    /// <p><b>\[Default policies only\]</b> Specifies destination Regions for snapshot or AMI copies. You can specify up to 3 destination Regions. If you do not want to create cross-Region copies, omit this parameter.</p>
281    pub fn get_cross_region_copy_targets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyTarget>> {
282        self.inner.get_cross_region_copy_targets()
283    }
284    /// <p><b>\[Default policies only\]</b> Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.</p>
285    pub fn exclusions(mut self, input: crate::types::Exclusions) -> Self {
286        self.inner = self.inner.exclusions(input);
287        self
288    }
289    /// <p><b>\[Default policies only\]</b> Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.</p>
290    pub fn set_exclusions(mut self, input: ::std::option::Option<crate::types::Exclusions>) -> Self {
291        self.inner = self.inner.set_exclusions(input);
292        self
293    }
294    /// <p><b>\[Default policies only\]</b> Specifies exclusion parameters for volumes or instances for which you do not want to create snapshots or AMIs. The policy will not create snapshots or AMIs for target resources that match any of the specified exclusion parameters.</p>
295    pub fn get_exclusions(&self) -> &::std::option::Option<crate::types::Exclusions> {
296        self.inner.get_exclusions()
297    }
298}