我使用网关部署了几个 API。如何以表格格式列出所有这些以及集成类型(如 lambda)和方法响应(如 200)等详细信息?
更新:正如答案中所建议的,我可以使用“get-rest-apis”方法来获取所有 API ID 的列表。json数据可以像这样转换为pandas数据框......
# aws apigateway get-rest-apis --region=us-east-1 > /tmp/to_file.json
import pandas as pd
import json
from pandas.io.json import json_normalize
with open("to_file.json") as f:
data = json.load(f)
df = json_normalize(data, "items")
df["createdDate"] = pd.to_datetime(df["createdDate"], unit="s").dt.date
df = df.sort_values(["createdDate"])
df["endpointConfiguration.types"] = df["endpointConfiguration.types"].str[0]
但是如何查询以获取每个 ID 的详细信息?
为了全面了解给定 API,我需要查询几个方法,例如 get-integration、get-method-response、get-resource。其中每一个都有不同数量的所需参数,这使得自动化过程非常困难。