blob: f2249c3e60e02b4200685710729f3bb9c86e92b7 [file] [log] [blame]
Samuel A. Falvo IIfd78c302013-06-25 16:35:32 -07001package gophercloud
2
3import (
4)
5
6type Provider struct {
7 // empty.
8}
9
10var providerMap = make(map[string]*Provider)
11
12func (c *Context) RegisterProvider(name string, p *Provider) error {
13 c.providerMap[name] = p
14 return nil
15}
16
17func (c *Context) ProviderByName(name string) (p *Provider, err error) {
18 for provider, descriptor := range c.providerMap {
19 if name == provider {
20 return descriptor, nil
21 }
22 }
23 return nil, ErrProvider
24}