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