aws_sdk_lambda/operation/update_function_code/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::update_function_code::_update_function_code_input::UpdateFunctionCodeInputBuilder;
3
4pub use crate::operation::update_function_code::_update_function_code_output::UpdateFunctionCodeOutputBuilder;
5
6impl crate::operation::update_function_code::builders::UpdateFunctionCodeInputBuilder {
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::update_function_code::UpdateFunctionCodeOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::update_function_code::UpdateFunctionCodeError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.update_function_code();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `UpdateFunctionCode`.
24///
25/// <p>Updates a Lambda function's code. If code signing is enabled for the function, the code package must be signed by a trusted publisher. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-codesigning.html">Configuring code signing for Lambda</a>.</p>
26/// <p>If the function's package type is <code>Image</code>, then you must specify the code package in <code>ImageUri</code> as the URI of a <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-images.html">container image</a> in the Amazon ECR registry.</p>
27/// <p>If the function's package type is <code>Zip</code>, then you must specify the deployment package as a <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-package.html#gettingstarted-package-zip">.zip file archive</a>. Enter the Amazon S3 bucket and key of the code .zip file location. You can also provide the function code inline using the <code>ZipFile</code> field.</p>
28/// <p>The code in the deployment package must be compatible with the target instruction set architecture of the function (<code>x86-64</code> or <code>arm64</code>).</p>
29/// <p>The function's code is locked when you publish a version. You can't modify the code of a published version, only the unpublished version.</p><note>
30/// <p>For a function defined as a container image, Lambda resolves the image tag to an image digest. In Amazon ECR, if you update the image tag to a new image, Lambda does not automatically update the function.</p>
31/// </note>
32#[derive(::std::clone::Clone, ::std::fmt::Debug)]
33pub struct UpdateFunctionCodeFluentBuilder {
34 handle: ::std::sync::Arc<crate::client::Handle>,
35 inner: crate::operation::update_function_code::builders::UpdateFunctionCodeInputBuilder,
36 config_override: ::std::option::Option<crate::config::Builder>,
37}
38impl
39 crate::client::customize::internal::CustomizableSend<
40 crate::operation::update_function_code::UpdateFunctionCodeOutput,
41 crate::operation::update_function_code::UpdateFunctionCodeError,
42 > for UpdateFunctionCodeFluentBuilder
43{
44 fn send(
45 self,
46 config_override: crate::config::Builder,
47 ) -> crate::client::customize::internal::BoxFuture<
48 crate::client::customize::internal::SendResult<
49 crate::operation::update_function_code::UpdateFunctionCodeOutput,
50 crate::operation::update_function_code::UpdateFunctionCodeError,
51 >,
52 > {
53 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
54 }
55}
56impl UpdateFunctionCodeFluentBuilder {
57 /// Creates a new `UpdateFunctionCodeFluentBuilder`.
58 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
59 Self {
60 handle,
61 inner: ::std::default::Default::default(),
62 config_override: ::std::option::Option::None,
63 }
64 }
65 /// Access the UpdateFunctionCode as a reference.
66 pub fn as_input(&self) -> &crate::operation::update_function_code::builders::UpdateFunctionCodeInputBuilder {
67 &self.inner
68 }
69 /// Sends the request and returns the response.
70 ///
71 /// If an error occurs, an `SdkError` will be returned with additional details that
72 /// can be matched against.
73 ///
74 /// By default, any retryable failures will be retried twice. Retry behavior
75 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
76 /// set when configuring the client.
77 pub async fn send(
78 self,
79 ) -> ::std::result::Result<
80 crate::operation::update_function_code::UpdateFunctionCodeOutput,
81 ::aws_smithy_runtime_api::client::result::SdkError<
82 crate::operation::update_function_code::UpdateFunctionCodeError,
83 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
84 >,
85 > {
86 let input = self
87 .inner
88 .build()
89 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
90 let runtime_plugins = crate::operation::update_function_code::UpdateFunctionCode::operation_runtime_plugins(
91 self.handle.runtime_plugins.clone(),
92 &self.handle.conf,
93 self.config_override,
94 );
95 crate::operation::update_function_code::UpdateFunctionCode::orchestrate(&runtime_plugins, input).await
96 }
97
98 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
99 pub fn customize(
100 self,
101 ) -> crate::client::customize::CustomizableOperation<
102 crate::operation::update_function_code::UpdateFunctionCodeOutput,
103 crate::operation::update_function_code::UpdateFunctionCodeError,
104 Self,
105 > {
106 crate::client::customize::CustomizableOperation::new(self)
107 }
108 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
109 self.set_config_override(::std::option::Option::Some(config_override.into()));
110 self
111 }
112
113 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
114 self.config_override = config_override;
115 self
116 }
117 /// <p>The name or ARN of the Lambda function.</p>
118 /// <p class="title"><b>Name formats</b></p>
119 /// <ul>
120 /// <li>
121 /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
122 /// <li>
123 /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
124 /// <li>
125 /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
126 /// </ul>
127 /// <p>The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
128 pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129 self.inner = self.inner.function_name(input.into());
130 self
131 }
132 /// <p>The name or ARN of the Lambda function.</p>
133 /// <p class="title"><b>Name formats</b></p>
134 /// <ul>
135 /// <li>
136 /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
137 /// <li>
138 /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
139 /// <li>
140 /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
141 /// </ul>
142 /// <p>The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
143 pub fn set_function_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
144 self.inner = self.inner.set_function_name(input);
145 self
146 }
147 /// <p>The name or ARN of the Lambda function.</p>
148 /// <p class="title"><b>Name formats</b></p>
149 /// <ul>
150 /// <li>
151 /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
152 /// <li>
153 /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
154 /// <li>
155 /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
156 /// </ul>
157 /// <p>The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.</p>
158 pub fn get_function_name(&self) -> &::std::option::Option<::std::string::String> {
159 self.inner.get_function_name()
160 }
161 /// <p>The base64-encoded contents of the deployment package. Amazon Web Services SDK and CLI clients handle the encoding for you. Use only with a function defined with a .zip file archive deployment package.</p>
162 pub fn zip_file(mut self, input: ::aws_smithy_types::Blob) -> Self {
163 self.inner = self.inner.zip_file(input);
164 self
165 }
166 /// <p>The base64-encoded contents of the deployment package. Amazon Web Services SDK and CLI clients handle the encoding for you. Use only with a function defined with a .zip file archive deployment package.</p>
167 pub fn set_zip_file(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
168 self.inner = self.inner.set_zip_file(input);
169 self
170 }
171 /// <p>The base64-encoded contents of the deployment package. Amazon Web Services SDK and CLI clients handle the encoding for you. Use only with a function defined with a .zip file archive deployment package.</p>
172 pub fn get_zip_file(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
173 self.inner.get_zip_file()
174 }
175 /// <p>An Amazon S3 bucket in the same Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services account. Use only with a function defined with a .zip file archive deployment package.</p>
176 pub fn s3_bucket(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177 self.inner = self.inner.s3_bucket(input.into());
178 self
179 }
180 /// <p>An Amazon S3 bucket in the same Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services account. Use only with a function defined with a .zip file archive deployment package.</p>
181 pub fn set_s3_bucket(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.inner = self.inner.set_s3_bucket(input);
183 self
184 }
185 /// <p>An Amazon S3 bucket in the same Amazon Web Services Region as your function. The bucket can be in a different Amazon Web Services account. Use only with a function defined with a .zip file archive deployment package.</p>
186 pub fn get_s3_bucket(&self) -> &::std::option::Option<::std::string::String> {
187 self.inner.get_s3_bucket()
188 }
189 /// <p>The Amazon S3 key of the deployment package. Use only with a function defined with a .zip file archive deployment package.</p>
190 pub fn s3_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191 self.inner = self.inner.s3_key(input.into());
192 self
193 }
194 /// <p>The Amazon S3 key of the deployment package. Use only with a function defined with a .zip file archive deployment package.</p>
195 pub fn set_s3_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196 self.inner = self.inner.set_s3_key(input);
197 self
198 }
199 /// <p>The Amazon S3 key of the deployment package. Use only with a function defined with a .zip file archive deployment package.</p>
200 pub fn get_s3_key(&self) -> &::std::option::Option<::std::string::String> {
201 self.inner.get_s3_key()
202 }
203 /// <p>For versioned objects, the version of the deployment package object to use.</p>
204 pub fn s3_object_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.inner = self.inner.s3_object_version(input.into());
206 self
207 }
208 /// <p>For versioned objects, the version of the deployment package object to use.</p>
209 pub fn set_s3_object_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.inner = self.inner.set_s3_object_version(input);
211 self
212 }
213 /// <p>For versioned objects, the version of the deployment package object to use.</p>
214 pub fn get_s3_object_version(&self) -> &::std::option::Option<::std::string::String> {
215 self.inner.get_s3_object_version()
216 }
217 /// <p>Specifies how the deployment package is stored. Valid values:</p>
218 /// <ul>
219 /// <li>
220 /// <p><code>COPY</code> (default) – Uploads a copy of your deployment package to Lambda.</p></li>
221 /// <li>
222 /// <p><code>REFERENCE</code> – Lambda references the deployment package from the specified Amazon S3 bucket.</p></li>
223 /// </ul>
224 pub fn s3_object_storage_mode(mut self, input: crate::types::S3ObjectStorageMode) -> Self {
225 self.inner = self.inner.s3_object_storage_mode(input);
226 self
227 }
228 /// <p>Specifies how the deployment package is stored. Valid values:</p>
229 /// <ul>
230 /// <li>
231 /// <p><code>COPY</code> (default) – Uploads a copy of your deployment package to Lambda.</p></li>
232 /// <li>
233 /// <p><code>REFERENCE</code> – Lambda references the deployment package from the specified Amazon S3 bucket.</p></li>
234 /// </ul>
235 pub fn set_s3_object_storage_mode(mut self, input: ::std::option::Option<crate::types::S3ObjectStorageMode>) -> Self {
236 self.inner = self.inner.set_s3_object_storage_mode(input);
237 self
238 }
239 /// <p>Specifies how the deployment package is stored. Valid values:</p>
240 /// <ul>
241 /// <li>
242 /// <p><code>COPY</code> (default) – Uploads a copy of your deployment package to Lambda.</p></li>
243 /// <li>
244 /// <p><code>REFERENCE</code> – Lambda references the deployment package from the specified Amazon S3 bucket.</p></li>
245 /// </ul>
246 pub fn get_s3_object_storage_mode(&self) -> &::std::option::Option<crate::types::S3ObjectStorageMode> {
247 self.inner.get_s3_object_storage_mode()
248 }
249 /// <p>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
250 pub fn image_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
251 self.inner = self.inner.image_uri(input.into());
252 self
253 }
254 /// <p>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
255 pub fn set_image_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
256 self.inner = self.inner.set_image_uri(input);
257 self
258 }
259 /// <p>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
260 pub fn get_image_uri(&self) -> &::std::option::Option<::std::string::String> {
261 self.inner.get_image_uri()
262 }
263 ///
264 /// Appends an item to `Architectures`.
265 ///
266 /// To override the contents of this collection use [`set_architectures`](Self::set_architectures).
267 ///
268 /// <p>The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value is <code>x86_64</code>.</p>
269 pub fn architectures(mut self, input: crate::types::Architecture) -> Self {
270 self.inner = self.inner.architectures(input);
271 self
272 }
273 /// <p>The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value is <code>x86_64</code>.</p>
274 pub fn set_architectures(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Architecture>>) -> Self {
275 self.inner = self.inner.set_architectures(input);
276 self
277 }
278 /// <p>The instruction set architecture that the function supports. Enter a string array with one of the valid values (arm64 or x86_64). The default value is <code>x86_64</code>.</p>
279 pub fn get_architectures(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Architecture>> {
280 self.inner.get_architectures()
281 }
282 /// <p>Set to true to publish a new version of the function after updating the code. This has the same effect as calling <code>PublishVersion</code> separately.</p>
283 pub fn publish(mut self, input: bool) -> Self {
284 self.inner = self.inner.publish(input);
285 self
286 }
287 /// <p>Set to true to publish a new version of the function after updating the code. This has the same effect as calling <code>PublishVersion</code> separately.</p>
288 pub fn set_publish(mut self, input: ::std::option::Option<bool>) -> Self {
289 self.inner = self.inner.set_publish(input);
290 self
291 }
292 /// <p>Set to true to publish a new version of the function after updating the code. This has the same effect as calling <code>PublishVersion</code> separately.</p>
293 pub fn get_publish(&self) -> &::std::option::Option<bool> {
294 self.inner.get_publish()
295 }
296 /// <p>Specifies where to publish the function version or configuration.</p>
297 pub fn publish_to(mut self, input: crate::types::FunctionVersionLatestPublished) -> Self {
298 self.inner = self.inner.publish_to(input);
299 self
300 }
301 /// <p>Specifies where to publish the function version or configuration.</p>
302 pub fn set_publish_to(mut self, input: ::std::option::Option<crate::types::FunctionVersionLatestPublished>) -> Self {
303 self.inner = self.inner.set_publish_to(input);
304 self
305 }
306 /// <p>Specifies where to publish the function version or configuration.</p>
307 pub fn get_publish_to(&self) -> &::std::option::Option<crate::types::FunctionVersionLatestPublished> {
308 self.inner.get_publish_to()
309 }
310 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
311 pub fn dry_run(mut self, input: bool) -> Self {
312 self.inner = self.inner.dry_run(input);
313 self
314 }
315 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
316 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
317 self.inner = self.inner.set_dry_run(input);
318 self
319 }
320 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
321 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
322 self.inner.get_dry_run()
323 }
324 /// <p>Update the function only if the revision ID matches the ID that's specified. Use this option to avoid modifying a function that has changed since you last read it.</p>
325 pub fn revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
326 self.inner = self.inner.revision_id(input.into());
327 self
328 }
329 /// <p>Update the function only if the revision ID matches the ID that's specified. Use this option to avoid modifying a function that has changed since you last read it.</p>
330 pub fn set_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
331 self.inner = self.inner.set_revision_id(input);
332 self
333 }
334 /// <p>Update the function only if the revision ID matches the ID that's specified. Use this option to avoid modifying a function that has changed since you last read it.</p>
335 pub fn get_revision_id(&self) -> &::std::option::Option<::std::string::String> {
336 self.inner.get_revision_id()
337 }
338 /// <p>The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt your function's .zip deployment package. If you don't provide a customer managed key, Lambda uses an Amazon Web Services managed key.</p>
339 pub fn source_kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
340 self.inner = self.inner.source_kms_key_arn(input.into());
341 self
342 }
343 /// <p>The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt your function's .zip deployment package. If you don't provide a customer managed key, Lambda uses an Amazon Web Services managed key.</p>
344 pub fn set_source_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
345 self.inner = self.inner.set_source_kms_key_arn(input);
346 self
347 }
348 /// <p>The ARN of the Key Management Service (KMS) customer managed key that's used to encrypt your function's .zip deployment package. If you don't provide a customer managed key, Lambda uses an Amazon Web Services managed key.</p>
349 pub fn get_source_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
350 self.inner.get_source_kms_key_arn()
351 }
352}