cloudprovider: add the ProviderName method

This patch adds the ProviderName method used to identify the cloud
provider.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
This commit is contained in:
Federico Simoncelli
2015-05-05 10:10:24 -04:00
parent 9b67435cf3
commit 194343267d
9 changed files with 64 additions and 8 deletions

View File

@@ -38,6 +38,8 @@ import (
"github.com/golang/glog"
)
const ProviderName = "rackspace"
var ErrNotFound = errors.New("Failed to find object")
var ErrMultipleResults = errors.New("Multiple results where only one expected")
var ErrNoAddressFound = errors.New("No address found for host")
@@ -89,7 +91,7 @@ type Config struct {
}
func init() {
cloudprovider.RegisterCloudProvider("rackspace", func(config io.Reader) (cloudprovider.Interface, error) {
cloudprovider.RegisterCloudProvider(ProviderName, func(config io.Reader) (cloudprovider.Interface, error) {
cfg, err := readConfig(config)
if err != nil {
return nil, err
@@ -399,6 +401,11 @@ func (os *Rackspace) Clusters() (cloudprovider.Clusters, bool) {
return nil, false
}
// ProviderName returns the cloud provider ID.
func (os *Rackspace) ProviderName() string {
return ProviderName
}
func (os *Rackspace) TCPLoadBalancer() (cloudprovider.TCPLoadBalancer, bool) {
return nil, false
}