AppSync / Client / evaluate_code
evaluate_code#
- AppSync.Client.evaluate_code(**kwargs)#
Evaluates the given code and returns the response. The code definition requirements depend on the specified runtime. For
APPSYNC_JS
runtimes, the code defines the request and response functions. The request function takes the incoming request after a GraphQL operation is parsed and converts it into a request configuration for the selected data source operation. The response function interprets responses from the data source and maps it to the shape of the GraphQL field output type.See also: AWS API Documentation
Request Syntax
response = client.evaluate_code( runtime={ 'name': 'APPSYNC_JS', 'runtimeVersion': 'string' }, code='string', context='string', function='string' )
- Parameters:
runtime (dict) –
[REQUIRED]
The runtime to be used when evaluating the code. Currently, only the
APPSYNC_JS
runtime is supported.name (string) – [REQUIRED]
The
name
of the runtime to use. Currently, the only allowed value isAPPSYNC_JS
.runtimeVersion (string) – [REQUIRED]
The
version
of the runtime to use. Currently, the only allowed version is1.0.0
.
code (string) –
[REQUIRED]
The code definition to be evaluated. Note that
code
andruntime
are both required for this action. Theruntime
value must beAPPSYNC_JS
.context (string) –
[REQUIRED]
The map that holds all of the contextual information for your resolver invocation. A
context
is required for this action.function (string) – The function within the code to be evaluated. If provided, the valid values are
request
andresponse
.
- Return type:
dict
- Returns:
Response Syntax
{ 'evaluationResult': 'string', 'error': { 'message': 'string', 'codeErrors': [ { 'errorType': 'string', 'value': 'string', 'location': { 'line': 123, 'column': 123, 'span': 123 } }, ] }, 'logs': [ 'string', ] }
Response Structure
(dict) –
evaluationResult (string) –
The result of the evaluation operation.
error (dict) –
Contains the payload of the response error.
message (string) –
The error payload.
codeErrors (list) –
Contains the list of
CodeError
objects.(dict) –
Describes an AppSync error.
errorType (string) –
The type of code error.
Examples include, but aren’t limited to:
LINT_ERROR
,PARSER_ERROR
.value (string) –
A user presentable error.
Examples include, but aren’t limited to:
Parsing error: Unterminated string literal
.location (dict) –
The line, column, and span location of the error in the code.
line (integer) –
The line number in the code. Defaults to
0
if unknown.column (integer) –
The column number in the code. Defaults to
0
if unknown.span (integer) –
The span/length of the error. Defaults to
-1
if unknown.
logs (list) –
A list of logs that were generated by calls to
util.log.info
andutil.log.error
in the evaluated code.(string) –
Exceptions