Skip to content

Commit

Permalink
Add Policy to STSAssumeRoleOptions (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
rgcostea authored Jun 7, 2022
1 parent 7835013 commit 75e50fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/credentials/assume_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type STSAssumeRoleOptions struct {
AccessKey string
SecretKey string

Policy string // Optional to assign a policy to the assumed role

Location string // Optional commonly needed with AWS STS.
DurationSeconds int // Optional defaults to 1 hour.

Expand Down Expand Up @@ -157,6 +159,9 @@ func getAssumeRoleCredentials(clnt *http.Client, endpoint string, opts STSAssume
} else {
v.Set("DurationSeconds", strconv.Itoa(defaultDurationSeconds))
}
if opts.Policy != "" {
v.Set("Policy", opts.Policy)
}

u, err := url.Parse(endpoint)
if err != nil {
Expand Down

0 comments on commit 75e50fe

Please sign in to comment.