本文整理汇总了Golang中github.com/juju/juju/environs.RegisterProvider函数的典型用法代码示例。如果您正苦于以下问题:Golang RegisterProvider函数的具体用法?Golang RegisterProvider怎么用?Golang RegisterProvider使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RegisterProvider函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func init() {
dummyProvider, err := environs.Provider("dummy")
if err != nil {
panic(err)
}
environs.RegisterProvider("fake", mockProvider{dummyProvider})
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:7,代码来源:credentials_test.go
示例2: init
func init() {
environs.RegisterProvider(providerType, azureEnvironProvider{})
// Register the Azure storage provider.
registry.RegisterProvider(storageProviderType, &azureStorageProvider{})
registry.RegisterEnvironStorageProviders(providerType, storageProviderType)
}
开发者ID:ktsakalozos,项目名称:juju,代码行数:7,代码来源:init.go
示例3: init
func init() {
environs.RegisterProvider(providerType, maasEnvironProvider{})
//Register the MAAS specific storage providers.
registry.RegisterProvider(maasStorageProviderType, &maasStorageProvider{})
registry.RegisterEnvironStorageProviders(providerType, maasStorageProviderType)
}
开发者ID:imoapps,项目名称:juju,代码行数:8,代码来源:init.go
示例4: init
func init() {
// This will only happen in binaries that actually import this provider
// somewhere. To enable a provider, import it in the "providers/all"
// package; please do *not* import individual providers anywhere else,
// except in direct tests for that provider.
environs.RegisterProvider("cloudsigma", providerInstance)
environs.RegisterImageDataSourceFunc("cloud sigma image source", getImageSource)
}
开发者ID:bac,项目名称:juju,代码行数:8,代码来源:provider.go
示例5: init
func init() {
environs.RegisterProvider("dummy", &dummy)
// Prime the first ops channel, so that naive clients can use
// the testing environment by simply importing it.
go func() {
for _ = range discardOperations {
}
}()
}
开发者ID:xushiwei,项目名称:juju,代码行数:10,代码来源:environs.go
示例6: init
func init() {
osProvider := openstack.EnvironProvider{
Credentials{},
&rackspaceConfigurator{},
&firewallerFactory{},
}
providerInstance = &environProvider{
osProvider,
}
environs.RegisterProvider(providerType, providerInstance)
}
开发者ID:bac,项目名称:juju,代码行数:11,代码来源:init.go
示例7: init
func init() {
environs.RegisterProvider("dummy", &providerInstance)
// Prime the first ops channel, so that naive clients can use
// the testing environment by simply importing it.
c := make(chan Operation)
go func() {
for _ = range c {
}
}()
discardOperations = c
Reset()
// parse errors are ignored
providerDelay, _ = time.ParseDuration(os.Getenv("JUJU_DUMMY_DELAY"))
}
开发者ID:klyachin,项目名称:juju,代码行数:16,代码来源:environs.go
示例8: TestRegisterProvider
func (s *suite) TestRegisterProvider(c *gc.C) {
s.PatchValue(environs.Providers, make(map[string]environs.EnvironProvider))
s.PatchValue(environs.ProviderAliases, make(map[string]string))
type step struct {
name string
aliases []string
err string
}
type test []step
tests := []test{
[]step{{
name: "providerName",
}},
[]step{{
name: "providerName",
aliases: []string{"providerName"},
err: "juju: duplicate provider alias \"providerName\"",
}},
[]step{{
name: "providerName",
aliases: []string{"providerAlias", "providerAlias"},
err: "juju: duplicate provider alias \"providerAlias\"",
}},
[]step{{
name: "providerName",
aliases: []string{"providerAlias1", "providerAlias2"},
}},
[]step{{
name: "providerName",
}, {
name: "providerName",
err: "juju: duplicate provider name \"providerName\"",
}},
[]step{{
name: "providerName1",
}, {
name: "providerName2",
aliases: []string{"providerName"},
}},
[]step{{
name: "providerName1",
}, {
name: "providerName2",
aliases: []string{"providerName1"},
err: "juju: duplicate provider alias \"providerName1\"",
}},
}
registerProvider := func(name string, aliases []string) (err error) {
defer func() { err, _ = recover().(error) }()
registered := &dummyProvider{}
environs.RegisterProvider(name, registered, aliases...)
p, err := environs.Provider(name)
c.Assert(err, jc.ErrorIsNil)
c.Assert(p, gc.Equals, registered)
for _, alias := range aliases {
p, err := environs.Provider(alias)
c.Assert(err, jc.ErrorIsNil)
c.Assert(p, gc.Equals, registered)
c.Assert(p, gc.Equals, registered)
}
return nil
}
for i, test := range tests {
c.Logf("test %d: %v", i, test)
for k := range *environs.Providers {
delete(*environs.Providers, k)
}
for k := range *environs.ProviderAliases {
delete(*environs.ProviderAliases, k)
}
for _, step := range test {
err := registerProvider(step.name, step.aliases)
if step.err == "" {
c.Assert(err, jc.ErrorIsNil)
} else {
c.Assert(err, gc.ErrorMatches, step.err)
}
}
}
}
开发者ID:imoapps,项目名称:juju,代码行数:82,代码来源:config_test.go
示例9: SetUpSuite
func (s *listCredentialsSuite) SetUpSuite(c *gc.C) {
s.BaseSuite.SetUpSuite(c)
environs.RegisterProvider("test-provider", &mockProvider{})
}
开发者ID:kat-co,项目名称:juju,代码行数:4,代码来源:listcredentials_test.go
示例10: init
func init() {
environs.RegisterProvider("maas", maasEnvironProvider{})
}
开发者ID:klyachin,项目名称:juju,代码行数:3,代码来源:environprovider.go
示例11: SetUpSuite
func (s *AddresserSuite) SetUpSuite(c *gc.C) {
s.BaseSuite.SetUpSuite(c)
environs.RegisterProvider("mock", mockEnvironProvider{})
}
开发者ID:exekias,项目名称:juju,代码行数:4,代码来源:addresser_test.go
示例12: SetUpSuite
func (s *detectCredentialsSuite) SetUpSuite(c *gc.C) {
environs.RegisterProvider("mock-provider", &mockProvider{detectedCreds: &s.aCredential})
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:3,代码来源:detectcredentials_test.go
示例13: init
func init() {
environs.RegisterProvider(provider.Local, providerInstance)
}
开发者ID:rogpeppe,项目名称:juju,代码行数:3,代码来源:environprovider.go
示例14: init
func init() {
environs.RegisterProvider("sshinit_test", &testProvider{})
}
开发者ID:Pankov404,项目名称:juju,代码行数:3,代码来源:renderscript_test.go
示例15: init
func init() {
provider := mockEnvironProvider{}
environs.RegisterProvider("mock", provider)
}
开发者ID:exekias,项目名称:juju,代码行数:4,代码来源:package_test.go
示例16: init
// Register the Azure provider with Juju.
func init() {
environs.RegisterProvider("azure", azureEnvironProvider{})
}
开发者ID:kapilt,项目名称:juju,代码行数:4,代码来源:environprovider.go
示例17: SetUpSuite
func (s StubNetwork) SetUpSuite(c *gc.C) {
providers := environs.RegisteredProviders()
for _, name := range providers {
if name == StubProviderType {
return
}
}
ProviderInstance.Zones = []providercommon.AvailabilityZone{
&FakeZone{"zone1", true},
&FakeZone{"zone2", false},
&FakeZone{"zone3", true},
&FakeZone{"zone4", false},
&FakeZone{"zone4", false}, // duplicates are ignored
}
ProviderInstance.Subnets = []network.SubnetInfo{{
CIDR: "10.10.0.0/24",
ProviderId: "sn-zadf00d",
AvailabilityZones: []string{"zone1"},
AllocatableIPLow: net.ParseIP("10.10.0.10"),
AllocatableIPHigh: net.ParseIP("10.10.0.100"),
}, {
CIDR: "2001:db8::/32",
ProviderId: "sn-ipv6",
AvailabilityZones: []string{"zone1", "zone3"},
}, {
// no CIDR or provider id -> cached, but cannot be added
CIDR: "",
ProviderId: "",
}, {
// no CIDR, just provider id -> cached, but can only be added by id
CIDR: "",
ProviderId: "sn-empty",
}, {
// invalid CIDR and provider id -> cannot be added, but is cached
CIDR: "invalid",
ProviderId: "sn-invalid",
}, {
// incorrectly specified CIDR, with provider id -> cached, cannot be added
CIDR: "0.1.2.3/4",
ProviderId: "sn-awesome",
}, {
// no zones, no provider-id -> cached, but can only be added by CIDR
CIDR: "10.20.0.0/16",
}, {
// with zones, duplicate provider-id -> overwritten by the last
// subnet with the same provider id when caching.
CIDR: "10.99.88.0/24",
ProviderId: "sn-deadbeef",
AvailabilityZones: []string{"zone1", "zone2"},
}, {
// no zones
CIDR: "10.42.0.0/16",
ProviderId: "sn-42",
}, {
// in an unavailable zone, duplicate CIDR -> cannot be added, but is cached
CIDR: "10.10.0.0/24",
ProviderId: "sn-deadbeef",
AvailabilityZones: []string{"zone2"},
}, {
CIDR: "10.30.1.0/24",
ProviderId: "vlan-42",
VLANTag: 42,
AvailabilityZones: []string{"zone3"},
}}
environs.RegisterProvider(StubProviderType, ProviderInstance)
}
开发者ID:AlexisBruemmer,项目名称:juju,代码行数:68,代码来源:stub_network.go
示例18: init
func init() {
environs.RegisterProvider("fake", &fakeProvider{})
}
开发者ID:pmatulis,项目名称:juju,代码行数:3,代码来源:modelmanager_test.go
注:本文中的github.com/juju/juju/environs.RegisterProvider函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论