mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-13 13:06:03 +00:00
Merge pull request #63405 from dims/update-to-latest-gophercloud-may-3-2018
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
Update to latest Gophercloud
**What this PR does / why we need it**:
periodic update to latest gophercloud. The changes are as follows:
6da026c32e...781450b3c4
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #
**Special notes for your reviewer**:
**Release note**:
```release-note
NONE
```
Kubernetes-commit: bc56947e8dd89d70735384239c4e5d0c2c9fe8eb
This commit is contained in:
commit
998a5ff4b9
14
Godeps/Godeps.json
generated
14
Godeps/Godeps.json
generated
@ -104,31 +104,31 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/openstack",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tenants",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/openstack/utils",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/gophercloud/gophercloud/pagination",
|
||||
"Rev": "6da026c32e2d622cc242d32984259c77237aefe1"
|
||||
"Rev": "781450b3c4fcb4f5182bcc5133adb4b2e4a09d1d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/golang-lru",
|
||||
|
18
vendor/github.com/gophercloud/gophercloud/errors.go
generated
vendored
18
vendor/github.com/gophercloud/gophercloud/errors.go
generated
vendored
@ -72,6 +72,11 @@ type ErrDefault401 struct {
|
||||
ErrUnexpectedResponseCode
|
||||
}
|
||||
|
||||
// ErrDefault403 is the default error type returned on a 403 HTTP response code.
|
||||
type ErrDefault403 struct {
|
||||
ErrUnexpectedResponseCode
|
||||
}
|
||||
|
||||
// ErrDefault404 is the default error type returned on a 404 HTTP response code.
|
||||
type ErrDefault404 struct {
|
||||
ErrUnexpectedResponseCode
|
||||
@ -108,6 +113,13 @@ func (e ErrDefault400) Error() string {
|
||||
func (e ErrDefault401) Error() string {
|
||||
return "Authentication failed"
|
||||
}
|
||||
func (e ErrDefault403) Error() string {
|
||||
e.DefaultErrString = fmt.Sprintf(
|
||||
"Request forbidden: [%s %s], error message: %s",
|
||||
e.Method, e.URL, e.Body,
|
||||
)
|
||||
return e.choseErrString()
|
||||
}
|
||||
func (e ErrDefault404) Error() string {
|
||||
return "Resource not found"
|
||||
}
|
||||
@ -141,6 +153,12 @@ type Err401er interface {
|
||||
Error401(ErrUnexpectedResponseCode) error
|
||||
}
|
||||
|
||||
// Err403er is the interface resource error types implement to override the error message
|
||||
// from a 403 error.
|
||||
type Err403er interface {
|
||||
Error403(ErrUnexpectedResponseCode) error
|
||||
}
|
||||
|
||||
// Err404er is the interface resource error types implement to override the error message
|
||||
// from a 404 error.
|
||||
type Err404er interface {
|
||||
|
6
vendor/github.com/gophercloud/gophercloud/openstack/client.go
generated
vendored
6
vendor/github.com/gophercloud/gophercloud/openstack/client.go
generated
vendored
@ -394,3 +394,9 @@ func NewLoadBalancerV2(client *gophercloud.ProviderClient, eo gophercloud.Endpoi
|
||||
sc.ResourceBase = sc.Endpoint + "v2.0/"
|
||||
return sc, err
|
||||
}
|
||||
|
||||
// NewClusteringV1 creates a ServiceClient that may be used with the v1 clustering
|
||||
// package.
|
||||
func NewClusteringV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
return initClientOpts(client, eo, "clustering")
|
||||
}
|
||||
|
2
vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go
generated
vendored
2
vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go
generated
vendored
@ -84,7 +84,7 @@ func V3EndpointURL(catalog *tokens3.ServiceCatalog, opts gophercloud.EndpointOpt
|
||||
return "", err
|
||||
}
|
||||
if (opts.Availability == gophercloud.Availability(endpoint.Interface)) &&
|
||||
(opts.Region == "" || endpoint.Region == opts.Region) {
|
||||
(opts.Region == "" || endpoint.Region == opts.Region || endpoint.RegionID == opts.Region) {
|
||||
endpoints = append(endpoints, endpoint)
|
||||
}
|
||||
}
|
||||
|
1
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
1
vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go
generated
vendored
@ -13,6 +13,7 @@ import (
|
||||
type Endpoint struct {
|
||||
ID string `json:"id"`
|
||||
Region string `json:"region"`
|
||||
RegionID string `json:"region_id"`
|
||||
Interface string `json:"interface"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
51
vendor/github.com/gophercloud/gophercloud/provider_client.go
generated
vendored
51
vendor/github.com/gophercloud/gophercloud/provider_client.go
generated
vendored
@ -126,6 +126,36 @@ func (client *ProviderClient) SetToken(t string) {
|
||||
client.TokenID = t
|
||||
}
|
||||
|
||||
//Reauthenticate calls client.ReauthFunc in a thread-safe way. If this is
|
||||
//called because of a 401 response, the caller may pass the previous token. In
|
||||
//this case, the reauthentication can be skipped if another thread has already
|
||||
//reauthenticated in the meantime. If no previous token is known, an empty
|
||||
//string should be passed instead to force unconditional reauthentication.
|
||||
func (client *ProviderClient) Reauthenticate(previousToken string) (err error) {
|
||||
if client.ReauthFunc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if client.mut == nil {
|
||||
return client.ReauthFunc()
|
||||
}
|
||||
client.mut.Lock()
|
||||
defer client.mut.Unlock()
|
||||
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = true
|
||||
client.reauthmut.Unlock()
|
||||
|
||||
if previousToken == "" || client.TokenID == previousToken {
|
||||
err = client.ReauthFunc()
|
||||
}
|
||||
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = false
|
||||
client.reauthmut.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
// RequestOpts customizes the behavior of the provider.Request() method.
|
||||
type RequestOpts struct {
|
||||
// JSONBody, if provided, will be encoded as JSON and used as the body of the HTTP request. The
|
||||
@ -254,21 +284,7 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
|
||||
}
|
||||
case http.StatusUnauthorized:
|
||||
if client.ReauthFunc != nil {
|
||||
if client.mut != nil {
|
||||
client.mut.Lock()
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = true
|
||||
client.reauthmut.Unlock()
|
||||
if curtok := client.TokenID; curtok == prereqtok {
|
||||
err = client.ReauthFunc()
|
||||
}
|
||||
client.reauthmut.Lock()
|
||||
client.reauthmut.reauthing = false
|
||||
client.reauthmut.Unlock()
|
||||
client.mut.Unlock()
|
||||
} else {
|
||||
err = client.ReauthFunc()
|
||||
}
|
||||
err = client.Reauthenticate(prereqtok)
|
||||
if err != nil {
|
||||
e := &ErrUnableToReauthenticate{}
|
||||
e.ErrOriginal = respErr
|
||||
@ -298,6 +314,11 @@ func (client *ProviderClient) Request(method, url string, options *RequestOpts)
|
||||
if error401er, ok := errType.(Err401er); ok {
|
||||
err = error401er.Error401(respErr)
|
||||
}
|
||||
case http.StatusForbidden:
|
||||
err = ErrDefault403{respErr}
|
||||
if error403er, ok := errType.(Err403er); ok {
|
||||
err = error403er.Error403(respErr)
|
||||
}
|
||||
case http.StatusNotFound:
|
||||
err = ErrDefault404{respErr}
|
||||
if error404er, ok := errType.(Err404er); ok {
|
||||
|
Loading…
Reference in New Issue
Block a user