Skip to content

Commit

Permalink
Merge branch 'main' into refreshable-aws-sso-tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
chrnorm committed Mar 1, 2024
2 parents 8b46288 + a8b3e6d commit e0b9ef5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ require (
github.com/common-fate/useragent v0.1.0
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/fatih/structs v1.1.0
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/deepmap/oapi-codegen v1.11.0 h1:f/X2NdIkaBKsSdpeuwLnY/vDI0AtPUrmB5LMgc7YD+A=
github.com/deepmap/oapi-codegen v1.11.0/go.mod h1:k+ujhoQGxmQYBZBbxhOZNZf4j08qv5mC+OH+fFTnKxM=
github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dvsekhvalnov/jose2go v1.6.0 h1:Y9gnSnP4qEI0+/uQkHvFXeD2PLPJeXEL+ySMEA2EjTY=
github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
Expand Down
8 changes: 5 additions & 3 deletions pkg/console/service_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package console
// e.g. passing in `-s ec2` will open the console at the ec2/v2 URL.
var ServiceMap = map[string]string{
"": "console",
"acm": "acm",
"acm": "acm",
"aos": "aos",
"athena": "athena",
"appsync": "appsync",
Expand All @@ -18,8 +18,8 @@ var ServiceMap = map[string]string{
"codepipeline": "codepipeline",
"codedeploy": "codedeploy",
"codesuite": "codesuite",
"codeartifact": "codesuite/codeartifact",
"codecommit": "codesuite/codecommit",
"codeartifact": "codesuite/codeartifact",
"codecommit": "codesuite/codecommit",
"config": "config",
"ct": "cloudtrail",
"cw": "cloudwatch",
Expand All @@ -33,6 +33,8 @@ var ServiceMap = map[string]string{
"ecr": "ecr",
"ecs": "ecs",
"eks": "eks",
"events": "events",
"eventbridge": "events",
"gd": "guardduty",
"grafana": "grafana",
"iam": "iamv2",
Expand Down
12 changes: 11 additions & 1 deletion pkg/granted/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,10 @@ var ExportCredentialsCommand = cli.Command{
var RotateCredentialsCommand = cli.Command{
Name: "rotate",
Usage: "Generates new access key for the profile in AWS, and updates the profile",
Flags: []cli.Flag{&cli.StringFlag{Name: "profile", Usage: "If provided, generates new access key for the specified profile"}},
Flags: []cli.Flag{
&cli.StringFlag{Name: "profile", Usage: "If provided, generates new access key for the specified profile"},
&cli.BoolFlag{Name: "delete", Usage: "delete the previous active key"},
},
Action: func(c *cli.Context) error {
profileName := c.String("profile")

Expand Down Expand Up @@ -583,6 +586,13 @@ var RotateCredentialsCommand = cli.Command{
return err
}

if c.Bool("delete") {
_, err = iamClient.DeleteAccessKey(c.Context, &iam.DeleteAccessKeyInput{AccessKeyId: &t.AccessKeyID})
if err != nil {
return err
}
}

clio.Successf("Access Key of '%s' profile has been successfully rotated and updated in secure storage\n", profileName)

return nil
Expand Down

0 comments on commit e0b9ef5

Please sign in to comment.