aws_sdk_ec2/operation/modify_instance_metadata_options/_modify_instance_metadata_options_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 ModifyInstanceMetadataOptionsInput {
6 /// <p>The ID of the instance.</p>
7 pub instance_id: ::std::option::Option<::std::string::String>,
8 /// <p>Indicates whether IMDSv2 is required.</p>
9 /// <ul>
10 /// <li>
11 /// <p><code>optional</code> - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.</p></li>
12 /// <li>
13 /// <p><code>required</code> - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.</p></li>
14 /// </ul>
15 /// <p>Default:</p>
16 /// <ul>
17 /// <li>
18 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code> and the account level default is set to <code>no-preference</code>, the default is <code>required</code>.</p></li>
19 /// <li>
20 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code>, but the account level default is set to <code>V1 or V2</code>, the default is <code>optional</code>.</p></li>
21 /// </ul>
22 /// <p>The default value can also be affected by other combinations of parameters. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence">Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.</p>
23 pub http_tokens: ::std::option::Option<crate::types::HttpTokensState>,
24 /// <p>The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. If no parameter is specified, the existing state is maintained.</p>
25 /// <p>Possible values: Integers from 1 to 64</p>
26 pub http_put_response_hop_limit: ::std::option::Option<i32>,
27 /// <p>Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the existing state is maintained.</p>
28 /// <p>If you specify a value of <code>disabled</code>, you cannot access your instance metadata.</p>
29 pub http_endpoint: ::std::option::Option<crate::types::InstanceMetadataEndpointState>,
30 /// <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>
31 pub dry_run: ::std::option::Option<bool>,
32 /// <p>Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP metadata endpoint.</p>
33 pub http_protocol_ipv6: ::std::option::Option<crate::types::InstanceMetadataProtocolState>,
34 /// <p>Set to <code>enabled</code> to allow access to instance tags from the instance metadata. Set to <code>disabled</code> to turn off access to instance tags from the instance metadata. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html">View tags for your EC2 instances using instance metadata</a>.</p>
35 pub instance_metadata_tags: ::std::option::Option<crate::types::InstanceMetadataTagsState>,
36}
37impl ModifyInstanceMetadataOptionsInput {
38 /// <p>The ID of the instance.</p>
39 pub fn instance_id(&self) -> ::std::option::Option<&str> {
40 self.instance_id.as_deref()
41 }
42 /// <p>Indicates whether IMDSv2 is required.</p>
43 /// <ul>
44 /// <li>
45 /// <p><code>optional</code> - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.</p></li>
46 /// <li>
47 /// <p><code>required</code> - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.</p></li>
48 /// </ul>
49 /// <p>Default:</p>
50 /// <ul>
51 /// <li>
52 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code> and the account level default is set to <code>no-preference</code>, the default is <code>required</code>.</p></li>
53 /// <li>
54 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code>, but the account level default is set to <code>V1 or V2</code>, the default is <code>optional</code>.</p></li>
55 /// </ul>
56 /// <p>The default value can also be affected by other combinations of parameters. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence">Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.</p>
57 pub fn http_tokens(&self) -> ::std::option::Option<&crate::types::HttpTokensState> {
58 self.http_tokens.as_ref()
59 }
60 /// <p>The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. If no parameter is specified, the existing state is maintained.</p>
61 /// <p>Possible values: Integers from 1 to 64</p>
62 pub fn http_put_response_hop_limit(&self) -> ::std::option::Option<i32> {
63 self.http_put_response_hop_limit
64 }
65 /// <p>Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the existing state is maintained.</p>
66 /// <p>If you specify a value of <code>disabled</code>, you cannot access your instance metadata.</p>
67 pub fn http_endpoint(&self) -> ::std::option::Option<&crate::types::InstanceMetadataEndpointState> {
68 self.http_endpoint.as_ref()
69 }
70 /// <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>
71 pub fn dry_run(&self) -> ::std::option::Option<bool> {
72 self.dry_run
73 }
74 /// <p>Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP metadata endpoint.</p>
75 pub fn http_protocol_ipv6(&self) -> ::std::option::Option<&crate::types::InstanceMetadataProtocolState> {
76 self.http_protocol_ipv6.as_ref()
77 }
78 /// <p>Set to <code>enabled</code> to allow access to instance tags from the instance metadata. Set to <code>disabled</code> to turn off access to instance tags from the instance metadata. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html">View tags for your EC2 instances using instance metadata</a>.</p>
79 pub fn instance_metadata_tags(&self) -> ::std::option::Option<&crate::types::InstanceMetadataTagsState> {
80 self.instance_metadata_tags.as_ref()
81 }
82}
83impl ModifyInstanceMetadataOptionsInput {
84 /// Creates a new builder-style object to manufacture [`ModifyInstanceMetadataOptionsInput`](crate::operation::modify_instance_metadata_options::ModifyInstanceMetadataOptionsInput).
85 pub fn builder() -> crate::operation::modify_instance_metadata_options::builders::ModifyInstanceMetadataOptionsInputBuilder {
86 crate::operation::modify_instance_metadata_options::builders::ModifyInstanceMetadataOptionsInputBuilder::default()
87 }
88}
89
90/// A builder for [`ModifyInstanceMetadataOptionsInput`](crate::operation::modify_instance_metadata_options::ModifyInstanceMetadataOptionsInput).
91#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
92#[non_exhaustive]
93pub struct ModifyInstanceMetadataOptionsInputBuilder {
94 pub(crate) instance_id: ::std::option::Option<::std::string::String>,
95 pub(crate) http_tokens: ::std::option::Option<crate::types::HttpTokensState>,
96 pub(crate) http_put_response_hop_limit: ::std::option::Option<i32>,
97 pub(crate) http_endpoint: ::std::option::Option<crate::types::InstanceMetadataEndpointState>,
98 pub(crate) dry_run: ::std::option::Option<bool>,
99 pub(crate) http_protocol_ipv6: ::std::option::Option<crate::types::InstanceMetadataProtocolState>,
100 pub(crate) instance_metadata_tags: ::std::option::Option<crate::types::InstanceMetadataTagsState>,
101}
102impl ModifyInstanceMetadataOptionsInputBuilder {
103 /// <p>The ID of the instance.</p>
104 /// This field is required.
105 pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
106 self.instance_id = ::std::option::Option::Some(input.into());
107 self
108 }
109 /// <p>The ID of the instance.</p>
110 pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
111 self.instance_id = input;
112 self
113 }
114 /// <p>The ID of the instance.</p>
115 pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
116 &self.instance_id
117 }
118 /// <p>Indicates whether IMDSv2 is required.</p>
119 /// <ul>
120 /// <li>
121 /// <p><code>optional</code> - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.</p></li>
122 /// <li>
123 /// <p><code>required</code> - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.</p></li>
124 /// </ul>
125 /// <p>Default:</p>
126 /// <ul>
127 /// <li>
128 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code> and the account level default is set to <code>no-preference</code>, the default is <code>required</code>.</p></li>
129 /// <li>
130 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code>, but the account level default is set to <code>V1 or V2</code>, the default is <code>optional</code>.</p></li>
131 /// </ul>
132 /// <p>The default value can also be affected by other combinations of parameters. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence">Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.</p>
133 pub fn http_tokens(mut self, input: crate::types::HttpTokensState) -> Self {
134 self.http_tokens = ::std::option::Option::Some(input);
135 self
136 }
137 /// <p>Indicates whether IMDSv2 is required.</p>
138 /// <ul>
139 /// <li>
140 /// <p><code>optional</code> - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.</p></li>
141 /// <li>
142 /// <p><code>required</code> - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.</p></li>
143 /// </ul>
144 /// <p>Default:</p>
145 /// <ul>
146 /// <li>
147 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code> and the account level default is set to <code>no-preference</code>, the default is <code>required</code>.</p></li>
148 /// <li>
149 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code>, but the account level default is set to <code>V1 or V2</code>, the default is <code>optional</code>.</p></li>
150 /// </ul>
151 /// <p>The default value can also be affected by other combinations of parameters. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence">Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.</p>
152 pub fn set_http_tokens(mut self, input: ::std::option::Option<crate::types::HttpTokensState>) -> Self {
153 self.http_tokens = input;
154 self
155 }
156 /// <p>Indicates whether IMDSv2 is required.</p>
157 /// <ul>
158 /// <li>
159 /// <p><code>optional</code> - IMDSv2 is optional. You can choose whether to send a session token in your instance metadata retrieval requests. If you retrieve IAM role credentials without a session token, you receive the IMDSv1 role credentials. If you retrieve IAM role credentials using a valid session token, you receive the IMDSv2 role credentials.</p></li>
160 /// <li>
161 /// <p><code>required</code> - IMDSv2 is required. You must send a session token in your instance metadata retrieval requests. With this option, retrieving the IAM role credentials always returns IMDSv2 credentials; IMDSv1 credentials are not available.</p></li>
162 /// </ul>
163 /// <p>Default:</p>
164 /// <ul>
165 /// <li>
166 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code> and the account level default is set to <code>no-preference</code>, the default is <code>required</code>.</p></li>
167 /// <li>
168 /// <p>If the value of <code>ImdsSupport</code> for the Amazon Machine Image (AMI) for your instance is <code>v2.0</code>, but the account level default is set to <code>V1 or V2</code>, the default is <code>optional</code>.</p></li>
169 /// </ul>
170 /// <p>The default value can also be affected by other combinations of parameters. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-options.html#instance-metadata-options-order-of-precedence">Order of precedence for instance metadata options</a> in the <i>Amazon EC2 User Guide</i>.</p>
171 pub fn get_http_tokens(&self) -> &::std::option::Option<crate::types::HttpTokensState> {
172 &self.http_tokens
173 }
174 /// <p>The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. If no parameter is specified, the existing state is maintained.</p>
175 /// <p>Possible values: Integers from 1 to 64</p>
176 pub fn http_put_response_hop_limit(mut self, input: i32) -> Self {
177 self.http_put_response_hop_limit = ::std::option::Option::Some(input);
178 self
179 }
180 /// <p>The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. If no parameter is specified, the existing state is maintained.</p>
181 /// <p>Possible values: Integers from 1 to 64</p>
182 pub fn set_http_put_response_hop_limit(mut self, input: ::std::option::Option<i32>) -> Self {
183 self.http_put_response_hop_limit = input;
184 self
185 }
186 /// <p>The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. If no parameter is specified, the existing state is maintained.</p>
187 /// <p>Possible values: Integers from 1 to 64</p>
188 pub fn get_http_put_response_hop_limit(&self) -> &::std::option::Option<i32> {
189 &self.http_put_response_hop_limit
190 }
191 /// <p>Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the existing state is maintained.</p>
192 /// <p>If you specify a value of <code>disabled</code>, you cannot access your instance metadata.</p>
193 pub fn http_endpoint(mut self, input: crate::types::InstanceMetadataEndpointState) -> Self {
194 self.http_endpoint = ::std::option::Option::Some(input);
195 self
196 }
197 /// <p>Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the existing state is maintained.</p>
198 /// <p>If you specify a value of <code>disabled</code>, you cannot access your instance metadata.</p>
199 pub fn set_http_endpoint(mut self, input: ::std::option::Option<crate::types::InstanceMetadataEndpointState>) -> Self {
200 self.http_endpoint = input;
201 self
202 }
203 /// <p>Enables or disables the HTTP metadata endpoint on your instances. If this parameter is not specified, the existing state is maintained.</p>
204 /// <p>If you specify a value of <code>disabled</code>, you cannot access your instance metadata.</p>
205 pub fn get_http_endpoint(&self) -> &::std::option::Option<crate::types::InstanceMetadataEndpointState> {
206 &self.http_endpoint
207 }
208 /// <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>
209 pub fn dry_run(mut self, input: bool) -> Self {
210 self.dry_run = ::std::option::Option::Some(input);
211 self
212 }
213 /// <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>
214 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
215 self.dry_run = input;
216 self
217 }
218 /// <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>
219 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
220 &self.dry_run
221 }
222 /// <p>Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP metadata endpoint.</p>
223 pub fn http_protocol_ipv6(mut self, input: crate::types::InstanceMetadataProtocolState) -> Self {
224 self.http_protocol_ipv6 = ::std::option::Option::Some(input);
225 self
226 }
227 /// <p>Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP metadata endpoint.</p>
228 pub fn set_http_protocol_ipv6(mut self, input: ::std::option::Option<crate::types::InstanceMetadataProtocolState>) -> Self {
229 self.http_protocol_ipv6 = input;
230 self
231 }
232 /// <p>Enables or disables the IPv6 endpoint for the instance metadata service. Applies only if you enabled the HTTP metadata endpoint.</p>
233 pub fn get_http_protocol_ipv6(&self) -> &::std::option::Option<crate::types::InstanceMetadataProtocolState> {
234 &self.http_protocol_ipv6
235 }
236 /// <p>Set to <code>enabled</code> to allow access to instance tags from the instance metadata. Set to <code>disabled</code> to turn off access to instance tags from the instance metadata. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html">View tags for your EC2 instances using instance metadata</a>.</p>
237 pub fn instance_metadata_tags(mut self, input: crate::types::InstanceMetadataTagsState) -> Self {
238 self.instance_metadata_tags = ::std::option::Option::Some(input);
239 self
240 }
241 /// <p>Set to <code>enabled</code> to allow access to instance tags from the instance metadata. Set to <code>disabled</code> to turn off access to instance tags from the instance metadata. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html">View tags for your EC2 instances using instance metadata</a>.</p>
242 pub fn set_instance_metadata_tags(mut self, input: ::std::option::Option<crate::types::InstanceMetadataTagsState>) -> Self {
243 self.instance_metadata_tags = input;
244 self
245 }
246 /// <p>Set to <code>enabled</code> to allow access to instance tags from the instance metadata. Set to <code>disabled</code> to turn off access to instance tags from the instance metadata. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/work-with-tags-in-IMDS.html">View tags for your EC2 instances using instance metadata</a>.</p>
247 pub fn get_instance_metadata_tags(&self) -> &::std::option::Option<crate::types::InstanceMetadataTagsState> {
248 &self.instance_metadata_tags
249 }
250 /// Consumes the builder and constructs a [`ModifyInstanceMetadataOptionsInput`](crate::operation::modify_instance_metadata_options::ModifyInstanceMetadataOptionsInput).
251 pub fn build(
252 self,
253 ) -> ::std::result::Result<
254 crate::operation::modify_instance_metadata_options::ModifyInstanceMetadataOptionsInput,
255 ::aws_smithy_types::error::operation::BuildError,
256 > {
257 ::std::result::Result::Ok(crate::operation::modify_instance_metadata_options::ModifyInstanceMetadataOptionsInput {
258 instance_id: self.instance_id,
259 http_tokens: self.http_tokens,
260 http_put_response_hop_limit: self.http_put_response_hop_limit,
261 http_endpoint: self.http_endpoint,
262 dry_run: self.dry_run,
263 http_protocol_ipv6: self.http_protocol_ipv6,
264 instance_metadata_tags: self.instance_metadata_tags,
265 })
266 }
267}