blob: 9d66fe178e054a9403625d367a346f137f569d5b [file] [log] [blame]
package gophercloud
import (
)
type Provider struct {
AuthEndpoint string
}
var providerMap = make(map[string]*Provider)
func (c *Context) RegisterProvider(name string, p *Provider) error {
if p.AuthEndpoint == "" {
return ErrConfiguration
}
c.providerMap[name] = p
return nil
}
func (c *Context) ProviderByName(name string) (p *Provider, err error) {
for provider, descriptor := range c.providerMap {
if name == provider {
return descriptor, nil
}
}
return nil, ErrProvider
}