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_output::UpdateFunctionCodeOutputBuilder;
3
4pub use crate::operation::update_function_code::_update_function_code_input::UpdateFunctionCodeInputBuilder;
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>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
218 pub fn image_uri(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219 self.inner = self.inner.image_uri(input.into());
220 self
221 }
222 /// <p>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
223 pub fn set_image_uri(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.inner = self.inner.set_image_uri(input);
225 self
226 }
227 /// <p>URI of a container image in the Amazon ECR registry. Do not use for a function defined with a .zip file archive.</p>
228 pub fn get_image_uri(&self) -> &::std::option::Option<::std::string::String> {
229 self.inner.get_image_uri()
230 }
231 /// <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>
232 pub fn publish(mut self, input: bool) -> Self {
233 self.inner = self.inner.publish(input);
234 self
235 }
236 /// <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>
237 pub fn set_publish(mut self, input: ::std::option::Option<bool>) -> Self {
238 self.inner = self.inner.set_publish(input);
239 self
240 }
241 /// <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>
242 pub fn get_publish(&self) -> &::std::option::Option<bool> {
243 self.inner.get_publish()
244 }
245 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
246 pub fn dry_run(mut self, input: bool) -> Self {
247 self.inner = self.inner.dry_run(input);
248 self
249 }
250 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
251 pub fn set_dry_run(mut self, input: ::std::option::Option<bool>) -> Self {
252 self.inner = self.inner.set_dry_run(input);
253 self
254 }
255 /// <p>Set to true to validate the request parameters and access permissions without modifying the function code.</p>
256 pub fn get_dry_run(&self) -> &::std::option::Option<bool> {
257 self.inner.get_dry_run()
258 }
259 /// <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>
260 pub fn revision_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
261 self.inner = self.inner.revision_id(input.into());
262 self
263 }
264 /// <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>
265 pub fn set_revision_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
266 self.inner = self.inner.set_revision_id(input);
267 self
268 }
269 /// <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>
270 pub fn get_revision_id(&self) -> &::std::option::Option<::std::string::String> {
271 self.inner.get_revision_id()
272 }
273 ///
274 /// Appends an item to `Architectures`.
275 ///
276 /// To override the contents of this collection use [`set_architectures`](Self::set_architectures).
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 architectures(mut self, input: crate::types::Architecture) -> Self {
280 self.inner = self.inner.architectures(input);
281 self
282 }
283 /// <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>
284 pub fn set_architectures(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Architecture>>) -> Self {
285 self.inner = self.inner.set_architectures(input);
286 self
287 }
288 /// <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>
289 pub fn get_architectures(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Architecture>> {
290 self.inner.get_architectures()
291 }
292 /// <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>
293 pub fn source_kms_key_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
294 self.inner = self.inner.source_kms_key_arn(input.into());
295 self
296 }
297 /// <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>
298 pub fn set_source_kms_key_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
299 self.inner = self.inner.set_source_kms_key_arn(input);
300 self
301 }
302 /// <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>
303 pub fn get_source_kms_key_arn(&self) -> &::std::option::Option<::std::string::String> {
304 self.inner.get_source_kms_key_arn()
305 }
306}