summaryrefslogtreecommitdiff
path: root/fs.go
diff options
context:
space:
mode:
Diffstat (limited to 'fs.go')
-rw-r--r--fs.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/fs.go b/fs.go
index 8856cfe..74f0273 100644
--- a/fs.go
+++ b/fs.go
@@ -3,8 +3,30 @@ package s3
import (
"os"
"time"
+
+ "github.com/minio/minio-go/v7"
+ "github.com/minio/minio-go/v7/pkg/credentials"
)
+type Fs struct {
+ client *minio.Client
+}
+
+func NewFs(endpoint, accessKeyID, secretAccessKey string, useSSL bool) (*Fs, error) {
+ // Initialize minio client object.
+ client, err := minio.New(endpoint, &minio.Options{
+ Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
+ Secure: useSSL,
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ return &Fs{
+ client: client,
+ }, nil
+}
+
// Create creates a file in the filesystem, returning the file and an
// error, if any happens.
func (fs *Fs) Create(name string) (File, error) {
@@ -75,10 +97,3 @@ func (fs *Fs) Chown(name string, uid, gid int) error {
func (fs *Fs) Chtimes(name string, atime time.Time, mtime time.Time) error {
panic("not implemented")
}
-
-type Fs struct {
-}
-
-func NewFs(url string) *Fs {
- return &Fs{}
-}