Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --list-available-roles to print the list of roles available to assume and exit #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kalbasit
Copy link

@kalbasit kalbasit commented Apr 15, 2024

Running gsts ... --list-available-roles prints the list of available roles and exits. Also, if -o json was given, the list of roles is then printed in JSON.

Please scrutinize my PR, I'm neither a TypeScript expert nor I know gsts internally well.

closes #56

@@ -97,7 +97,7 @@ const credentialsManager = new CredentialsManager(logger, argv.awsRegion, argv['
await trash(paths.data);
}

if (!argv.headful) {
if (!argv.headful && !argv.listAvailableRoles) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without adding this, the output looks something like this:

❯ node index.js --idp-id=redacted --sp-id=redacted --aws-region us-west-2 --list-available-roles
⠋ Logging inarn:aws:iam::1234567890:role/StagingAccount-AdministratorAccess
arn:aws:iam::1234567890:role/StagingAccount-FullReadOnlyAccess
arn:aws:iam::1234567890:role/StagingAccount-ReadOnlyAccess
arn:aws:iam::1234567891:role/ProductionAccount-AdministratorAccess
arn:aws:iam::1234567891:role/ProductionAccount-FullReadOnlyAccess
arn:aws:iam::1234567891:role/ProductionAccount-ReadOnlyAccess

I have to filter out stderr to get the output to look good

❯ node index.js --idp-id=redacted --sp-id=redacted --aws-region us-west-2 --list-available-roles 2>/dev/null
arn:aws:iam::1234567890:role/StagingAccount-AdministratorAccess
arn:aws:iam::1234567890:role/StagingAccount-FullReadOnlyAccess
arn:aws:iam::1234567890:role/StagingAccount-ReadOnlyAccess
arn:aws:iam::1234567891:role/ProductionAccount-AdministratorAccess
arn:aws:iam::1234567891:role/ProductionAccount-FullReadOnlyAccess
arn:aws:iam::1234567891:role/ProductionAccount-ReadOnlyAccess

Looking for recommendation on what's the best way to address this.

@kalbasit
Copy link
Author

kalbasit commented Apr 26, 2024

@ruimarinho Do you mind taking a look if this implementation is satisfactory to close #56?

@kalbasit
Copy link
Author

@ruimarinho any chance to get this merged, please??

kalbasit added a commit to canary-technologies-corp/homebrew-tap that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --list-available-roles
1 participant