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 9 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
9 changes: 0 additions & 9 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ packages:
github.com/c2fo/vfs/v6/backend/s3:
config:
all: true
github.com/aws/aws-sdk-go/service/s3/s3iface:
config:
all: true
dir: "backend/s3/mocks"
github.com/aws/aws-sdk-go/service/s3/s3manager/s3manageriface:
config:
dir: "backend/s3/mocks"
interfaces:
UploaderAPI:
github.com/c2fo/vfs/v6/backend/sftp:
interfaces:
Client:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add support for role based authentication in s3 backend.

## [6.25.1] - 2025-01-09
### Fixed
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