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

V2: Replace DurationSeconds with Duration #84

Merged
merged 1 commit into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aws_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func TestGetAwsConfig(t *testing.T) {
Config: &Config{
AccessKey: servicemocks.MockStaticAccessKey,
AssumeRole: &AssumeRole{
RoleARN: servicemocks.MockStsAssumeRoleArn,
DurationSeconds: 3600,
SessionName: servicemocks.MockStsAssumeRoleSessionName,
RoleARN: servicemocks.MockStsAssumeRoleArn,
Duration: 1 * time.Hour,
SessionName: servicemocks.MockStsAssumeRoleSessionName,
},
Region: "us-east-1",
SecretKey: servicemocks.MockStaticSecretKey,
Expand Down
3 changes: 1 addition & 2 deletions credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"log"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
Expand Down Expand Up @@ -73,7 +72,7 @@ func assumeRoleCredentialsProvider(ctx context.Context, awsConfig aws.Config, c

appCreds := stscreds.NewAssumeRoleProvider(client, ar.RoleARN, func(opts *stscreds.AssumeRoleOptions) {
opts.RoleSessionName = ar.SessionName
opts.Duration = time.Duration(ar.DurationSeconds) * time.Second
opts.Duration = ar.Duration

if ar.ExternalID != "" {
opts.ExternalID = aws.String(ar.ExternalID)
Expand Down
4 changes: 3 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package config

import "time"

type Config struct {
AccessKey string
APNInfo *APNInfo
Expand Down Expand Up @@ -35,7 +37,7 @@ type APNProduct struct {

type AssumeRole struct {
RoleARN string
DurationSeconds int
Duration time.Duration
ExternalID string
Policy string
PolicyARNs []string
Expand Down
6 changes: 3 additions & 3 deletions v2/awsv1shim/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ func TestGetSession(t *testing.T) {
Config: &awsbase.Config{
AccessKey: servicemocks.MockStaticAccessKey,
AssumeRole: &awsbase.AssumeRole{
RoleARN: servicemocks.MockStsAssumeRoleArn,
DurationSeconds: 3600,
SessionName: servicemocks.MockStsAssumeRoleSessionName,
RoleARN: servicemocks.MockStsAssumeRoleArn,
Duration: 1 * time.Hour,
SessionName: servicemocks.MockStsAssumeRoleSessionName,
},
Region: "us-east-1",
SecretKey: servicemocks.MockStaticSecretKey,
Expand Down