aws_sdk_ec2/operation/modify_instance_placement/
_modify_instance_placement_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct ModifyInstancePlacementInput {
6    /// <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>
7    /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
8    pub group_name: ::std::option::Option<::std::string::String>,
9    /// <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>
10    pub partition_number: ::std::option::Option<i32>,
11    /// <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>
12    pub host_resource_group_arn: ::std::option::Option<::std::string::String>,
13    /// <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>
14    pub group_id: ::std::option::Option<::std::string::String>,
15    /// <p>The ID of the instance that you are modifying.</p>
16    pub instance_id: ::std::option::Option<::std::string::String>,
17    /// <p>The tenancy for the instance.</p><note>
18    /// <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>
19    /// </note>
20    pub tenancy: ::std::option::Option<crate::types::HostTenancy>,
21    /// <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>
22    pub affinity: ::std::option::Option<crate::types::Affinity>,
23    /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
24    pub host_id: ::std::option::Option<::std::string::String>,
25}
26impl ModifyInstancePlacementInput {
27    /// <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>
28    /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
29    pub fn group_name(&self) -> ::std::option::Option<&str> {
30        self.group_name.as_deref()
31    }
32    /// <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>
33    pub fn partition_number(&self) -> ::std::option::Option<i32> {
34        self.partition_number
35    }
36    /// <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>
37    pub fn host_resource_group_arn(&self) -> ::std::option::Option<&str> {
38        self.host_resource_group_arn.as_deref()
39    }
40    /// <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>
41    pub fn group_id(&self) -> ::std::option::Option<&str> {
42        self.group_id.as_deref()
43    }
44    /// <p>The ID of the instance that you are modifying.</p>
45    pub fn instance_id(&self) -> ::std::option::Option<&str> {
46        self.instance_id.as_deref()
47    }
48    /// <p>The tenancy for the instance.</p><note>
49    /// <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>
50    /// </note>
51    pub fn tenancy(&self) -> ::std::option::Option<&crate::types::HostTenancy> {
52        self.tenancy.as_ref()
53    }
54    /// <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>
55    pub fn affinity(&self) -> ::std::option::Option<&crate::types::Affinity> {
56        self.affinity.as_ref()
57    }
58    /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
59    pub fn host_id(&self) -> ::std::option::Option<&str> {
60        self.host_id.as_deref()
61    }
62}
63impl ModifyInstancePlacementInput {
64    /// Creates a new builder-style object to manufacture [`ModifyInstancePlacementInput`](crate::operation::modify_instance_placement::ModifyInstancePlacementInput).
65    pub fn builder() -> crate::operation::modify_instance_placement::builders::ModifyInstancePlacementInputBuilder {
66        crate::operation::modify_instance_placement::builders::ModifyInstancePlacementInputBuilder::default()
67    }
68}
69
70/// A builder for [`ModifyInstancePlacementInput`](crate::operation::modify_instance_placement::ModifyInstancePlacementInput).
71#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
72#[non_exhaustive]
73pub struct ModifyInstancePlacementInputBuilder {
74    pub(crate) group_name: ::std::option::Option<::std::string::String>,
75    pub(crate) partition_number: ::std::option::Option<i32>,
76    pub(crate) host_resource_group_arn: ::std::option::Option<::std::string::String>,
77    pub(crate) group_id: ::std::option::Option<::std::string::String>,
78    pub(crate) instance_id: ::std::option::Option<::std::string::String>,
79    pub(crate) tenancy: ::std::option::Option<crate::types::HostTenancy>,
80    pub(crate) affinity: ::std::option::Option<crate::types::Affinity>,
81    pub(crate) host_id: ::std::option::Option<::std::string::String>,
82}
83impl ModifyInstancePlacementInputBuilder {
84    /// <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>
85    /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
86    pub fn group_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
87        self.group_name = ::std::option::Option::Some(input.into());
88        self
89    }
90    /// <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>
91    /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
92    pub fn set_group_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
93        self.group_name = input;
94        self
95    }
96    /// <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>
97    /// <p>To remove an instance from a placement group, specify an empty string ("").</p>
98    pub fn get_group_name(&self) -> &::std::option::Option<::std::string::String> {
99        &self.group_name
100    }
101    /// <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>
102    pub fn partition_number(mut self, input: i32) -> Self {
103        self.partition_number = ::std::option::Option::Some(input);
104        self
105    }
106    /// <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>
107    pub fn set_partition_number(mut self, input: ::std::option::Option<i32>) -> Self {
108        self.partition_number = input;
109        self
110    }
111    /// <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>
112    pub fn get_partition_number(&self) -> &::std::option::Option<i32> {
113        &self.partition_number
114    }
115    /// <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>
116    pub fn host_resource_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117        self.host_resource_group_arn = ::std::option::Option::Some(input.into());
118        self
119    }
120    /// <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>
121    pub fn set_host_resource_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
122        self.host_resource_group_arn = input;
123        self
124    }
125    /// <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>
126    pub fn get_host_resource_group_arn(&self) -> &::std::option::Option<::std::string::String> {
127        &self.host_resource_group_arn
128    }
129    /// <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>
130    pub fn group_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
131        self.group_id = ::std::option::Option::Some(input.into());
132        self
133    }
134    /// <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>
135    pub fn set_group_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.group_id = input;
137        self
138    }
139    /// <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>
140    pub fn get_group_id(&self) -> &::std::option::Option<::std::string::String> {
141        &self.group_id
142    }
143    /// <p>The ID of the instance that you are modifying.</p>
144    /// This field is required.
145    pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.instance_id = ::std::option::Option::Some(input.into());
147        self
148    }
149    /// <p>The ID of the instance that you are modifying.</p>
150    pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.instance_id = input;
152        self
153    }
154    /// <p>The ID of the instance that you are modifying.</p>
155    pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
156        &self.instance_id
157    }
158    /// <p>The tenancy for the instance.</p><note>
159    /// <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>
160    /// </note>
161    pub fn tenancy(mut self, input: crate::types::HostTenancy) -> Self {
162        self.tenancy = ::std::option::Option::Some(input);
163        self
164    }
165    /// <p>The tenancy for the instance.</p><note>
166    /// <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>
167    /// </note>
168    pub fn set_tenancy(mut self, input: ::std::option::Option<crate::types::HostTenancy>) -> Self {
169        self.tenancy = input;
170        self
171    }
172    /// <p>The tenancy for the instance.</p><note>
173    /// <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>
174    /// </note>
175    pub fn get_tenancy(&self) -> &::std::option::Option<crate::types::HostTenancy> {
176        &self.tenancy
177    }
178    /// <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>
179    pub fn affinity(mut self, input: crate::types::Affinity) -> Self {
180        self.affinity = ::std::option::Option::Some(input);
181        self
182    }
183    /// <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>
184    pub fn set_affinity(mut self, input: ::std::option::Option<crate::types::Affinity>) -> Self {
185        self.affinity = input;
186        self
187    }
188    /// <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>
189    pub fn get_affinity(&self) -> &::std::option::Option<crate::types::Affinity> {
190        &self.affinity
191    }
192    /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
193    pub fn host_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194        self.host_id = ::std::option::Option::Some(input.into());
195        self
196    }
197    /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
198    pub fn set_host_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
199        self.host_id = input;
200        self
201    }
202    /// <p>The ID of the Dedicated Host with which to associate the instance.</p>
203    pub fn get_host_id(&self) -> &::std::option::Option<::std::string::String> {
204        &self.host_id
205    }
206    /// Consumes the builder and constructs a [`ModifyInstancePlacementInput`](crate::operation::modify_instance_placement::ModifyInstancePlacementInput).
207    pub fn build(
208        self,
209    ) -> ::std::result::Result<
210        crate::operation::modify_instance_placement::ModifyInstancePlacementInput,
211        ::aws_smithy_types::error::operation::BuildError,
212    > {
213        ::std::result::Result::Ok(crate::operation::modify_instance_placement::ModifyInstancePlacementInput {
214            group_name: self.group_name,
215            partition_number: self.partition_number,
216            host_resource_group_arn: self.host_resource_group_arn,
217            group_id: self.group_id,
218            instance_id: self.instance_id,
219            tenancy: self.tenancy,
220            affinity: self.affinity,
221            host_id: self.host_id,
222        })
223    }
224}