aws_sdk_ec2/operation/start_instances/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::start_instances::_start_instances_output::StartInstancesOutputBuilder;
3
4pub use crate::operation::start_instances::_start_instances_input::StartInstancesInputBuilder;
5
6impl crate::operation::start_instances::builders::StartInstancesInputBuilder {
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::start_instances::StartInstancesOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::start_instances::StartInstancesError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.start_instances();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `StartInstances`.
24///
25/// <p>Starts an Amazon EBS-backed instance that you've previously stopped.</p>
26/// <p>Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for instance usage. However, your root partition Amazon EBS volume remains and continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Every time you start your instance, Amazon EC2 charges a one-minute minimum for instance usage, and thereafter charges per second for instance usage.</p>
27/// <p>Before stopping an instance, make sure it is in a state from which it can be restarted. Stopping an instance does not preserve data stored in RAM.</p>
28/// <p>Performing this operation on an instance that uses an instance store as its root device returns an error.</p>
29/// <p>If you attempt to start a T3 instance with <code>host</code> tenancy and the <code>unlimited</code> CPU credit option, the request fails. The <code>unlimited</code> CPU credit option is not supported on Dedicated Hosts. Before you start the instance, either change its CPU credit option to <code>standard</code>, or change its tenancy to <code>default</code> or <code>dedicated</code>.</p>
30/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html">Stop and start Amazon EC2 instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
31#[derive(::std::clone::Clone, ::std::fmt::Debug)]
32pub struct StartInstancesFluentBuilder {
33    handle: ::std::sync::Arc<crate::client::Handle>,
34    inner: crate::operation::start_instances::builders::StartInstancesInputBuilder,
35    config_override: ::std::option::Option<crate::config::Builder>,
36}
37impl
38    crate::client::customize::internal::CustomizableSend<
39        crate::operation::start_instances::StartInstancesOutput,
40        crate::operation::start_instances::StartInstancesError,
41    > for StartInstancesFluentBuilder
42{
43    fn send(
44        self,
45        config_override: crate::config::Builder,
46    ) -> crate::client::customize::internal::BoxFuture<
47        crate::client::customize::internal::SendResult<
48            crate::operation::start_instances::StartInstancesOutput,
49            crate::operation::start_instances::StartInstancesError,
50        >,
51    > {
52        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
53    }
54}
55impl StartInstancesFluentBuilder {
56    /// Creates a new `StartInstancesFluentBuilder`.
57    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
58        Self {
59            handle,
60            inner: ::std::default::Default::default(),
61            config_override: ::std::option::Option::None,
62        }
63    }
64    /// Access the StartInstances as a reference.
65    pub fn as_input(&self) -> &crate::operation::start_instances::builders::StartInstancesInputBuilder {
66        &self.inner
67    }
68    /// Sends the request and returns the response.
69    ///
70    /// If an error occurs, an `SdkError` will be returned with additional details that
71    /// can be matched against.
72    ///
73    /// By default, any retryable failures will be retried twice. Retry behavior
74    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
75    /// set when configuring the client.
76    pub async fn send(
77        self,
78    ) -> ::std::result::Result<
79        crate::operation::start_instances::StartInstancesOutput,
80        ::aws_smithy_runtime_api::client::result::SdkError<
81            crate::operation::start_instances::StartInstancesError,
82            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
83        >,
84    > {
85        let input = self
86            .inner
87            .build()
88            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
89        let runtime_plugins = crate::operation::start_instances::StartInstances::operation_runtime_plugins(
90            self.handle.runtime_plugins.clone(),
91            &self.handle.conf,
92            self.config_override,
93        );
94        crate::operation::start_instances::StartInstances::orchestrate(&runtime_plugins, input).await
95    }
96
97    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
98    pub fn customize(
99        self,
100    ) -> crate::client::customize::CustomizableOperation<
101        crate::operation::start_instances::StartInstancesOutput,
102        crate::operation::start_instances::StartInstancesError,
103        Self,
104    > {
105        crate::client::customize::CustomizableOperation::new(self)
106    }
107    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
108        self.set_config_override(::std::option::Option::Some(config_override.into()));
109        self
110    }
111
112    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
113        self.config_override = config_override;
114        self
115    }
116    ///
117    /// Appends an item to `InstanceIds`.
118    ///
119    /// To override the contents of this collection use [`set_instance_ids`](Self::set_instance_ids).
120    ///
121    /// <p>The IDs of the instances.</p>
122    pub fn instance_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123        self.inner = self.inner.instance_ids(input.into());
124        self
125    }
126    /// <p>The IDs of the instances.</p>
127    pub fn set_instance_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
128        self.inner = self.inner.set_instance_ids(input);
129        self
130    }
131    /// <p>The IDs of the instances.</p>
132    pub fn get_instance_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
133        self.inner.get_instance_ids()
134    }
135    /// <p>Reserved.</p>
136    pub fn additional_info(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
137        self.inner = self.inner.additional_info(input.into());
138        self
139    }
140    /// <p>Reserved.</p>
141    pub fn set_additional_info(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_additional_info(input);
143        self
144    }
145    /// <p>Reserved.</p>
146    pub fn get_additional_info(&self) -> &::std::option::Option<::std::string::String> {
147        self.inner.get_additional_info()
148    }
149    /// <p>Checks whether you have the required permissions for the operation, 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>
150    pub fn dry_run(mut self, input: bool) -> Self {
151        self.inner = self.inner.dry_run(input);
152        self
153    }
154    /// <p>Checks whether you have the required permissions for the operation, 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>
155    pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
156        self.inner = self.inner.set_dry_run(input);
157        self
158    }
159    /// <p>Checks whether you have the required permissions for the operation, 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>
160    pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
161        self.inner.get_dry_run()
162    }
163}