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> and <code>gp3</code>: 1 - 16,384 GiB</p></li>
148    /// <li>
149    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
150    /// <li>
151    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
152    /// <li>
153    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
154    /// <li>
155    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
156    /// </ul>
157    /// <p>Default: The existing size is retained.</p>
158    pub fn size(mut self, input: i32) -> Self {
159        self.inner = self.inner.size(input);
160        self
161    }
162    /// <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>
163    /// <p>The following are the supported volumes sizes for each volume type:</p>
164    /// <ul>
165    /// <li>
166    /// <p><code>gp2</code> and <code>gp3</code>: 1 - 16,384 GiB</p></li>
167    /// <li>
168    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
169    /// <li>
170    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
171    /// <li>
172    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
173    /// <li>
174    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
175    /// </ul>
176    /// <p>Default: The existing size is retained.</p>
177    pub fn set_size(mut self, input: ::std::option::Option<i32>) -> Self {
178        self.inner = self.inner.set_size(input);
179        self
180    }
181    /// <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>
182    /// <p>The following are the supported volumes sizes for each volume type:</p>
183    /// <ul>
184    /// <li>
185    /// <p><code>gp2</code> and <code>gp3</code>: 1 - 16,384 GiB</p></li>
186    /// <li>
187    /// <p><code>io1</code>: 4 - 16,384 GiB</p></li>
188    /// <li>
189    /// <p><code>io2</code>: 4 - 65,536 GiB</p></li>
190    /// <li>
191    /// <p><code>st1</code> and <code>sc1</code>: 125 - 16,384 GiB</p></li>
192    /// <li>
193    /// <p><code>standard</code>: 1 - 1024 GiB</p></li>
194    /// </ul>
195    /// <p>Default: The existing size is retained.</p>
196    pub fn get_size(&self) -> &::std::option::Option<i32> {
197        self.inner.get_size()
198    }
199    /// <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>
200    /// <p>Default: The existing type is retained.</p>
201    pub fn volume_type(mut self, input: crate::types::VolumeType) -> Self {
202        self.inner = self.inner.volume_type(input);
203        self
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 set_volume_type(mut self, input: ::std::option::Option<crate::types::VolumeType>) -> Self {
208        self.inner = self.inner.set_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 get_volume_type(&self) -> &::std::option::Option<crate::types::VolumeType> {
214        self.inner.get_volume_type()
215    }
216    /// <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>
217    /// <p>The following are the supported values for each volume type:</p>
218    /// <ul>
219    /// <li>
220    /// <p><code>gp3</code>: 3,000 - 16,000 IOPS</p></li>
221    /// <li>
222    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
223    /// <li>
224    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
225    /// </ul>
226    /// <p>For <code>io2</code> volumes, you can achieve up to 256,000 IOPS on <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html">instances built on the Nitro System</a>. On other instances, you can achieve performance up to 32,000 IOPS.</p>
227    /// <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>
228    pub fn iops(mut self, input: i32) -> Self {
229        self.inner = self.inner.iops(input);
230        self
231    }
232    /// <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>
233    /// <p>The following are the supported values for each volume type:</p>
234    /// <ul>
235    /// <li>
236    /// <p><code>gp3</code>: 3,000 - 16,000 IOPS</p></li>
237    /// <li>
238    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
239    /// <li>
240    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
241    /// </ul>
242    /// <p>For <code>io2</code> volumes, you can achieve up to 256,000 IOPS on <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html">instances built on the Nitro System</a>. On other instances, you can achieve performance up to 32,000 IOPS.</p>
243    /// <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>
244    pub fn set_iops(mut self, input: ::std::option::Option<i32>) -> Self {
245        self.inner = self.inner.set_iops(input);
246        self
247    }
248    /// <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>
249    /// <p>The following are the supported values for each volume type:</p>
250    /// <ul>
251    /// <li>
252    /// <p><code>gp3</code>: 3,000 - 16,000 IOPS</p></li>
253    /// <li>
254    /// <p><code>io1</code>: 100 - 64,000 IOPS</p></li>
255    /// <li>
256    /// <p><code>io2</code>: 100 - 256,000 IOPS</p></li>
257    /// </ul>
258    /// <p>For <code>io2</code> volumes, you can achieve up to 256,000 IOPS on <a href="https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html">instances built on the Nitro System</a>. On other instances, you can achieve performance up to 32,000 IOPS.</p>
259    /// <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>
260    pub fn get_iops(&self) -> &::std::option::Option<i32> {
261        self.inner.get_iops()
262    }
263    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 1,000.</p>
264    /// <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>
265    /// <p>Valid Range: Minimum value of 125. Maximum value of 1000.</p>
266    pub fn throughput(mut self, input: i32) -> Self {
267        self.inner = self.inner.throughput(input);
268        self
269    }
270    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 1,000.</p>
271    /// <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>
272    /// <p>Valid Range: Minimum value of 125. Maximum value of 1000.</p>
273    pub fn set_throughput(mut self, input: ::std::option::Option<i32>) -> Self {
274        self.inner = self.inner.set_throughput(input);
275        self
276    }
277    /// <p>The target throughput of the volume, in MiB/s. This parameter is valid only for <code>gp3</code> volumes. The maximum value is 1,000.</p>
278    /// <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>
279    /// <p>Valid Range: Minimum value of 125. Maximum value of 1000.</p>
280    pub fn get_throughput(&self) -> &::std::option::Option<i32> {
281        self.inner.get_throughput()
282    }
283    /// <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>
284    pub fn multi_attach_enabled(mut self, input: bool) -> Self {
285        self.inner = self.inner.multi_attach_enabled(input);
286        self
287    }
288    /// <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>
289    pub fn set_multi_attach_enabled(mut self, input: ::std::option::Option<bool>) -> Self {
290        self.inner = self.inner.set_multi_attach_enabled(input);
291        self
292    }
293    /// <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>
294    pub fn get_multi_attach_enabled(&self) -> &::std::option::Option<bool> {
295        self.inner.get_multi_attach_enabled()
296    }
297}