Last active
October 27, 2019 16:34
-
-
Save mgjam/d050908bb8e087b142f90016ac4f2f4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private creatGetOutputResolver( | |
api: appsync.CfnGraphQLApi, | |
schema: appsync.CfnGraphQLSchema, | |
outputDataSource: appsync.CfnDataSource | |
) { | |
const name = 'GetOutputResolver'; | |
const requestMappingTemplate = `{ | |
"version": "2017-02-28", | |
"operation": "Invoke", | |
"payload": { | |
"Number": $utils.toJson($context.arguments.number), | |
"Count": $utils.toJson($context.arguments.count) | |
} | |
}`; | |
const responseMappingTemplate = `$utils.toJson($context.result)`; | |
const getOutputResolver = new appsync.CfnResolver(this, name, { | |
apiId: api.attrApiId, | |
typeName: 'Query', | |
fieldName: 'getOutput', | |
dataSourceName: outputDataSource.name, | |
requestMappingTemplate: requestMappingTemplate, | |
responseMappingTemplate: responseMappingTemplate | |
}); | |
getOutputResolver.addDependsOn(schema); | |
getOutputResolver.addDependsOn(outputDataSource); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment