aws_sdk_lightsail/operation/create_disk_from_snapshot/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::create_disk_from_snapshot::_create_disk_from_snapshot_output::CreateDiskFromSnapshotOutputBuilder;
3
4pub use crate::operation::create_disk_from_snapshot::_create_disk_from_snapshot_input::CreateDiskFromSnapshotInputBuilder;
5
6impl crate::operation::create_disk_from_snapshot::builders::CreateDiskFromSnapshotInputBuilder {
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_disk_from_snapshot::CreateDiskFromSnapshotOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.create_disk_from_snapshot();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `CreateDiskFromSnapshot`.
24///
25/// <p>Creates a block storage disk from a manual or automatic snapshot of a disk. The resulting disk can be attached to an Amazon Lightsail instance in the same Availability Zone (<code>us-east-2a</code>).</p>
26/// <p>The <code>create disk from snapshot</code> operation supports tag-based access control via request tags and resource tags applied to the resource identified by <code>disk snapshot name</code>. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-controlling-access-using-tags">Amazon Lightsail Developer Guide</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct CreateDiskFromSnapshotFluentBuilder {
29 handle: ::std::sync::Arc<crate::client::Handle>,
30 inner: crate::operation::create_disk_from_snapshot::builders::CreateDiskFromSnapshotInputBuilder,
31 config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34 crate::client::customize::internal::CustomizableSend<
35 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotOutput,
36 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotError,
37 > for CreateDiskFromSnapshotFluentBuilder
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_disk_from_snapshot::CreateDiskFromSnapshotOutput,
45 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotError,
46 >,
47 > {
48 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49 }
50}
51impl CreateDiskFromSnapshotFluentBuilder {
52 /// Creates a new `CreateDiskFromSnapshotFluentBuilder`.
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 CreateDiskFromSnapshot as a reference.
61 pub fn as_input(&self) -> &crate::operation::create_disk_from_snapshot::builders::CreateDiskFromSnapshotInputBuilder {
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_disk_from_snapshot::CreateDiskFromSnapshotOutput,
76 ::aws_smithy_runtime_api::client::result::SdkError<
77 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotError,
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_disk_from_snapshot::CreateDiskFromSnapshot::operation_runtime_plugins(
86 self.handle.runtime_plugins.clone(),
87 &self.handle.conf,
88 self.config_override,
89 );
90 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshot::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_disk_from_snapshot::CreateDiskFromSnapshotOutput,
98 crate::operation::create_disk_from_snapshot::CreateDiskFromSnapshotError,
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 unique Lightsail disk name (<code>my-disk</code>).</p>
113 pub fn disk_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114 self.inner = self.inner.disk_name(input.into());
115 self
116 }
117 /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
118 pub fn set_disk_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119 self.inner = self.inner.set_disk_name(input);
120 self
121 }
122 /// <p>The unique Lightsail disk name (<code>my-disk</code>).</p>
123 pub fn get_disk_name(&self) -> &::std::option::Option<::std::string::String> {
124 self.inner.get_disk_name()
125 }
126 /// <p>The name of the disk snapshot (<code>my-snapshot</code>) from which to create the new storage disk.</p>
127 /// <p>Constraint:</p>
128 /// <ul>
129 /// <li>
130 /// <p>This parameter cannot be defined together with the <code>source disk name</code> parameter. The <code>disk snapshot name</code> and <code>source disk name</code> parameters are mutually exclusive.</p></li>
131 /// </ul>
132 pub fn disk_snapshot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.disk_snapshot_name(input.into());
134 self
135 }
136 /// <p>The name of the disk snapshot (<code>my-snapshot</code>) from which to create the new storage disk.</p>
137 /// <p>Constraint:</p>
138 /// <ul>
139 /// <li>
140 /// <p>This parameter cannot be defined together with the <code>source disk name</code> parameter. The <code>disk snapshot name</code> and <code>source disk name</code> parameters are mutually exclusive.</p></li>
141 /// </ul>
142 pub fn set_disk_snapshot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.inner = self.inner.set_disk_snapshot_name(input);
144 self
145 }
146 /// <p>The name of the disk snapshot (<code>my-snapshot</code>) from which to create the new storage disk.</p>
147 /// <p>Constraint:</p>
148 /// <ul>
149 /// <li>
150 /// <p>This parameter cannot be defined together with the <code>source disk name</code> parameter. The <code>disk snapshot name</code> and <code>source disk name</code> parameters are mutually exclusive.</p></li>
151 /// </ul>
152 pub fn get_disk_snapshot_name(&self) -> &::std::option::Option<::std::string::String> {
153 self.inner.get_disk_snapshot_name()
154 }
155 /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Choose the same Availability Zone as the Lightsail instance where you want to create the disk.</p>
156 /// <p>Use the GetRegions operation to list the Availability Zones where Lightsail is currently available.</p>
157 pub fn availability_zone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
158 self.inner = self.inner.availability_zone(input.into());
159 self
160 }
161 /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Choose the same Availability Zone as the Lightsail instance where you want to create the disk.</p>
162 /// <p>Use the GetRegions operation to list the Availability Zones where Lightsail is currently available.</p>
163 pub fn set_availability_zone(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
164 self.inner = self.inner.set_availability_zone(input);
165 self
166 }
167 /// <p>The Availability Zone where you want to create the disk (<code>us-east-2a</code>). Choose the same Availability Zone as the Lightsail instance where you want to create the disk.</p>
168 /// <p>Use the GetRegions operation to list the Availability Zones where Lightsail is currently available.</p>
169 pub fn get_availability_zone(&self) -> &::std::option::Option<::std::string::String> {
170 self.inner.get_availability_zone()
171 }
172 /// <p>The size of the disk in GB (<code>32</code>).</p>
173 pub fn size_in_gb(mut self, input: i32) -> Self {
174 self.inner = self.inner.size_in_gb(input);
175 self
176 }
177 /// <p>The size of the disk in GB (<code>32</code>).</p>
178 pub fn set_size_in_gb(mut self, input: ::std::option::Option<i32>) -> Self {
179 self.inner = self.inner.set_size_in_gb(input);
180 self
181 }
182 /// <p>The size of the disk in GB (<code>32</code>).</p>
183 pub fn get_size_in_gb(&self) -> &::std::option::Option<i32> {
184 self.inner.get_size_in_gb()
185 }
186 ///
187 /// Appends an item to `tags`.
188 ///
189 /// To override the contents of this collection use [`set_tags`](Self::set_tags).
190 ///
191 /// <p>The tag keys and optional values to add to the resource during create.</p>
192 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
193 pub fn tags(mut self, input: crate::types::Tag) -> Self {
194 self.inner = self.inner.tags(input);
195 self
196 }
197 /// <p>The tag keys and optional values to add to the resource during create.</p>
198 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
199 pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
200 self.inner = self.inner.set_tags(input);
201 self
202 }
203 /// <p>The tag keys and optional values to add to the resource during create.</p>
204 /// <p>Use the <code>TagResource</code> action to tag a resource after it's created.</p>
205 pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
206 self.inner.get_tags()
207 }
208 ///
209 /// Appends an item to `addOns`.
210 ///
211 /// To override the contents of this collection use [`set_add_ons`](Self::set_add_ons).
212 ///
213 /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
214 pub fn add_ons(mut self, input: crate::types::AddOnRequest) -> Self {
215 self.inner = self.inner.add_ons(input);
216 self
217 }
218 /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
219 pub fn set_add_ons(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>>) -> Self {
220 self.inner = self.inner.set_add_ons(input);
221 self
222 }
223 /// <p>An array of objects that represent the add-ons to enable for the new disk.</p>
224 pub fn get_add_ons(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::AddOnRequest>> {
225 self.inner.get_add_ons()
226 }
227 /// <p>The name of the source disk from which the source automatic snapshot was created.</p>
228 /// <p>Constraints:</p>
229 /// <ul>
230 /// <li>
231 /// <p>This parameter cannot be defined together with the <code>disk snapshot name</code> parameter. The <code>source disk name</code> and <code>disk snapshot name</code> parameters are mutually exclusive.</p></li>
232 /// <li>
233 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
234 /// </ul>
235 pub fn source_disk_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
236 self.inner = self.inner.source_disk_name(input.into());
237 self
238 }
239 /// <p>The name of the source disk from which the source automatic snapshot was created.</p>
240 /// <p>Constraints:</p>
241 /// <ul>
242 /// <li>
243 /// <p>This parameter cannot be defined together with the <code>disk snapshot name</code> parameter. The <code>source disk name</code> and <code>disk snapshot name</code> parameters are mutually exclusive.</p></li>
244 /// <li>
245 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
246 /// </ul>
247 pub fn set_source_disk_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
248 self.inner = self.inner.set_source_disk_name(input);
249 self
250 }
251 /// <p>The name of the source disk from which the source automatic snapshot was created.</p>
252 /// <p>Constraints:</p>
253 /// <ul>
254 /// <li>
255 /// <p>This parameter cannot be defined together with the <code>disk snapshot name</code> parameter. The <code>source disk name</code> and <code>disk snapshot name</code> parameters are mutually exclusive.</p></li>
256 /// <li>
257 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
258 /// </ul>
259 pub fn get_source_disk_name(&self) -> &::std::option::Option<::std::string::String> {
260 self.inner.get_source_disk_name()
261 }
262 /// <p>The date of the automatic snapshot to use for the new disk. Use the <code>get auto snapshots</code> operation to identify the dates of the available automatic snapshots.</p>
263 /// <p>Constraints:</p>
264 /// <ul>
265 /// <li>
266 /// <p>Must be specified in <code>YYYY-MM-DD</code> format.</p></li>
267 /// <li>
268 /// <p>This parameter cannot be defined together with the <code>use latest restorable auto snapshot</code> parameter. The <code>restore date</code> and <code>use latest restorable auto snapshot</code> parameters are mutually exclusive.</p></li>
269 /// <li>
270 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
271 /// </ul>
272 pub fn restore_date(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
273 self.inner = self.inner.restore_date(input.into());
274 self
275 }
276 /// <p>The date of the automatic snapshot to use for the new disk. Use the <code>get auto snapshots</code> operation to identify the dates of the available automatic snapshots.</p>
277 /// <p>Constraints:</p>
278 /// <ul>
279 /// <li>
280 /// <p>Must be specified in <code>YYYY-MM-DD</code> format.</p></li>
281 /// <li>
282 /// <p>This parameter cannot be defined together with the <code>use latest restorable auto snapshot</code> parameter. The <code>restore date</code> and <code>use latest restorable auto snapshot</code> parameters are mutually exclusive.</p></li>
283 /// <li>
284 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
285 /// </ul>
286 pub fn set_restore_date(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
287 self.inner = self.inner.set_restore_date(input);
288 self
289 }
290 /// <p>The date of the automatic snapshot to use for the new disk. Use the <code>get auto snapshots</code> operation to identify the dates of the available automatic snapshots.</p>
291 /// <p>Constraints:</p>
292 /// <ul>
293 /// <li>
294 /// <p>Must be specified in <code>YYYY-MM-DD</code> format.</p></li>
295 /// <li>
296 /// <p>This parameter cannot be defined together with the <code>use latest restorable auto snapshot</code> parameter. The <code>restore date</code> and <code>use latest restorable auto snapshot</code> parameters are mutually exclusive.</p></li>
297 /// <li>
298 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
299 /// </ul>
300 pub fn get_restore_date(&self) -> &::std::option::Option<::std::string::String> {
301 self.inner.get_restore_date()
302 }
303 /// <p>A Boolean value to indicate whether to use the latest available automatic snapshot.</p>
304 /// <p>Constraints:</p>
305 /// <ul>
306 /// <li>
307 /// <p>This parameter cannot be defined together with the <code>restore date</code> parameter. The <code>use latest restorable auto snapshot</code> and <code>restore date</code> parameters are mutually exclusive.</p></li>
308 /// <li>
309 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
310 /// </ul>
311 pub fn use_latest_restorable_auto_snapshot(mut self, input: bool) -> Self {
312 self.inner = self.inner.use_latest_restorable_auto_snapshot(input);
313 self
314 }
315 /// <p>A Boolean value to indicate whether to use the latest available automatic snapshot.</p>
316 /// <p>Constraints:</p>
317 /// <ul>
318 /// <li>
319 /// <p>This parameter cannot be defined together with the <code>restore date</code> parameter. The <code>use latest restorable auto snapshot</code> and <code>restore date</code> parameters are mutually exclusive.</p></li>
320 /// <li>
321 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
322 /// </ul>
323 pub fn set_use_latest_restorable_auto_snapshot(mut self, input: ::std::option::Option<bool>) -> Self {
324 self.inner = self.inner.set_use_latest_restorable_auto_snapshot(input);
325 self
326 }
327 /// <p>A Boolean value to indicate whether to use the latest available automatic snapshot.</p>
328 /// <p>Constraints:</p>
329 /// <ul>
330 /// <li>
331 /// <p>This parameter cannot be defined together with the <code>restore date</code> parameter. The <code>use latest restorable auto snapshot</code> and <code>restore date</code> parameters are mutually exclusive.</p></li>
332 /// <li>
333 /// <p>Define this parameter only when creating a new disk from an automatic snapshot. For more information, see the <a href="https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configuring-automatic-snapshots">Amazon Lightsail Developer Guide</a>.</p></li>
334 /// </ul>
335 pub fn get_use_latest_restorable_auto_snapshot(&self) -> &::std::option::Option<bool> {
336 self.inner.get_use_latest_restorable_auto_snapshot()
337 }
338}