mirror of
https://github.com/rancher/os.git
synced 2025-09-22 19:10:13 +00:00
Update vendor
This commit is contained in:
3
vendor/google.golang.org/cloud/.travis.yml
generated
vendored
3
vendor/google.golang.org/cloud/.travis.yml
generated
vendored
@@ -1,7 +1,8 @@
|
||||
sudo: false
|
||||
language: go
|
||||
go:
|
||||
- 1.4
|
||||
- tip
|
||||
- 1.5
|
||||
install:
|
||||
- go get -v google.golang.org/cloud/...
|
||||
script:
|
||||
|
64
vendor/google.golang.org/cloud/CONTRIBUTING.md
generated
vendored
64
vendor/google.golang.org/cloud/CONTRIBUTING.md
generated
vendored
@@ -1,13 +1,14 @@
|
||||
# Contributing
|
||||
|
||||
1. Sign one of the contributor license agreements below.
|
||||
1. `go get golang.org/x/review/git-review` to install the code reviewing tool.
|
||||
1. `go get golang.org/x/review/git-codereview` to install the code reviewing tool.
|
||||
1. Get the cloud package by running `go get -d google.golang.org/cloud`.
|
||||
If you've already got the package, make sure that the remote git origin
|
||||
is https://code.googlesource.com/gocloud.
|
||||
`git remote set-url origin https://code.googlesource.com/gocloud`
|
||||
1. Make changes and create a change by running `review change <name>`,
|
||||
provide a command message, and use `review mail` to create a Gerrit CL.
|
||||
1. If you have already checked out the source, make sure that the remote git
|
||||
origin is https://code.googlesource.com/gocloud:
|
||||
|
||||
git remote set-url origin https://code.googlesource.com/gocloud
|
||||
1. Make changes and create a change by running `git codereview change <name>`,
|
||||
provide a command message, and use `git codereview mail` to create a Gerrit CL.
|
||||
1. Keep amending to the change and mail as your recieve feedback.
|
||||
|
||||
## Integration Tests
|
||||
@@ -20,7 +21,9 @@ following environment variables to be able to run the against the actual APIs.
|
||||
|
||||
- **GCLOUD_TESTS_GOLANG_PROJECT_ID**: Developers Console project's ID (e.g. bamboo-shift-455)
|
||||
- **GCLOUD_TESTS_GOLANG_KEY**: The path to the JSON key file.
|
||||
- **GCLOUD_TESTS_GOLANG_BUCKET_NAME**: The test bucket name.
|
||||
|
||||
Create a storage bucket with the same name as the project id set in **GCLOUD_TESTS_GOLANG_PROJECT_ID**.
|
||||
The storage integration test will create and delete some objects in this bucket.
|
||||
|
||||
Install the [gcloud command-line tool][gcloudcli] to your machine and use it
|
||||
to create the indexes used in the datastore integration tests with indexes
|
||||
@@ -39,7 +42,8 @@ $ gcloud config set project $GCLOUD_TESTS_GOLANG_PROJECT_ID
|
||||
$ gcloud auth login
|
||||
|
||||
# Create the indexes
|
||||
$ gcloud preview datastore create-indexes datastore/testdata
|
||||
$ gcloud preview datastore create-indexes datastore/testdata/index.yaml
|
||||
|
||||
```
|
||||
|
||||
You can run the integration tests by running:
|
||||
@@ -61,6 +65,50 @@ then you'll need to sign a [corporate CLA][corpcla].
|
||||
You can sign these electronically (just scroll to the bottom). After that,
|
||||
we'll be able to accept your pull requests.
|
||||
|
||||
## Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project,
|
||||
and in the interest of fostering an open and welcoming community,
|
||||
we pledge to respect all people who contribute through reporting issues,
|
||||
posting feature requests, updating documentation,
|
||||
submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project
|
||||
a harassment-free experience for everyone,
|
||||
regardless of level of experience, gender, gender identity and expression,
|
||||
sexual orientation, disability, personal appearance,
|
||||
body size, race, ethnicity, age, religion, or nationality.
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery
|
||||
* Personal attacks
|
||||
* Trolling or insulting/derogatory comments
|
||||
* Public or private harassment
|
||||
* Publishing other's private information,
|
||||
such as physical or electronic
|
||||
addresses, without explicit permission
|
||||
* Other unethical or unprofessional conduct.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct.
|
||||
By adopting this Code of Conduct,
|
||||
project maintainers commit themselves to fairly and consistently
|
||||
applying these principles to every aspect of managing this project.
|
||||
Project maintainers who do not follow or enforce the Code of Conduct
|
||||
may be permanently removed from the project team.
|
||||
|
||||
This code of conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior
|
||||
may be reported by opening an issue
|
||||
or contacting one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
|
||||
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
|
||||
|
||||
[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/
|
||||
[indvcla]: https://developers.google.com/open-source/cla/individual
|
||||
[corpcla]: https://developers.google.com/open-source/cla/corporate
|
||||
|
2
vendor/google.golang.org/cloud/CONTRIBUTORS
generated
vendored
2
vendor/google.golang.org/cloud/CONTRIBUTORS
generated
vendored
@@ -15,8 +15,10 @@ Andrew Gerrand <adg@golang.org>
|
||||
Brad Fitzpatrick <bradfitz@golang.org>
|
||||
Burcu Dogan <jbd@google.com>
|
||||
Dave Day <djd@golang.org>
|
||||
David Symonds <dsymonds@golang.org>
|
||||
Glenn Lewis <gmlewis@google.com>
|
||||
Johan Euphrosine <proppy@google.com>
|
||||
Luna Duclos <luna.duclos@palmstonegames.com>
|
||||
Michael McGreevy <mcgreevy@golang.org>
|
||||
Péter Szilágyi <peterke@gmail.com>
|
||||
Tyler Treat <ttreat31@gmail.com>
|
||||
|
11
vendor/google.golang.org/cloud/README.md
generated
vendored
11
vendor/google.golang.org/cloud/README.md
generated
vendored
@@ -2,6 +2,9 @@
|
||||
|
||||
[](https://travis-ci.org/GoogleCloudPlatform/gcloud-golang)
|
||||
|
||||
**NOTE:** These packages are experimental, and may occasionally make
|
||||
backwards-incompatible changes.
|
||||
|
||||
**NOTE:** Github repo is a mirror of [https://code.googlesource.com/gocloud](https://code.googlesource.com/gocloud).
|
||||
|
||||
Go packages for Google Cloud Platform services. Supported APIs include:
|
||||
@@ -15,9 +18,6 @@ Go packages for Google Cloud Platform services. Supported APIs include:
|
||||
import "google.golang.org/cloud"
|
||||
```
|
||||
|
||||
> Note: This package is a work-in-progress, and may occasionally
|
||||
> make backwards-incompatible changes.
|
||||
|
||||
Documentation and examples are available at
|
||||
[https://godoc.org/google.golang.org/cloud](https://godoc.org/google.golang.org/cloud).
|
||||
|
||||
@@ -118,6 +118,11 @@ Contributions are welcome. Please, see the
|
||||
document for details. We're using Gerrit for our code reviews. Please don't open pull
|
||||
requests against this repo, new pull requests will be automatically closed.
|
||||
|
||||
Please note that this project is released with a Contributor Code of Conduct.
|
||||
By participating in this project you agree to abide by its terms.
|
||||
See [Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/gcloud-golang/blob/master/CONTRIBUTING.md#contributor-code-of-conduct)
|
||||
for more information.
|
||||
|
||||
[cloud-datastore]: https://cloud.google.com/datastore/
|
||||
[cloud-datastore-docs]: https://cloud.google.com/datastore/docs
|
||||
[cloud-datastore-activation]: https://cloud.google.com/datastore/docs/activate
|
||||
|
37
vendor/google.golang.org/cloud/compute/metadata/go13.go
generated
vendored
37
vendor/google.golang.org/cloud/compute/metadata/go13.go
generated
vendored
@@ -1,37 +0,0 @@
|
||||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build go1.3
|
||||
|
||||
package metadata
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This is a workaround for https://github.com/golang/oauth2/issues/70, where
|
||||
// net.Dialer.KeepAlive is unavailable on Go 1.2 (which App Engine as of
|
||||
// Jan 2015 still runs).
|
||||
//
|
||||
// TODO(bradfitz,jbd,adg): remove this once App Engine supports Go
|
||||
// 1.3+.
|
||||
func init() {
|
||||
go13Dialer = func() *net.Dialer {
|
||||
return &net.Dialer{
|
||||
Timeout: 750 * time.Millisecond,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}
|
||||
}
|
||||
}
|
140
vendor/google.golang.org/cloud/compute/metadata/metadata.go
generated
vendored
140
vendor/google.golang.org/cloud/compute/metadata/metadata.go
generated
vendored
@@ -17,7 +17,7 @@
|
||||
//
|
||||
// This package is a wrapper around the GCE metadata service,
|
||||
// as documented at https://developers.google.com/compute/docs/metadata.
|
||||
package metadata
|
||||
package metadata // import "google.golang.org/cloud/compute/metadata"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -25,6 +25,8 @@ import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -48,31 +50,15 @@ var (
|
||||
var metaClient = &http.Client{
|
||||
Transport: &internal.Transport{
|
||||
Base: &http.Transport{
|
||||
Dial: dialer().Dial,
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 750 * time.Millisecond,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).Dial,
|
||||
ResponseHeaderTimeout: 750 * time.Millisecond,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// go13Dialer is nil until we're using Go 1.3+.
|
||||
// This is a workaround for https://github.com/golang/oauth2/issues/70, where
|
||||
// net.Dialer.KeepAlive is unavailable on Go 1.2 (which App Engine as of
|
||||
// Jan 2015 still runs).
|
||||
//
|
||||
// TODO(bradfitz,jbd,adg,dsymonds): remove this once App Engine supports Go
|
||||
// 1.3+ and go-app-builder also supports 1.3+, or when Go 1.2 is no longer an
|
||||
// option on App Engine.
|
||||
var go13Dialer func() *net.Dialer
|
||||
|
||||
func dialer() *net.Dialer {
|
||||
if fn := go13Dialer; fn != nil {
|
||||
return fn()
|
||||
}
|
||||
return &net.Dialer{
|
||||
Timeout: 750 * time.Millisecond,
|
||||
}
|
||||
}
|
||||
|
||||
// NotDefinedError is returned when requested metadata is not defined.
|
||||
//
|
||||
// The underlying string is the suffix after "/computeMetadata/v1/".
|
||||
@@ -86,35 +72,54 @@ func (suffix NotDefinedError) Error() string {
|
||||
}
|
||||
|
||||
// Get returns a value from the metadata service.
|
||||
// The suffix is appended to "http://metadata/computeMetadata/v1/".
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
//
|
||||
// If the GCE_METADATA_HOST environment variable is not defined, a default of
|
||||
// 169.254.169.254 will be used instead.
|
||||
//
|
||||
// If the requested metadata is not defined, the returned error will
|
||||
// be of type NotDefinedError.
|
||||
func Get(suffix string) (string, error) {
|
||||
// Using 169.254.169.254 instead of "metadata" here because Go
|
||||
// binaries built with the "netgo" tag and without cgo won't
|
||||
// know the search suffix for "metadata" is
|
||||
// ".google.internal", and this IP address is documented as
|
||||
// being stable anyway.
|
||||
url := "http://169.254.169.254/computeMetadata/v1/" + suffix
|
||||
val, _, err := getETag(suffix)
|
||||
return val, err
|
||||
}
|
||||
|
||||
// getETag returns a value from the metadata service as well as the associated
|
||||
// ETag. This func is otherwise equivalent to Get.
|
||||
func getETag(suffix string) (value, etag string, err error) {
|
||||
// Using a fixed IP makes it very difficult to spoof the metadata service in
|
||||
// a container, which is an important use-case for local testing of cloud
|
||||
// deployments. To enable spoofing of the metadata service, the environment
|
||||
// variable GCE_METADATA_HOST is first inspected to decide where metadata
|
||||
// requests shall go.
|
||||
host := os.Getenv("GCE_METADATA_HOST")
|
||||
if host == "" {
|
||||
// Using 169.254.169.254 instead of "metadata" here because Go
|
||||
// binaries built with the "netgo" tag and without cgo won't
|
||||
// know the search suffix for "metadata" is
|
||||
// ".google.internal", and this IP address is documented as
|
||||
// being stable anyway.
|
||||
host = "169.254.169.254"
|
||||
}
|
||||
url := "http://" + host + "/computeMetadata/v1/" + suffix
|
||||
req, _ := http.NewRequest("GET", url, nil)
|
||||
req.Header.Set("Metadata-Flavor", "Google")
|
||||
res, err := metaClient.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", "", err
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode == http.StatusNotFound {
|
||||
return "", NotDefinedError(suffix)
|
||||
return "", "", NotDefinedError(suffix)
|
||||
}
|
||||
if res.StatusCode != 200 {
|
||||
return "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
|
||||
return "", "", fmt.Errorf("status code %d trying to fetch %s", res.StatusCode, url)
|
||||
}
|
||||
all, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
return "", "", err
|
||||
}
|
||||
return string(all), nil
|
||||
return string(all), res.Header.Get("Etag"), nil
|
||||
}
|
||||
|
||||
func getTrimmed(suffix string) (s string, err error) {
|
||||
@@ -165,6 +170,46 @@ func OnGCE() bool {
|
||||
return onGCE.v
|
||||
}
|
||||
|
||||
// Subscribe subscribes to a value from the metadata service.
|
||||
// The suffix is appended to "http://${GCE_METADATA_HOST}/computeMetadata/v1/".
|
||||
//
|
||||
// Subscribe calls fn with the latest metadata value indicated by the provided
|
||||
// suffix. If the metadata value is deleted, fn is called with the empty string
|
||||
// and ok false. Subscribe blocks until fn returns a non-nil error or the value
|
||||
// is deleted. Subscribe returns the error value returned from the last call to
|
||||
// fn, which may be nil when ok == false.
|
||||
func Subscribe(suffix string, fn func(v string, ok bool) error) error {
|
||||
const failedSubscribeSleep = time.Second * 5
|
||||
|
||||
// First check to see if the metadata value exists at all.
|
||||
val, lastETag, err := getETag(suffix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := fn(val, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ok := true
|
||||
suffix += "?wait_for_change=true&last_etag="
|
||||
for {
|
||||
val, etag, err := getETag(suffix + url.QueryEscape(lastETag))
|
||||
if err != nil {
|
||||
if _, deleted := err.(NotDefinedError); !deleted {
|
||||
time.Sleep(failedSubscribeSleep)
|
||||
continue // Retry on other errors.
|
||||
}
|
||||
ok = false
|
||||
}
|
||||
lastETag = etag
|
||||
|
||||
if err := fn(val, ok); err != nil || !ok {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ProjectID returns the current instance's project ID string.
|
||||
func ProjectID() (string, error) { return projID.get() }
|
||||
|
||||
@@ -181,14 +226,10 @@ func ExternalIP() (string, error) {
|
||||
return getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip")
|
||||
}
|
||||
|
||||
// Hostname returns the instance's hostname. This will probably be of
|
||||
// the form "INSTANCENAME.c.PROJECT.internal" but that isn't
|
||||
// guaranteed.
|
||||
//
|
||||
// TODO: what is this defined to be? Docs say "The host name of the
|
||||
// instance."
|
||||
// Hostname returns the instance's hostname. This will be of the form
|
||||
// "<instanceID>.c.<projID>.internal".
|
||||
func Hostname() (string, error) {
|
||||
return getTrimmed("network-interfaces/0/ip")
|
||||
return getTrimmed("instance/hostname")
|
||||
}
|
||||
|
||||
// InstanceTags returns the list of user-defined instance tags,
|
||||
@@ -210,6 +251,25 @@ func InstanceID() (string, error) {
|
||||
return instID.get()
|
||||
}
|
||||
|
||||
// InstanceName returns the current VM's instance ID string.
|
||||
func InstanceName() (string, error) {
|
||||
host, err := Hostname()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.Split(host, ".")[0], nil
|
||||
}
|
||||
|
||||
// Zone returns the current VM's zone, such as "us-central1-b".
|
||||
func Zone() (string, error) {
|
||||
zone, err := getTrimmed("instance/zone")
|
||||
// zone is of the form "projects/<projNum>/zones/<zoneName>".
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return zone[strings.LastIndex(zone, "/")+1:], nil
|
||||
}
|
||||
|
||||
// InstanceAttributes returns the list of user-defined attributes,
|
||||
// assigned when initially creating a GCE VM instance. The value of an
|
||||
// attribute can be obtained with InstanceAttributeValue.
|
||||
|
Reference in New Issue
Block a user