在 API Gateway 中为 CloudWatch 调用操作时收到以下错误消息。
"Error": {
"Code": "InvalidAction",
"Message": "Could not find operation DescribeAlarms for version 2009-05-15",
"Type": "Sender"
}
我一直在使用 DescribeAlarms 进行测试。我的设置如下。
- 集成类型 = AWS 服务
- AWS 服务 = CloudWatch
- HTTP 方法 = POST
- 行动 = 描述警报
该错误引用了 API 版本 2009-05-15,根据第 54 页的文档,它只有 ListMetrics 和 GetMetricStatistics。ListMetrics在我的设置中确实按预期工作。
当前版本是 2010-08-01,但无论如何我都看不到在 API Gateway 中引用它。在文档中的 POST 请求示例中,它显示了一个标有 x-amz-target 的标头,其值为 GraniteServiceVersion20100801.API_Name。
我的解释是我可以将 Name = x-amz-target 和 value 'GraniteServiceVersion20100801.DescribeAlarms' 放在我的 http 标头中,用于 API 网关中的集成请求。
这不会改变响应并给出相同的错误消息。
在调用 describe-alarms 时,我还在 CLI 中使用了 --debug,它在正文中显示...
"body": {
"Action":"DescribeAlarms",
"Version":"2010-08-01"
}
因此,我还设置了 http 标头以包含值为 'application/x-amz-json-1.1' 的 Content-Type,然后放入
{
"Action":"DescribeAlarms",
"Version":"2010-08-01"
}
但也没有任何改变。
任何帮助或指导将不胜感激。