aws_sdk_lambda/operation/invoke/
_invoke_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct InvokeInput {
6    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
7    /// <p class="title"><b>Name formats</b></p>
8    /// <ul>
9    /// <li>
10    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
11    /// <li>
12    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
13    /// <li>
14    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
15    /// </ul>
16    /// <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>
17    pub function_name: ::std::option::Option<::std::string::String>,
18    /// <p>Choose from the following options.</p>
19    /// <ul>
20    /// <li>
21    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.</p></li>
22    /// <li>
23    /// <p><code>Event</code> – Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if one is configured). The API response only includes a status code.</p></li>
24    /// <li>
25    /// <p><code>DryRun</code> – Validate parameter values and verify that the user or role has permission to invoke the function.</p></li>
26    /// </ul>
27    pub invocation_type: ::std::option::Option<crate::types::InvocationType>,
28    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
29    pub log_type: ::std::option::Option<crate::types::LogType>,
30    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p>
31    pub client_context: ::std::option::Option<::std::string::String>,
32    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
33    /// <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>
34    pub payload: ::std::option::Option<::aws_smithy_types::Blob>,
35    /// <p>Specify a version or alias to invoke a published version of the function.</p>
36    pub qualifier: ::std::option::Option<::std::string::String>,
37}
38impl InvokeInput {
39    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
40    /// <p class="title"><b>Name formats</b></p>
41    /// <ul>
42    /// <li>
43    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
44    /// <li>
45    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
46    /// <li>
47    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
48    /// </ul>
49    /// <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>
50    pub fn function_name(&self) -> ::std::option::Option<&str> {
51        self.function_name.as_deref()
52    }
53    /// <p>Choose from the following options.</p>
54    /// <ul>
55    /// <li>
56    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.</p></li>
57    /// <li>
58    /// <p><code>Event</code> – Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if one is configured). The API response only includes a status code.</p></li>
59    /// <li>
60    /// <p><code>DryRun</code> – Validate parameter values and verify that the user or role has permission to invoke the function.</p></li>
61    /// </ul>
62    pub fn invocation_type(&self) -> ::std::option::Option<&crate::types::InvocationType> {
63        self.invocation_type.as_ref()
64    }
65    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
66    pub fn log_type(&self) -> ::std::option::Option<&crate::types::LogType> {
67        self.log_type.as_ref()
68    }
69    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p>
70    pub fn client_context(&self) -> ::std::option::Option<&str> {
71        self.client_context.as_deref()
72    }
73    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
74    /// <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>
75    pub fn payload(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
76        self.payload.as_ref()
77    }
78    /// <p>Specify a version or alias to invoke a published version of the function.</p>
79    pub fn qualifier(&self) -> ::std::option::Option<&str> {
80        self.qualifier.as_deref()
81    }
82}
83impl ::std::fmt::Debug for InvokeInput {
84    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
85        let mut formatter = f.debug_struct("InvokeInput");
86        formatter.field("function_name", &self.function_name);
87        formatter.field("invocation_type", &self.invocation_type);
88        formatter.field("log_type", &self.log_type);
89        formatter.field("client_context", &self.client_context);
90        formatter.field("payload", &"*** Sensitive Data Redacted ***");
91        formatter.field("qualifier", &self.qualifier);
92        formatter.finish()
93    }
94}
95impl InvokeInput {
96    /// Creates a new builder-style object to manufacture [`InvokeInput`](crate::operation::invoke::InvokeInput).
97    pub fn builder() -> crate::operation::invoke::builders::InvokeInputBuilder {
98        crate::operation::invoke::builders::InvokeInputBuilder::default()
99    }
100}
101
102/// A builder for [`InvokeInput`](crate::operation::invoke::InvokeInput).
103#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
104#[non_exhaustive]
105pub struct InvokeInputBuilder {
106    pub(crate) function_name: ::std::option::Option<::std::string::String>,
107    pub(crate) invocation_type: ::std::option::Option<crate::types::InvocationType>,
108    pub(crate) log_type: ::std::option::Option<crate::types::LogType>,
109    pub(crate) client_context: ::std::option::Option<::std::string::String>,
110    pub(crate) payload: ::std::option::Option<::aws_smithy_types::Blob>,
111    pub(crate) qualifier: ::std::option::Option<::std::string::String>,
112}
113impl InvokeInputBuilder {
114    /// <p>The name or ARN of the Lambda function, version, or alias.</p>
115    /// <p class="title"><b>Name formats</b></p>
116    /// <ul>
117    /// <li>
118    /// <p><b>Function name</b> – <code>my-function</code> (name-only), <code>my-function:v1</code> (with alias).</p></li>
119    /// <li>
120    /// <p><b>Function ARN</b> – <code>arn:aws:lambda:us-west-2:123456789012:function:my-function</code>.</p></li>
121    /// <li>
122    /// <p><b>Partial ARN</b> – <code>123456789012:function:my-function</code>.</p></li>
123    /// </ul>
124    /// <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>
125    /// This field is required.
126    pub fn function_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.function_name = ::std::option::Option::Some(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.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.function_name
158    }
159    /// <p>Choose from the following options.</p>
160    /// <ul>
161    /// <li>
162    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.</p></li>
163    /// <li>
164    /// <p><code>Event</code> – Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if one is configured). The API response only includes a status code.</p></li>
165    /// <li>
166    /// <p><code>DryRun</code> – Validate parameter values and verify that the user or role has permission to invoke the function.</p></li>
167    /// </ul>
168    pub fn invocation_type(mut self, input: crate::types::InvocationType) -> Self {
169        self.invocation_type = ::std::option::Option::Some(input);
170        self
171    }
172    /// <p>Choose from the following options.</p>
173    /// <ul>
174    /// <li>
175    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.</p></li>
176    /// <li>
177    /// <p><code>Event</code> – Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if one is configured). The API response only includes a status code.</p></li>
178    /// <li>
179    /// <p><code>DryRun</code> – Validate parameter values and verify that the user or role has permission to invoke the function.</p></li>
180    /// </ul>
181    pub fn set_invocation_type(mut self, input: ::std::option::Option<crate::types::InvocationType>) -> Self {
182        self.invocation_type = input;
183        self
184    }
185    /// <p>Choose from the following options.</p>
186    /// <ul>
187    /// <li>
188    /// <p><code>RequestResponse</code> (default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API response includes the function response and additional data.</p></li>
189    /// <li>
190    /// <p><code>Event</code> – Invoke the function asynchronously. Send events that fail multiple times to the function's dead-letter queue (if one is configured). The API response only includes a status code.</p></li>
191    /// <li>
192    /// <p><code>DryRun</code> – Validate parameter values and verify that the user or role has permission to invoke the function.</p></li>
193    /// </ul>
194    pub fn get_invocation_type(&self) -> &::std::option::Option<crate::types::InvocationType> {
195        &self.invocation_type
196    }
197    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
198    pub fn log_type(mut self, input: crate::types::LogType) -> Self {
199        self.log_type = ::std::option::Option::Some(input);
200        self
201    }
202    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
203    pub fn set_log_type(mut self, input: ::std::option::Option<crate::types::LogType>) -> Self {
204        self.log_type = input;
205        self
206    }
207    /// <p>Set to <code>Tail</code> to include the execution log in the response. Applies to synchronously invoked functions only.</p>
208    pub fn get_log_type(&self) -> &::std::option::Option<crate::types::LogType> {
209        &self.log_type
210    }
211    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p>
212    pub fn client_context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
213        self.client_context = ::std::option::Option::Some(input.into());
214        self
215    }
216    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p>
217    pub fn set_client_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
218        self.client_context = input;
219        self
220    }
221    /// <p>Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p>
222    pub fn get_client_context(&self) -> &::std::option::Option<::std::string::String> {
223        &self.client_context
224    }
225    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
226    /// <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>
227    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
228        self.payload = ::std::option::Option::Some(input);
229        self
230    }
231    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
232    /// <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>
233    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
234        self.payload = input;
235        self
236    }
237    /// <p>The JSON that you want to provide to your Lambda function as input.</p>
238    /// <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>
239    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
240        &self.payload
241    }
242    /// <p>Specify a version or alias to invoke a published version of the function.</p>
243    pub fn qualifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
244        self.qualifier = ::std::option::Option::Some(input.into());
245        self
246    }
247    /// <p>Specify a version or alias to invoke a published version of the function.</p>
248    pub fn set_qualifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
249        self.qualifier = input;
250        self
251    }
252    /// <p>Specify a version or alias to invoke a published version of the function.</p>
253    pub fn get_qualifier(&self) -> &::std::option::Option<::std::string::String> {
254        &self.qualifier
255    }
256    /// Consumes the builder and constructs a [`InvokeInput`](crate::operation::invoke::InvokeInput).
257    pub fn build(self) -> ::std::result::Result<crate::operation::invoke::InvokeInput, ::aws_smithy_types::error::operation::BuildError> {
258        ::std::result::Result::Ok(crate::operation::invoke::InvokeInput {
259            function_name: self.function_name,
260            invocation_type: self.invocation_type,
261            log_type: self.log_type,
262            client_context: self.client_context,
263            payload: self.payload,
264            qualifier: self.qualifier,
265        })
266    }
267}
268impl ::std::fmt::Debug for InvokeInputBuilder {
269    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
270        let mut formatter = f.debug_struct("InvokeInputBuilder");
271        formatter.field("function_name", &self.function_name);
272        formatter.field("invocation_type", &self.invocation_type);
273        formatter.field("log_type", &self.log_type);
274        formatter.field("client_context", &self.client_context);
275        formatter.field("payload", &"*** Sensitive Data Redacted ***");
276        formatter.field("qualifier", &self.qualifier);
277        formatter.finish()
278    }
279}