码迷,mamicode.com
首页 > 移动开发 > 详细

[AWS DA] API Gateway: Mapping Templates

时间:2021-06-02 19:55:41      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:body   ppi   return   turn   技术   lambda   图片   setup   pre   

技术图片

 

What does it means?

For example, if we have setup a API Gateway, REST API, GET method point to a Lambda function with no proxy intergration which return:

{
  "statusCode": 200,
  "body": "\"Hello from Lambda! mapping\""
}

[Notice]: If we set with Proxy integration, we will only get the body from the response "Hello from Lambda! mapping"; Mapping template can NOT be used with proxy

If no proxy, then we get whatever Lambda function return to us.

Now we want to mask the response field to a different one:

技术图片

In this case, we can use Mapping Templates.

 

To create a Mapping Template for a Method:

技术图片

技术图片

Here we renamed `statusCode` & `body`, and added new field `newField`.

 

技术图片

 

技术图片

 

技术图片

[AWS DA] API Gateway: Mapping Templates

标签:body   ppi   return   turn   技术   lambda   图片   setup   pre   

原文地址:https://www.cnblogs.com/Answer1215/p/14836881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!