Skip to content

Commit

Permalink
3026: proper wrapper approach for NewChainCredentialsS3DataSource
Browse files Browse the repository at this point in the history
Signed-off-by: russellcain <[email protected]>
  • Loading branch information
russellcain committed Sep 13, 2024
1 parent 9c6eaba commit 81b3c8e
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions pkg/importer/s3-datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func NewS3DataSource(endpoint string, accessKey string, secKey string, certDir s
}, nil
}

// NewS3DataSource creates a new instance of the S3DataSource using chain credentials
// NewChainCredentialsS3DataSource creates a new instance of the S3DataSource using chain credentials (wraps NewS3DataSource)
func NewChainCredentialsS3DataSource(endpoint, certDir string) (*S3DataSource, error) {
/*
Quick Note on IRSA credential chain:
Expand All @@ -86,20 +86,7 @@ func NewChainCredentialsS3DataSource(endpoint, certDir string) (*S3DataSource, e
- If your application is running on an Amazon EC2 instance, IAM role for Amazon EC2.
*/
ep, err := ParseEndpoint(endpoint)
if err != nil {
return nil, errors.Wrapf(err, fmt.Sprintf("unable to parse endpoint %q", endpoint))
}
s3Reader, err := createS3Reader(ep, emptyAccessKey, emptySecretKey, certDir)
if err != nil {
return nil, err
}
return &S3DataSource{
ep: ep,
accessKey: emptyAccessKey,
secKey: emptySecretKey,
s3Reader: s3Reader,
}, nil
return NewS3DataSource(endpoint, emptyAccessKey, emptySecretKey, certDir)
}

// Info is called to get initial information about the data.
Expand Down

0 comments on commit 81b3c8e

Please sign in to comment.