从sam模板或swagger 2.0添加AWS API网关映射模板

时间:2020-02-19 11:52:45

标签: amazon-web-services aws-api-gateway swagger-2.0

我正在使用sam模板创建基于aws的应用程序,因此,我有自定义的lambda授权者,因此我需要将映射模板添加到方法中,而我找不到能够做到这一点的模板

1 个答案:

答案 0 :(得分:0)

HI经过大量研究,如果有人面临同样的问题,我在这里共享了解决方案。 SAM模板实际上是一种cloudformation模板,因此大多数cloudformation语法都可以在SAM模板上使用(可能不是直接使用,而是可以通过某种方式完成) 这是我所做的

# All the Resources are defined Here
Resources:
  MyApiGatewayWrapper:
    Type: AWS::Serverless::Api
    Description: Sam generated  API Endpoint for My web app
    Properties:
      Name: My Api Gateway Wrapper
      StageName: prod
      DefinitionBody:
        'Fn::Transform':
          Name: 'AWS::Include'
          Parameters:
            Location: stages/care_now_24-prod-swagger-apigateway.yaml