diff options
| author | edisonxiang <xiang.edison@gmail.com> | 2019-07-22 11:39:57 +0800 |
|---|---|---|
| committer | edisonxiang <xiang.edison@gmail.com> | 2019-07-22 12:32:57 +0800 |
| commit | bac4ff4f3e5549dab52c961418b8f5aa6aba1f3f (patch) | |
| tree | 99a10a1808a2b823e0fefd04f2cdab955c45233c /vendor/cloud.google.com | |
| parent | edged modifications (diff) | |
| download | kubeedge-bac4ff4f3e5549dab52c961418b8f5aa6aba1f3f.tar.gz | |
upgrade vendors
Diffstat (limited to 'vendor/cloud.google.com')
| -rw-r--r-- | vendor/cloud.google.com/go/AUTHORS | 15 | ||||
| -rw-r--r-- | vendor/cloud.google.com/go/CONTRIBUTORS | 40 | ||||
| -rw-r--r-- | vendor/cloud.google.com/go/compute/metadata/metadata.go | 30 |
3 files changed, 20 insertions, 65 deletions
diff --git a/vendor/cloud.google.com/go/AUTHORS b/vendor/cloud.google.com/go/AUTHORS deleted file mode 100644 index c364af1da..000000000 --- a/vendor/cloud.google.com/go/AUTHORS +++ /dev/null @@ -1,15 +0,0 @@ -# This is the official list of cloud authors for copyright purposes. -# This file is distinct from the CONTRIBUTORS files. -# See the latter for an explanation. - -# Names should be added to this file as: -# Name or Organization <email address> -# The email address is not required for organizations. - -Filippo Valsorda <hi@filippo.io> -Google Inc. -Ingo Oeser <nightlyone@googlemail.com> -Palm Stone Games, Inc. -Paweł Knap <pawelknap88@gmail.com> -Péter Szilágyi <peterke@gmail.com> -Tyler Treat <ttreat31@gmail.com> diff --git a/vendor/cloud.google.com/go/CONTRIBUTORS b/vendor/cloud.google.com/go/CONTRIBUTORS deleted file mode 100644 index 3b3cbed98..000000000 --- a/vendor/cloud.google.com/go/CONTRIBUTORS +++ /dev/null @@ -1,40 +0,0 @@ -# People who have agreed to one of the CLAs and can contribute patches. -# The AUTHORS file lists the copyright holders; this file -# lists people. For example, Google employees are listed here -# but not in AUTHORS, because Google holds the copyright. -# -# https://developers.google.com/open-source/cla/individual -# https://developers.google.com/open-source/cla/corporate -# -# Names should be added to this file as: -# Name <email address> - -# Keep the list alphabetically sorted. - -Alexis Hunt <lexer@google.com> -Andreas Litt <andreas.litt@gmail.com> -Andrew Gerrand <adg@golang.org> -Brad Fitzpatrick <bradfitz@golang.org> -Burcu Dogan <jbd@google.com> -Dave Day <djd@golang.org> -David Sansome <me@davidsansome.com> -David Symonds <dsymonds@golang.org> -Filippo Valsorda <hi@filippo.io> -Glenn Lewis <gmlewis@google.com> -Ingo Oeser <nightlyone@googlemail.com> -James Hall <james.hall@shopify.com> -Johan Euphrosine <proppy@google.com> -Jonathan Amsterdam <jba@google.com> -Kunpei Sakai <namusyaka@gmail.com> -Luna Duclos <luna.duclos@palmstonegames.com> -Magnus Hiie <magnus.hiie@gmail.com> -Mario Castro <mariocaster@gmail.com> -Michael McGreevy <mcgreevy@golang.org> -Omar Jarjur <ojarjur@google.com> -Paweł Knap <pawelknap88@gmail.com> -Péter Szilágyi <peterke@gmail.com> -Sarah Adams <shadams@google.com> -Thanatat Tamtan <acoshift@gmail.com> -Toby Burress <kurin@google.com> -Tuo Shan <shantuo@google.com> -Tyler Treat <ttreat31@gmail.com> diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go index 9d0660be4..125b7033c 100644 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -20,6 +20,7 @@ package metadata // import "cloud.google.com/go/compute/metadata" import ( + "context" "encoding/json" "fmt" "io/ioutil" @@ -31,9 +32,6 @@ import ( "strings" "sync" "time" - - "golang.org/x/net/context" - "golang.org/x/net/context/ctxhttp" ) const ( @@ -139,11 +137,11 @@ func testOnGCE() bool { resc := make(chan bool, 2) // Try two strategies in parallel. - // See https://github.com/GoogleCloudPlatform/google-cloud-go/issues/194 + // See https://github.com/googleapis/google-cloud-go/issues/194 go func() { req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) req.Header.Set("User-Agent", userAgent) - res, err := ctxhttp.Do(ctx, defaultClient.hc, req) + res, err := defaultClient.hc.Do(req.WithContext(ctx)) if err != nil { resc <- false return @@ -302,8 +300,8 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) { // being stable anyway. host = metadataIP } - url := "http://" + host + "/computeMetadata/v1/" + suffix - req, _ := http.NewRequest("GET", url, nil) + u := "http://" + host + "/computeMetadata/v1/" + suffix + req, _ := http.NewRequest("GET", u, nil) req.Header.Set("Metadata-Flavor", "Google") req.Header.Set("User-Agent", userAgent) res, err := c.hc.Do(req) @@ -314,13 +312,13 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) { if res.StatusCode == http.StatusNotFound { return "", "", NotDefinedError(suffix) } - if res.StatusCode != 200 { - return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url) - } all, err := ioutil.ReadAll(res.Body) if err != nil { return "", "", err } + if res.StatusCode != 200 { + return "", "", &Error{Code: res.StatusCode, Message: string(all)} + } return string(all), res.Header.Get("Etag"), nil } @@ -501,3 +499,15 @@ func (c *Client) Subscribe(suffix string, fn func(v string, ok bool) error) erro } } } + +// Error contains an error response from the server. +type Error struct { + // Code is the HTTP response status code. + Code int + // Message is the server response message. + Message string +} + +func (e *Error) Error() string { + return fmt.Sprintf("compute: Received %d `%s`", e.Code, e.Message) +} |
