aws_sdk_ec2/operation/modify_image_attribute/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::modify_image_attribute::_modify_image_attribute_output::ModifyImageAttributeOutputBuilder;
3
4pub use crate::operation::modify_image_attribute::_modify_image_attribute_input::ModifyImageAttributeInputBuilder;
5
6impl crate::operation::modify_image_attribute::builders::ModifyImageAttributeInputBuilder {
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_image_attribute::ModifyImageAttributeOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::modify_image_attribute::ModifyImageAttributeError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.modify_image_attribute();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `ModifyImageAttribute`.
24///
25/// <p>Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time.</p>
26/// <p>To specify the attribute, you can use the <code>Attribute</code> parameter, or one of the following parameters: <code>Description</code>, <code>ImdsSupport</code>, or <code>LaunchPermission</code>.</p>
27/// <p>Images with an Amazon Web Services Marketplace product code cannot be made public.</p>
28/// <p>To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.</p>
29#[derive(::std::clone::Clone, ::std::fmt::Debug)]
30pub struct ModifyImageAttributeFluentBuilder {
31 handle: ::std::sync::Arc<crate::client::Handle>,
32 inner: crate::operation::modify_image_attribute::builders::ModifyImageAttributeInputBuilder,
33 config_override: ::std::option::Option<crate::config::Builder>,
34}
35impl
36 crate::client::customize::internal::CustomizableSend<
37 crate::operation::modify_image_attribute::ModifyImageAttributeOutput,
38 crate::operation::modify_image_attribute::ModifyImageAttributeError,
39 > for ModifyImageAttributeFluentBuilder
40{
41 fn send(
42 self,
43 config_override: crate::config::Builder,
44 ) -> crate::client::customize::internal::BoxFuture<
45 crate::client::customize::internal::SendResult<
46 crate::operation::modify_image_attribute::ModifyImageAttributeOutput,
47 crate::operation::modify_image_attribute::ModifyImageAttributeError,
48 >,
49 > {
50 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
51 }
52}
53impl ModifyImageAttributeFluentBuilder {
54 /// Creates a new `ModifyImageAttributeFluentBuilder`.
55 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
56 Self {
57 handle,
58 inner: ::std::default::Default::default(),
59 config_override: ::std::option::Option::None,
60 }
61 }
62 /// Access the ModifyImageAttribute as a reference.
63 pub fn as_input(&self) -> &crate::operation::modify_image_attribute::builders::ModifyImageAttributeInputBuilder {
64 &self.inner
65 }
66 /// Sends the request and returns the response.
67 ///
68 /// If an error occurs, an `SdkError` will be returned with additional details that
69 /// can be matched against.
70 ///
71 /// By default, any retryable failures will be retried twice. Retry behavior
72 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
73 /// set when configuring the client.
74 pub async fn send(
75 self,
76 ) -> ::std::result::Result<
77 crate::operation::modify_image_attribute::ModifyImageAttributeOutput,
78 ::aws_smithy_runtime_api::client::result::SdkError<
79 crate::operation::modify_image_attribute::ModifyImageAttributeError,
80 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
81 >,
82 > {
83 let input = self
84 .inner
85 .build()
86 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
87 let runtime_plugins = crate::operation::modify_image_attribute::ModifyImageAttribute::operation_runtime_plugins(
88 self.handle.runtime_plugins.clone(),
89 &self.handle.conf,
90 self.config_override,
91 );
92 crate::operation::modify_image_attribute::ModifyImageAttribute::orchestrate(&runtime_plugins, input).await
93 }
94
95 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
96 pub fn customize(
97 self,
98 ) -> crate::client::customize::CustomizableOperation<
99 crate::operation::modify_image_attribute::ModifyImageAttributeOutput,
100 crate::operation::modify_image_attribute::ModifyImageAttributeError,
101 Self,
102 > {
103 crate::client::customize::CustomizableOperation::new(self)
104 }
105 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
106 self.set_config_override(::std::option::Option::Some(config_override.into()));
107 self
108 }
109
110 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
111 self.config_override = config_override;
112 self
113 }
114 /// <p>The name of the attribute to modify.</p>
115 /// <p>Valid values: <code>description</code> | <code>imdsSupport</code> | <code>launchPermission</code></p>
116 pub fn attribute(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
117 self.inner = self.inner.attribute(input.into());
118 self
119 }
120 /// <p>The name of the attribute to modify.</p>
121 /// <p>Valid values: <code>description</code> | <code>imdsSupport</code> | <code>launchPermission</code></p>
122 pub fn set_attribute(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123 self.inner = self.inner.set_attribute(input);
124 self
125 }
126 /// <p>The name of the attribute to modify.</p>
127 /// <p>Valid values: <code>description</code> | <code>imdsSupport</code> | <code>launchPermission</code></p>
128 pub fn get_attribute(&self) -> &::std::option::Option<::std::string::String> {
129 self.inner.get_attribute()
130 }
131 /// <p>A new description for the AMI.</p>
132 pub fn description(mut self, input: crate::types::AttributeValue) -> Self {
133 self.inner = self.inner.description(input);
134 self
135 }
136 /// <p>A new description for the AMI.</p>
137 pub fn set_description(mut self, input: ::std::option::Option<crate::types::AttributeValue>) -> Self {
138 self.inner = self.inner.set_description(input);
139 self
140 }
141 /// <p>A new description for the AMI.</p>
142 pub fn get_description(&self) -> &::std::option::Option<crate::types::AttributeValue> {
143 self.inner.get_description()
144 }
145 /// <p>The ID of the AMI.</p>
146 pub fn image_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.image_id(input.into());
148 self
149 }
150 /// <p>The ID of the AMI.</p>
151 pub fn set_image_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_image_id(input);
153 self
154 }
155 /// <p>The ID of the AMI.</p>
156 pub fn get_image_id(&self) -> &::std::option::Option<::std::string::String> {
157 self.inner.get_image_id()
158 }
159 /// <p>A new launch permission for the AMI.</p>
160 pub fn launch_permission(mut self, input: crate::types::LaunchPermissionModifications) -> Self {
161 self.inner = self.inner.launch_permission(input);
162 self
163 }
164 /// <p>A new launch permission for the AMI.</p>
165 pub fn set_launch_permission(mut self, input: ::std::option::Option<crate::types::LaunchPermissionModifications>) -> Self {
166 self.inner = self.inner.set_launch_permission(input);
167 self
168 }
169 /// <p>A new launch permission for the AMI.</p>
170 pub fn get_launch_permission(&self) -> &::std::option::Option<crate::types::LaunchPermissionModifications> {
171 self.inner.get_launch_permission()
172 }
173 /// <p>The operation type. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
174 pub fn operation_type(mut self, input: crate::types::OperationType) -> Self {
175 self.inner = self.inner.operation_type(input);
176 self
177 }
178 /// <p>The operation type. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
179 pub fn set_operation_type(mut self, input: ::std::option::Option<crate::types::OperationType>) -> Self {
180 self.inner = self.inner.set_operation_type(input);
181 self
182 }
183 /// <p>The operation type. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
184 pub fn get_operation_type(&self) -> &::std::option::Option<crate::types::OperationType> {
185 self.inner.get_operation_type()
186 }
187 ///
188 /// Appends an item to `ProductCodes`.
189 ///
190 /// To override the contents of this collection use [`set_product_codes`](Self::set_product_codes).
191 ///
192 /// <p>Not supported.</p>
193 pub fn product_codes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
194 self.inner = self.inner.product_codes(input.into());
195 self
196 }
197 /// <p>Not supported.</p>
198 pub fn set_product_codes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
199 self.inner = self.inner.set_product_codes(input);
200 self
201 }
202 /// <p>Not supported.</p>
203 pub fn get_product_codes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
204 self.inner.get_product_codes()
205 }
206 ///
207 /// Appends an item to `UserGroups`.
208 ///
209 /// To override the contents of this collection use [`set_user_groups`](Self::set_user_groups).
210 ///
211 /// <p>The user groups. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
212 pub fn user_groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213 self.inner = self.inner.user_groups(input.into());
214 self
215 }
216 /// <p>The user groups. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
217 pub fn set_user_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
218 self.inner = self.inner.set_user_groups(input);
219 self
220 }
221 /// <p>The user groups. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
222 pub fn get_user_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
223 self.inner.get_user_groups()
224 }
225 ///
226 /// Appends an item to `UserIds`.
227 ///
228 /// To override the contents of this collection use [`set_user_ids`](Self::set_user_ids).
229 ///
230 /// <p>The Amazon Web Services account IDs. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
231 pub fn user_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
232 self.inner = self.inner.user_ids(input.into());
233 self
234 }
235 /// <p>The Amazon Web Services account IDs. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
236 pub fn set_user_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
237 self.inner = self.inner.set_user_ids(input);
238 self
239 }
240 /// <p>The Amazon Web Services account IDs. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
241 pub fn get_user_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
242 self.inner.get_user_ids()
243 }
244 /// <p>The value of the attribute being modified. This parameter can be used only when the <code>Attribute</code> parameter is <code>description</code> or <code>imdsSupport</code>.</p>
245 pub fn value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
246 self.inner = self.inner.value(input.into());
247 self
248 }
249 /// <p>The value of the attribute being modified. This parameter can be used only when the <code>Attribute</code> parameter is <code>description</code> or <code>imdsSupport</code>.</p>
250 pub fn set_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
251 self.inner = self.inner.set_value(input);
252 self
253 }
254 /// <p>The value of the attribute being modified. This parameter can be used only when the <code>Attribute</code> parameter is <code>description</code> or <code>imdsSupport</code>.</p>
255 pub fn get_value(&self) -> &::std::option::Option<::std::string::String> {
256 self.inner.get_value()
257 }
258 ///
259 /// Appends an item to `OrganizationArns`.
260 ///
261 /// To override the contents of this collection use [`set_organization_arns`](Self::set_organization_arns).
262 ///
263 /// <p>The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
264 pub fn organization_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265 self.inner = self.inner.organization_arns(input.into());
266 self
267 }
268 /// <p>The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
269 pub fn set_organization_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
270 self.inner = self.inner.set_organization_arns(input);
271 self
272 }
273 /// <p>The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
274 pub fn get_organization_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
275 self.inner.get_organization_arns()
276 }
277 ///
278 /// Appends an item to `OrganizationalUnitArns`.
279 ///
280 /// To override the contents of this collection use [`set_organizational_unit_arns`](Self::set_organizational_unit_arns).
281 ///
282 /// <p>The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
283 pub fn organizational_unit_arns(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
284 self.inner = self.inner.organizational_unit_arns(input.into());
285 self
286 }
287 /// <p>The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
288 pub fn set_organizational_unit_arns(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
289 self.inner = self.inner.set_organizational_unit_arns(input);
290 self
291 }
292 /// <p>The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the <code>Attribute</code> parameter is <code>launchPermission</code>.</p>
293 pub fn get_organizational_unit_arns(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
294 self.inner.get_organizational_unit_arns()
295 }
296 /// <p>Set to <code>v2.0</code> to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have <code>HttpTokens</code> automatically set to <code>required</code> so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, <code>HttpPutResponseHopLimit</code> is set to <code>2</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration">Configure the AMI</a> in the <i>Amazon EC2 User Guide</i>.</p><important>
297 /// <p>Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to <code>v2.0</code>, you can't undo it. The only way to “reset” your AMI is to create a new AMI from the underlying snapshot.</p>
298 /// </important>
299 pub fn imds_support(mut self, input: crate::types::AttributeValue) -> Self {
300 self.inner = self.inner.imds_support(input);
301 self
302 }
303 /// <p>Set to <code>v2.0</code> to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have <code>HttpTokens</code> automatically set to <code>required</code> so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, <code>HttpPutResponseHopLimit</code> is set to <code>2</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration">Configure the AMI</a> in the <i>Amazon EC2 User Guide</i>.</p><important>
304 /// <p>Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to <code>v2.0</code>, you can't undo it. The only way to “reset” your AMI is to create a new AMI from the underlying snapshot.</p>
305 /// </important>
306 pub fn set_imds_support(mut self, input: ::std::option::Option<crate::types::AttributeValue>) -> Self {
307 self.inner = self.inner.set_imds_support(input);
308 self
309 }
310 /// <p>Set to <code>v2.0</code> to indicate that IMDSv2 is specified in the AMI. Instances launched from this AMI will have <code>HttpTokens</code> automatically set to <code>required</code> so that, by default, the instance requires that IMDSv2 is used when requesting instance metadata. In addition, <code>HttpPutResponseHopLimit</code> is set to <code>2</code>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration">Configure the AMI</a> in the <i>Amazon EC2 User Guide</i>.</p><important>
311 /// <p>Do not use this parameter unless your AMI software supports IMDSv2. After you set the value to <code>v2.0</code>, you can't undo it. The only way to “reset” your AMI is to create a new AMI from the underlying snapshot.</p>
312 /// </important>
313 pub fn get_imds_support(&self) -> &::std::option::Option<crate::types::AttributeValue> {
314 self.inner.get_imds_support()
315 }
316 /// <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>
317 pub fn dry_run(mut self, input: bool) -> Self {
318 self.inner = self.inner.dry_run(input);
319 self
320 }
321 /// <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>
322 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
323 self.inner = self.inner.set_dry_run(input);
324 self
325 }
326 /// <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>
327 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
328 self.inner.get_dry_run()
329 }
330}