小编Joe*_*mpf的帖子

AWS Cloudformation APIGateway 尝试设置静态标头值时遇到不受支持的属性 IntegrationResponses

我正在尝试使用 Cloudformation 在 AWS APIGateway 的方法执行上设置标头映射。

这是我希望的最终状态: 在此输入图像描述

这是我尝试使用的 Cloudformation JSON 模板片段:

   "AlertDetailMock": {
  "Type": "AWS::ApiGateway::Method",
  "Properties": {
    "RestApiId": {
      "Ref": "RestApi"
    },
    "ResourceId": {
      "Ref": "AlertDetailResource"
    },
    "HttpMethod": "OPTIONS",
    "AuthorizationType": "NONE",
    "Integration": {
      "Type": "MOCK",
      "RequestTemplates": {
        "application/json": "{\"statusCode\": 200}"
      }
    },
    "IntegrationResponses": [
      {
        "ResponseTemplates": {
          "application/json": ""
        },
        "ResponseParameters": {
          "method.response.header.Access-Control-Allow-Origin": "\\'*\\'",
          "method.response.header.Access-Control-Allow-Methods": "\\'GET,OPTIONS\\'",
          "method.response.header.Access-Control-Allow-Headers": "\\'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token\\'"
        },
        "StatusCode": 200
      }
    ],
    "MethodResponses": [
      {
        "ResponseModels": {
          "application/json": {
            "Ref": "AlertDetailsModel"
          }
        },
        "ResponseParameters": {
          "method.response.header.Access-Control-Allow-Origin": true,
          "method.response.header.Access-Control-Allow-Methods": true, …
Run Code Online (Sandbox Code Playgroud)

json amazon-web-services aws-cloudformation devops aws-api-gateway

1
推荐指数
1
解决办法
2346
查看次数