aws_sdk_lambda/operation/invoke_with_response_stream/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::invoke_with_response_stream::_invoke_with_response_stream_output::InvokeWithResponseStreamOutputBuilder;
3
4pub use crate::operation::invoke_with_response_stream::_invoke_with_response_stream_input::InvokeWithResponseStreamInputBuilder;
5
6impl crate::operation::invoke_with_response_stream::builders::InvokeWithResponseStreamInputBuilder {
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::invoke_with_response_stream::InvokeWithResponseStreamOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.invoke_with_response_stream();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `InvokeWithResponseStream`.
24///
25/// <p>Configure your Lambda functions to stream response payloads back to clients. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html">Configuring a Lambda function to stream responses</a>.</p>
26/// <p>This operation requires permission for the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html">lambda:InvokeFunction</a> action. For details on how to set up permissions for cross-account invocations, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#permissions-resource-xaccountinvoke">Granting function access to other accounts</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct InvokeWithResponseStreamFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::invoke_with_response_stream::builders::InvokeWithResponseStreamInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::invoke_with_response_stream::InvokeWithResponseStreamOutput,
36        crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
37    > for InvokeWithResponseStreamFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::invoke_with_response_stream::InvokeWithResponseStreamOutput,
45            crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl InvokeWithResponseStreamFluentBuilder {
52    /// Creates a new `InvokeWithResponseStreamFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the InvokeWithResponseStream as a reference.
61    pub fn as_input(&self) -> &crate::operation::invoke_with_response_stream::builders::InvokeWithResponseStreamInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::invoke_with_response_stream::InvokeWithResponseStreamOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::invoke_with_response_stream::InvokeWithResponseStream::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::invoke_with_response_stream::InvokeWithResponseStream::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::invoke_with_response_stream::InvokeWithResponseStreamOutput,
98        crate::operation::invoke_with_response_stream::InvokeWithResponseStreamError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The name or ARN of the Lambda function.</p>
113    /// <p class="title"><b>Name formats</b></p>
114    /// <ul>
115    /// <li>
116    /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
117    /// <li>
118    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
119    /// <li>
120    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
121    /// </ul>
122    /// <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>
123    pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
124        self.inner = self.inner.function_name(input.into());
125        self
126    }
127    /// <p>The name or ARN of the Lambda function.</p>
128    /// <p class="title"><b>Name formats</b></p>
129    /// <ul>
130    /// <li>
131    /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
132    /// <li>
133    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
134    /// <li>
135    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
136    /// </ul>
137    /// <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>
138    pub fn set_function_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139        self.inner = self.inner.set_function_name(input);
140        self
141    }
142    /// <p>The name or ARN of the Lambda function.</p>
143    /// <p class="title"><b>Name formats</b></p>
144    /// <ul>
145    /// <li>
146    /// <p><b>Function name</b> – <code>my-function</code>.</p></li>
147    /// <li>
148    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
149    /// <li>
150    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
151    /// </ul>
152    /// <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>
153    pub fn get_function_name(&self) -> &::std::option::Option<::std::string::String> {
154        self.inner.get_function_name()
155    }
156    /// <p>Use one of the following options:</p>
157    /// <ul>
158    /// <li>
159    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data.</p></li>
160    /// <li>
161    /// <p><code>DryRun</code> – Validate parameter values and verify that the IAM user or role has permission to invoke the function.</p></li>
162    /// </ul>
163    pub fn invocation_type(mut self, input: crate::types::ResponseStreamingInvocationType) -> Self {
164        self.inner = self.inner.invocation_type(input);
165        self
166    }
167    /// <p>Use one of the following options:</p>
168    /// <ul>
169    /// <li>
170    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data.</p></li>
171    /// <li>
172    /// <p><code>DryRun</code> – Validate parameter values and verify that the IAM user or role has permission to invoke the function.</p></li>
173    /// </ul>
174    pub fn set_invocation_type(mut self, input: ::std::option::Option<crate::types::ResponseStreamingInvocationType>) -> Self {
175        self.inner = self.inner.set_invocation_type(input);
176        self
177    }
178    /// <p>Use one of the following options:</p>
179    /// <ul>
180    /// <li>
181    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data.</p></li>
182    /// <li>
183    /// <p><code>DryRun</code> – Validate parameter values and verify that the IAM user or role has permission to invoke the function.</p></li>
184    /// </ul>
185    pub fn get_invocation_type(&self) -> &::std::option::Option<crate::types::ResponseStreamingInvocationType> {
186        self.inner.get_invocation_type()
187    }
188    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
189    pub fn log_type(mut self, input: crate::types::LogType) -> Self {
190        self.inner = self.inner.log_type(input);
191        self
192    }
193    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
194    pub fn set_log_type(mut self, input: ::std::option::Option<crate::types::LogType>) -> Self {
195        self.inner = self.inner.set_log_type(input);
196        self
197    }
198    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
199    pub fn get_log_type(&self) -> &::std::option::Option<crate::types::LogType> {
200        self.inner.get_log_type()
201    }
202    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.</p>
203    pub fn client_context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
204        self.inner = self.inner.client_context(input.into());
205        self
206    }
207    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.</p>
208    pub fn set_client_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
209        self.inner = self.inner.set_client_context(input);
210        self
211    }
212    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.</p>
213    pub fn get_client_context(&self) -> &::std::option::Option<::std::string::String> {
214        self.inner.get_client_context()
215    }
216    /// <p>The alias name.</p>
217    pub fn qualifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
218        self.inner = self.inner.qualifier(input.into());
219        self
220    }
221    /// <p>The alias name.</p>
222    pub fn set_qualifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
223        self.inner = self.inner.set_qualifier(input);
224        self
225    }
226    /// <p>The alias name.</p>
227    pub fn get_qualifier(&self) -> &::std::option::Option<::std::string::String> {
228        self.inner.get_qualifier()
229    }
230    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
231    /// <p>You can enter the JSON directly. For example, <code>--payload '{ "key": "value" }'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>
232    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
233        self.inner = self.inner.payload(input);
234        self
235    }
236    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
237    /// <p>You can enter the JSON directly. For example, <code>--payload '{ "key": "value" }'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>
238    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
239        self.inner = self.inner.set_payload(input);
240        self
241    }
242    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
243    /// <p>You can enter the JSON directly. For example, <code>--payload '{ "key": "value" }'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>
244    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
245        self.inner.get_payload()
246    }
247}