Skip to content

Commit

Permalink
Use named return variables and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Memisoglu committed Aug 20, 2019
1 parent 5bedb57 commit e992040
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/blockstorage/awsebs/awsebs.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func NewProvider(config map[string]string) (blockstorage.Provider, error) {
return &ebsStorage{ec2Cli: ec2Cli}, nil
}

// GetConfig returns a configuration to establish AWS connection and the connected region name.
func GetConfig(config map[string]string) (*aws.Config, string, string, error) {
// GetConfig returns a configuration to establish AWS connection, connected region name and the role to assume if it exists.
func GetConfig(config map[string]string) (awsConfig *aws.Config, region string, role string, err error) {
region, ok := config[ConfigRegion]
if !ok {
return nil, "", "", errors.New("region required for storage type EBS")
Expand All @@ -83,7 +83,7 @@ func GetConfig(config map[string]string) (*aws.Config, string, string, error) {
return nil, "", "", errors.New("AWS_SECRET_ACCESS_KEY required for storage type EBS")
}
sessionToken := config[SessionToken]
role := config[ConfigRole]
role = config[ConfigRole]
return &aws.Config{Credentials: credentials.NewStaticCredentials(accessKey, secretAccessKey, sessionToken)}, region, role, nil
}

Expand Down

0 comments on commit e992040

Please sign in to comment.