Upgrade minio-go to 4.0.3

This commit is contained in:
Lena Fuhrimann 2017-12-05 23:30:28 +01:00
parent f978993ebc
commit 22ab81b1ae
6 changed files with 13 additions and 11 deletions

6
Gopkg.lock generated
View file

@ -46,8 +46,8 @@
[[projects]]
name = "github.com/minio/minio-go"
packages = [".","pkg/credentials","pkg/encrypt","pkg/policy","pkg/s3signer","pkg/s3utils","pkg/set"]
revision = "4e0f567303d4cc90ceb055a451959fb9fc391fb9"
version = "3.0.3"
revision = "57a8ae886b49af6eb0d2c27c2d007ed2f71e1da5"
version = "4.0.3"
[[projects]]
name = "github.com/pkg/errors"
@ -88,6 +88,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "418c94e2d7594bbe1cca1b2014f3bcdf31271c8b6d3c757c25564619d3eccd0a"
inputs-digest = "5ab967c9abb8839deef83bb16468854f4bc3cf22123dbae72157241ccb6eb49a"
solver-name = "gps-cdcl"
solver-version = 1

View file

@ -23,7 +23,7 @@
[[constraint]]
name = "github.com/gorilla/mux"
version = "1.5.0"
version = "1.6.0"
[[constraint]]
branch = "master"
@ -31,7 +31,7 @@
[[constraint]]
name = "github.com/minio/minio-go"
version = "3.0.3"
version = "4.0.3"
[[constraint]]
name = "github.com/pkg/errors"

View file

@ -5,6 +5,7 @@ import (
"net/http"
"github.com/gorilla/mux"
minio "github.com/minio/minio-go"
"github.com/pkg/errors"
)
@ -30,7 +31,7 @@ func CreateObjectHandler(s3 S3) http.Handler {
}()
bucketName := mux.Vars(r)["bucketName"]
_, err = s3.PutObject(bucketName, handler.Filename, file, contentTypeOctetStream)
_, err = s3.PutObject(bucketName, handler.Filename, file, 1, minio.PutObjectOptions{ContentType: contentTypeOctetStream})
if err != nil {
handleHTTPError(w, errors.Wrap(err, "error putting object"))
return

View file

@ -6,6 +6,7 @@ import (
"net/http"
"github.com/gorilla/mux"
minio "github.com/minio/minio-go"
"github.com/pkg/errors"
)
@ -16,7 +17,7 @@ func GetObjectHandler(s3 S3) http.Handler {
bucketName := vars["bucketName"]
objectName := vars["objectName"]
object, err := s3.GetObject(bucketName, objectName)
object, err := s3.GetObject(bucketName, objectName, minio.GetObjectOptions{})
if err != nil {
handleHTTPError(w, errors.Wrap(err, "error getting object"))
return

4
s3.go
View file

@ -9,11 +9,11 @@ import (
// S3 is a client to interact with S3 storage.
type S3 interface {
CopyObject(minio.DestinationInfo, minio.SourceInfo) error
GetObject(string, string) (*minio.Object, error)
GetObject(string, string, minio.GetObjectOptions) (*minio.Object, error)
ListBuckets() ([]minio.BucketInfo, error)
ListObjectsV2(string, string, bool, <-chan struct{}) <-chan minio.ObjectInfo
MakeBucket(string, string) error
PutObject(string, string, io.Reader, string) (int64, error)
PutObject(string, string, io.Reader, int64, minio.PutObjectOptions) (int64, error)
RemoveBucket(string) error
RemoveObject(string, string) error
}

View file

@ -20,7 +20,7 @@ func (s *s3Mock) CopyObject(minio.DestinationInfo, minio.SourceInfo) error {
}
// GetObject mocks minio.Client.GetObject.
func (s *s3Mock) GetObject(bucketName string, objectName string) (*minio.Object, error) {
func (s *s3Mock) GetObject(bucketName string, objectName string, opts minio.GetObjectOptions) (*minio.Object, error) {
if s.Err != nil {
return nil, s.Err
}
@ -73,7 +73,7 @@ func (s *s3Mock) MakeBucket(string, string) error {
}
// PutObject mocks minio.Client.PutObject.
func (s *s3Mock) PutObject(string, string, io.Reader, string) (int64, error) {
func (s *s3Mock) PutObject(string, string, io.Reader, int64, minio.PutObjectOptions) (int64, error) {
return 0, s.Err
}