AppSync / Client / evaluate_mapping_template

evaluate_mapping_template#

AppSync.Client.evaluate_mapping_template(**kwargs)#

Evaluates a given template and returns the response. The mapping template can be a request or response template.

Request templates take the incoming request after a GraphQL operation is parsed and convert it into a request configuration for the selected data source operation. Response templates interpret responses from the data source and map it to the shape of the GraphQL field output type.

Mapping templates are written in the Apache Velocity Template Language (VTL).

See also: AWS API Documentation

Request Syntax

response = client.evaluate_mapping_template(
    template='string',
    context='string'
)
Parameters:
  • template (string) –

    [REQUIRED]

    The mapping template; this can be a request or response template. A template is required for this action.

  • context (string) –

    [REQUIRED]

    The map that holds all of the contextual information for your resolver invocation. A context is required for this action.

Return type:

dict

Returns:

Response Syntax

{
    'evaluationResult': 'string',
    'error': {
        'message': 'string'
    },
    'logs': [
        'string',
    ]
}

Response Structure

  • (dict) –

    • evaluationResult (string) –

      The mapping template; this can be a request or response template.

    • error (dict) –

      The ErrorDetail object.

      • message (string) –

        The error payload.

    • logs (list) –

      A list of logs that were generated by calls to util.log.info and util.log.error in the evaluated code.

      • (string) –

Exceptions

  • AppSync.Client.exceptions.AccessDeniedException

  • AppSync.Client.exceptions.InternalFailureException

  • AppSync.Client.exceptions.BadRequestException