aws_sdk_lambda/operation/put_function_event_invoke_config/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_function_event_invoke_config::_put_function_event_invoke_config_output::PutFunctionEventInvokeConfigOutputBuilder;
3
4pub use crate::operation::put_function_event_invoke_config::_put_function_event_invoke_config_input::PutFunctionEventInvokeConfigInputBuilder;
5
6impl crate::operation::put_function_event_invoke_config::builders::PutFunctionEventInvokeConfigInputBuilder {
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::put_function_event_invoke_config::PutFunctionEventInvokeConfigOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_function_event_invoke_config();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutFunctionEventInvokeConfig`.
24///
25/// <p>Configures options for <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">asynchronous invocation</a> on a function, version, or alias. If a configuration already exists for a function, version, or alias, this operation overwrites it. If you exclude any settings, they are removed. To set one option without affecting existing settings for other options, use <code>UpdateFunctionEventInvokeConfig</code>.</p>
26/// <p>By default, Lambda retries an asynchronous invocation twice if the function returns an error. It retains events in a queue for up to six hours. When an event fails all processing attempts or stays in the asynchronous invocation queue for too long, Lambda discards it. To retain discarded events, configure a dead-letter queue with <code>UpdateFunctionConfiguration</code>.</p>
27/// <p>To send an invocation record to a queue, topic, S3 bucket, function, or event bus, specify a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">destination</a>. You can configure separate destinations for successful invocations (on-success) and events that fail all processing attempts (on-failure). You can configure destinations in addition to or instead of a dead-letter queue.</p><note>
28/// <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
29/// </note>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct PutFunctionEventInvokeConfigFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::put_function_event_invoke_config::builders::PutFunctionEventInvokeConfigInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl
37    crate::client::customize::internal::CustomizableSend<
38        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigOutput,
39        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigError,
40    > for PutFunctionEventInvokeConfigFluentBuilder
41{
42    fn send(
43        self,
44        config_override: crate::config::Builder,
45    ) -> crate::client::customize::internal::BoxFuture<
46        crate::client::customize::internal::SendResult<
47            crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigOutput,
48            crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigError,
49        >,
50    > {
51        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
52    }
53}
54impl PutFunctionEventInvokeConfigFluentBuilder {
55    /// Creates a new `PutFunctionEventInvokeConfigFluentBuilder`.
56    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
57        Self {
58            handle,
59            inner: ::std::default::Default::default(),
60            config_override: ::std::option::Option::None,
61        }
62    }
63    /// Access the PutFunctionEventInvokeConfig as a reference.
64    pub fn as_input(&self) -> &crate::operation::put_function_event_invoke_config::builders::PutFunctionEventInvokeConfigInputBuilder {
65        &self.inner
66    }
67    /// Sends the request and returns the response.
68    ///
69    /// If an error occurs, an `SdkError` will be returned with additional details that
70    /// can be matched against.
71    ///
72    /// By default, any retryable failures will be retried twice. Retry behavior
73    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
74    /// set when configuring the client.
75    pub async fn send(
76        self,
77    ) -> ::std::result::Result<
78        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigOutput,
79        ::aws_smithy_runtime_api::client::result::SdkError<
80            crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigError,
81            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
82        >,
83    > {
84        let input = self
85            .inner
86            .build()
87            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
88        let runtime_plugins = crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfig::operation_runtime_plugins(
89            self.handle.runtime_plugins.clone(),
90            &self.handle.conf,
91            self.config_override,
92        );
93        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfig::orchestrate(&runtime_plugins, input).await
94    }
95
96    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
97    pub fn customize(
98        self,
99    ) -> crate::client::customize::CustomizableOperation<
100        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigOutput,
101        crate::operation::put_function_event_invoke_config::PutFunctionEventInvokeConfigError,
102        Self,
103    > {
104        crate::client::customize::CustomizableOperation::new(self)
105    }
106    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
107        self.set_config_override(::std::option::Option::Some(config_override.into()));
108        self
109    }
110
111    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
112        self.config_override = config_override;
113        self
114    }
115    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
116    /// <p class="title"><b>Name formats</b></p>
117    /// <ul>
118    /// <li>
119    /// <p><b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
120    /// <li>
121    /// <p><b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
122    /// <li>
123    /// <p><b>Partial ARN</b> - <code>123456789012:function:my-function</code>.</p></li>
124    /// </ul>
125    /// <p>You can append a version number or alias to any of the formats. 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>
126    pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.function_name(input.into());
128        self
129    }
130    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
131    /// <p class="title"><b>Name formats</b></p>
132    /// <ul>
133    /// <li>
134    /// <p><b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
135    /// <li>
136    /// <p><b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
137    /// <li>
138    /// <p><b>Partial ARN</b> - <code>123456789012:function:my-function</code>.</p></li>
139    /// </ul>
140    /// <p>You can append a version number or alias to any of the formats. 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>
141    pub fn set_function_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
142        self.inner = self.inner.set_function_name(input);
143        self
144    }
145    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
146    /// <p class="title"><b>Name formats</b></p>
147    /// <ul>
148    /// <li>
149    /// <p><b>Function name</b> - <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
150    /// <li>
151    /// <p><b>Function ARN</b> - <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
152    /// <li>
153    /// <p><b>Partial ARN</b> - <code>123456789012:function:my-function</code>.</p></li>
154    /// </ul>
155    /// <p>You can append a version number or alias to any of the formats. 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>
156    pub fn get_function_name(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_function_name()
158    }
159    /// <p>A version number or alias name.</p>
160    pub fn qualifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.inner = self.inner.qualifier(input.into());
162        self
163    }
164    /// <p>A version number or alias name.</p>
165    pub fn set_qualifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.inner = self.inner.set_qualifier(input);
167        self
168    }
169    /// <p>A version number or alias name.</p>
170    pub fn get_qualifier(&self) -> &::std::option::Option<::std::string::String> {
171        self.inner.get_qualifier()
172    }
173    /// <p>The maximum number of times to retry when the function returns an error.</p>
174    pub fn maximum_retry_attempts(mut self, input: i32) -> Self {
175        self.inner = self.inner.maximum_retry_attempts(input);
176        self
177    }
178    /// <p>The maximum number of times to retry when the function returns an error.</p>
179    pub fn set_maximum_retry_attempts(mut self, input: ::std::option::Option<i32>) -> Self {
180        self.inner = self.inner.set_maximum_retry_attempts(input);
181        self
182    }
183    /// <p>The maximum number of times to retry when the function returns an error.</p>
184    pub fn get_maximum_retry_attempts(&self) -> &::std::option::Option<i32> {
185        self.inner.get_maximum_retry_attempts()
186    }
187    /// <p>The maximum age of a request that Lambda sends to a function for processing.</p>
188    pub fn maximum_event_age_in_seconds(mut self, input: i32) -> Self {
189        self.inner = self.inner.maximum_event_age_in_seconds(input);
190        self
191    }
192    /// <p>The maximum age of a request that Lambda sends to a function for processing.</p>
193    pub fn set_maximum_event_age_in_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
194        self.inner = self.inner.set_maximum_event_age_in_seconds(input);
195        self
196    }
197    /// <p>The maximum age of a request that Lambda sends to a function for processing.</p>
198    pub fn get_maximum_event_age_in_seconds(&self) -> &::std::option::Option<i32> {
199        self.inner.get_maximum_event_age_in_seconds()
200    }
201    /// <p>A destination for events after they have been sent to a function for processing.</p>
202    /// <p class="title"><b>Destinations</b></p>
203    /// <ul>
204    /// <li>
205    /// <p><b>Function</b> - The Amazon Resource Name (ARN) of a Lambda function.</p></li>
206    /// <li>
207    /// <p><b>Queue</b> - The ARN of a standard SQS queue.</p></li>
208    /// <li>
209    /// <p><b>Bucket</b> - The ARN of an Amazon S3 bucket.</p></li>
210    /// <li>
211    /// <p><b>Topic</b> - The ARN of a standard SNS topic.</p></li>
212    /// <li>
213    /// <p><b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p></li>
214    /// </ul><note>
215    /// <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
216    /// </note>
217    pub fn destination_config(mut self, input: crate::types::DestinationConfig) -> Self {
218        self.inner = self.inner.destination_config(input);
219        self
220    }
221    /// <p>A destination for events after they have been sent to a function for processing.</p>
222    /// <p class="title"><b>Destinations</b></p>
223    /// <ul>
224    /// <li>
225    /// <p><b>Function</b> - The Amazon Resource Name (ARN) of a Lambda function.</p></li>
226    /// <li>
227    /// <p><b>Queue</b> - The ARN of a standard SQS queue.</p></li>
228    /// <li>
229    /// <p><b>Bucket</b> - The ARN of an Amazon S3 bucket.</p></li>
230    /// <li>
231    /// <p><b>Topic</b> - The ARN of a standard SNS topic.</p></li>
232    /// <li>
233    /// <p><b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p></li>
234    /// </ul><note>
235    /// <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
236    /// </note>
237    pub fn set_destination_config(mut self, input: ::std::option::Option<crate::types::DestinationConfig>) -> Self {
238        self.inner = self.inner.set_destination_config(input);
239        self
240    }
241    /// <p>A destination for events after they have been sent to a function for processing.</p>
242    /// <p class="title"><b>Destinations</b></p>
243    /// <ul>
244    /// <li>
245    /// <p><b>Function</b> - The Amazon Resource Name (ARN) of a Lambda function.</p></li>
246    /// <li>
247    /// <p><b>Queue</b> - The ARN of a standard SQS queue.</p></li>
248    /// <li>
249    /// <p><b>Bucket</b> - The ARN of an Amazon S3 bucket.</p></li>
250    /// <li>
251    /// <p><b>Topic</b> - The ARN of a standard SNS topic.</p></li>
252    /// <li>
253    /// <p><b>Event Bus</b> - The ARN of an Amazon EventBridge event bus.</p></li>
254    /// </ul><note>
255    /// <p>S3 buckets are supported only for on-failure destinations. To retain records of successful invocations, use another destination type.</p>
256    /// </note>
257    pub fn get_destination_config(&self) -> &::std::option::Option<crate::types::DestinationConfig> {
258        self.inner.get_destination_config()
259    }
260}