aws_sdk_lambda/operation/invoke/
_invoke_output.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 InvokeOutput {
6    /// <p>The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.</p>
7    pub status_code: i32,
8    /// <p>If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.</p>
9    pub function_error: ::std::option::Option<::std::string::String>,
10    /// <p>The last 4 KB of the execution log, which is base64-encoded.</p>
11    pub log_result: ::std::option::Option<::std::string::String>,
12    /// <p>The response from the function, or an error object.</p>
13    pub payload: ::std::option::Option<::aws_smithy_types::Blob>,
14    /// <p>The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.</p>
15    pub executed_version: ::std::option::Option<::std::string::String>,
16    /// <p>The ARN of the durable execution that was started. This is returned when invoking a durable function and provides a unique identifier for tracking the execution.</p>
17    pub durable_execution_arn: ::std::option::Option<::std::string::String>,
18    _request_id: Option<String>,
19}
20impl InvokeOutput {
21    /// <p>The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.</p>
22    pub fn status_code(&self) -> i32 {
23        self.status_code
24    }
25    /// <p>If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.</p>
26    pub fn function_error(&self) -> ::std::option::Option<&str> {
27        self.function_error.as_deref()
28    }
29    /// <p>The last 4 KB of the execution log, which is base64-encoded.</p>
30    pub fn log_result(&self) -> ::std::option::Option<&str> {
31        self.log_result.as_deref()
32    }
33    /// <p>The response from the function, or an error object.</p>
34    pub fn payload(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
35        self.payload.as_ref()
36    }
37    /// <p>The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.</p>
38    pub fn executed_version(&self) -> ::std::option::Option<&str> {
39        self.executed_version.as_deref()
40    }
41    /// <p>The ARN of the durable execution that was started. This is returned when invoking a durable function and provides a unique identifier for tracking the execution.</p>
42    pub fn durable_execution_arn(&self) -> ::std::option::Option<&str> {
43        self.durable_execution_arn.as_deref()
44    }
45}
46impl ::std::fmt::Debug for InvokeOutput {
47    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
48        let mut formatter = f.debug_struct("InvokeOutput");
49        formatter.field("status_code", &self.status_code);
50        formatter.field("function_error", &self.function_error);
51        formatter.field("log_result", &self.log_result);
52        formatter.field("payload", &"*** Sensitive Data Redacted ***");
53        formatter.field("executed_version", &self.executed_version);
54        formatter.field("durable_execution_arn", &self.durable_execution_arn);
55        formatter.field("_request_id", &self._request_id);
56        formatter.finish()
57    }
58}
59impl ::aws_types::request_id::RequestId for InvokeOutput {
60    fn request_id(&self) -> Option<&str> {
61        self._request_id.as_deref()
62    }
63}
64impl InvokeOutput {
65    /// Creates a new builder-style object to manufacture [`InvokeOutput`](crate::operation::invoke::InvokeOutput).
66    pub fn builder() -> crate::operation::invoke::builders::InvokeOutputBuilder {
67        crate::operation::invoke::builders::InvokeOutputBuilder::default()
68    }
69}
70
71/// A builder for [`InvokeOutput`](crate::operation::invoke::InvokeOutput).
72#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
73#[non_exhaustive]
74pub struct InvokeOutputBuilder {
75    pub(crate) status_code: ::std::option::Option<i32>,
76    pub(crate) function_error: ::std::option::Option<::std::string::String>,
77    pub(crate) log_result: ::std::option::Option<::std::string::String>,
78    pub(crate) payload: ::std::option::Option<::aws_smithy_types::Blob>,
79    pub(crate) executed_version: ::std::option::Option<::std::string::String>,
80    pub(crate) durable_execution_arn: ::std::option::Option<::std::string::String>,
81    _request_id: Option<String>,
82}
83impl InvokeOutputBuilder {
84    /// <p>The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.</p>
85    pub fn status_code(mut self, input: i32) -> Self {
86        self.status_code = ::std::option::Option::Some(input);
87        self
88    }
89    /// <p>The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.</p>
90    pub fn set_status_code(mut self, input: ::std::option::Option<i32>) -> Self {
91        self.status_code = input;
92        self
93    }
94    /// <p>The HTTP status code is in the 200 range for a successful request. For the <code>RequestResponse</code> invocation type, this status code is 200. For the <code>Event</code> invocation type, this status code is 202. For the <code>DryRun</code> invocation type, the status code is 204.</p>
95    pub fn get_status_code(&self) -> &::std::option::Option<i32> {
96        &self.status_code
97    }
98    /// <p>If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.</p>
99    pub fn function_error(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100        self.function_error = ::std::option::Option::Some(input.into());
101        self
102    }
103    /// <p>If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.</p>
104    pub fn set_function_error(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.function_error = input;
106        self
107    }
108    /// <p>If present, indicates that an error occurred during function execution. Details about the error are included in the response payload.</p>
109    pub fn get_function_error(&self) -> &::std::option::Option<::std::string::String> {
110        &self.function_error
111    }
112    /// <p>The last 4 KB of the execution log, which is base64-encoded.</p>
113    pub fn log_result(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.log_result = ::std::option::Option::Some(input.into());
115        self
116    }
117    /// <p>The last 4 KB of the execution log, which is base64-encoded.</p>
118    pub fn set_log_result(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.log_result = input;
120        self
121    }
122    /// <p>The last 4 KB of the execution log, which is base64-encoded.</p>
123    pub fn get_log_result(&self) -> &::std::option::Option<::std::string::String> {
124        &self.log_result
125    }
126    /// <p>The response from the function, or an error object.</p>
127    pub fn payload(mut self, input: ::aws_smithy_types::Blob) -> Self {
128        self.payload = ::std::option::Option::Some(input);
129        self
130    }
131    /// <p>The response from the function, or an error object.</p>
132    pub fn set_payload(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
133        self.payload = input;
134        self
135    }
136    /// <p>The response from the function, or an error object.</p>
137    pub fn get_payload(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
138        &self.payload
139    }
140    /// <p>The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.</p>
141    pub fn executed_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.executed_version = ::std::option::Option::Some(input.into());
143        self
144    }
145    /// <p>The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.</p>
146    pub fn set_executed_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.executed_version = input;
148        self
149    }
150    /// <p>The version of the function that executed. When you invoke a function with an alias, this indicates which version the alias resolved to.</p>
151    pub fn get_executed_version(&self) -> &::std::option::Option<::std::string::String> {
152        &self.executed_version
153    }
154    /// <p>The ARN of the durable execution that was started. This is returned when invoking a durable function and provides a unique identifier for tracking the execution.</p>
155    pub fn durable_execution_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
156        self.durable_execution_arn = ::std::option::Option::Some(input.into());
157        self
158    }
159    /// <p>The ARN of the durable execution that was started. This is returned when invoking a durable function and provides a unique identifier for tracking the execution.</p>
160    pub fn set_durable_execution_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
161        self.durable_execution_arn = input;
162        self
163    }
164    /// <p>The ARN of the durable execution that was started. This is returned when invoking a durable function and provides a unique identifier for tracking the execution.</p>
165    pub fn get_durable_execution_arn(&self) -> &::std::option::Option<::std::string::String> {
166        &self.durable_execution_arn
167    }
168    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
169        self._request_id = Some(request_id.into());
170        self
171    }
172
173    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
174        self._request_id = request_id;
175        self
176    }
177    /// Consumes the builder and constructs a [`InvokeOutput`](crate::operation::invoke::InvokeOutput).
178    pub fn build(self) -> crate::operation::invoke::InvokeOutput {
179        crate::operation::invoke::InvokeOutput {
180            status_code: self.status_code.unwrap_or_default(),
181            function_error: self.function_error,
182            log_result: self.log_result,
183            payload: self.payload,
184            executed_version: self.executed_version,
185            durable_execution_arn: self.durable_execution_arn,
186            _request_id: self._request_id,
187        }
188    }
189}
190impl ::std::fmt::Debug for InvokeOutputBuilder {
191    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
192        let mut formatter = f.debug_struct("InvokeOutputBuilder");
193        formatter.field("status_code", &self.status_code);
194        formatter.field("function_error", &self.function_error);
195        formatter.field("log_result", &self.log_result);
196        formatter.field("payload", &"*** Sensitive Data Redacted ***");
197        formatter.field("executed_version", &self.executed_version);
198        formatter.field("durable_execution_arn", &self.durable_execution_arn);
199        formatter.field("_request_id", &self._request_id);
200        formatter.finish()
201    }
202}