From d8e451f716ad88a5cfbb93906880c2198987757b Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Fri, 1 Aug 2025 08:26:34 +1200 Subject: [PATCH 1/2] feat: add method to return underlying s3 client --- aws/s3/s3.go | 5 +++++ aws/s3/s3_integration_test.go | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) 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() From 6656636db2b19a61a76d179c92c99fd46cb01845 Mon Sep 17 00:00:00 2001 From: Callum Morris Date: Fri, 1 Aug 2025 08:27:37 +1200 Subject: [PATCH 2/2] feat: add method to return underlying sns client --- aws/sns/sns.go | 5 +++++ aws/sns/sns_integration_test.go | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) 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)