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_JSruntimes, 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_JSruntime is supported.- name (string) – [REQUIRED] - The - nameof the runtime to use. Currently, the only allowed value is- APPSYNC_JS.
- runtimeVersion (string) – [REQUIRED] - The - versionof the runtime to use. Currently, the only allowed version is- 1.0.0.
 
- code (string) – - [REQUIRED] - The code definition to be evaluated. Note that - codeand- runtimeare both required for this action. The- runtimevalue must be- APPSYNC_JS.
- context (string) – - [REQUIRED] - The map that holds all of the contextual information for your resolver invocation. A - contextis required for this action.
- function (string) – The function within the code to be evaluated. If provided, the valid values are - requestand- response.
 
- 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 - CodeErrorobjects.- (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 - 0if unknown.
- column (integer) – - The column number in the code. Defaults to - 0if unknown.
- span (integer) – - The span/length of the error. Defaults to - -1if unknown.
 
 
 
 
- logs (list) – - A list of logs that were generated by calls to - util.log.infoand- util.log.errorin the evaluated code.- (string) – 
 
 
 
 - Exceptions - AppSync.Client.exceptions.AccessDeniedException
- AppSync.Client.exceptions.InternalFailureException
- AppSync.Client.exceptions.BadRequestException