Skip to content

Commit

Permalink
Renaming to assume_role_arn, it's more descriptive and added to readme
Browse files Browse the repository at this point in the history
Signed-off-by: Long Nguyen <[email protected]>
  • Loading branch information
lnguyen committed Apr 24, 2023
1 parent 705e4d9 commit afb521c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ bucket.
* `secret_access_key`: *Required.* The AWS secret key to use when accessing
the bucket.

* `assume_role_arn`: *Optional.* The AWS role to assume when using access keys.

* `session_token`: *Optional.* The AWS session token to use when accessing
the bucket.

Expand Down
22 changes: 11 additions & 11 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func FromSource(source models.Source) (Driver, error) {
s3Session := session.New(awsConfig)

var s3Client *s3.S3
if source.RoleArn != "" {
creds := stscreds.NewCredentials(s3Session, source.RoleArn)
if source.AssumeRoleArn != "" {
creds := stscreds.NewCredentials(s3Session, source.AssumeRoleArn)
s3Client = s3.New(s3Session, &aws.Config{Credentials: creds})
} else {
s3Client = s3.New(s3Session)
Expand All @@ -102,15 +102,15 @@ func FromSource(source models.Source) (Driver, error) {
return &GitDriver{
InitialVersion: initialVersion,

URI: source.URI,
Branch: source.Branch,
PrivateKey: source.PrivateKey,
Username: source.Username,
Password: source.Password,
File: source.File,
GitUser: source.GitUser,
CommitMessage: source.CommitMessage,
SkipSSLVerification: source.SkipSSLVerification,
URI: source.URI,
Branch: source.Branch,
PrivateKey: source.PrivateKey,
Username: source.Username,
Password: source.Password,
File: source.File,
GitUser: source.GitUser,
CommitMessage: source.CommitMessage,
SkipSSLVerification: source.SkipSSLVerification,
}, nil

case models.DriverSwift:
Expand Down
2 changes: 1 addition & 1 deletion models/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type Source struct {
Key string `json:"key"`
AccessKeyID string `json:"access_key_id"`
SecretAccessKey string `json:"secret_access_key"`
RoleArn string `json:"role_arn"`
AssumeRoleArn string `json:"assume_role_arn"`
SessionToken string `json:"session_token"`
RegionName string `json:"region_name"`
Endpoint string `json:"endpoint"`
Expand Down

0 comments on commit afb521c

Please sign in to comment.