冲突解决

This commit is contained in:
屈轩
2018-12-08 18:30:00 +08:00
3 changed files with 11 additions and 11 deletions
+9 -9
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"errors"
"yunion.io/x/jsonutils"
"yunion.io/x/log"
)
@@ -59,15 +60,6 @@ func GetProviderDriver(provider string) (ICloudProviderFactory, error) {
return nil, fmt.Errorf("No such provider %s", provider)
}
func GetProvider(providerId, providerName, accessUrl, account, secret, provider string) (ICloudProvider, error) {
factory, ok := providerTable[provider]
if ok {
return factory.GetProvider(providerId, providerName, accessUrl, account, secret)
}
log.Errorf("Provider %s not registerd", provider)
return nil, fmt.Errorf("No such provider %s", provider)
}
func GetRegistedProviderIds() []string {
providers := []string{}
for id := range providerTable {
@@ -77,6 +69,14 @@ func GetRegistedProviderIds() []string {
return providers
}
func GetProvider(providerId, providerName, accessUrl, account, secret, provider string) (ICloudProvider, error) {
driver, err := GetProviderDriver(provider)
if err != nil {
return nil, err
}
return driver.GetProvider(providerId, providerName, accessUrl, account, secret)
}
func IsSupported(provider string) bool {
_, ok := providerTable[provider]
return ok