mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-01-07 19:01:55 -05:00
Add distributed routers support
This commit is contained in:
43
vendor/github.com/rackspace/gophercloud/openstack/client.go
generated
vendored
43
vendor/github.com/rackspace/gophercloud/openstack/client.go
generated
vendored
@@ -3,6 +3,7 @@ package openstack
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/rackspace/gophercloud"
|
||||
tokens2 "github.com/rackspace/gophercloud/openstack/identity/v2/tokens"
|
||||
@@ -64,8 +65,8 @@ func AuthenticatedClient(options gophercloud.AuthOptions) (*gophercloud.Provider
|
||||
// Authenticate or re-authenticate against the most recent identity service supported at the provided endpoint.
|
||||
func Authenticate(client *gophercloud.ProviderClient, options gophercloud.AuthOptions) error {
|
||||
versions := []*utils.Version{
|
||||
&utils.Version{ID: v20, Priority: 20, Suffix: "/v2.0/"},
|
||||
&utils.Version{ID: v30, Priority: 30, Suffix: "/v3/"},
|
||||
{ID: v20, Priority: 20, Suffix: "/v2.0/"},
|
||||
{ID: v30, Priority: 30, Suffix: "/v3/"},
|
||||
}
|
||||
|
||||
chosen, endpoint, err := utils.ChooseVersion(client, versions)
|
||||
@@ -110,7 +111,7 @@ func v2auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
|
||||
if options.AllowReauth {
|
||||
client.ReauthFunc = func() error {
|
||||
client.TokenID = ""
|
||||
return AuthenticateV2(client, options)
|
||||
return v2auth(client, endpoint, options)
|
||||
}
|
||||
}
|
||||
client.TokenID = token.ID
|
||||
@@ -168,7 +169,7 @@ func v3auth(client *gophercloud.ProviderClient, endpoint string, options gopherc
|
||||
if options.AllowReauth {
|
||||
client.ReauthFunc = func() error {
|
||||
client.TokenID = ""
|
||||
return AuthenticateV3(client, options)
|
||||
return v3auth(client, endpoint, options)
|
||||
}
|
||||
}
|
||||
client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) {
|
||||
@@ -198,6 +199,40 @@ func NewIdentityV3(client *gophercloud.ProviderClient) *gophercloud.ServiceClien
|
||||
}
|
||||
}
|
||||
|
||||
func NewIdentityAdminV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
eo.ApplyDefaults("identity")
|
||||
eo.Availability = gophercloud.AvailabilityAdmin
|
||||
|
||||
url, err := client.EndpointLocator(eo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Force using v2 API
|
||||
if strings.Contains(url, "/v3") {
|
||||
url = strings.Replace(url, "/v3", "/v2.0", -1)
|
||||
}
|
||||
|
||||
return &gophercloud.ServiceClient{ProviderClient: client, Endpoint: url}, nil
|
||||
}
|
||||
|
||||
func NewIdentityAdminV3(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
eo.ApplyDefaults("identity")
|
||||
eo.Availability = gophercloud.AvailabilityAdmin
|
||||
|
||||
url, err := client.EndpointLocator(eo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Force using v3 API
|
||||
if strings.Contains(url, "/v2.0") {
|
||||
url = strings.Replace(url, "/v2.0", "/v3", -1)
|
||||
}
|
||||
|
||||
return &gophercloud.ServiceClient{ProviderClient: client, Endpoint: url}, nil
|
||||
}
|
||||
|
||||
// NewObjectStorageV1 creates a ServiceClient that may be used with the v1 object storage package.
|
||||
func NewObjectStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {
|
||||
eo.ApplyDefaults("object-store")
|
||||
|
||||
Reference in New Issue
Block a user