mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-28 03:23:25 +08:00
冲突解决
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user