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