diff --git a/aws/s3/s3.go b/aws/s3/s3.go index e7a3c49..e87669f 100644 --- a/aws/s3/s3.go +++ b/aws/s3/s3.go @@ -121,6 +121,11 @@ func (s *S3) Ready() bool { return s.client != nil } +// Client returns the underlying S3 client. +func (s *S3) Client() *s3.Client { + return s.client +} + // Get gets the object referred to by key and version from bucket and writes it into b. // Version can be empty. func (s *S3) Get(bucket, key, version string, b *bytes.Buffer) error { diff --git a/aws/s3/s3_integration_test.go b/aws/s3/s3_integration_test.go index 5ee9da3..884d17e 100644 --- a/aws/s3/s3_integration_test.go +++ b/aws/s3/s3_integration_test.go @@ -321,6 +321,24 @@ func TestCreateS3ClientWithOptions(t *testing.T) { assert.Nil(t, err) } +func TestS3Client(t *testing.T) { + // ARRANGE + setup() + defer teardown() + + client, err := New() + ready := client.Ready() + + require.Nil(t, err) + require.True(t, ready) + + // ACTION + underlyingClient := client.Client() + + // ASSERT + assert.NotNil(t, underlyingClient) +} + func TestS3Get(t *testing.T) { // ARRANGE setup() diff --git a/aws/sns/sns.go b/aws/sns/sns.go index e889f7c..b179ae0 100644 --- a/aws/sns/sns.go +++ b/aws/sns/sns.go @@ -77,6 +77,11 @@ func (s *SNS) Ready() bool { return s.client != nil } +// Client returns the underlying SNS client. +func (s *SNS) Client() *sns.Client { + return s.client +} + // Publish publishes message to topicArn. func (s *SNS) Publish(topicArn string, message []byte) error { input := sns.PublishInput{ diff --git a/aws/sns/sns_integration_test.go b/aws/sns/sns_integration_test.go index 2135209..420303b 100644 --- a/aws/sns/sns_integration_test.go +++ b/aws/sns/sns_integration_test.go @@ -128,6 +128,24 @@ func TestSNSNewWithRetries(t *testing.T) { assert.NotNil(t, err) } +func TestSNSClient(t *testing.T) { + // ARRANGE + setup(false, false) + defer teardown("", "") + + client, err := New() + ready := client.Ready() + + require.Nil(t, err) + require.True(t, ready) + + // ACTION + underlyingClient := client.Client() + + // ASSERT + assert.NotNil(t, underlyingClient) +} + func TestSNSPublish(t *testing.T) { // ARRANGE queueArn, topicArn := setup(true, true)