Created
May 17, 2021 23:26
-
-
Save davidwebstar34/bdcb423fac67669d65a33091f363a8f0 to your computer and use it in GitHub Desktop.
Some sample code for returning data from well-architected reviews
This file contains hidden or 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
let AWS = require('aws-sdk'); | |
let wellarchitected = new AWS.WellArchitected(); | |
AWS.config.update({ region: process.env.AWS_REGION }); | |
async function getWorkloads() { | |
let params = { | |
MaxResults: '50', | |
}; | |
return wellarchitected.listWorkloads(params).promise() | |
} | |
async function getMilestones(workloadID) { | |
let params = { | |
WorkloadId: workloadID, /* required */ | |
MaxResults: '50' | |
}; | |
return wellarchitected.listMilestones(params).promise(); | |
} | |
async function getAnswers(workloadID, lens) { | |
let pillars = [] | |
let arr = ["reliability", "operationalExcellence", "security", "costOptimization", "performance"]; | |
for (let i = 0; i < arr.length; i++) { | |
let params = { | |
LensAlias: lens, | |
WorkloadId: workloadID, | |
MaxResults: '50', | |
PillarId: arr[i] | |
}; | |
let wa = wellarchitected.listAnswers(params).promise(); | |
let pillar = await wa; | |
pillars.push(pillar); | |
} | |
return pillars; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment