Skip to main content

Resolver

Manages an AppSync Resolver.

Sample code#

provider.AppSync.makeResolver({
properties: ({ config }) => ({
typeName: "Mutation",
fieldName: "createNote",
kind: "UNIT",
}),
dependencies: ({ resources }) => ({
graphqlApi: resources.AppSync.GraphqlApi.cdkNotesAppsyncApi,
dataSource: resources.AppSync.DataSource.lambdaDatasource,
}),
});

Properties#

Dependencies#

Full Examples#

List#

The resolvers can be filtered with the Resolver type:

gc l -t Resolver
Listing resources on 1 provider: aws
✓ aws
✓ Initialising
✓ Listing 5/5
┌───────────────────────────────────────────────────────────────────────────┐
│ 5 AppSync::Resolver from aws │
├───────────────────────────────────────────────────────────────────────────┤
│ name: Mutation-createMyModelType │
│ managedByUs: Yes │
│ live: │
│ typeName: Mutation │
│ fieldName: createMyModelType │
│ dataSourceName: MyModelTypeTable │
│ resolverArn: arn:aws:appsync:eu-west-2:840541460064:apis/7xsgpgf4hjef7… │
│ requestMappingTemplate: { │
│ "version": "2017-02-28", │
│ "operation": "PutItem", │
│ "key": { │
│ "id": $util.dynamodb.toDynamoDBJson($util.autoId()), │
│ }, │
│ "attributeValues": $util.dynamodb.toMapValuesJson($ctx.args.input), │
│ "condition": { │
│ "expression": "attribute_not_exists(#id)", │
│ "expressionNames": { │
│ "#id": "id", │
│ }, │
│ }, │
│ } │
│ responseMappingTemplate: $util.toJson($context.result) │
│ kind: UNIT │
│ apiId: 7xsgpgf4hjef7f5higuiifiapm │
│ tags: │
│ gc-api-key-da2-obteoqfenja6dnmmfiuhb223dq: da2-wbuvlxl5cfapbifytstbz… │
│ gc-project-name: aws-appsync-graphql │
│ gc-api-key-da2-5dhrxdmt75f5naje6soej3dkja: da2-kyhuzrhyvbcadm6geay6g… │
│ gc-managed-by: grucloud │
│ gc-stage: dev │
│ gc-created-by-provider: aws │
│ gc-data-source-MyModelTypeTable: MyModelTypeTable │
│ Name: My AppSync App │
│ │
├───────────────────────────────────────────────────────────────────────────┤
│ name: Mutation-deleteMyModelType │
│ managedByUs: Yes │
│ live: │
│ typeName: Mutation │
│ fieldName: deleteMyModelType │
│ dataSourceName: MyModelTypeTable │
│ resolverArn: arn:aws:appsync:eu-west-2:840541460064:apis/7xsgpgf4hjef7… │
│ requestMappingTemplate: { │
│ "version": "2017-02-28", │
│ "operation": "DeleteItem", │
│ "key": { │
│ "id": $util.dynamodb.toDynamoDBJson($ctx.args.input.id), │
│ }, │
│ } │
│ responseMappingTemplate: $util.toJson($context.result) │
│ kind: UNIT │
│ apiId: 7xsgpgf4hjef7f5higuiifiapm │
│ tags: │
│ gc-api-key-da2-obteoqfenja6dnmmfiuhb223dq: da2-wbuvlxl5cfapbifytstbz… │
│ gc-project-name: aws-appsync-graphql │
│ gc-api-key-da2-5dhrxdmt75f5naje6soej3dkja: da2-kyhuzrhyvbcadm6geay6g… │
│ gc-managed-by: grucloud │
│ gc-stage: dev │
│ gc-created-by-provider: aws │
│ gc-data-source-MyModelTypeTable: MyModelTypeTable │
│ Name: My AppSync App │
│ │
├───────────────────────────────────────────────────────────────────────────┤