Skip to content

Commit

Permalink
feat(appsync): mapping template for lambda proxy
Browse files Browse the repository at this point in the history
Adds default payload argument for `lambdaRequest` static methods' payload argument in MappingTemplate
  • Loading branch information
MrArnoldPalmer authored Feb 18, 2020
2 parents c505348 + 0526935 commit f865d5e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export abstract class BaseDataSource extends Construct implements IGrantable {
*/
public readonly name: string;
/**
* the underlying CFNN data source resource
* the underlying CFN data source resource
*/
public readonly ds: CfnDataSource;

Expand Down Expand Up @@ -868,9 +868,11 @@ export abstract class MappingTemplate {

/**
* Mapping template to invoke a Lambda function
* @param payload the VTL template snippet of the payload to send to the lambda
*
* @param payload the VTL template snippet of the payload to send to the lambda.
* If no payload is provided all available context fields are sent to the Lambda function
*/
public static lambdaRequest(payload: string): MappingTemplate {
public static lambdaRequest(payload: string = '$util.toJson($ctx)'): MappingTemplate {
return this.fromString(`{"version": "2017-02-28", "operation": "Invoke", "payload": ${payload}}`);
}

Expand Down

0 comments on commit f865d5e

Please sign in to comment.