Created
March 25, 2020 02:32
-
-
Save DavidWells/569a092481435da82198f0326e9eacb0 to your computer and use it in GitHub Desktop.
Recursively fetch API gateway rest API data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk') | |
const apiGateway = new AWS.APIGateway() | |
async function fetchAllApis() { | |
let getRestApisResult = await apiGateway.getRestApis().promise() | |
let apis = getRestApisResult.items | |
while (getRestApisResult.$response.hasNextPage()) { | |
getRestApisResult = await (getRestApisResult.$response.nextPage()).promise() | |
apis = apis.concat(getRestApisResult.items) | |
} | |
return apis | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment