Type: AWS::AppSync::Resolver
Properties:
  ApiId: !GetAtt AppSyncAPI.ApiId
  DataSourceName: !GetAtt AppSyncDynamoDBMechanismSource.Name
  TypeName: "Query"
  FieldName: "listMechanisms"
  RequestMappingTemplate: |
    #set( $ListRequest = {
      "version": "2018-05-29",
      "operation": "Scan"
    } )
    #if( $context.args.limit )
      #set( $ListRequest.limit = $context.args.limit )
    #end
    #if( $context.args.nextToken )
      #set( $ListRequest.nextToken = $context.args.nextToken )
    #end
    #if( $context.args.filter )
      #set( $ListRequest.filter = $util.parseJson("$util.transform.toDynamoDBFilterExpression($ctx.args.filter)") )
    #end
    $util.toJson($ListRequest)
  ResponseMappingTemplate: |
    #if( $ctx.error )
      $util.error($ctx.error.message, $ctx.error.type)
    #else
      $util.toJson($ctx.result)
    #end