aws_sdk_fsx/operation/create_file_cache/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_file_cache::_create_file_cache_output::CreateFileCacheOutputBuilder;
3
4pub use crate::operation::create_file_cache::_create_file_cache_input::CreateFileCacheInputBuilder;
5
6impl crate::operation::create_file_cache::builders::CreateFileCacheInputBuilder {
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_file_cache::CreateFileCacheOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_file_cache::CreateFileCacheError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_file_cache();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateFileCache`.
24///
25/// <p>Creates a new Amazon File Cache resource.</p>
26/// <p>You can use this operation with a client request token in the request that Amazon File Cache uses to ensure idempotent creation. If a cache with the specified client request token exists and the parameters match, <code>CreateFileCache</code> returns the description of the existing cache. If a cache with the specified client request token exists and the parameters don't match, this call returns <code>IncompatibleParameterError</code>. If a file cache with the specified client request token doesn't exist, <code>CreateFileCache</code> does the following:</p>
27/// <ul>
28/// <li>
29/// <p>Creates a new, empty Amazon File Cache resource with an assigned ID, and an initial lifecycle state of <code>CREATING</code>.</p></li>
30/// <li>
31/// <p>Returns the description of the cache in JSON format.</p></li>
32/// </ul><note>
33/// <p>The <code>CreateFileCache</code> call returns while the cache's lifecycle state is still <code>CREATING</code>. You can check the cache creation status by calling the <a href="https://docs.aws.amazon.com/fsx/latest/APIReference/API_DescribeFileCaches.html">DescribeFileCaches</a> operation, which returns the cache state along with other information.</p>
34/// </note>
35#[derive(::std::clone::Clone, ::std::fmt::Debug)]
36pub struct CreateFileCacheFluentBuilder {
37    handle: ::std::sync::Arc<crate::client::Handle>,
38    inner: crate::operation::create_file_cache::builders::CreateFileCacheInputBuilder,
39    config_override: ::std::option::Option<crate::config::Builder>,
40}
41impl
42    crate::client::customize::internal::CustomizableSend<
43        crate::operation::create_file_cache::CreateFileCacheOutput,
44        crate::operation::create_file_cache::CreateFileCacheError,
45    > for CreateFileCacheFluentBuilder
46{
47    fn send(
48        self,
49        config_override: crate::config::Builder,
50    ) -> crate::client::customize::internal::BoxFuture<
51        crate::client::customize::internal::SendResult<
52            crate::operation::create_file_cache::CreateFileCacheOutput,
53            crate::operation::create_file_cache::CreateFileCacheError,
54        >,
55    > {
56        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
57    }
58}
59impl CreateFileCacheFluentBuilder {
60    /// Creates a new `CreateFileCacheFluentBuilder`.
61    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
62        Self {
63            handle,
64            inner: ::std::default::Default::default(),
65            config_override: ::std::option::Option::None,
66        }
67    }
68    /// Access the CreateFileCache as a reference.
69    pub fn as_input(&self) -> &crate::operation::create_file_cache::builders::CreateFileCacheInputBuilder {
70        &self.inner
71    }
72    /// Sends the request and returns the response.
73    ///
74    /// If an error occurs, an `SdkError` will be returned with additional details that
75    /// can be matched against.
76    ///
77    /// By default, any retryable failures will be retried twice. Retry behavior
78    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
79    /// set when configuring the client.
80    pub async fn send(
81        self,
82    ) -> ::std::result::Result<
83        crate::operation::create_file_cache::CreateFileCacheOutput,
84        ::aws_smithy_runtime_api::client::result::SdkError<
85            crate::operation::create_file_cache::CreateFileCacheError,
86            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
87        >,
88    > {
89        let input = self
90            .inner
91            .build()
92            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
93        let runtime_plugins = crate::operation::create_file_cache::CreateFileCache::operation_runtime_plugins(
94            self.handle.runtime_plugins.clone(),
95            &self.handle.conf,
96            self.config_override,
97        );
98        crate::operation::create_file_cache::CreateFileCache::orchestrate(&runtime_plugins, input).await
99    }
100
101    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
102    pub fn customize(
103        self,
104    ) -> crate::client::customize::CustomizableOperation<
105        crate::operation::create_file_cache::CreateFileCacheOutput,
106        crate::operation::create_file_cache::CreateFileCacheError,
107        Self,
108    > {
109        crate::client::customize::CustomizableOperation::new(self)
110    }
111    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
112        self.set_config_override(::std::option::Option::Some(config_override.into()));
113        self
114    }
115
116    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
117        self.config_override = config_override;
118        self
119    }
120    /// <p>An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
121    /// <p>By using the idempotent operation, you can retry a <code>CreateFileCache</code> operation without the risk of creating an extra cache. This approach can be useful when an initial call fails in a way that makes it unclear whether a cache was created. Examples are if a transport level timeout occurred, or your connection was reset. If you use the same client request token and the initial call created a cache, the client receives success as long as the parameters are the same.</p>
122    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.client_request_token(input.into());
124        self
125    }
126    /// <p>An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
127    /// <p>By using the idempotent operation, you can retry a <code>CreateFileCache</code> operation without the risk of creating an extra cache. This approach can be useful when an initial call fails in a way that makes it unclear whether a cache was created. Examples are if a transport level timeout occurred, or your connection was reset. If you use the same client request token and the initial call created a cache, the client receives success as long as the parameters are the same.</p>
128    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
129        self.inner = self.inner.set_client_request_token(input);
130        self
131    }
132    /// <p>An idempotency token for resource creation, in a string of up to 63 ASCII characters. This token is automatically filled on your behalf when you use the Command Line Interface (CLI) or an Amazon Web Services SDK.</p>
133    /// <p>By using the idempotent operation, you can retry a <code>CreateFileCache</code> operation without the risk of creating an extra cache. This approach can be useful when an initial call fails in a way that makes it unclear whether a cache was created. Examples are if a transport level timeout occurred, or your connection was reset. If you use the same client request token and the initial call created a cache, the client receives success as long as the parameters are the same.</p>
134    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
135        self.inner.get_client_request_token()
136    }
137    /// <p>The type of cache that you're creating, which must be <code>LUSTRE</code>.</p>
138    pub fn file_cache_type(mut self, input: crate::types::FileCacheType) -> Self {
139        self.inner = self.inner.file_cache_type(input);
140        self
141    }
142    /// <p>The type of cache that you're creating, which must be <code>LUSTRE</code>.</p>
143    pub fn set_file_cache_type(mut self, input: ::std::option::Option<crate::types::FileCacheType>) -> Self {
144        self.inner = self.inner.set_file_cache_type(input);
145        self
146    }
147    /// <p>The type of cache that you're creating, which must be <code>LUSTRE</code>.</p>
148    pub fn get_file_cache_type(&self) -> &::std::option::Option<crate::types::FileCacheType> {
149        self.inner.get_file_cache_type()
150    }
151    /// <p>Sets the Lustre version for the cache that you're creating, which must be <code>2.12</code>.</p>
152    pub fn file_cache_type_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
153        self.inner = self.inner.file_cache_type_version(input.into());
154        self
155    }
156    /// <p>Sets the Lustre version for the cache that you're creating, which must be <code>2.12</code>.</p>
157    pub fn set_file_cache_type_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
158        self.inner = self.inner.set_file_cache_type_version(input);
159        self
160    }
161    /// <p>Sets the Lustre version for the cache that you're creating, which must be <code>2.12</code>.</p>
162    pub fn get_file_cache_type_version(&self) -> &::std::option::Option<::std::string::String> {
163        self.inner.get_file_cache_type_version()
164    }
165    /// <p>The storage capacity of the cache in gibibytes (GiB). Valid values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.</p>
166    pub fn storage_capacity(mut self, input: i32) -> Self {
167        self.inner = self.inner.storage_capacity(input);
168        self
169    }
170    /// <p>The storage capacity of the cache in gibibytes (GiB). Valid values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.</p>
171    pub fn set_storage_capacity(mut self, input: ::std::option::Option<i32>) -> Self {
172        self.inner = self.inner.set_storage_capacity(input);
173        self
174    }
175    /// <p>The storage capacity of the cache in gibibytes (GiB). Valid values are 1200 GiB, 2400 GiB, and increments of 2400 GiB.</p>
176    pub fn get_storage_capacity(&self) -> &::std::option::Option<i32> {
177        self.inner.get_storage_capacity()
178    }
179    ///
180    /// Appends an item to `SubnetIds`.
181    ///
182    /// To override the contents of this collection use [`set_subnet_ids`](Self::set_subnet_ids).
183    ///
184    /// <p>A list of subnet IDs that the cache will be accessible from. You can specify only one subnet ID in a call to the <code>CreateFileCache</code> operation.</p>
185    pub fn subnet_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
186        self.inner = self.inner.subnet_ids(input.into());
187        self
188    }
189    /// <p>A list of subnet IDs that the cache will be accessible from. You can specify only one subnet ID in a call to the <code>CreateFileCache</code> operation.</p>
190    pub fn set_subnet_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
191        self.inner = self.inner.set_subnet_ids(input);
192        self
193    }
194    /// <p>A list of subnet IDs that the cache will be accessible from. You can specify only one subnet ID in a call to the <code>CreateFileCache</code> operation.</p>
195    pub fn get_subnet_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
196        self.inner.get_subnet_ids()
197    }
198    ///
199    /// Appends an item to `SecurityGroupIds`.
200    ///
201    /// To override the contents of this collection use [`set_security_group_ids`](Self::set_security_group_ids).
202    ///
203    /// <p>A list of IDs specifying the security groups to apply to all network interfaces created for Amazon File Cache access. This list isn't returned in later requests to describe the cache.</p>
204    pub fn security_group_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205        self.inner = self.inner.security_group_ids(input.into());
206        self
207    }
208    /// <p>A list of IDs specifying the security groups to apply to all network interfaces created for Amazon File Cache access. This list isn't returned in later requests to describe the cache.</p>
209    pub fn set_security_group_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
210        self.inner = self.inner.set_security_group_ids(input);
211        self
212    }
213    /// <p>A list of IDs specifying the security groups to apply to all network interfaces created for Amazon File Cache access. This list isn't returned in later requests to describe the cache.</p>
214    pub fn get_security_group_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
215        self.inner.get_security_group_ids()
216    }
217    ///
218    /// Appends an item to `Tags`.
219    ///
220    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
221    ///
222    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
223    pub fn tags(mut self, input: crate::types::Tag) -> Self {
224        self.inner = self.inner.tags(input);
225        self
226    }
227    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
228    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
229        self.inner = self.inner.set_tags(input);
230        self
231    }
232    /// <p>A list of <code>Tag</code> values, with a maximum of 50 elements.</p>
233    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
234        self.inner.get_tags()
235    }
236    /// <p>A boolean flag indicating whether tags for the cache should be copied to data repository associations. This value defaults to false.</p>
237    pub fn copy_tags_to_data_repository_associations(mut self, input: bool) -> Self {
238        self.inner = self.inner.copy_tags_to_data_repository_associations(input);
239        self
240    }
241    /// <p>A boolean flag indicating whether tags for the cache should be copied to data repository associations. This value defaults to false.</p>
242    pub fn set_copy_tags_to_data_repository_associations(mut self, input: ::std::option::Option<bool>) -> Self {
243        self.inner = self.inner.set_copy_tags_to_data_repository_associations(input);
244        self
245    }
246    /// <p>A boolean flag indicating whether tags for the cache should be copied to data repository associations. This value defaults to false.</p>
247    pub fn get_copy_tags_to_data_repository_associations(&self) -> &::std::option::Option<bool> {
248        self.inner.get_copy_tags_to_data_repository_associations()
249    }
250    /// <p>Specifies the ID of the Key Management Service (KMS) key to use for encrypting data on an Amazon File Cache. If a <code>KmsKeyId</code> isn't specified, the Amazon FSx-managed KMS key for your account is used. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html">Encrypt</a> in the <i>Key Management Service API Reference</i>.</p>
251    pub fn kms_key_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
252        self.inner = self.inner.kms_key_id(input.into());
253        self
254    }
255    /// <p>Specifies the ID of the Key Management Service (KMS) key to use for encrypting data on an Amazon File Cache. If a <code>KmsKeyId</code> isn't specified, the Amazon FSx-managed KMS key for your account is used. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html">Encrypt</a> in the <i>Key Management Service API Reference</i>.</p>
256    pub fn set_kms_key_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
257        self.inner = self.inner.set_kms_key_id(input);
258        self
259    }
260    /// <p>Specifies the ID of the Key Management Service (KMS) key to use for encrypting data on an Amazon File Cache. If a <code>KmsKeyId</code> isn't specified, the Amazon FSx-managed KMS key for your account is used. For more information, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html">Encrypt</a> in the <i>Key Management Service API Reference</i>.</p>
261    pub fn get_kms_key_id(&self) -> &::std::option::Option<::std::string::String> {
262        self.inner.get_kms_key_id()
263    }
264    /// <p>The configuration for the Amazon File Cache resource being created.</p>
265    pub fn lustre_configuration(mut self, input: crate::types::CreateFileCacheLustreConfiguration) -> Self {
266        self.inner = self.inner.lustre_configuration(input);
267        self
268    }
269    /// <p>The configuration for the Amazon File Cache resource being created.</p>
270    pub fn set_lustre_configuration(mut self, input: ::std::option::Option<crate::types::CreateFileCacheLustreConfiguration>) -> Self {
271        self.inner = self.inner.set_lustre_configuration(input);
272        self
273    }
274    /// <p>The configuration for the Amazon File Cache resource being created.</p>
275    pub fn get_lustre_configuration(&self) -> &::std::option::Option<crate::types::CreateFileCacheLustreConfiguration> {
276        self.inner.get_lustre_configuration()
277    }
278    ///
279    /// Appends an item to `DataRepositoryAssociations`.
280    ///
281    /// To override the contents of this collection use [`set_data_repository_associations`](Self::set_data_repository_associations).
282    ///
283    /// <p>A list of up to 8 configurations for data repository associations (DRAs) to be created during the cache creation. The DRAs link the cache to either an Amazon S3 data repository or a Network File System (NFS) data repository that supports the NFSv3 protocol.</p>
284    /// <p>The DRA configurations must meet the following requirements:</p>
285    /// <ul>
286    /// <li>
287    /// <p>All configurations on the list must be of the same data repository type, either all S3 or all NFS. A cache can't link to different data repository types at the same time.</p></li>
288    /// <li>
289    /// <p>An NFS DRA must link to an NFS file system that supports the NFSv3 protocol.</p></li>
290    /// </ul>
291    /// <p>DRA automatic import and automatic export is not supported.</p>
292    pub fn data_repository_associations(mut self, input: crate::types::FileCacheDataRepositoryAssociation) -> Self {
293        self.inner = self.inner.data_repository_associations(input);
294        self
295    }
296    /// <p>A list of up to 8 configurations for data repository associations (DRAs) to be created during the cache creation. The DRAs link the cache to either an Amazon S3 data repository or a Network File System (NFS) data repository that supports the NFSv3 protocol.</p>
297    /// <p>The DRA configurations must meet the following requirements:</p>
298    /// <ul>
299    /// <li>
300    /// <p>All configurations on the list must be of the same data repository type, either all S3 or all NFS. A cache can't link to different data repository types at the same time.</p></li>
301    /// <li>
302    /// <p>An NFS DRA must link to an NFS file system that supports the NFSv3 protocol.</p></li>
303    /// </ul>
304    /// <p>DRA automatic import and automatic export is not supported.</p>
305    pub fn set_data_repository_associations(
306        mut self,
307        input: ::std::option::Option<::std::vec::Vec<crate::types::FileCacheDataRepositoryAssociation>>,
308    ) -> Self {
309        self.inner = self.inner.set_data_repository_associations(input);
310        self
311    }
312    /// <p>A list of up to 8 configurations for data repository associations (DRAs) to be created during the cache creation. The DRAs link the cache to either an Amazon S3 data repository or a Network File System (NFS) data repository that supports the NFSv3 protocol.</p>
313    /// <p>The DRA configurations must meet the following requirements:</p>
314    /// <ul>
315    /// <li>
316    /// <p>All configurations on the list must be of the same data repository type, either all S3 or all NFS. A cache can't link to different data repository types at the same time.</p></li>
317    /// <li>
318    /// <p>An NFS DRA must link to an NFS file system that supports the NFSv3 protocol.</p></li>
319    /// </ul>
320    /// <p>DRA automatic import and automatic export is not supported.</p>
321    pub fn get_data_repository_associations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FileCacheDataRepositoryAssociation>> {
322        self.inner.get_data_repository_associations()
323    }
324}