aws_sdk_efs/operation/put_lifecycle_configuration/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_lifecycle_configuration::_put_lifecycle_configuration_output::PutLifecycleConfigurationOutputBuilder;
3
4pub use crate::operation::put_lifecycle_configuration::_put_lifecycle_configuration_input::PutLifecycleConfigurationInputBuilder;
5
6impl crate::operation::put_lifecycle_configuration::builders::PutLifecycleConfigurationInputBuilder {
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::put_lifecycle_configuration::PutLifecycleConfigurationOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_lifecycle_configuration();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutLifecycleConfiguration`.
24///
25/// <p>Use this action to manage storage for your file system. A <code>LifecycleConfiguration</code> consists of one or more <code>LifecyclePolicy</code> objects that define the following:</p>
26/// <ul>
27/// <li>
28/// <p><b> <code>TransitionToIA</code> </b> – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.</p></li>
29/// <li>
30/// <p><b> <code>TransitionToArchive</code> </b> – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.</p>
31/// <p>File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.</p><note>
32/// <p>The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.</p>
33/// </note></li>
34/// </ul>
35/// <ul>
36/// <li>
37/// <p><b> <code>TransitionToPrimaryStorageClass</code> </b> – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.</p></li>
38/// </ul>
39/// <p>For more information, see <a href="https://docs.aws.amazon.com/efs/latest/ug/lifecycle-management-efs.html"> Managing file system storage</a>.</p>
40/// <p>Each Amazon EFS file system supports one lifecycle configuration, which applies to all files in the file system. If a <code>LifecycleConfiguration</code> object already exists for the specified file system, a <code>PutLifecycleConfiguration</code> call modifies the existing configuration. A <code>PutLifecycleConfiguration</code> call with an empty <code>LifecyclePolicies</code> array in the request body deletes any existing <code>LifecycleConfiguration</code>. In the request, specify the following:</p>
41/// <ul>
42/// <li>
43/// <p>The ID for the file system for which you are enabling, disabling, or modifying lifecycle management.</p></li>
44/// <li>
45/// <p>A <code>LifecyclePolicies</code> array of <code>LifecyclePolicy</code> objects that define when to move files to IA storage, to Archive storage, and back to primary storage.</p><note>
46/// <p>Amazon EFS requires that each <code>LifecyclePolicy</code> object have only have a single transition, so the <code>LifecyclePolicies</code> array needs to be structured with separate <code>LifecyclePolicy</code> objects. See the example requests in the following section for more information.</p>
47/// </note></li>
48/// </ul>
49/// <p>This operation requires permissions for the <code>elasticfilesystem:PutLifecycleConfiguration</code> operation.</p>
50/// <p>To apply a <code>LifecycleConfiguration</code> object to an encrypted file system, you need the same Key Management Service permissions as when you created the encrypted file system.</p>
51#[derive(::std::clone::Clone, ::std::fmt::Debug)]
52pub struct PutLifecycleConfigurationFluentBuilder {
53    handle: ::std::sync::Arc<crate::client::Handle>,
54    inner: crate::operation::put_lifecycle_configuration::builders::PutLifecycleConfigurationInputBuilder,
55    config_override: ::std::option::Option<crate::config::Builder>,
56}
57impl
58    crate::client::customize::internal::CustomizableSend<
59        crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationOutput,
60        crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationError,
61    > for PutLifecycleConfigurationFluentBuilder
62{
63    fn send(
64        self,
65        config_override: crate::config::Builder,
66    ) -> crate::client::customize::internal::BoxFuture<
67        crate::client::customize::internal::SendResult<
68            crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationOutput,
69            crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationError,
70        >,
71    > {
72        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
73    }
74}
75impl PutLifecycleConfigurationFluentBuilder {
76    /// Creates a new `PutLifecycleConfigurationFluentBuilder`.
77    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
78        Self {
79            handle,
80            inner: ::std::default::Default::default(),
81            config_override: ::std::option::Option::None,
82        }
83    }
84    /// Access the PutLifecycleConfiguration as a reference.
85    pub fn as_input(&self) -> &crate::operation::put_lifecycle_configuration::builders::PutLifecycleConfigurationInputBuilder {
86        &self.inner
87    }
88    /// Sends the request and returns the response.
89    ///
90    /// If an error occurs, an `SdkError` will be returned with additional details that
91    /// can be matched against.
92    ///
93    /// By default, any retryable failures will be retried twice. Retry behavior
94    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
95    /// set when configuring the client.
96    pub async fn send(
97        self,
98    ) -> ::std::result::Result<
99        crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationOutput,
100        ::aws_smithy_runtime_api::client::result::SdkError<
101            crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationError,
102            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
103        >,
104    > {
105        let input = self
106            .inner
107            .build()
108            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
109        let runtime_plugins = crate::operation::put_lifecycle_configuration::PutLifecycleConfiguration::operation_runtime_plugins(
110            self.handle.runtime_plugins.clone(),
111            &self.handle.conf,
112            self.config_override,
113        );
114        crate::operation::put_lifecycle_configuration::PutLifecycleConfiguration::orchestrate(&runtime_plugins, input).await
115    }
116
117    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
118    pub fn customize(
119        self,
120    ) -> crate::client::customize::CustomizableOperation<
121        crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationOutput,
122        crate::operation::put_lifecycle_configuration::PutLifecycleConfigurationError,
123        Self,
124    > {
125        crate::client::customize::CustomizableOperation::new(self)
126    }
127    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
128        self.set_config_override(::std::option::Option::Some(config_override.into()));
129        self
130    }
131
132    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
133        self.config_override = config_override;
134        self
135    }
136    /// <p>The ID of the file system for which you are creating the <code>LifecycleConfiguration</code> object (String).</p>
137    pub fn file_system_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138        self.inner = self.inner.file_system_id(input.into());
139        self
140    }
141    /// <p>The ID of the file system for which you are creating the <code>LifecycleConfiguration</code> object (String).</p>
142    pub fn set_file_system_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143        self.inner = self.inner.set_file_system_id(input);
144        self
145    }
146    /// <p>The ID of the file system for which you are creating the <code>LifecycleConfiguration</code> object (String).</p>
147    pub fn get_file_system_id(&self) -> &::std::option::Option<::std::string::String> {
148        self.inner.get_file_system_id()
149    }
150    ///
151    /// Appends an item to `LifecyclePolicies`.
152    ///
153    /// To override the contents of this collection use [`set_lifecycle_policies`](Self::set_lifecycle_policies).
154    ///
155    /// <p>An array of <code>LifecyclePolicy</code> objects that define the file system's <code>LifecycleConfiguration</code> object. A <code>LifecycleConfiguration</code> object informs lifecycle management of the following:</p>
156    /// <ul>
157    /// <li>
158    /// <p><b> <code>TransitionToIA</code> </b> – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.</p></li>
159    /// <li>
160    /// <p><b> <code>TransitionToArchive</code> </b> – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.</p>
161    /// <p>File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.</p><note>
162    /// <p>The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.</p>
163    /// </note></li>
164    /// <li>
165    /// <p><b> <code>TransitionToPrimaryStorageClass</code> </b> – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.</p></li>
166    /// </ul><note>
167    /// <p>When using the <code>put-lifecycle-configuration</code> CLI command or the <code>PutLifecycleConfiguration</code> API action, Amazon EFS requires that each <code>LifecyclePolicy</code> object have only a single transition. This means that in a request body, <code>LifecyclePolicies</code> must be structured as an array of <code>LifecyclePolicy</code> objects, one object for each storage transition. See the example requests in the following section for more information.</p>
168    /// </note>
169    pub fn lifecycle_policies(mut self, input: crate::types::LifecyclePolicy) -> Self {
170        self.inner = self.inner.lifecycle_policies(input);
171        self
172    }
173    /// <p>An array of <code>LifecyclePolicy</code> objects that define the file system's <code>LifecycleConfiguration</code> object. A <code>LifecycleConfiguration</code> object informs lifecycle management of the following:</p>
174    /// <ul>
175    /// <li>
176    /// <p><b> <code>TransitionToIA</code> </b> – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.</p></li>
177    /// <li>
178    /// <p><b> <code>TransitionToArchive</code> </b> – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.</p>
179    /// <p>File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.</p><note>
180    /// <p>The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.</p>
181    /// </note></li>
182    /// <li>
183    /// <p><b> <code>TransitionToPrimaryStorageClass</code> </b> – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.</p></li>
184    /// </ul><note>
185    /// <p>When using the <code>put-lifecycle-configuration</code> CLI command or the <code>PutLifecycleConfiguration</code> API action, Amazon EFS requires that each <code>LifecyclePolicy</code> object have only a single transition. This means that in a request body, <code>LifecyclePolicies</code> must be structured as an array of <code>LifecyclePolicy</code> objects, one object for each storage transition. See the example requests in the following section for more information.</p>
186    /// </note>
187    pub fn set_lifecycle_policies(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::LifecyclePolicy>>) -> Self {
188        self.inner = self.inner.set_lifecycle_policies(input);
189        self
190    }
191    /// <p>An array of <code>LifecyclePolicy</code> objects that define the file system's <code>LifecycleConfiguration</code> object. A <code>LifecycleConfiguration</code> object informs lifecycle management of the following:</p>
192    /// <ul>
193    /// <li>
194    /// <p><b> <code>TransitionToIA</code> </b> – When to move files in the file system from primary storage (Standard storage class) into the Infrequent Access (IA) storage.</p></li>
195    /// <li>
196    /// <p><b> <code>TransitionToArchive</code> </b> – When to move files in the file system from their current storage class (either IA or Standard storage) into the Archive storage.</p>
197    /// <p>File systems cannot transition into Archive storage before transitioning into IA storage. Therefore, TransitionToArchive must either not be set or must be later than TransitionToIA.</p><note>
198    /// <p>The Archive storage class is available only for file systems that use the Elastic throughput mode and the General Purpose performance mode.</p>
199    /// </note></li>
200    /// <li>
201    /// <p><b> <code>TransitionToPrimaryStorageClass</code> </b> – Whether to move files in the file system back to primary storage (Standard storage class) after they are accessed in IA or Archive storage.</p></li>
202    /// </ul><note>
203    /// <p>When using the <code>put-lifecycle-configuration</code> CLI command or the <code>PutLifecycleConfiguration</code> API action, Amazon EFS requires that each <code>LifecyclePolicy</code> object have only a single transition. This means that in a request body, <code>LifecyclePolicies</code> must be structured as an array of <code>LifecyclePolicy</code> objects, one object for each storage transition. See the example requests in the following section for more information.</p>
204    /// </note>
205    pub fn get_lifecycle_policies(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::LifecyclePolicy>> {
206        self.inner.get_lifecycle_policies()
207    }
208}