summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Hamonangan <70834922+hamonangann@users.noreply.github.com>2023-12-27 17:09:23 +0700
committerGitHub <noreply@github.com>2023-12-27 11:09:23 +0100
commit3e92d251ba7a950d050234d8780ce75085b1b1d4 (patch)
tree129c8f2e8982120abd9d921bf70d732b0d10fea8
parent94a0481f182b4a2cc87e76af8761e00c07de79dc (diff)
downloadzsh-3e92d251ba7a950d050234d8780ce75085b1b1d4.tar.gz
zsh-3e92d251ba7a950d050234d8780ce75085b1b1d4.tar.bz2
zsh-3e92d251ba7a950d050234d8780ce75085b1b1d4.zip
feat(aws): add support for sso sessions login (#12090)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
-rw-r--r--plugins/aws/README.md1
-rw-r--r--plugins/aws/aws.plugin.zsh6
2 files changed, 6 insertions, 1 deletions
diff --git a/plugins/aws/README.md b/plugins/aws/README.md
index 4850e223e..dbf8dcfeb 100644
--- a/plugins/aws/README.md
+++ b/plugins/aws/README.md
@@ -16,6 +16,7 @@ plugins=(... aws)
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI. It sets `$AWS_PROFILE_REGION` for display in `aws_prompt_info`.
Run `asp` without arguments to clear the profile.
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
+* `asp [<profile>] login [<sso_session>]`: In addition to `asp [<profile>] login`, if SSO session has been configured in your aws profile, it will run the `aws sso login --sso-session <sso_session>` command following profile selection.
* `asp [<profile>] logout`: If AWS SSO has been configured in your aws profile, it will run the `aws sso logout` command following profile selection.
* `asr [<region>]`: sets `$AWS_REGION` and `$AWS_DEFAULT_REGION` (legacy) to `<region>`.
diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
index 0d7040f92..fd00714e7 100644
--- a/plugins/aws/aws.plugin.zsh
+++ b/plugins/aws/aws.plugin.zsh
@@ -29,7 +29,11 @@ function asp() {
export AWS_PROFILE_REGION=$(aws configure get region)
if [[ "$2" == "login" ]]; then
- aws sso login
+ if [[ -n "$3" ]]; then
+ aws sso login --sso-session $3
+ else
+ aws sso login
+ fi
elif [[ "$2" == "logout" ]]; then
aws sso logout
fi