From 81b3c8ec0b31b98c54da32409eb51f243f4fa3d7 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 Signed-off-by: russellcain --- 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.