summaryrefslogtreecommitdiff
path: root/fs.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2022-08-14 20:03:26 +0300
committerMarin Ivanov <[email protected]>2022-08-14 20:03:26 +0300
commit5c50ab7055c5fb269b197c6d6d23a1108bd17ffe (patch)
tree89144ae335ab0a1300f3269e4aaf8592fa1eb97f /fs.go
parent391f147a227b264c37c57950c9ee054bfd22cd41 (diff)
Wire Minio client
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{}
-}