问题描述
我正在尝试通过AWS Apigateway解析ssm参数,但是我找不到任何示例。 我在其中定义方法集成的云形成部分如下:
Integration:
Type: AWS
Uri: !Sub "arn:aws:apigateway:us-west-2:ssm:action/GetParameter"
IntegrationHttpMethod: POST
PassthroughBehavior: NEVER
RequestTemplates:
application/json: '
{
"Name": "/dev/configs/xoxo"
}
'
当我在AWS控制台中对其进行测试时,这就是日志
Mon Aug 10 18:14:10 UTC 2020 : Method request body before transformations:
Mon Aug 10 18:14:10 UTC 2020 : Endpoint request URI: https://ssm.us-west-2.amazonaws.com/?Action=GetParameter
Mon Aug 10 18:14:10 UTC 2020 : Endpoint request headers: {Authorization=**********************************************************************************************************************************************************************************************************************************************************************dbf24f,X-Amz-Date=20200810T181410Z,x-amzn-apigateway-api-id=mrvijesndc,Accept=application/json,User-Agent=AmazonAPIGateway_mrvijesndc,X-Amz-Security-Token=...[TruncATED]
Mon Aug 10 18:14:10 UTC 2020 : Endpoint request body after transformations: { "Name": "/dev/configs/xoxo"}
Mon Aug 10 18:14:10 UTC 2020 : Sending request to https://ssm.us-west-2.amazonaws.com/?Action=GetParameter
Mon Aug 10 18:14:10 UTC 2020 : Received response. Status: 400,Integration latency: 43 ms
Mon Aug 10 18:14:10 UTC 2020 : Endpoint response headers: {Server=Server,Date=Mon,10 Aug 2020 18:14:10 GMT,Content-Type=application/json,Content-Length=220,Connection=keep-alive,x-amzn-RequestId=c2e56a30-d846-4cd6-b4af-1df95267a3fd}
Mon Aug 10 18:14:10 UTC 2020 : Endpoint response body before transformations: {"Error":{"Code":"ValidationError","Message":"1 validation error detected: Value null at 'name' Failed to satisfy constraint: Member must not be null.","Type":"Sender"},"RequestId":"c2e56a30-d846-4cd6-b4af-1df95267a3fd"}
我想它打的电话不正确,有人可以帮我吗?
解决方法
好吧,经过长时间的研究,谷歌在8个小时内为我隐藏了这篇文章,最后,我找到了它:
https://forums.aws.amazon.com/thread.jspa?threadID=288118
希望以后对像我这样的人有帮助