我发现最简单的方法是使用 swagger 定义DefinitionBody
,这里有一个例子,所以你可以得到一个想法。回购
重要提示:如果您在 Lambda 上使用代理集成,则无论您的方法、或=>中的httpMethod
方法x-amazon-apigateway-integration
都应该是POST
GET
PUT
POST
DELETE
httpMethod: POST
DefinitionBody:
swagger: 2.0
info:
title: EventSource API Definition
paths:
/events/{id}:
get:
summary: Get an event details
description: Retrieve specific event
parameters:
- name: id
in: path
required: true
type: string
consumes:
- application/json
produces:
- application/json
x-amazon-apigateway-integration:
uri:
Fn::Sub: arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetEventsFunction.Arn}/invocations
responses: {}
httpMethod: POST
type: aws_proxy