aws_sdk_ec2/operation/modify_instance_placement/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_instance_placement::_modify_instance_placement_output::ModifyInstancePlacementOutputBuilder;
3
4pub use crate::operation::modify_instance_placement::_modify_instance_placement_input::ModifyInstancePlacementInputBuilder;
5
6impl crate::operation::modify_instance_placement::builders::ModifyInstancePlacementInputBuilder {
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::modify_instance_placement::ModifyInstancePlacementOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::modify_instance_placement::ModifyInstancePlacementError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.modify_instance_placement();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ModifyInstancePlacement`.
24///
25/// <p>Modifies the placement attributes for a specified instance. You can do the following:</p>
26/// <ul>
27/// <li>
28/// <p>Modify the affinity between an instance and a <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-hosts-overview.html">Dedicated Host</a>. When affinity is set to <code>host</code> and the instance is not associated with a specific Dedicated Host, the next time the instance is started, it is automatically associated with the host on which it lands. If the instance is restarted or rebooted, this relationship persists.</p></li>
29/// <li>
30/// <p>Change the Dedicated Host with which an instance is associated.</p></li>
31/// <li>
32/// <p>Change the instance tenancy of an instance.</p></li>
33/// <li>
34/// <p>Move an instance to or from a <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html">placement group</a>.</p></li>
35/// </ul>
36/// <p>At least one attribute for affinity, host ID, tenancy, or placement group name must be specified in the request. Affinity and tenancy can be modified in the same request.</p>
37/// <p>To modify the host ID, tenancy, placement group, or partition for an instance, the instance must be in the <code>stopped</code> state.</p>
38#[derive(::std::clone::Clone, ::std::fmt::Debug)]
39pub struct ModifyInstancePlacementFluentBuilder {
40 handle: ::std::sync::Arc<crate::client::Handle>,
41 inner: crate::operation::modify_instance_placement::builders::ModifyInstancePlacementInputBuilder,
42 config_override: ::std::option::Option<crate::config::Builder>,
43}
44impl
45 crate::client::customize::internal::CustomizableSend<
46 crate::operation::modify_instance_placement::ModifyInstancePlacementOutput,
47 crate::operation::modify_instance_placement::ModifyInstancePlacementError,
48 > for ModifyInstancePlacementFluentBuilder
49{
50 fn send(
51 self,
52 config_override: crate::config::Builder,
53 ) -> crate::client::customize::internal::BoxFuture<
54 crate::client::customize::internal::SendResult<
55 crate::operation::modify_instance_placement::ModifyInstancePlacementOutput,
56 crate::operation::modify_instance_placement::ModifyInstancePlacementError,
57 >,
58 > {
59 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
60 }
61}
62impl ModifyInstancePlacementFluentBuilder {
63 /// Creates a new `ModifyInstancePlacementFluentBuilder`.
64 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
65 Self {
66 handle,
67 inner: ::std::default::Default::default(),
68 config_override: ::std::option::Option::None,
69 }
70 }
71 /// Access the ModifyInstancePlacement as a reference.
72 pub fn as_input(&self) -> &crate::operation::modify_instance_placement::builders::ModifyInstancePlacementInputBuilder {
73 &self.inner
74 }
75 /// Sends the request and returns the response.
76 ///
77 /// If an error occurs, an `SdkError` will be returned with additional details that
78 /// can be matched against.
79 ///
80 /// By default, any retryable failures will be retried twice. Retry behavior
81 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
82 /// set when configuring the client.
83 pub async fn send(
84 self,
85 ) -> ::std::result::Result<
86 crate::operation::modify_instance_placement::ModifyInstancePlacementOutput,
87 ::aws_smithy_runtime_api::client::result::SdkError<
88 crate::operation::modify_instance_placement::ModifyInstancePlacementError,
89 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
90 >,
91 > {
92 let input = self
93 .inner
94 .build()
95 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
96 let runtime_plugins = crate::operation::modify_instance_placement::ModifyInstancePlacement::operation_runtime_plugins(
97 self.handle.runtime_plugins.clone(),
98 &self.handle.conf,
99 self.config_override,
100 );
101 crate::operation::modify_instance_placement::ModifyInstancePlacement::orchestrate(&runtime_plugins, input).await
102 }
103
104 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
105 pub fn customize(
106 self,
107 ) -> crate::client::customize::CustomizableOperation<
108 crate::operation::modify_instance_placement::ModifyInstancePlacementOutput,
109 crate::operation::modify_instance_placement::ModifyInstancePlacementError,
110 Self,
111 > {
112 crate::client::customize::CustomizableOperation::new(self)
113 }
114 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
115 self.set_config_override(::std::option::Option::Some(config_override.into()));
116 self
117 }
118
119 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
120 self.config_override = config_override;
121 self
122 }
123 /// <p>The name of the placement group in which to place the instance. For spread placement groups, the instance must have a tenancy of <code>default</code>. For cluster and partition placement groups, the instance must have a tenancy of <code>default</code> or <code>dedicated</code>.</p>
124 /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
125 pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.inner = self.inner.group_name(input.into());
127 self
128 }
129 /// <p>The name of the placement group in which to place the instance. For spread placement groups, the instance must have a tenancy of <code>default</code>. For cluster and partition placement groups, the instance must have a tenancy of <code>default</code> or <code>dedicated</code>.</p>
130 /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
131 pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132 self.inner = self.inner.set_group_name(input);
133 self
134 }
135 /// <p>The name of the placement group in which to place the instance. For spread placement groups, the instance must have a tenancy of <code>default</code>. For cluster and partition placement groups, the instance must have a tenancy of <code>default</code> or <code>dedicated</code>.</p>
136 /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
137 pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
138 self.inner.get_group_name()
139 }
140 /// <p>The number of the partition in which to place the instance. Valid only if the placement group strategy is set to <code>partition</code>.</p>
141 pub fn partition_number(mut self, input: i32) -> Self {
142 self.inner = self.inner.partition_number(input);
143 self
144 }
145 /// <p>The number of the partition in which to place the instance. Valid only if the placement group strategy is set to <code>partition</code>.</p>
146 pub fn set_partition_number(mut self, input: ::std::option::Option<i32>) -> Self {
147 self.inner = self.inner.set_partition_number(input);
148 self
149 }
150 /// <p>The number of the partition in which to place the instance. Valid only if the placement group strategy is set to <code>partition</code>.</p>
151 pub fn get_partition_number(&self) -> &::std::option::Option<i32> {
152 self.inner.get_partition_number()
153 }
154 /// <p>The ARN of the host resource group in which to place the instance. The instance must have a tenancy of <code>host</code> to specify this parameter.</p>
155 pub fn host_resource_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156 self.inner = self.inner.host_resource_group_arn(input.into());
157 self
158 }
159 /// <p>The ARN of the host resource group in which to place the instance. The instance must have a tenancy of <code>host</code> to specify this parameter.</p>
160 pub fn set_host_resource_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161 self.inner = self.inner.set_host_resource_group_arn(input);
162 self
163 }
164 /// <p>The ARN of the host resource group in which to place the instance. The instance must have a tenancy of <code>host</code> to specify this parameter.</p>
165 pub fn get_host_resource_group_arn(&self) -> &::std::option::Option<::std::string::String> {
166 self.inner.get_host_resource_group_arn()
167 }
168 /// <p>The Group Id of a placement group. You must specify the Placement Group <b>Group Id</b> to launch an instance in a shared placement group.</p>
169 pub fn group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
170 self.inner = self.inner.group_id(input.into());
171 self
172 }
173 /// <p>The Group Id of a placement group. You must specify the Placement Group <b>Group Id</b> to launch an instance in a shared placement group.</p>
174 pub fn set_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
175 self.inner = self.inner.set_group_id(input);
176 self
177 }
178 /// <p>The Group Id of a placement group. You must specify the Placement Group <b>Group Id</b> to launch an instance in a shared placement group.</p>
179 pub fn get_group_id(&self) -> &::std::option::Option<::std::string::String> {
180 self.inner.get_group_id()
181 }
182 /// <p>The ID of the instance that you are modifying.</p>
183 pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
184 self.inner = self.inner.instance_id(input.into());
185 self
186 }
187 /// <p>The ID of the instance that you are modifying.</p>
188 pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
189 self.inner = self.inner.set_instance_id(input);
190 self
191 }
192 /// <p>The ID of the instance that you are modifying.</p>
193 pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
194 self.inner.get_instance_id()
195 }
196 /// <p>The tenancy for the instance.</p><note>
197 /// <p>For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of <code>host</code>. You can't change the tenancy from <code>host</code> to <code>dedicated</code> or <code>default</code>. Attempting to make one of these unsupported tenancy changes results in an <code>InvalidRequest</code> error code.</p>
198 /// </note>
199 pub fn tenancy(mut self, input: crate::types::HostTenancy) -> Self {
200 self.inner = self.inner.tenancy(input);
201 self
202 }
203 /// <p>The tenancy for the instance.</p><note>
204 /// <p>For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of <code>host</code>. You can't change the tenancy from <code>host</code> to <code>dedicated</code> or <code>default</code>. Attempting to make one of these unsupported tenancy changes results in an <code>InvalidRequest</code> error code.</p>
205 /// </note>
206 pub fn set_tenancy(mut self, input: ::std::option::Option<crate::types::HostTenancy>) -> Self {
207 self.inner = self.inner.set_tenancy(input);
208 self
209 }
210 /// <p>The tenancy for the instance.</p><note>
211 /// <p>For T3 instances, you must launch the instance on a Dedicated Host to use a tenancy of <code>host</code>. You can't change the tenancy from <code>host</code> to <code>dedicated</code> or <code>default</code>. Attempting to make one of these unsupported tenancy changes results in an <code>InvalidRequest</code> error code.</p>
212 /// </note>
213 pub fn get_tenancy(&self) -> &::std::option::Option<crate::types::HostTenancy> {
214 self.inner.get_tenancy()
215 }
216 /// <p>The affinity setting for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-affinity">Host affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
217 pub fn affinity(mut self, input: crate::types::Affinity) -> Self {
218 self.inner = self.inner.affinity(input);
219 self
220 }
221 /// <p>The affinity setting for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-affinity">Host affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
222 pub fn set_affinity(mut self, input: ::std::option::Option<crate::types::Affinity>) -> Self {
223 self.inner = self.inner.set_affinity(input);
224 self
225 }
226 /// <p>The affinity setting for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-dedicated-hosts-work.html#dedicated-hosts-affinity">Host affinity</a> in the <i>Amazon EC2 User Guide</i>.</p>
227 pub fn get_affinity(&self) -> &::std::option::Option<crate::types::Affinity> {
228 self.inner.get_affinity()
229 }
230 /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
231 pub fn host_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232 self.inner = self.inner.host_id(input.into());
233 self
234 }
235 /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
236 pub fn set_host_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
237 self.inner = self.inner.set_host_id(input);
238 self
239 }
240 /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
241 pub fn get_host_id(&self) -> &::std::option::Option<::std::string::String> {
242 self.inner.get_host_id()
243 }
244}