Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to AWS SDK v2 #212

Open
wants to merge 10 commits into
base: v7.x-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- main
- v7.x-dev
pull_request:
branches:
- main
- v7.x-dev

jobs:
test:
Expand Down
19 changes: 19 additions & 0 deletions backend/s3/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package s3

import (
"context"

"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
)

type Client interface {
manager.DownloadAPIClient
manager.UploadAPIClient
CopyObject(ctx context.Context, in *s3.CopyObjectInput, opts ...func(*s3.Options)) (*s3.CopyObjectOutput, error)
DeleteObject(ctx context.Context, in *s3.DeleteObjectInput, opts ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
HeadBucket(ctx context.Context, in *s3.HeadBucketInput, opts ...func(*s3.Options)) (*s3.HeadBucketOutput, error)
HeadObject(ctx context.Context, in *s3.HeadObjectInput, opts ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
ListObjects(ctx context.Context, in *s3.ListObjectsInput, opts ...func(*s3.Options)) (*s3.ListObjectsOutput, error)
ListObjectVersions(ctx context.Context, in *s3.ListObjectVersionsInput, opts ...func(*s3.Options)) (*s3.ListObjectVersionsOutput, error)
}
8 changes: 4 additions & 4 deletions backend/s3/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ would have to be cast as s3.FileSystem to use the following:
)

// to pass specific client, for instance a mock client
s3apiMock := &mocks.S3API{}
s3apiMock.On("GetObject", mock.AnythingOfType("*s3.GetObjectInput")).
s3cliMock := &mocks.Client{}
s3cliMock.On("GetObject", matchContext, mock.AnythingOfType("*s3.GetObjectInput")).
Return(&s3.GetObjectOutput{
Body: nopCloser{bytes.NewBufferString("Hello world!")},
}, nil)
fs = fs.WithClient(s3apiMock)
fs = fs.WithClient(s3cliMock)
}

# Object ACL
Expand Down Expand Up @@ -86,6 +86,6 @@ and https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.ht

# See Also

See: https://github.com/aws/aws-sdk-go/tree/master/service/s3
See: https://github.com/aws/aws-sdk-go-v2/tree/main/service/s3
*/
package s3
Loading
Loading