diff --git a/api.go b/api.go index cfaaf45..81cb7d0 100644 --- a/api.go +++ b/api.go @@ -29,7 +29,7 @@ func (s *Server) CreateBucketHandler() http.Handler { return } - err = s.s3.MakeBucket(bucket.Name, "") + err = s.S3.MakeBucket(bucket.Name, "") if err != nil { w.WriteHeader(http.StatusInternalServerError) return @@ -64,7 +64,7 @@ func (s *Server) CreateObjectHandler() http.Handler { objectSource := fmt.Sprintf("/%s/%s", copy.SourceBucketName, copy.SourceObjectName) fmt.Println(copy) fmt.Println(objectSource) - err = s.s3.CopyObject(copy.BucketName, copy.ObjectName, objectSource, copyConds) + err = s.S3.CopyObject(copy.BucketName, copy.ObjectName, objectSource, copyConds) if err != nil { w.WriteHeader(http.StatusInternalServerError) return @@ -90,7 +90,7 @@ func (s *Server) CreateObjectHandler() http.Handler { } defer file.Close() - _, err = s.s3.PutObject(vars["bucketName"], handler.Filename, file, "application/octet-stream") + _, err = s.S3.PutObject(vars["bucketName"], handler.Filename, file, "application/octet-stream") if err != nil { w.WriteHeader(http.StatusUnprocessableEntity) return @@ -106,7 +106,7 @@ func (s *Server) DeleteBucketHandler() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - err := s.s3.RemoveBucket(vars["bucketName"]) + err := s.S3.RemoveBucket(vars["bucketName"]) if err != nil { w.WriteHeader(http.StatusInternalServerError) return @@ -121,7 +121,7 @@ func (s *Server) DeleteObjectHandler() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - err := s.s3.RemoveObject(vars["bucketName"], vars["objectName"]) + err := s.S3.RemoveObject(vars["bucketName"], vars["objectName"]) if err != nil { w.WriteHeader(http.StatusInternalServerError) return @@ -137,7 +137,7 @@ func (s *Server) GetObjectHandler() http.Handler { vars := mux.Vars(r) objectName := vars["objectName"] - object, err := s.s3.GetObject(vars["bucketName"], objectName) + object, err := s.S3.GetObject(vars["bucketName"], objectName) if err != nil { w.WriteHeader(http.StatusInternalServerError) return diff --git a/main.go b/main.go index d403bd3..f8fd4a4 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( // Server is a server containing a minio client type Server struct { - s3 *minio.Client + S3 *minio.Client } func main() { @@ -21,7 +21,7 @@ func main() { } s := &Server{ - s3: NewMinioClient(), + S3: NewMinioClient(), } router := mux.NewRouter() diff --git a/pages.go b/pages.go index ddd0394..fda5195 100644 --- a/pages.go +++ b/pages.go @@ -38,7 +38,7 @@ func (s *Server) BucketPageHandler() http.Handler { doneCh := make(chan struct{}) - objectCh := s.s3.ListObjectsV2(bucketName, "", false, doneCh) + objectCh := s.S3.ListObjectsV2(bucketName, "", false, doneCh) for object := range objectCh { if object.Err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -73,7 +73,7 @@ func (s *Server) BucketsPageHandler() http.Handler { return } - buckets, err := s.s3.ListBuckets() + buckets, err := s.S3.ListBuckets() if err != nil { w.WriteHeader(http.StatusInternalServerError) return