Skip to main content

aws_sdk_ec2/operation/create_replace_root_volume_task/
_create_replace_root_volume_task_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct CreateReplaceRootVolumeTaskInput {
6    /// <p>The ID of the instance for which to replace the root volume.</p>
7    pub instance_id: ::std::option::Option<::std::string::String>,
8    /// <p>The ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume.</p>
9    /// <p>If you want to restore the replacement root volume to the initial launch state, or if you want to restore the replacement root volume from an AMI, omit this parameter.</p>
10    pub snapshot_id: ::std::option::Option<::std::string::String>,
11    /// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
12    pub client_token: ::std::option::Option<::std::string::String>,
13    /// <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>
14    pub dry_run: ::std::option::Option<bool>,
15    /// <p>The tags to apply to the root volume replacement task.</p>
16    pub tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
17    /// <p>The ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance.</p>
18    /// <p>If you want to restore the replacement volume from a specific snapshot, or if you want to restore it to its launch state, omit this parameter.</p>
19    pub image_id: ::std::option::Option<::std::string::String>,
20    /// <p>Indicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify <code>true</code>. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.</p>
21    pub delete_replaced_root_volume: ::std::option::Option<bool>,
22    /// <p>Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as <i>volume initialization</i>. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.</p>
23    /// <p>Omit this parameter if:</p>
24    /// <ul>
25    /// <li>
26    /// <p>You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.</p><note>
27    /// <p>If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.</p>
28    /// </note></li>
29    /// <li>
30    /// <p>You want to create a volume that is initialized at the default rate.</p></li>
31    /// </ul>
32    /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html"> Initialize Amazon EBS volumes</a> in the <i>Amazon EC2 User Guide</i>.</p>
33    /// <p>Valid range: 100 - 300 MiB/s</p>
34    pub volume_initialization_rate: ::std::option::Option<i64>,
35}
36impl CreateReplaceRootVolumeTaskInput {
37    /// <p>The ID of the instance for which to replace the root volume.</p>
38    pub fn instance_id(&self) -> ::std::option::Option<&str> {
39        self.instance_id.as_deref()
40    }
41    /// <p>The ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume.</p>
42    /// <p>If you want to restore the replacement root volume to the initial launch state, or if you want to restore the replacement root volume from an AMI, omit this parameter.</p>
43    pub fn snapshot_id(&self) -> ::std::option::Option<&str> {
44        self.snapshot_id.as_deref()
45    }
46    /// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
47    pub fn client_token(&self) -> ::std::option::Option<&str> {
48        self.client_token.as_deref()
49    }
50    /// <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>
51    pub fn dry_run(&self) -> ::std::option::Option<bool> {
52        self.dry_run
53    }
54    /// <p>The tags to apply to the root volume replacement task.</p>
55    ///
56    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tag_specifications.is_none()`.
57    pub fn tag_specifications(&self) -> &[crate::types::TagSpecification] {
58        self.tag_specifications.as_deref().unwrap_or_default()
59    }
60    /// <p>The ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance.</p>
61    /// <p>If you want to restore the replacement volume from a specific snapshot, or if you want to restore it to its launch state, omit this parameter.</p>
62    pub fn image_id(&self) -> ::std::option::Option<&str> {
63        self.image_id.as_deref()
64    }
65    /// <p>Indicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify <code>true</code>. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.</p>
66    pub fn delete_replaced_root_volume(&self) -> ::std::option::Option<bool> {
67        self.delete_replaced_root_volume
68    }
69    /// <p>Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as <i>volume initialization</i>. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.</p>
70    /// <p>Omit this parameter if:</p>
71    /// <ul>
72    /// <li>
73    /// <p>You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.</p><note>
74    /// <p>If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.</p>
75    /// </note></li>
76    /// <li>
77    /// <p>You want to create a volume that is initialized at the default rate.</p></li>
78    /// </ul>
79    /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html"> Initialize Amazon EBS volumes</a> in the <i>Amazon EC2 User Guide</i>.</p>
80    /// <p>Valid range: 100 - 300 MiB/s</p>
81    pub fn volume_initialization_rate(&self) -> ::std::option::Option<i64> {
82        self.volume_initialization_rate
83    }
84}
85impl CreateReplaceRootVolumeTaskInput {
86    /// Creates a new builder-style object to manufacture [`CreateReplaceRootVolumeTaskInput`](crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskInput).
87    pub fn builder() -> crate::operation::create_replace_root_volume_task::builders::CreateReplaceRootVolumeTaskInputBuilder {
88        crate::operation::create_replace_root_volume_task::builders::CreateReplaceRootVolumeTaskInputBuilder::default()
89    }
90}
91
92/// A builder for [`CreateReplaceRootVolumeTaskInput`](crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskInput).
93#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
94#[non_exhaustive]
95pub struct CreateReplaceRootVolumeTaskInputBuilder {
96    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
97    pub(crate) snapshot_id: ::std::option::Option<::std::string::String>,
98    pub(crate) client_token: ::std::option::Option<::std::string::String>,
99    pub(crate) dry_run: ::std::option::Option<bool>,
100    pub(crate) tag_specifications: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>,
101    pub(crate) image_id: ::std::option::Option<::std::string::String>,
102    pub(crate) delete_replaced_root_volume: ::std::option::Option<bool>,
103    pub(crate) volume_initialization_rate: ::std::option::Option<i64>,
104}
105impl CreateReplaceRootVolumeTaskInputBuilder {
106    /// <p>The ID of the instance for which to replace the root volume.</p>
107    /// This field is required.
108    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
109        self.instance_id = ::std::option::Option::Some(input.into());
110        self
111    }
112    /// <p>The ID of the instance for which to replace the root volume.</p>
113    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
114        self.instance_id = input;
115        self
116    }
117    /// <p>The ID of the instance for which to replace the root volume.</p>
118    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
119        &self.instance_id
120    }
121    /// <p>The ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume.</p>
122    /// <p>If you want to restore the replacement root volume to the initial launch state, or if you want to restore the replacement root volume from an AMI, omit this parameter.</p>
123    pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.snapshot_id = ::std::option::Option::Some(input.into());
125        self
126    }
127    /// <p>The ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume.</p>
128    /// <p>If you want to restore the replacement root volume to the initial launch state, or if you want to restore the replacement root volume from an AMI, omit this parameter.</p>
129    pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
130        self.snapshot_id = input;
131        self
132    }
133    /// <p>The ID of the snapshot from which to restore the replacement root volume. The specified snapshot must be a snapshot that you previously created from the original root volume.</p>
134    /// <p>If you want to restore the replacement root volume to the initial launch state, or if you want to restore the replacement root volume from an AMI, omit this parameter.</p>
135    pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
136        &self.snapshot_id
137    }
138    /// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
139    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.client_token = ::std::option::Option::Some(input.into());
141        self
142    }
143    /// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
144    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.client_token = input;
146        self
147    }
148    /// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency. For more information, see <a href="https://docs.aws.amazon.com/ec2/latest/devguide/ec2-api-idempotency.html">Ensuring idempotency</a>.</p>
149    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
150        &self.client_token
151    }
152    /// <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>
153    pub fn dry_run(mut self, input: bool) -> Self {
154        self.dry_run = ::std::option::Option::Some(input);
155        self
156    }
157    /// <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>
158    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
159        self.dry_run = input;
160        self
161    }
162    /// <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>
163    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
164        &self.dry_run
165    }
166    /// Appends an item to `tag_specifications`.
167    ///
168    /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
169    ///
170    /// <p>The tags to apply to the root volume replacement task.</p>
171    pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
172        let mut v = self.tag_specifications.unwrap_or_default();
173        v.push(input);
174        self.tag_specifications = ::std::option::Option::Some(v);
175        self
176    }
177    /// <p>The tags to apply to the root volume replacement task.</p>
178    pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
179        self.tag_specifications = input;
180        self
181    }
182    /// <p>The tags to apply to the root volume replacement task.</p>
183    pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
184        &self.tag_specifications
185    }
186    /// <p>The ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance.</p>
187    /// <p>If you want to restore the replacement volume from a specific snapshot, or if you want to restore it to its launch state, omit this parameter.</p>
188    pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.image_id = ::std::option::Option::Some(input.into());
190        self
191    }
192    /// <p>The ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance.</p>
193    /// <p>If you want to restore the replacement volume from a specific snapshot, or if you want to restore it to its launch state, omit this parameter.</p>
194    pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195        self.image_id = input;
196        self
197    }
198    /// <p>The ID of the AMI to use to restore the root volume. The specified AMI must have the same product code, billing information, architecture type, and virtualization type as that of the instance.</p>
199    /// <p>If you want to restore the replacement volume from a specific snapshot, or if you want to restore it to its launch state, omit this parameter.</p>
200    pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
201        &self.image_id
202    }
203    /// <p>Indicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify <code>true</code>. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.</p>
204    pub fn delete_replaced_root_volume(mut self, input: bool) -> Self {
205        self.delete_replaced_root_volume = ::std::option::Option::Some(input);
206        self
207    }
208    /// <p>Indicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify <code>true</code>. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.</p>
209    pub fn set_delete_replaced_root_volume(mut self, input: ::std::option::Option<bool>) -> Self {
210        self.delete_replaced_root_volume = input;
211        self
212    }
213    /// <p>Indicates whether to automatically delete the original root volume after the root volume replacement task completes. To delete the original root volume, specify <code>true</code>. If you choose to keep the original root volume after the replacement task completes, you must manually delete it when you no longer need it.</p>
214    pub fn get_delete_replaced_root_volume(&self) -> &::std::option::Option<bool> {
215        &self.delete_replaced_root_volume
216    }
217    /// <p>Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as <i>volume initialization</i>. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.</p>
218    /// <p>Omit this parameter if:</p>
219    /// <ul>
220    /// <li>
221    /// <p>You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.</p><note>
222    /// <p>If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.</p>
223    /// </note></li>
224    /// <li>
225    /// <p>You want to create a volume that is initialized at the default rate.</p></li>
226    /// </ul>
227    /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html"> Initialize Amazon EBS volumes</a> in the <i>Amazon EC2 User Guide</i>.</p>
228    /// <p>Valid range: 100 - 300 MiB/s</p>
229    pub fn volume_initialization_rate(mut self, input: i64) -> Self {
230        self.volume_initialization_rate = ::std::option::Option::Some(input);
231        self
232    }
233    /// <p>Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as <i>volume initialization</i>. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.</p>
234    /// <p>Omit this parameter if:</p>
235    /// <ul>
236    /// <li>
237    /// <p>You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.</p><note>
238    /// <p>If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.</p>
239    /// </note></li>
240    /// <li>
241    /// <p>You want to create a volume that is initialized at the default rate.</p></li>
242    /// </ul>
243    /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html"> Initialize Amazon EBS volumes</a> in the <i>Amazon EC2 User Guide</i>.</p>
244    /// <p>Valid range: 100 - 300 MiB/s</p>
245    pub fn set_volume_initialization_rate(mut self, input: ::std::option::Option<i64>) -> Self {
246        self.volume_initialization_rate = input;
247        self
248    }
249    /// <p>Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the replacement root volume. This is also known as <i>volume initialization</i>. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.</p>
250    /// <p>Omit this parameter if:</p>
251    /// <ul>
252    /// <li>
253    /// <p>You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.</p><note>
254    /// <p>If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.</p>
255    /// </note></li>
256    /// <li>
257    /// <p>You want to create a volume that is initialized at the default rate.</p></li>
258    /// </ul>
259    /// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html"> Initialize Amazon EBS volumes</a> in the <i>Amazon EC2 User Guide</i>.</p>
260    /// <p>Valid range: 100 - 300 MiB/s</p>
261    pub fn get_volume_initialization_rate(&self) -> &::std::option::Option<i64> {
262        &self.volume_initialization_rate
263    }
264    /// Consumes the builder and constructs a [`CreateReplaceRootVolumeTaskInput`](crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskInput).
265    pub fn build(
266        self,
267    ) -> ::std::result::Result<
268        crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskInput,
269        ::aws_smithy_types::error::operation::BuildError,
270    > {
271        ::std::result::Result::Ok(crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskInput {
272            instance_id: self.instance_id,
273            snapshot_id: self.snapshot_id,
274            client_token: self.client_token,
275            dry_run: self.dry_run,
276            tag_specifications: self.tag_specifications,
277            image_id: self.image_id,
278            delete_replaced_root_volume: self.delete_replaced_root_volume,
279            volume_initialization_rate: self.volume_initialization_rate,
280        })
281    }
282}