aws_sdk_ec2/operation/attach_volume/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::attach_volume::_attach_volume_output::AttachVolumeOutputBuilder;
3
4pub use crate::operation::attach_volume::_attach_volume_input::AttachVolumeInputBuilder;
5
6impl crate::operation::attach_volume::builders::AttachVolumeInputBuilder {
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::attach_volume::AttachVolumeOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::attach_volume::AttachVolumeError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.attach_volume();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `AttachVolume`.
24///
25/// <p>Attaches an EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.</p>
26/// <p>Encrypted EBS volumes must be attached to instances that support Amazon EBS encryption. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-encryption.html">Amazon EBS encryption</a> in the <i>Amazon EBS User Guide</i>.</p>
27/// <p>After you attach an EBS volume, you must make it available. For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.html">Make an EBS volume available for use</a>.</p>
28/// <p>If a volume has an Amazon Web Services Marketplace product code:</p>
29/// <ul>
30/// <li>
31/// <p>The volume can be attached only to a stopped instance.</p></li>
32/// <li>
33/// <p>Amazon Web Services Marketplace product codes are copied from the volume to the instance.</p></li>
34/// <li>
35/// <p>You must be subscribed to the product.</p></li>
36/// <li>
37/// <p>The instance type and operating system of the instance must support the product. For example, you can't detach a volume from a Windows instance and attach it to a Linux instance.</p></li>
38/// </ul>
39/// <p>For more information, see <a href="https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html">Attach an Amazon EBS volume to an instance</a> in the <i>Amazon EBS User Guide</i>.</p>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct AttachVolumeFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::attach_volume::builders::AttachVolumeInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47    crate::client::customize::internal::CustomizableSend<
48        crate::operation::attach_volume::AttachVolumeOutput,
49        crate::operation::attach_volume::AttachVolumeError,
50    > for AttachVolumeFluentBuilder
51{
52    fn send(
53        self,
54        config_override: crate::config::Builder,
55    ) -> crate::client::customize::internal::BoxFuture<
56        crate::client::customize::internal::SendResult<
57            crate::operation::attach_volume::AttachVolumeOutput,
58            crate::operation::attach_volume::AttachVolumeError,
59        >,
60    > {
61        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62    }
63}
64impl AttachVolumeFluentBuilder {
65    /// Creates a new `AttachVolumeFluentBuilder`.
66    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67        Self {
68            handle,
69            inner: ::std::default::Default::default(),
70            config_override: ::std::option::Option::None,
71        }
72    }
73    /// Access the AttachVolume as a reference.
74    pub fn as_input(&self) -> &crate::operation::attach_volume::builders::AttachVolumeInputBuilder {
75        &self.inner
76    }
77    /// Sends the request and returns the response.
78    ///
79    /// If an error occurs, an `SdkError` will be returned with additional details that
80    /// can be matched against.
81    ///
82    /// By default, any retryable failures will be retried twice. Retry behavior
83    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84    /// set when configuring the client.
85    pub async fn send(
86        self,
87    ) -> ::std::result::Result<
88        crate::operation::attach_volume::AttachVolumeOutput,
89        ::aws_smithy_runtime_api::client::result::SdkError<
90            crate::operation::attach_volume::AttachVolumeError,
91            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92        >,
93    > {
94        let input = self
95            .inner
96            .build()
97            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98        let runtime_plugins = crate::operation::attach_volume::AttachVolume::operation_runtime_plugins(
99            self.handle.runtime_plugins.clone(),
100            &self.handle.conf,
101            self.config_override,
102        );
103        crate::operation::attach_volume::AttachVolume::orchestrate(&runtime_plugins, input).await
104    }
105
106    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107    pub fn customize(
108        self,
109    ) -> crate::client::customize::CustomizableOperation<
110        crate::operation::attach_volume::AttachVolumeOutput,
111        crate::operation::attach_volume::AttachVolumeError,
112        Self,
113    > {
114        crate::client::customize::CustomizableOperation::new(self)
115    }
116    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117        self.set_config_override(::std::option::Option::Some(config_override.into()));
118        self
119    }
120
121    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122        self.config_override = config_override;
123        self
124    }
125    /// <p>The device name (for example, <code>/dev/sdh</code> or <code>xvdh</code>).</p>
126    pub fn device(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.device(input.into());
128        self
129    }
130    /// <p>The device name (for example, <code>/dev/sdh</code> or <code>xvdh</code>).</p>
131    pub fn set_device(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_device(input);
133        self
134    }
135    /// <p>The device name (for example, <code>/dev/sdh</code> or <code>xvdh</code>).</p>
136    pub fn get_device(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_device()
138    }
139    /// <p>The ID of the instance.</p>
140    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.instance_id(input.into());
142        self
143    }
144    /// <p>The ID of the instance.</p>
145    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_instance_id(input);
147        self
148    }
149    /// <p>The ID of the instance.</p>
150    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_instance_id()
152    }
153    /// <p>The ID of the EBS volume. The volume and instance must be within the same Availability Zone.</p>
154    pub fn volume_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.volume_id(input.into());
156        self
157    }
158    /// <p>The ID of the EBS volume. The volume and instance must be within the same Availability Zone.</p>
159    pub fn set_volume_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_volume_id(input);
161        self
162    }
163    /// <p>The ID of the EBS volume. The volume and instance must be within the same Availability Zone.</p>
164    pub fn get_volume_id(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_volume_id()
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 dry_run(mut self, input: bool) -> Self {
169        self.inner = self.inner.dry_run(input);
170        self
171    }
172    /// <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>
173    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
174        self.inner = self.inner.set_dry_run(input);
175        self
176    }
177    /// <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>
178    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
179        self.inner.get_dry_run()
180    }
181}