Last active
April 5, 2022 11:50
-
-
Save brianfoody/1060e45114e4584fe63b9dd040c26124 to your computer and use it in GitHub Desktop.
Easy AWS SSO Stuff
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
const { createAWSClient } = require("easy-aws-utils"); | |
const exec = async () => { | |
const { aws, access, s3Helper } = await createAWSClient(); | |
// The access details you have configured | |
console.log(JSON.stringify(access, null, 2)); | |
// The organisations in the left bar | |
const ssoUrls = access.organisations.map((o) => o.ssoStartUrl); | |
// List top level buckets for the account | |
const buckets = await s3Helper.listBuckets({ | |
access: { | |
accountId: "433121571808", | |
permissionSet: "AdministratorAccess", | |
}, | |
}); | |
console.log("buckets"); | |
console.log(buckets); | |
// List objects under a buckets path | |
const firstLevelObjects = await s3Helper.listObjects({ | |
access: { | |
accountId: "433121571808", | |
permissionSet: "AdministratorAccess", | |
}, | |
bucket: "wow-this-is-a-great-bucket", | |
path: "", | |
}); | |
console.log(firstLevelObjects); | |
// List objects under another path | |
const secondLevelObjects = await s3Helper.listObjects({ | |
access: { | |
accountId: "433121571808", | |
permissionSet: "AdministratorAccess", | |
}, | |
bucket: "wow-this-is-a-great-bucket", | |
path: "whatsinhere", | |
}); | |
console.log(secondLevelObjects); | |
// List objects under another path | |
const levelWithFiles = await s3Helper.listObjects({ | |
access: { | |
accountId: "433121571808", | |
permissionSet: "AdministratorAccess", | |
}, | |
bucket: "wow-this-is-a-great-bucket", | |
path: "whatsinhere/a-little-further/", | |
}); | |
console.log(levelWithFiles); | |
}; | |
exec(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment