blob: 08bdfbe82bc07aa520accf1382a258501a12a1c9 [file] [log] [blame]
package gophercloud
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
}