aws_sdk_appsync/operation/evaluate_code/
_evaluate_code_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, ::std::fmt::Debug)]
5pub struct EvaluateCodeOutput {
6    /// <p>The result of the evaluation operation.</p>
7    pub evaluation_result: ::std::option::Option<::std::string::String>,
8    /// <p>Contains the payload of the response error.</p>
9    pub error: ::std::option::Option<crate::types::EvaluateCodeErrorDetail>,
10    /// <p>A list of logs that were generated by calls to <code>util.log.info</code> and <code>util.log.error</code> in the evaluated code.</p>
11    pub logs: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
12    /// <p>An object available inside each resolver and function handler. A single <code>stash</code> object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.</p>
13    pub stash: ::std::option::Option<::std::string::String>,
14    /// <p>The list of runtime errors that are added to the GraphQL operation response.</p>
15    pub out_errors: ::std::option::Option<::std::string::String>,
16    _request_id: Option<String>,
17}
18impl EvaluateCodeOutput {
19    /// <p>The result of the evaluation operation.</p>
20    pub fn evaluation_result(&self) -> ::std::option::Option<&str> {
21        self.evaluation_result.as_deref()
22    }
23    /// <p>Contains the payload of the response error.</p>
24    pub fn error(&self) -> ::std::option::Option<&crate::types::EvaluateCodeErrorDetail> {
25        self.error.as_ref()
26    }
27    /// <p>A list of logs that were generated by calls to <code>util.log.info</code> and <code>util.log.error</code> in the evaluated code.</p>
28    ///
29    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.logs.is_none()`.
30    pub fn logs(&self) -> &[::std::string::String] {
31        self.logs.as_deref().unwrap_or_default()
32    }
33    /// <p>An object available inside each resolver and function handler. A single <code>stash</code> object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.</p>
34    pub fn stash(&self) -> ::std::option::Option<&str> {
35        self.stash.as_deref()
36    }
37    /// <p>The list of runtime errors that are added to the GraphQL operation response.</p>
38    pub fn out_errors(&self) -> ::std::option::Option<&str> {
39        self.out_errors.as_deref()
40    }
41}
42impl ::aws_types::request_id::RequestId for EvaluateCodeOutput {
43    fn request_id(&self) -> Option<&str> {
44        self._request_id.as_deref()
45    }
46}
47impl EvaluateCodeOutput {
48    /// Creates a new builder-style object to manufacture [`EvaluateCodeOutput`](crate::operation::evaluate_code::EvaluateCodeOutput).
49    pub fn builder() -> crate::operation::evaluate_code::builders::EvaluateCodeOutputBuilder {
50        crate::operation::evaluate_code::builders::EvaluateCodeOutputBuilder::default()
51    }
52}
53
54/// A builder for [`EvaluateCodeOutput`](crate::operation::evaluate_code::EvaluateCodeOutput).
55#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
56#[non_exhaustive]
57pub struct EvaluateCodeOutputBuilder {
58    pub(crate) evaluation_result: ::std::option::Option<::std::string::String>,
59    pub(crate) error: ::std::option::Option<crate::types::EvaluateCodeErrorDetail>,
60    pub(crate) logs: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
61    pub(crate) stash: ::std::option::Option<::std::string::String>,
62    pub(crate) out_errors: ::std::option::Option<::std::string::String>,
63    _request_id: Option<String>,
64}
65impl EvaluateCodeOutputBuilder {
66    /// <p>The result of the evaluation operation.</p>
67    pub fn evaluation_result(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68        self.evaluation_result = ::std::option::Option::Some(input.into());
69        self
70    }
71    /// <p>The result of the evaluation operation.</p>
72    pub fn set_evaluation_result(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73        self.evaluation_result = input;
74        self
75    }
76    /// <p>The result of the evaluation operation.</p>
77    pub fn get_evaluation_result(&self) -> &::std::option::Option<::std::string::String> {
78        &self.evaluation_result
79    }
80    /// <p>Contains the payload of the response error.</p>
81    pub fn error(mut self, input: crate::types::EvaluateCodeErrorDetail) -> Self {
82        self.error = ::std::option::Option::Some(input);
83        self
84    }
85    /// <p>Contains the payload of the response error.</p>
86    pub fn set_error(mut self, input: ::std::option::Option<crate::types::EvaluateCodeErrorDetail>) -> Self {
87        self.error = input;
88        self
89    }
90    /// <p>Contains the payload of the response error.</p>
91    pub fn get_error(&self) -> &::std::option::Option<crate::types::EvaluateCodeErrorDetail> {
92        &self.error
93    }
94    /// Appends an item to `logs`.
95    ///
96    /// To override the contents of this collection use [`set_logs`](Self::set_logs).
97    ///
98    /// <p>A list of logs that were generated by calls to <code>util.log.info</code> and <code>util.log.error</code> in the evaluated code.</p>
99    pub fn logs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100        let mut v = self.logs.unwrap_or_default();
101        v.push(input.into());
102        self.logs = ::std::option::Option::Some(v);
103        self
104    }
105    /// <p>A list of logs that were generated by calls to <code>util.log.info</code> and <code>util.log.error</code> in the evaluated code.</p>
106    pub fn set_logs(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
107        self.logs = input;
108        self
109    }
110    /// <p>A list of logs that were generated by calls to <code>util.log.info</code> and <code>util.log.error</code> in the evaluated code.</p>
111    pub fn get_logs(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
112        &self.logs
113    }
114    /// <p>An object available inside each resolver and function handler. A single <code>stash</code> object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.</p>
115    pub fn stash(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
116        self.stash = ::std::option::Option::Some(input.into());
117        self
118    }
119    /// <p>An object available inside each resolver and function handler. A single <code>stash</code> object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.</p>
120    pub fn set_stash(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
121        self.stash = input;
122        self
123    }
124    /// <p>An object available inside each resolver and function handler. A single <code>stash</code> object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.</p>
125    pub fn get_stash(&self) -> &::std::option::Option<::std::string::String> {
126        &self.stash
127    }
128    /// <p>The list of runtime errors that are added to the GraphQL operation response.</p>
129    pub fn out_errors(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.out_errors = ::std::option::Option::Some(input.into());
131        self
132    }
133    /// <p>The list of runtime errors that are added to the GraphQL operation response.</p>
134    pub fn set_out_errors(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.out_errors = input;
136        self
137    }
138    /// <p>The list of runtime errors that are added to the GraphQL operation response.</p>
139    pub fn get_out_errors(&self) -> &::std::option::Option<::std::string::String> {
140        &self.out_errors
141    }
142    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
143        self._request_id = Some(request_id.into());
144        self
145    }
146
147    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
148        self._request_id = request_id;
149        self
150    }
151    /// Consumes the builder and constructs a [`EvaluateCodeOutput`](crate::operation::evaluate_code::EvaluateCodeOutput).
152    pub fn build(self) -> crate::operation::evaluate_code::EvaluateCodeOutput {
153        crate::operation::evaluate_code::EvaluateCodeOutput {
154            evaluation_result: self.evaluation_result,
155            error: self.error,
156            logs: self.logs,
157            stash: self.stash,
158            out_errors: self.out_errors,
159            _request_id: self._request_id,
160        }
161    }
162}