从AWS API Gateway导出api定义

Fel*_*ano 6 amazon-web-services aws-api-gateway

我正在AWS API Gateway中创建一个完整的API.由于我正在使用图形控制台,因为我处于学习阶段,我需要一些方法以编程方式或通过CLI创建相同的API.是否有一些设施可以以某种方式导出当前的API集我可以重现相同的结构?

vaq*_*han 9

打开 CLI 并运行以下命令

aws apigateway get-export --parameters extensions='apigateway' --rest-api-id **<aaaaabcdefg123>** --stage-name dev --export-type swagger latestswagger2.json
Run Code Online (Sandbox Code Playgroud)

或者

进入舞台并导出

在此输入图像描述


小智 6

我刚刚发布了一个从Amazon API Gateway导出现有API的工具:

Amazon API Gateway Swagger Exporter

https://github.com/isabinin/aws-apigateway-swagger-exporter

希望你会发现它很有用.


Vin*_*one 6

此功能现在可以通过CLI直接从Amazon获得.它产生与Amazon的gui控制台相同的输出.

昂首阔步

aws apigateway get-export --rest-api-id a1b2c3d4e5 --stage-name dev
--export-type swagger /path/to/filename.json
Run Code Online (Sandbox Code Playgroud)

swagger + api网关扩展

aws apigateway get-export --parameters extensions='integrations'
--rest-api-id a1b2c3d4e5 --stage-name dev --export-type swagger /path/to/filename.json
Run Code Online (Sandbox Code Playgroud)

昂首阔步+邮递员扩展

aws apigateway get-export --parameters extensions='postman'
--rest-api-id a1b2c3d4e5 --stage-name dev --export-type swagger /path/to/filename.json
Run Code Online (Sandbox Code Playgroud)

有关详细信息:http: //docs.aws.amazon.com/cli/latest/reference/apigateway/get-export.html


Bob*_*ney 1

目前不支持使用 API Gateway 导出 API 定义,但这是一个强烈要求的功能,我们正在研究如何最好地支持它。