я следующая конфигурация для моего GET
метода в шаблоне apigateway для CloudFormationКак настроить réponse в 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"
}
}
}
}
АНИ создается прекрасно, однако, реакция АФИ
{
"Item": {
"Name": {
"S": "Alex"
},
"CustomerId": {
"S": "123"
}
}
}
Но я хочу, чтобы это было просто как JSON
{
"Name":"Alex",
"CustomerId":"123"
}
Я смотрю документацию aws, но я не могу понять, какая часть моей конфигурации должна быть изменена. Я знаю, что у меня есть input
переменную, которую можно использовать для извлечения данных, но где и как, я так потерял