From 17468c88630298e871ca35babb64360cb9be6ae0 Mon Sep 17 00:00:00 2001 From: Aakash Muttineni Date: Tue, 14 Jun 2016 22:44:33 +0530 Subject: [PATCH] Vendor update (#1739) --- vendor/github.com/minio/minio-go/API.md | 76 +++++++++++++++---- .../minio/minio-go/api-error-response.go | 10 +++ .../minio/minio-go/api-get-object.go | 3 + .../minio/minio-go/api-put-bucket.go | 15 +++- vendor/vendor.json | 6 +- 5 files changed, 91 insertions(+), 19 deletions(-) diff --git a/vendor/github.com/minio/minio-go/API.md b/vendor/github.com/minio/minio-go/API.md index d73a469a..3ad74a40 100644 --- a/vendor/github.com/minio/minio-go/API.md +++ b/vendor/github.com/minio/minio-go/API.md @@ -14,7 +14,7 @@ import ( func main() { secure := true // Make HTTPS requests by default. s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", secure) - if err !!= nil { + if err != nil { fmt.Println(err) return } @@ -68,6 +68,9 @@ __Parameters__ * `bucketName` _string_ - Name of the bucket. * `location` _string_ - region valid values are _us-west-1_, _us-west-2_, _eu-west-1_, _eu-central-1_, _ap-southeast-1_, _ap-northeast-1_, _ap-southeast-2_, _sa-east-1_ +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.MakeBucket("mybucket", "us-west-1") @@ -82,9 +85,11 @@ fmt.Println("Successfully created mybucket.") #### ListBuckets() ([]BucketInfo, error) Lists all buckets. -`bucketList` lists bucket in the format: -* `bucket.Name` _string_: bucket name -* `bucket.CreationDate` time.Time : date when bucket was created +__Return Values__ +* `buckets` _[]BucketInfo_ : array of `BucketInfo` objects that contain: + * `Name` _string_ : name of the bucket + * `CreationDate` _time.Time_ : date the bucket was created +* `err` _error_ __Example__ ```go @@ -105,6 +110,9 @@ Check if bucket exists. __Parameters__ * `bucketName` _string_ : name of the bucket +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.BucketExists("mybucket") @@ -121,6 +129,9 @@ Remove a bucket. __Parameters__ * `bucketName` _string_ : name of the bucket +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.RemoveBucket("mybucket") @@ -131,13 +142,17 @@ if err != nil { ``` --------------------------------------- -#### GetBucketPolicy(bucketName string, objectPrefix string) error +#### GetBucketPolicy(bucketName string, objectPrefix string) (BucketPolicy, error) Get access permissions on a bucket or a prefix. __Parameters__ * `bucketName` _string_ : name of the bucket * `objectPrefix` _string_ : name of the object prefix +__Return Values__ +* `bucketPolicy` _BucketPolicy_ : string that contains: 'none', 'readonly', 'readwrite', or 'writeonly' +* `err` _error_ + __Example__ ```go bucketPolicy, err := s3Client.GetBucketPolicy("mybucket", "") @@ -157,6 +172,9 @@ __Parameters__ * `objectPrefix` _string_ : name of the object prefix * `policy` _BucketPolicy_: policy can be _BucketPolicyNone_, _BucketPolicyReadOnly_, _BucketPolicyReadWrite_, _BucketPolicyWriteOnly_ +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.SetBucketPolicy("mybucket", "myprefix", BucketPolicyReadWrite) @@ -174,6 +192,9 @@ __Parameters__ * `bucketName` _string_: name of the bucket * `objectPrefix` _string_ : name of the object prefix +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.RemoveBucketPolicy("mybucket", "myprefix") @@ -194,7 +215,7 @@ __Parameters__ * `recursive` _bool_: `true` indicates recursive style listing and `false` indicates directory style listing delimited by '/' * `doneCh` chan struct{} : channel for pro-actively closing the internal go routine -__Return Value__ +__Return Values__ * `<-chan ObjectInfo` _chan ObjectInfo_: Read channel for all the objects in the bucket, the object is of the format: * `objectInfo.Key` _string_: name of the object * `objectInfo.Size` _int64_: size of the object @@ -232,7 +253,7 @@ __Parameters__ * `recursive` bool: directory style listing when false, recursive listing when true * `doneCh` chan struct{} : channel for pro-actively closing the internal go routine -__Return Value__ +__Return Values__ * `<-chan ObjectMultipartInfo` _chan ObjectMultipartInfo_ : emits multipart objects of the format: * `multiPartObjInfo.Key` _string_: name of the incomplete object * `multiPartObjInfo.UploadID` _string_: upload ID of the incomplete object @@ -267,8 +288,8 @@ __Parameters__ * `bucketName` _string_: name of the bucket * `objectName` _string_: name of the object -__Return Value__ -* `object` _*Object_ : _Object_ represents object reader. +__Return Values__ +* `object` _*Object_ : represents object reader. __Example__ ```go @@ -294,6 +315,9 @@ __Parameters__ * `objectName` _string_: name of the object * `filePath` _string_: path to which the object data will be written to +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.FGetObject("mybucket", "photo.jpg", "/tmp/photo.jpg") @@ -304,7 +328,7 @@ if err != nil { ``` --------------------------------------- -#### PutObject(bucketName string, objectName string, reader io.Reader, contentType string) (n int, err error) +#### PutObject(bucketName string, objectName string, reader io.Reader, contentType string) (int64, error) Upload contents from `io.Reader` to objectName. __Parameters__ @@ -313,6 +337,10 @@ __Parameters__ * `reader` _io.Reader_: Any golang object implementing io.Reader * `contentType` _string_: content type of the object. +__Return Values__ +* `totalUploadedSize` _int64_: Size in bytes of uploaded file +* `err` _error_ + __Example__ ```go file, err := os.Open("my-testfile") @@ -340,6 +368,9 @@ __Parameters__ * `objectSource` _string_: name of the object source. * `conditions` _CopyConditions_: Collection of supported CopyObject conditions. ['x-amz-copy-source', 'x-amz-copy-source-if-match', 'x-amz-copy-source-if-none-match', 'x-amz-copy-source-if-unmodified-since', 'x-amz-copy-source-if-modified-since'] +__Return Values__ +* `err` _error_ + __Example__ ```go // All following conditions are allowed and can be combined together. @@ -367,7 +398,7 @@ if err != nil { --------------------------------------- -#### FPutObject(bucketName string, objectName string, filePath string, contentType string) error +#### FPutObject(bucketName string, objectName string, filePath string, contentType string) (int64, error) Uploads the object using contents from a file __Parameters__ @@ -376,6 +407,10 @@ __Parameters__ * `filePath` _string_: file path of the file to be uploaded * `contentType` _string_: content type of the object +__Return Values__ +* `totalUploadedSize` _int64_: Size in bytes of uploaded file +* `err`: _error_ + __Example__ ```go n, err := s3Client.FPutObject("my-bucketname", "my-objectname", "/tmp/my-filename.csv", "application/csv") @@ -393,12 +428,13 @@ __Parameters__ * `bucketName` _string_: name of the bucket * `objectName` _string_: name of the object -__Return Value__ - `objInfo` _ObjectInfo_ : object stat info for following format: +__Return Values__ +* `objInfo` _ObjectInfo_ : object stat info for following format: * `objInfo.Size` _int64_: size of the object * `objInfo.ETag` _string_: etag of the object * `objInfo.ContentType` _string_: Content-Type of the object * `objInfo.LastModified` _string_: modified time stamp +* `err` _error_ __Example__ ```go @@ -418,6 +454,9 @@ __Parameters__ * `bucketName` _string_: name of the bucket * `objectName` _string_: name of the object +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.RemoveObject("mybucket", "photo.jpg") @@ -435,6 +474,9 @@ __Parameters__ * `bucketName` _string_: name of the bucket * `objectName` _string_: name of the object +__Return Values__ +* `err` _error_ + __Example__ ```go err := s3Client.RemoveIncompleteUpload("mybucket", "photo.jpg") @@ -456,6 +498,10 @@ __Parameters__ * `expiry` _time.Duration_: expiry in seconds. * `reqParams` _url.Values_ : additional response header overrides supports _response-expires_, _response-content-type_, _response-cache-control_, _response-content-disposition_ +__Return Values__ +* `url` _*url.URL_ : Presigned URL for GET on an object +* `err` _error_ + __Example__ ```go // Set request parameters for content-disposition. @@ -483,6 +529,10 @@ __Parameters__ * `objectName` _string_: name of the object * `expiry` _time.Duration_: expiry in seconds +__Return Values__ +* `url` _*url.URL_ : Presigned URL for PUT on an object +* `err` _error + __Example__ ```go // Generates a url which expires in a day. diff --git a/vendor/github.com/minio/minio-go/api-error-response.go b/vendor/github.com/minio/minio-go/api-error-response.go index e6789aff..3bfff44e 100644 --- a/vendor/github.com/minio/minio-go/api-error-response.go +++ b/vendor/github.com/minio/minio-go/api-error-response.go @@ -223,3 +223,13 @@ func ErrInvalidArgument(message string) error { RequestID: "minio", } } + +// ErrNoSuchBucketPolicy - No Such Bucket Policy response +// The specified bucket does not have a bucket policy. +func ErrNoSuchBucketPolicy(message string) error { + return ErrorResponse{ + Code: "NoSuchBucketPolicy", + Message: message, + RequestID: "minio", + } +} diff --git a/vendor/github.com/minio/minio-go/api-get-object.go b/vendor/github.com/minio/minio-go/api-get-object.go index b5b74ff7..ad3eadaa 100644 --- a/vendor/github.com/minio/minio-go/api-get-object.go +++ b/vendor/github.com/minio/minio-go/api-get-object.go @@ -59,6 +59,9 @@ func (c Client) GetObject(bucketName, objectName string) (*Object, error) { select { // When the done channel is closed exit our routine. case <-doneCh: + // Close the http response body before returning. + // This ends the connection with the server. + httpReader.Close() return // Request message. case req := <-reqCh: diff --git a/vendor/github.com/minio/minio-go/api-put-bucket.go b/vendor/github.com/minio/minio-go/api-put-bucket.go index 357f8b99..9e025f2c 100644 --- a/vendor/github.com/minio/minio-go/api-put-bucket.go +++ b/vendor/github.com/minio/minio-go/api-put-bucket.go @@ -26,6 +26,7 @@ import ( "io/ioutil" "net/http" "net/url" + "reflect" ) /// Bucket operations @@ -166,14 +167,22 @@ func (c Client) SetBucketPolicy(bucketName string, objectPrefix string, bucketPo return nil } // Remove any previous policies at this path. - policy.Statements = removeBucketPolicyStatement(policy.Statements, bucketName, objectPrefix) + statements := removeBucketPolicyStatement(policy.Statements, bucketName, objectPrefix) // generating []Statement for the given bucketPolicy. - statements, err := generatePolicyStatement(bucketPolicy, bucketName, objectPrefix) + generatedStatements, err := generatePolicyStatement(bucketPolicy, bucketName, objectPrefix) if err != nil { return err } - policy.Statements = append(policy.Statements, statements...) + statements = append(statements, generatedStatements...) + + // No change in the statements indicates an attempt of setting 'none' on a prefix + // which doesn't have a pre-existing policy. + if reflect.DeepEqual(policy.Statements, statements) { + return ErrNoSuchBucketPolicy(fmt.Sprintf("No policy exists on %s/%s", bucketName, objectPrefix)) + } + + policy.Statements = statements // Save the updated policies. return c.putBucketPolicy(bucketName, policy) } diff --git a/vendor/vendor.json b/vendor/vendor.json index c951ed51..dcac3d59 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -43,10 +43,10 @@ "revisionTime": "2015-10-24T22:24:27-07:00" }, { - "checksumSHA1": "QHR5sfmPMTzDeOUjxw1bW3ipS4g=", + "checksumSHA1": "5ZGLJLpmquEHaZ2jTvS6isg3xEE=", "path": "github.com/minio/minio-go", - "revision": "28fb30ae06c8cb43fb5dabd66930d7c4a19bb520", - "revisionTime": "2016-05-27T08:59:22Z" + "revision": "e38f1f4384432f3899c37c11debcea201ac58cb1", + "revisionTime": "2016-06-09T09:20:35Z" }, { "path": "github.com/minio/minio/pkg/atomic",