繁体   English   中英

如何删除刻度线 使用 Lambda AWS 上的代理集成 api

[英]How to remove tickmark Use Lambda Proxy integration on aws api

我正在使用 sam 模板创建 api+lambdas,但我遇到了一个问题如何删除标记使用 Lambda 在 sam 模板中使用代理集成在此处输入图像描述aws api???????

你不能用 SAM 做到这一点,因为它是有限的,而且他们选择保持它的轻量和最小化(根据我在 Github 与他们争论附加功能的经验)。 您可以做的是将 SAM 与 cloudformation 类型混合使用:

ApiGatewayRestApi:
  Type: AWS::ApiGateway::RestApi
  Properties:
    ApiKeySourceType: HEADER
    Description: An API Gateway with a Lambda Integration
    EndpointConfiguration:
      Types:
        - EDGE
    Name: lambda-api

ApiGatewayResource:
  Type: AWS::ApiGateway::Resource
  Properties:
    ParentId: !GetAtt ApiGatewayRestApi.RootResourceId
    PathPart: 'lambda'
    RestApiId: !Ref ApiGatewayRestApi

ApiGatewayMethod:
  Type: AWS::ApiGateway::Method
  Properties:
    ApiKeyRequired: false
    AuthorizationType: NONE
    HttpMethod: POST
    Integration:
      ConnectionType: INTERNET
      Credentials: !GetAtt ApiGatewayIamRole.Arn
      IntegrationHttpMethod: POST
      PassthroughBehavior: WHEN_NO_MATCH
      TimeoutInMillis: 29000
      Type: AWS
      Uri: !Sub 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunction.Arn}/invocations'
    OperationName: 'lambda'
    ResourceId: !Ref ApiGatewayResource
    RestApiId: !Ref ApiGatewayRestApi

请注意, integration type设置为AWS而不是AWS_PROXY 有关 CFT 类型检查文档的更多信息。 同样需要注意的是,如果没有代理,您可能需要提供 model 和 req/res 模板。 此外,SAM CLI local 将无法与 req/res 模板一起使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM