aws_sdk_appsync/operation/evaluate_code/_evaluate_code_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, ::std::fmt::Debug)]
5pub struct EvaluateCodeInput {
6 /// <p>The runtime to be used when evaluating the code. Currently, only the <code>APPSYNC_JS</code> runtime is supported.</p>
7 pub runtime: ::std::option::Option<crate::types::AppSyncRuntime>,
8 /// <p>The code definition to be evaluated. Note that <code>code</code> and <code>runtime</code> are both required for this action. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
9 pub code: ::std::option::Option<::std::string::String>,
10 /// <p>The map that holds all of the contextual information for your resolver invocation. A <code>context</code> is required for this action.</p>
11 pub context: ::std::option::Option<::std::string::String>,
12 /// <p>The function within the code to be evaluated. If provided, the valid values are <code>request</code> and <code>response</code>.</p>
13 pub function: ::std::option::Option<::std::string::String>,
14}
15impl EvaluateCodeInput {
16 /// <p>The runtime to be used when evaluating the code. Currently, only the <code>APPSYNC_JS</code> runtime is supported.</p>
17 pub fn runtime(&self) -> ::std::option::Option<&crate::types::AppSyncRuntime> {
18 self.runtime.as_ref()
19 }
20 /// <p>The code definition to be evaluated. Note that <code>code</code> and <code>runtime</code> are both required for this action. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
21 pub fn code(&self) -> ::std::option::Option<&str> {
22 self.code.as_deref()
23 }
24 /// <p>The map that holds all of the contextual information for your resolver invocation. A <code>context</code> is required for this action.</p>
25 pub fn context(&self) -> ::std::option::Option<&str> {
26 self.context.as_deref()
27 }
28 /// <p>The function within the code to be evaluated. If provided, the valid values are <code>request</code> and <code>response</code>.</p>
29 pub fn function(&self) -> ::std::option::Option<&str> {
30 self.function.as_deref()
31 }
32}
33impl EvaluateCodeInput {
34 /// Creates a new builder-style object to manufacture [`EvaluateCodeInput`](crate::operation::evaluate_code::EvaluateCodeInput).
35 pub fn builder() -> crate::operation::evaluate_code::builders::EvaluateCodeInputBuilder {
36 crate::operation::evaluate_code::builders::EvaluateCodeInputBuilder::default()
37 }
38}
39
40/// A builder for [`EvaluateCodeInput`](crate::operation::evaluate_code::EvaluateCodeInput).
41#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
42#[non_exhaustive]
43pub struct EvaluateCodeInputBuilder {
44 pub(crate) runtime: ::std::option::Option<crate::types::AppSyncRuntime>,
45 pub(crate) code: ::std::option::Option<::std::string::String>,
46 pub(crate) context: ::std::option::Option<::std::string::String>,
47 pub(crate) function: ::std::option::Option<::std::string::String>,
48}
49impl EvaluateCodeInputBuilder {
50 /// <p>The runtime to be used when evaluating the code. Currently, only the <code>APPSYNC_JS</code> runtime is supported.</p>
51 /// This field is required.
52 pub fn runtime(mut self, input: crate::types::AppSyncRuntime) -> Self {
53 self.runtime = ::std::option::Option::Some(input);
54 self
55 }
56 /// <p>The runtime to be used when evaluating the code. Currently, only the <code>APPSYNC_JS</code> runtime is supported.</p>
57 pub fn set_runtime(mut self, input: ::std::option::Option<crate::types::AppSyncRuntime>) -> Self {
58 self.runtime = input;
59 self
60 }
61 /// <p>The runtime to be used when evaluating the code. Currently, only the <code>APPSYNC_JS</code> runtime is supported.</p>
62 pub fn get_runtime(&self) -> &::std::option::Option<crate::types::AppSyncRuntime> {
63 &self.runtime
64 }
65 /// <p>The code definition to be evaluated. Note that <code>code</code> and <code>runtime</code> are both required for this action. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
66 /// This field is required.
67 pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
68 self.code = ::std::option::Option::Some(input.into());
69 self
70 }
71 /// <p>The code definition to be evaluated. Note that <code>code</code> and <code>runtime</code> are both required for this action. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
72 pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
73 self.code = input;
74 self
75 }
76 /// <p>The code definition to be evaluated. Note that <code>code</code> and <code>runtime</code> are both required for this action. The <code>runtime</code> value must be <code>APPSYNC_JS</code>.</p>
77 pub fn get_code(&self) -> &::std::option::Option<::std::string::String> {
78 &self.code
79 }
80 /// <p>The map that holds all of the contextual information for your resolver invocation. A <code>context</code> is required for this action.</p>
81 /// This field is required.
82 pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
83 self.context = ::std::option::Option::Some(input.into());
84 self
85 }
86 /// <p>The map that holds all of the contextual information for your resolver invocation. A <code>context</code> is required for this action.</p>
87 pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
88 self.context = input;
89 self
90 }
91 /// <p>The map that holds all of the contextual information for your resolver invocation. A <code>context</code> is required for this action.</p>
92 pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
93 &self.context
94 }
95 /// <p>The function within the code to be evaluated. If provided, the valid values are <code>request</code> and <code>response</code>.</p>
96 pub fn function(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
97 self.function = ::std::option::Option::Some(input.into());
98 self
99 }
100 /// <p>The function within the code to be evaluated. If provided, the valid values are <code>request</code> and <code>response</code>.</p>
101 pub fn set_function(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
102 self.function = input;
103 self
104 }
105 /// <p>The function within the code to be evaluated. If provided, the valid values are <code>request</code> and <code>response</code>.</p>
106 pub fn get_function(&self) -> &::std::option::Option<::std::string::String> {
107 &self.function
108 }
109 /// Consumes the builder and constructs a [`EvaluateCodeInput`](crate::operation::evaluate_code::EvaluateCodeInput).
110 pub fn build(
111 self,
112 ) -> ::std::result::Result<crate::operation::evaluate_code::EvaluateCodeInput, ::aws_smithy_types::error::operation::BuildError> {
113 ::std::result::Result::Ok(crate::operation::evaluate_code::EvaluateCodeInput {
114 runtime: self.runtime,
115 code: self.code,
116 context: self.context,
117 function: self.function,
118 })
119 }
120}