aws_sdk_storagegateway/operation/create_cachedi_scsi_volume/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_cachedi_scsi_volume::_create_cachedi_scsi_volume_output::CreateCachediScsiVolumeOutputBuilder;
3
4pub use crate::operation::create_cachedi_scsi_volume::_create_cachedi_scsi_volume_input::CreateCachediScsiVolumeInputBuilder;
5
6impl crate::operation::create_cachedi_scsi_volume::builders::CreateCachediScsiVolumeInputBuilder {
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_cachedi_scsi_volume::CreateCachediScsiVolumeOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolumeError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.create_cachedi_scsi_volume();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CreateCachediSCSIVolume`.
24///
25/// <p>Creates a cached volume on a specified cached volume gateway. This operation is only supported in the cached volume gateway type.</p><note>
26/// <p>Cache storage must be allocated to the gateway before you can create a cached volume. Use the <code>AddCache</code> operation to add cache storage to a gateway.</p>
27/// </note>
28/// <p>In the request, you must specify the gateway, size of the volume in bytes, the iSCSI target name, an IP address on which to expose the target, and a unique client token. In response, the gateway creates the volume and returns information about it. This information includes the volume Amazon Resource Name (ARN), its size, and the iSCSI target ARN that initiators can use to connect to the volume target.</p>
29/// <p>Optionally, you can provide the ARN for an existing volume as the <code>SourceVolumeARN</code> for this cached volume, which creates an exact copy of the existing volume’s latest recovery point. The <code>VolumeSizeInBytes</code> value must be equal to or larger than the size of the copied volume, in bytes.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CreateCachediSCSIVolumeFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::create_cachedi_scsi_volume::builders::CreateCachediScsiVolumeInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::create_cachedi_scsi_volume::CreateCachediScsiVolumeOutput,
39        crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolumeError,
40    > for CreateCachediSCSIVolumeFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::create_cachedi_scsi_volume::CreateCachediScsiVolumeOutput,
48            crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolumeError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl CreateCachediSCSIVolumeFluentBuilder {
55    /// Creates a new `CreateCachediSCSIVolumeFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the CreateCachediSCSIVolume as a reference.
64    pub fn as_input(&self) -> &crate::operation::create_cachedi_scsi_volume::builders::CreateCachediScsiVolumeInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::create_cachedi_scsi_volume::CreateCachediScsiVolumeOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolumeError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolume::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolume::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::create_cachedi_scsi_volume::CreateCachediScsiVolumeOutput,
101        crate::operation::create_cachedi_scsi_volume::CreateCachediSCSIVolumeError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The Amazon Resource Name (ARN) of the gateway. Use the <code>ListGateways</code> operation to return a list of gateways for your account and Amazon Web Services Region.</p>
116    pub fn gateway_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.inner = self.inner.gateway_arn(input.into());
118        self
119    }
120    /// <p>The Amazon Resource Name (ARN) of the gateway. Use the <code>ListGateways</code> operation to return a list of gateways for your account and Amazon Web Services Region.</p>
121    pub fn set_gateway_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.inner = self.inner.set_gateway_arn(input);
123        self
124    }
125    /// <p>The Amazon Resource Name (ARN) of the gateway. Use the <code>ListGateways</code> operation to return a list of gateways for your account and Amazon Web Services Region.</p>
126    pub fn get_gateway_arn(&self) -> &::std::option::Option<::std::string::String> {
127        self.inner.get_gateway_arn()
128    }
129    /// <p>The size of the volume in bytes.</p>
130    pub fn volume_size_in_bytes(mut self, input: i64) -> Self {
131        self.inner = self.inner.volume_size_in_bytes(input);
132        self
133    }
134    /// <p>The size of the volume in bytes.</p>
135    pub fn set_volume_size_in_bytes(mut self, input: ::std::option::Option<i64>) -> Self {
136        self.inner = self.inner.set_volume_size_in_bytes(input);
137        self
138    }
139    /// <p>The size of the volume in bytes.</p>
140    pub fn get_volume_size_in_bytes(&self) -> &::std::option::Option<i64> {
141        self.inner.get_volume_size_in_bytes()
142    }
143    /// <p>The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new cached volume. Specify this field if you want to create the iSCSI storage volume from a snapshot; otherwise, do not include this field. To list snapshots for your account use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html">DescribeSnapshots</a> in the <i>Amazon Elastic Compute Cloud API Reference</i>.</p>
144    pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145        self.inner = self.inner.snapshot_id(input.into());
146        self
147    }
148    /// <p>The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new cached volume. Specify this field if you want to create the iSCSI storage volume from a snapshot; otherwise, do not include this field. To list snapshots for your account use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html">DescribeSnapshots</a> in the <i>Amazon Elastic Compute Cloud API Reference</i>.</p>
149    pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150        self.inner = self.inner.set_snapshot_id(input);
151        self
152    }
153    /// <p>The snapshot ID (e.g. "snap-1122aabb") of the snapshot to restore as the new cached volume. Specify this field if you want to create the iSCSI storage volume from a snapshot; otherwise, do not include this field. To list snapshots for your account use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSnapshots.html">DescribeSnapshots</a> in the <i>Amazon Elastic Compute Cloud API Reference</i>.</p>
154    pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
155        self.inner.get_snapshot_id()
156    }
157    /// <p>The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the target ARN. For example, specifying <code>TargetName</code> as <i>myvolume</i> results in the target ARN of <code>arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume</code>. The target name must be unique across all volumes on a gateway.</p>
158    /// <p>If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as the new target name.</p>
159    pub fn target_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.inner = self.inner.target_name(input.into());
161        self
162    }
163    /// <p>The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the target ARN. For example, specifying <code>TargetName</code> as <i>myvolume</i> results in the target ARN of <code>arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume</code>. The target name must be unique across all volumes on a gateway.</p>
164    /// <p>If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as the new target name.</p>
165    pub fn set_target_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_target_name(input);
167        self
168    }
169    /// <p>The name of the iSCSI target used by an initiator to connect to a volume and used as a suffix for the target ARN. For example, specifying <code>TargetName</code> as <i>myvolume</i> results in the target ARN of <code>arn:aws:storagegateway:us-east-2:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume</code>. The target name must be unique across all volumes on a gateway.</p>
170    /// <p>If you don't specify a value, Storage Gateway uses the value that was previously used for this volume as the new target name.</p>
171    pub fn get_target_name(&self) -> &::std::option::Option<::std::string::String> {
172        self.inner.get_target_name()
173    }
174    /// <p>The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified existing volume's latest recovery point. The <code>VolumeSizeInBytes</code> value for this new volume must be equal to or larger than the size of the existing volume, in bytes.</p>
175    pub fn source_volume_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
176        self.inner = self.inner.source_volume_arn(input.into());
177        self
178    }
179    /// <p>The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified existing volume's latest recovery point. The <code>VolumeSizeInBytes</code> value for this new volume must be equal to or larger than the size of the existing volume, in bytes.</p>
180    pub fn set_source_volume_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
181        self.inner = self.inner.set_source_volume_arn(input);
182        self
183    }
184    /// <p>The ARN for an existing volume. Specifying this ARN makes the new volume into an exact copy of the specified existing volume's latest recovery point. The <code>VolumeSizeInBytes</code> value for this new volume must be equal to or larger than the size of the existing volume, in bytes.</p>
185    pub fn get_source_volume_arn(&self) -> &::std::option::Option<::std::string::String> {
186        self.inner.get_source_volume_arn()
187    }
188    /// <p>The network interface of the gateway on which to expose the iSCSI target. Accepts IPv4 and IPv6 addresses. Use <code>DescribeGatewayInformation</code> to get a list of the network interfaces available on a gateway.</p>
189    /// <p>Valid Values: A valid IP address.</p>
190    pub fn network_interface_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191        self.inner = self.inner.network_interface_id(input.into());
192        self
193    }
194    /// <p>The network interface of the gateway on which to expose the iSCSI target. Accepts IPv4 and IPv6 addresses. Use <code>DescribeGatewayInformation</code> to get a list of the network interfaces available on a gateway.</p>
195    /// <p>Valid Values: A valid IP address.</p>
196    pub fn set_network_interface_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
197        self.inner = self.inner.set_network_interface_id(input);
198        self
199    }
200    /// <p>The network interface of the gateway on which to expose the iSCSI target. Accepts IPv4 and IPv6 addresses. Use <code>DescribeGatewayInformation</code> to get a list of the network interfaces available on a gateway.</p>
201    /// <p>Valid Values: A valid IP address.</p>
202    pub fn get_network_interface_id(&self) -> &::std::option::Option<::std::string::String> {
203        self.inner.get_network_interface_id()
204    }
205    /// <p>A unique identifier that you use to retry a request. If you retry a request, use the same <code>ClientToken</code> you specified in the initial request.</p>
206    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
207        self.inner = self.inner.client_token(input.into());
208        self
209    }
210    /// <p>A unique identifier that you use to retry a request. If you retry a request, use the same <code>ClientToken</code> you specified in the initial request.</p>
211    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212        self.inner = self.inner.set_client_token(input);
213        self
214    }
215    /// <p>A unique identifier that you use to retry a request. If you retry a request, use the same <code>ClientToken</code> you specified in the initial request.</p>
216    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
217        self.inner.get_client_token()
218    }
219    /// <p>Set to <code>true</code> to use Amazon S3 server-side encryption with your own KMS key, or <code>false</code> to use a key managed by Amazon S3. Optional.</p>
220    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
221    pub fn kms_encrypted(mut self, input: bool) -> Self {
222        self.inner = self.inner.kms_encrypted(input);
223        self
224    }
225    /// <p>Set to <code>true</code> to use Amazon S3 server-side encryption with your own KMS key, or <code>false</code> to use a key managed by Amazon S3. Optional.</p>
226    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
227    pub fn set_kms_encrypted(mut self, input: ::std::option::Option<bool>) -> Self {
228        self.inner = self.inner.set_kms_encrypted(input);
229        self
230    }
231    /// <p>Set to <code>true</code> to use Amazon S3 server-side encryption with your own KMS key, or <code>false</code> to use a key managed by Amazon S3. Optional.</p>
232    /// <p>Valid Values: <code>true</code> | <code>false</code></p>
233    pub fn get_kms_encrypted(&self) -> &::std::option::Option<bool> {
234        self.inner.get_kms_encrypted()
235    }
236    /// <p>The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when <code>KMSEncrypted</code> is <code>true</code>. Optional.</p>
237    pub fn kms_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
238        self.inner = self.inner.kms_key(input.into());
239        self
240    }
241    /// <p>The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when <code>KMSEncrypted</code> is <code>true</code>. Optional.</p>
242    pub fn set_kms_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
243        self.inner = self.inner.set_kms_key(input);
244        self
245    }
246    /// <p>The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when <code>KMSEncrypted</code> is <code>true</code>. Optional.</p>
247    pub fn get_kms_key(&self) -> &::std::option::Option<::std::string::String> {
248        self.inner.get_kms_key()
249    }
250    ///
251    /// Appends an item to `Tags`.
252    ///
253    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
254    ///
255    /// <p>A list of up to 50 tags that you can assign to a cached volume. Each tag is a key-value pair.</p><note>
256    /// <p>Valid characters for key and value are letters, spaces, and numbers that you can represent in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256 characters.</p>
257    /// </note>
258    pub fn tags(mut self, input: crate::types::Tag) -> Self {
259        self.inner = self.inner.tags(input);
260        self
261    }
262    /// <p>A list of up to 50 tags that you can assign to a cached volume. Each tag is a key-value pair.</p><note>
263    /// <p>Valid characters for key and value are letters, spaces, and numbers that you can represent in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256 characters.</p>
264    /// </note>
265    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
266        self.inner = self.inner.set_tags(input);
267        self
268    }
269    /// <p>A list of up to 50 tags that you can assign to a cached volume. Each tag is a key-value pair.</p><note>
270    /// <p>Valid characters for key and value are letters, spaces, and numbers that you can represent in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256 characters.</p>
271    /// </note>
272    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
273        self.inner.get_tags()
274    }
275}