aws_sdk_redshift/operation/modify_snapshot_copy_retention_period/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_snapshot_copy_retention_period::_modify_snapshot_copy_retention_period_output::ModifySnapshotCopyRetentionPeriodOutputBuilder;
3
4pub use crate::operation::modify_snapshot_copy_retention_period::_modify_snapshot_copy_retention_period_input::ModifySnapshotCopyRetentionPeriodInputBuilder;
5
6impl crate::operation::modify_snapshot_copy_retention_period::builders::ModifySnapshotCopyRetentionPeriodInputBuilder {
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::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_snapshot_copy_retention_period();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifySnapshotCopyRetentionPeriod`.
24///
25/// <p>Modifies the number of days to retain snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. By default, this operation only changes the retention period of copied automated snapshots. The retention periods for both new and existing copied automated snapshots are updated with the new retention period. You can set the manual option to change only the retention periods of copied manual snapshots. If you set this option, only newly copied manual snapshots have the new retention period.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct ModifySnapshotCopyRetentionPeriodFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::modify_snapshot_copy_retention_period::builders::ModifySnapshotCopyRetentionPeriodInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodOutput,
35        crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodError,
36    > for ModifySnapshotCopyRetentionPeriodFluentBuilder
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::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodOutput,
44            crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl ModifySnapshotCopyRetentionPeriodFluentBuilder {
51    /// Creates a new `ModifySnapshotCopyRetentionPeriodFluentBuilder`.
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 ModifySnapshotCopyRetentionPeriod as a reference.
60    pub fn as_input(&self) -> &crate::operation::modify_snapshot_copy_retention_period::builders::ModifySnapshotCopyRetentionPeriodInputBuilder {
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::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodError,
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::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriod::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriod::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::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodOutput,
97        crate::operation::modify_snapshot_copy_retention_period::ModifySnapshotCopyRetentionPeriodError,
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 identifier of the cluster for which you want to change the retention period for either automated or manual snapshots that are copied to a destination Amazon Web Services Region.</p>
112    /// <p>Constraints: Must be the valid name of an existing cluster that has cross-region snapshot copy enabled.</p>
113    pub fn cluster_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.cluster_identifier(input.into());
115        self
116    }
117    /// <p>The unique identifier of the cluster for which you want to change the retention period for either automated or manual snapshots that are copied to a destination Amazon Web Services Region.</p>
118    /// <p>Constraints: Must be the valid name of an existing cluster that has cross-region snapshot copy enabled.</p>
119    pub fn set_cluster_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
120        self.inner = self.inner.set_cluster_identifier(input);
121        self
122    }
123    /// <p>The unique identifier of the cluster for which you want to change the retention period for either automated or manual snapshots that are copied to a destination Amazon Web Services Region.</p>
124    /// <p>Constraints: Must be the valid name of an existing cluster that has cross-region snapshot copy enabled.</p>
125    pub fn get_cluster_identifier(&self) -> &::std::option::Option<::std::string::String> {
126        self.inner.get_cluster_identifier()
127    }
128    /// <p>The number of days to retain automated snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region.</p>
129    /// <p>By default, this only changes the retention period of copied automated snapshots.</p>
130    /// <p>If you decrease the retention period for automated snapshots that are copied to a destination Amazon Web Services Region, Amazon Redshift deletes any existing automated snapshots that were copied to the destination Amazon Web Services Region and that fall outside of the new retention period.</p>
131    /// <p>Constraints: Must be at least 1 and no more than 35 for automated snapshots.</p>
132    /// <p>If you specify the <code>manual</code> option, only newly copied manual snapshots will have the new retention period.</p>
133    /// <p>If you specify the value of -1 newly copied manual snapshots are retained indefinitely.</p>
134    /// <p>Constraints: The number of days must be either -1 or an integer between 1 and 3,653 for manual snapshots.</p>
135    pub fn retention_period(mut self, input: i32) -> Self {
136        self.inner = self.inner.retention_period(input);
137        self
138    }
139    /// <p>The number of days to retain automated snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region.</p>
140    /// <p>By default, this only changes the retention period of copied automated snapshots.</p>
141    /// <p>If you decrease the retention period for automated snapshots that are copied to a destination Amazon Web Services Region, Amazon Redshift deletes any existing automated snapshots that were copied to the destination Amazon Web Services Region and that fall outside of the new retention period.</p>
142    /// <p>Constraints: Must be at least 1 and no more than 35 for automated snapshots.</p>
143    /// <p>If you specify the <code>manual</code> option, only newly copied manual snapshots will have the new retention period.</p>
144    /// <p>If you specify the value of -1 newly copied manual snapshots are retained indefinitely.</p>
145    /// <p>Constraints: The number of days must be either -1 or an integer between 1 and 3,653 for manual snapshots.</p>
146    pub fn set_retention_period(mut self, input: ::std::option::Option<i32>) -> Self {
147        self.inner = self.inner.set_retention_period(input);
148        self
149    }
150    /// <p>The number of days to retain automated snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region.</p>
151    /// <p>By default, this only changes the retention period of copied automated snapshots.</p>
152    /// <p>If you decrease the retention period for automated snapshots that are copied to a destination Amazon Web Services Region, Amazon Redshift deletes any existing automated snapshots that were copied to the destination Amazon Web Services Region and that fall outside of the new retention period.</p>
153    /// <p>Constraints: Must be at least 1 and no more than 35 for automated snapshots.</p>
154    /// <p>If you specify the <code>manual</code> option, only newly copied manual snapshots will have the new retention period.</p>
155    /// <p>If you specify the value of -1 newly copied manual snapshots are retained indefinitely.</p>
156    /// <p>Constraints: The number of days must be either -1 or an integer between 1 and 3,653 for manual snapshots.</p>
157    pub fn get_retention_period(&self) -> &::std::option::Option<i32> {
158        self.inner.get_retention_period()
159    }
160    /// <p>Indicates whether to apply the snapshot retention period to newly copied manual snapshots instead of automated snapshots.</p>
161    pub fn manual(mut self, input: bool) -> Self {
162        self.inner = self.inner.manual(input);
163        self
164    }
165    /// <p>Indicates whether to apply the snapshot retention period to newly copied manual snapshots instead of automated snapshots.</p>
166    pub fn set_manual(mut self, input: ::std::option::Option<bool>) -> Self {
167        self.inner = self.inner.set_manual(input);
168        self
169    }
170    /// <p>Indicates whether to apply the snapshot retention period to newly copied manual snapshots instead of automated snapshots.</p>
171    pub fn get_manual(&self) -> &::std::option::Option<bool> {
172        self.inner.get_manual()
173    }
174}