From eb57eaf30965ba24ff669d6f9c8d11cd24951777 Mon Sep 17 00:00:00 2001 From: Niall Sheridan Date: Sun, 19 Feb 2017 01:49:51 +0000 Subject: update dependencies --- vendor/cloud.google.com/go/storage/acl.go | 1 + vendor/cloud.google.com/go/storage/storage.go | 47 ++++++++++++++++----------- 2 files changed, 29 insertions(+), 19 deletions(-) (limited to 'vendor/cloud.google.com') diff --git a/vendor/cloud.google.com/go/storage/acl.go b/vendor/cloud.google.com/go/storage/acl.go index 714d280..6c24394 100644 --- a/vendor/cloud.google.com/go/storage/acl.go +++ b/vendor/cloud.google.com/go/storage/acl.go @@ -27,6 +27,7 @@ type ACLRole string const ( RoleOwner ACLRole = "OWNER" RoleReader ACLRole = "READER" + RoleWriter ACLRole = "WRITER" ) // ACLEntity refers to a user or group. diff --git a/vendor/cloud.google.com/go/storage/storage.go b/vendor/cloud.google.com/go/storage/storage.go index bafb136..53fc029 100644 --- a/vendor/cloud.google.com/go/storage/storage.go +++ b/vendor/cloud.google.com/go/storage/storage.go @@ -82,7 +82,7 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error option.WithUserAgent(userAgent), } opts = append(o, opts...) - hc, _, err := transport.NewHTTPClient(ctx, opts...) + hc, ep, err := transport.NewHTTPClient(ctx, opts...) if err != nil { return nil, fmt.Errorf("dialing: %v", err) } @@ -90,6 +90,9 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error if err != nil { return nil, fmt.Errorf("storage client: %v", err) } + if ep != "" { + rawService.BasePath = ep + } return &Client{ hc: hc, raw: rawService, @@ -508,27 +511,33 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) return nil, err } var res *http.Response - err = runWithRetry(ctx, func() error { res, err = o.c.hc.Do(req); return err }) + err = runWithRetry(ctx, func() error { + res, err = o.c.hc.Do(req) + if err != nil { + return err + } + if res.StatusCode == http.StatusNotFound { + res.Body.Close() + return ErrObjectNotExist + } + if res.StatusCode < 200 || res.StatusCode > 299 { + body, _ := ioutil.ReadAll(res.Body) + res.Body.Close() + return &googleapi.Error{ + Code: res.StatusCode, + Header: res.Header, + Body: string(body), + } + } + if offset > 0 && length != 0 && res.StatusCode != http.StatusPartialContent { + res.Body.Close() + return errors.New("storage: partial request not satisfied") + } + return nil + }) if err != nil { return nil, err } - if res.StatusCode == http.StatusNotFound { - res.Body.Close() - return nil, ErrObjectNotExist - } - if res.StatusCode < 200 || res.StatusCode > 299 { - body, _ := ioutil.ReadAll(res.Body) - res.Body.Close() - return nil, &googleapi.Error{ - Code: res.StatusCode, - Header: res.Header, - Body: string(body), - } - } - if offset > 0 && length != 0 && res.StatusCode != http.StatusPartialContent { - res.Body.Close() - return nil, errors.New("storage: partial request not satisfied") - } var size int64 // total size of object, even if a range was requested. if res.StatusCode == http.StatusPartialContent { -- cgit v1.2.3