feat(aws): Adds the login option for AWS SSO (#9921)
Diff
1diff --git a/plugins/aws/README.md b/plugins/aws/README.md
2index 011bbd8b4d382e01b59e0ad9882fee5e2807d1b7..24c6429ddbe11644ebb047cbd9e52f7e1584a185 100644
3--- a/plugins/aws/README.md
4+++ b/plugins/aws/README.md
5@@ -14,6 +14,7 @@ plugins=(... aws)
6 * `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
7 It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
8 Run `asp` without arguments to clear the profile.
9+* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
1011 * `acp [<profile>]`: in addition to `asp` functionality, it actually changes the profile by
12 assuming the role specified in the `<profile>` configuration. It supports MFA and sets
13diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
14index 2d095635b54b407f7af7c558d06f8e92043f8e85..3a3a111b4fcb7eac853637095ff9e3ed88676855 100644
15--- a/plugins/aws/aws.plugin.zsh
16+++ b/plugins/aws/aws.plugin.zsh
17@@ -21,6 +21,10 @@ function asp() {
18 export AWS_DEFAULT_PROFILE=$1
19 export AWS_PROFILE=$1
20 export AWS_EB_PROFILE=$1
21+
22+ if [[ "$2" == "login" ]]; then
23+ aws sso login
24+ fi
25 }
2627 # AWS profile switch