From e1f84cabf4c1233010d4a429bf18b70016c5db21 Mon Sep 17 00:00:00 2001 From: russellcain Date: Thu, 12 Sep 2024 14:50:10 -0500 Subject: [PATCH] 3026: proper wrapper approach for NewChainCredentialsS3DataSource --- pkg/importer/s3-datasource.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/pkg/importer/s3-datasource.go b/pkg/importer/s3-datasource.go index 306f83be18..8ab3ad1338 100644 --- a/pkg/importer/s3-datasource.go +++ b/pkg/importer/s3-datasource.go @@ -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: @@ -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.