aws_sdk_ec2/operation/create_replace_root_volume_task/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_replace_root_volume_task::_create_replace_root_volume_task_output::CreateReplaceRootVolumeTaskOutputBuilder;
3
4pub use crate::operation::create_replace_root_volume_task::_create_replace_root_volume_task_input::CreateReplaceRootVolumeTaskInputBuilder;
5
6impl crate::operation::create_replace_root_volume_task::builders::CreateReplaceRootVolumeTaskInputBuilder {
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_replace_root_volume_task::CreateReplaceRootVolumeTaskOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_replace_root_volume_task();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateReplaceRootVolumeTask`.
24///
25/// <p>Replaces the EBS-backed root volume for a <code>running</code> instance with a new volume that is restored to the original root volume's launch state, that is restored to a specific snapshot taken from the original root volume, or that is restored from an AMI that has the same key characteristics as that of the instance.</p>
26/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/replace-root.html">Replace a root volume</a> in the <i>Amazon EC2 User Guide</i>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateReplaceRootVolumeTaskFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_replace_root_volume_task::builders::CreateReplaceRootVolumeTaskInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskOutput,
36 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskError,
37 > for CreateReplaceRootVolumeTaskFluentBuilder
38{
39 fn send(
40 self,
41 config_override: crate::config::Builder,
42 ) -> crate::client::customize::internal::BoxFuture<
43 crate::client::customize::internal::SendResult<
44 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskOutput,
45 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl CreateReplaceRootVolumeTaskFluentBuilder {
52 /// Creates a new `CreateReplaceRootVolumeTaskFluentBuilder`.
53 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54 Self {
55 handle,
56 inner: ::std::default::Default::default(),
57 config_override: ::std::option::Option::None,
58 }
59 }
60 /// Access the CreateReplaceRootVolumeTask as a reference.
61 pub fn as_input(&self) -> &crate::operation::create_replace_root_volume_task::builders::CreateReplaceRootVolumeTaskInputBuilder {
62 &self.inner
63 }
64 /// Sends the request and returns the response.
65 ///
66 /// If an error occurs, an `SdkError` will be returned with additional details that
67 /// can be matched against.
68 ///
69 /// By default, any retryable failures will be retried twice. Retry behavior
70 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71 /// set when configuring the client.
72 pub async fn send(
73 self,
74 ) -> ::std::result::Result<
75 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskError,
78 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79 >,
80 > {
81 let input = self
82 .inner
83 .build()
84 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85 let runtime_plugins = crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTask::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTask::orchestrate(&runtime_plugins, input).await
91 }
92
93 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94 pub fn customize(
95 self,
96 ) -> crate::client::customize::CustomizableOperation<
97 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskOutput,
98 crate::operation::create_replace_root_volume_task::CreateReplaceRootVolumeTaskError,
99 Self,
100 > {
101 crate::client::customize::CustomizableOperation::new(self)
102 }
103 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104 self.set_config_override(::std::option::Option::Some(config_override.into()));
105 self
106 }
107
108 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109 self.config_override = config_override;
110 self
111 }
112 /// <p>The ID of the instance for which to replace the root volume.</p>
113 pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.instance_id(input.into());
115 self
116 }
117 /// <p>The ID of the instance for which to replace the root volume.</p>
118 pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.inner = self.inner.set_instance_id(input);
120 self
121 }
122 /// <p>The ID of the instance for which to replace the root volume.</p>
123 pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
124 self.inner.get_instance_id()
125 }
126 /// <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>
127 /// <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>
128 pub fn snapshot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.inner = self.inner.snapshot_id(input.into());
130 self
131 }
132 /// <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>
133 /// <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>
134 pub fn set_snapshot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_snapshot_id(input);
136 self
137 }
138 /// <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>
139 /// <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>
140 pub fn get_snapshot_id(&self) -> &::std::option::Option<::std::string::String> {
141 self.inner.get_snapshot_id()
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 client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
145 self.inner = self.inner.client_token(input.into());
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 set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
150 self.inner = self.inner.set_client_token(input);
151 self
152 }
153 /// <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>
154 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
155 self.inner.get_client_token()
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 dry_run(mut self, input: bool) -> Self {
159 self.inner = self.inner.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 set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
164 self.inner = self.inner.set_dry_run(input);
165 self
166 }
167 /// <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>
168 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
169 self.inner.get_dry_run()
170 }
171 ///
172 /// Appends an item to `TagSpecifications`.
173 ///
174 /// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
175 ///
176 /// <p>The tags to apply to the root volume replacement task.</p>
177 pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
178 self.inner = self.inner.tag_specifications(input);
179 self
180 }
181 /// <p>The tags to apply to the root volume replacement task.</p>
182 pub fn set_tag_specifications(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>>) -> Self {
183 self.inner = self.inner.set_tag_specifications(input);
184 self
185 }
186 /// <p>The tags to apply to the root volume replacement task.</p>
187 pub fn get_tag_specifications(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TagSpecification>> {
188 self.inner.get_tag_specifications()
189 }
190 /// <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>
191 /// <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>
192 pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193 self.inner = self.inner.image_id(input.into());
194 self
195 }
196 /// <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>
197 /// <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>
198 pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199 self.inner = self.inner.set_image_id(input);
200 self
201 }
202 /// <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>
203 /// <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>
204 pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
205 self.inner.get_image_id()
206 }
207 /// <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>
208 pub fn delete_replaced_root_volume(mut self, input: bool) -> Self {
209 self.inner = self.inner.delete_replaced_root_volume(input);
210 self
211 }
212 /// <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>
213 pub fn set_delete_replaced_root_volume(mut self, input: ::std::option::Option<bool>) -> Self {
214 self.inner = self.inner.set_delete_replaced_root_volume(input);
215 self
216 }
217 /// <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>
218 pub fn get_delete_replaced_root_volume(&self) -> &::std::option::Option<bool> {
219 self.inner.get_delete_replaced_root_volume()
220 }
221 /// <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>
222 /// <p>Omit this parameter if:</p>
223 /// <ul>
224 /// <li>
225 /// <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>
226 /// <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>
227 /// </note></li>
228 /// <li>
229 /// <p>You want to create a volume that is initialized at the default rate.</p></li>
230 /// </ul>
231 /// <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>
232 /// <p>Valid range: 100 - 300 MiB/s</p>
233 pub fn volume_initialization_rate(mut self, input: i64) -> Self {
234 self.inner = self.inner.volume_initialization_rate(input);
235 self
236 }
237 /// <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>
238 /// <p>Omit this parameter if:</p>
239 /// <ul>
240 /// <li>
241 /// <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>
242 /// <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>
243 /// </note></li>
244 /// <li>
245 /// <p>You want to create a volume that is initialized at the default rate.</p></li>
246 /// </ul>
247 /// <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>
248 /// <p>Valid range: 100 - 300 MiB/s</p>
249 pub fn set_volume_initialization_rate(mut self, input: ::std::option::Option<i64>) -> Self {
250 self.inner = self.inner.set_volume_initialization_rate(input);
251 self
252 }
253 /// <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>
254 /// <p>Omit this parameter if:</p>
255 /// <ul>
256 /// <li>
257 /// <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>
258 /// <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>
259 /// </note></li>
260 /// <li>
261 /// <p>You want to create a volume that is initialized at the default rate.</p></li>
262 /// </ul>
263 /// <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>
264 /// <p>Valid range: 100 - 300 MiB/s</p>
265 pub fn get_volume_initialization_rate(&self) -> &::std::option::Option<i64> {
266 self.inner.get_volume_initialization_rate()
267 }
268}