aws_sdk_ec2/operation/modify_volume/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_volume::_modify_volume_output::ModifyVolumeOutputBuilder;
3
4pub use crate::operation::modify_volume::_modify_volume_input::ModifyVolumeInputBuilder;
5
6impl crate::operation::modify_volume::builders::ModifyVolumeInputBuilder {
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_volume::ModifyVolumeOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::modify_volume::ModifyVolumeError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.modify_volume();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `ModifyVolume`.
24///
25/// <p>You can modify several parameters of an existing EBS volume, including volume size, volume type, and IOPS capacity. If your EBS volume is attached to a current-generation EC2 instance type, you might be able to apply these changes without stopping the instance or detaching the volume from it. For more information about modifying EBS volumes, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-modify-volume.html">Amazon EBS Elastic Volumes</a> in the <i>Amazon EBS User Guide</i>.</p>
26/// <p>When you complete a resize operation on your volume, you need to extend the volume's file-system size to take advantage of the new storage capacity. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.html">Extend the file system</a>.</p>
27/// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/monitoring-volume-modifications.html">Monitor the progress of volume modifications</a> in the <i>Amazon EBS User Guide</i>.</p>
28/// <p>With previous-generation instance types, resizing an EBS volume might require detaching and reattaching the volume or stopping and restarting the instance.</p>
29/// <p>After modifying a volume, you must wait at least six hours and ensure that the volume is in the <code>in-use</code> or <code>available</code> state before you can modify the same volume. This is sometimes referred to as a cooldown period.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct ModifyVolumeFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::modify_volume::builders::ModifyVolumeInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::modify_volume::ModifyVolumeOutput,
39        crate::operation::modify_volume::ModifyVolumeError,
40    > for ModifyVolumeFluentBuilder
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::modify_volume::ModifyVolumeOutput,
48            crate::operation::modify_volume::ModifyVolumeError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl ModifyVolumeFluentBuilder {
55    /// Creates a new `ModifyVolumeFluentBuilder`.
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 ModifyVolume as a reference.
64    pub fn as_input(&self) -> &crate::operation::modify_volume::builders::ModifyVolumeInputBuilder {
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::modify_volume::ModifyVolumeOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::modify_volume::ModifyVolumeError,
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::modify_volume::ModifyVolume::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::modify_volume::ModifyVolume::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::modify_volume::ModifyVolumeOutput,
101        crate::operation::modify_volume::ModifyVolumeError,
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>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
116    pub fn dry_run(mut self, input: bool) -> Self {
117        self.inner = self.inner.dry_run(input);
118        self
119    }
120    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
121    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
122        self.inner = self.inner.set_dry_run(input);
123        self
124    }
125    /// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
126    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
127        self.inner.get_dry_run()
128    }
129    /// <p>The ID of the volume.</p>
130    pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.inner = self.inner.volume_id(input.into());
132        self
133    }
134    /// <p>The ID of the volume.</p>
135    pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_volume_id(input);
137        self
138    }
139    /// <p>The ID of the volume.</p>
140    pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
141        self.inner.get_volume_id()
142    }
143    /// <p>The target size of the volume, in GiB. The target volume size must be greater than or equal to the existing size of the volume.</p>
144    /// <p>The following are the supported volumes sizes for each volume type:</p>
145    /// <ul>
146    /// <li>
147    /// <p><code>gp2</code>: 1 - 16,384 GiB</p></li>
148    /// <li>
149    /// <p><code>gp3</code>: 1 - 65,536 GiB</p></li>
150    /// <li>
151    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
152    /// <li>
153    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
154    /// <li>
155    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
156    /// <li>
157    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
158    /// </ul>
159    /// <p>Default: The existing size is retained.</p>
160    pub fn size(mut self, input: i32) -> Self {
161        self.inner = self.inner.size(input);
162        self
163    }
164    /// <p>The target size of the volume, in GiB. The target volume size must be greater than or equal to the existing size of the volume.</p>
165    /// <p>The following are the supported volumes sizes for each volume type:</p>
166    /// <ul>
167    /// <li>
168    /// <p><code>gp2</code>: 1 - 16,384 GiB</p></li>
169    /// <li>
170    /// <p><code>gp3</code>: 1 - 65,536 GiB</p></li>
171    /// <li>
172    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
173    /// <li>
174    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
175    /// <li>
176    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
177    /// <li>
178    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
179    /// </ul>
180    /// <p>Default: The existing size is retained.</p>
181    pub fn set_size(mut self, input: ::std::option::Option<i32>) -> Self {
182        self.inner = self.inner.set_size(input);
183        self
184    }
185    /// <p>The target size of the volume, in GiB. The target volume size must be greater than or equal to the existing size of the volume.</p>
186    /// <p>The following are the supported volumes sizes for each volume type:</p>
187    /// <ul>
188    /// <li>
189    /// <p><code>gp2</code>: 1 - 16,384 GiB</p></li>
190    /// <li>
191    /// <p><code>gp3</code>: 1 - 65,536 GiB</p></li>
192    /// <li>
193    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
194    /// <li>
195    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
196    /// <li>
197    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
198    /// <li>
199    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
200    /// </ul>
201    /// <p>Default: The existing size is retained.</p>
202    pub fn get_size(&self) -> &::std::option::Option<i32> {
203        self.inner.get_size()
204    }
205    /// <p>The target EBS volume type of the volume. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html">Amazon EBS volume types</a> in the <i>Amazon EBS User Guide</i>.</p>
206    /// <p>Default: The existing type is retained.</p>
207    pub fn volume_type(mut self, input: crate::types::VolumeType) -> Self {
208        self.inner = self.inner.volume_type(input);
209        self
210    }
211    /// <p>The target EBS volume type of the volume. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html">Amazon EBS volume types</a> in the <i>Amazon EBS User Guide</i>.</p>
212    /// <p>Default: The existing type is retained.</p>
213    pub fn set_volume_type(mut self, input: ::std::option::Option<crate::types::VolumeType>) -> Self {
214        self.inner = self.inner.set_volume_type(input);
215        self
216    }
217    /// <p>The target EBS volume type of the volume. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html">Amazon EBS volume types</a> in the <i>Amazon EBS User Guide</i>.</p>
218    /// <p>Default: The existing type is retained.</p>
219    pub fn get_volume_type(&self) -> &::std::option::Option<crate::types::VolumeType> {
220        self.inner.get_volume_type()
221    }
222    /// <p>The target IOPS rate of the volume. This parameter is valid only for <code>gp3</code>, <code>io1</code>, and <code>io2</code> volumes.</p>
223    /// <p>The following are the supported values for each volume type:</p>
224    /// <ul>
225    /// <li>
226    /// <p><code>gp3</code>: 3,000 - 80,000 IOPS</p></li>
227    /// <li>
228    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
229    /// <li>
230    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
231    /// </ul><note>
232    /// <p><a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Instances built on the Nitro System</a> can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.</p>
233    /// </note>
234    /// <p>Default: The existing value is retained if you keep the same volume type. If you change the volume type to <code>io1</code>, <code>io2</code>, or <code>gp3</code>, the default is 3,000.</p>
235    pub fn iops(mut self, input: i32) -> Self {
236        self.inner = self.inner.iops(input);
237        self
238    }
239    /// <p>The target IOPS rate of the volume. This parameter is valid only for <code>gp3</code>, <code>io1</code>, and <code>io2</code> volumes.</p>
240    /// <p>The following are the supported values for each volume type:</p>
241    /// <ul>
242    /// <li>
243    /// <p><code>gp3</code>: 3,000 - 80,000 IOPS</p></li>
244    /// <li>
245    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
246    /// <li>
247    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
248    /// </ul><note>
249    /// <p><a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Instances built on the Nitro System</a> can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.</p>
250    /// </note>
251    /// <p>Default: The existing value is retained if you keep the same volume type. If you change the volume type to <code>io1</code>, <code>io2</code>, or <code>gp3</code>, the default is 3,000.</p>
252    pub fn set_iops(mut self, input: ::std::option::Option<i32>) -> Self {
253        self.inner = self.inner.set_iops(input);
254        self
255    }
256    /// <p>The target IOPS rate of the volume. This parameter is valid only for <code>gp3</code>, <code>io1</code>, and <code>io2</code> volumes.</p>
257    /// <p>The following are the supported values for each volume type:</p>
258    /// <ul>
259    /// <li>
260    /// <p><code>gp3</code>: 3,000 - 80,000 IOPS</p></li>
261    /// <li>
262    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
263    /// <li>
264    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
265    /// </ul><note>
266    /// <p><a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Instances built on the Nitro System</a> can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.</p>
267    /// </note>
268    /// <p>Default: The existing value is retained if you keep the same volume type. If you change the volume type to <code>io1</code>, <code>io2</code>, or <code>gp3</code>, the default is 3,000.</p>
269    pub fn get_iops(&self) -> &::std::option::Option<i32> {
270        self.inner.get_iops()
271    }
272    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 2,000.</p>
273    /// <p>Default: The existing value is retained if the source and target volume type is <code>gp3</code>. Otherwise, the default value is 125.</p>
274    /// <p>Valid Range: Minimum value of 125. Maximum value of 2,000.</p>
275    pub fn throughput(mut self, input: i32) -> Self {
276        self.inner = self.inner.throughput(input);
277        self
278    }
279    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 2,000.</p>
280    /// <p>Default: The existing value is retained if the source and target volume type is <code>gp3</code>. Otherwise, the default value is 125.</p>
281    /// <p>Valid Range: Minimum value of 125. Maximum value of 2,000.</p>
282    pub fn set_throughput(mut self, input: ::std::option::Option<i32>) -> Self {
283        self.inner = self.inner.set_throughput(input);
284        self
285    }
286    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 2,000.</p>
287    /// <p>Default: The existing value is retained if the source and target volume type is <code>gp3</code>. Otherwise, the default value is 125.</p>
288    /// <p>Valid Range: Minimum value of 125. Maximum value of 2,000.</p>
289    pub fn get_throughput(&self) -> &::std::option::Option<i32> {
290        self.inner.get_throughput()
291    }
292    /// <p>Specifies whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Nitro-based instances</a> in the same Availability Zone. This parameter is supported with <code>io1</code> and <code>io2</code> volumes only. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes-multi.html"> Amazon EBS Multi-Attach</a> in the <i>Amazon EBS User Guide</i>.</p>
293    pub fn multi_attach_enabled(mut self, input: bool) -> Self {
294        self.inner = self.inner.multi_attach_enabled(input);
295        self
296    }
297    /// <p>Specifies whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Nitro-based instances</a> in the same Availability Zone. This parameter is supported with <code>io1</code> and <code>io2</code> volumes only. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes-multi.html"> Amazon EBS Multi-Attach</a> in the <i>Amazon EBS User Guide</i>.</p>
298    pub fn set_multi_attach_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
299        self.inner = self.inner.set_multi_attach_enabled(input);
300        self
301    }
302    /// <p>Specifies whether to enable Amazon EBS Multi-Attach. If you enable Multi-Attach, you can attach the volume to up to 16 <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html"> Nitro-based instances</a> in the same Availability Zone. This parameter is supported with <code>io1</code> and <code>io2</code> volumes only. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes-multi.html"> Amazon EBS Multi-Attach</a> in the <i>Amazon EBS User Guide</i>.</p>
303    pub fn get_multi_attach_enabled(&self) -> &::std::option::Option<bool> {
304        self.inner.get_multi_attach_enabled()
305    }
306}