0
我有以下爲我apigateway模板GET
方法配置cloudformation如何自定義效應初探在cloudformation爲apigateway
"paths": {
"/customer/{customerid}": {
"get": {
"description": "Returns JSON customer objects from DynamoDB.",
"parameters": [
{
"required": true,
"type": "string",
"name": "customerid",
"in": "path"
}
],
"produces": [
"application/json"
],
"x-amazon-apigateway-integration": {
"passthroughBehavior": "never",
"responses": {
"default": {
"statusCode": "200"
}
},
"uri": {
"Fn::Join": [
":",
[
"arn",
"aws",
"apigateway",
{
"Ref": "AWS::Region"
},
"dynamodb",
"action/GetItem"
]
]
},
"httpMethod": "POST",
"requestTemplates": {
"application/json": "{\n \"TableName\": \"customer\",\n \"Key\": {\n \"customerid\": {\n \"S\": \"$input.params('customerid')\"\n }\n }\n}\n"
},
"credentials": {
"Fn::GetAtt": [
"TableAccessRole",
"Arn"
]
},
"type": "aws"
},
"consumes": [
"application/json"
],
"responses": {
"200": {
"description": "200 response"
}
}
}
}
被完美創建的API,但是,該API的響應
{
"Item": {
"Name": {
"S": "Alex"
},
"CustomerId": {
"S": "123"
}
}
}
但我想這是一個簡單的JSON像
{
"Name":"Alex",
"CustomerId":"123"
}
我正在查看aws文檔,但我無法弄清楚我的配置的哪個部分需要更改。我知道我有input
變量,我可以用它來獲取數據,但在何處以及如何,我這樣失去