init files

This commit is contained in:
TangBin
2018-09-26 18:31:55 +08:00
parent 54bb57ad68
commit 538a53cd3d
7 changed files with 182 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
package guestdrivers
+1
View File
@@ -0,0 +1 @@
package hostdrivers
+1
View File
@@ -28,6 +28,7 @@ const (
CLOUD_PROVIDER_VMWARE = "VMware"
CLOUD_PROVIDER_ALIYUN = "Aliyun"
CLOUD_PROVIDER_AZURE = "Azure"
CLOUD_PROVIDER_AWS = "Aws"
)
type SCloudproviderManager struct {
+80
View File
@@ -0,0 +1,80 @@
package aws
import (
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/compute/models"
)
const (
CLOUD_PROVIDER_AWS = models.CLOUD_PROVIDER_AWS
CLOUD_PROVIDER_AWS_CN = "AWS"
)
type SAwsClient struct {
providerId string
providerName string
accessKey string
secret string
iregions []cloudprovider.ICloudRegion
}
func (self *SAwsClient) fetchRegions() error {
panic("implement me")
}
func (self *SAwsClient) GetRegions() error {
panic("implement me")
}
func (self *SAwsClient) UpdateAccount(tenantId, secret, envName string) error {
return nil
}
func (self *SAwsClient) GetIRegions() []cloudprovider.ICloudRegion {
panic("implement me")
}
func (self *SAwsClient) GetIRegionById(id string) (cloudprovider.ICloudRegion, error) {
panic("implement me")
}
func (self *SAwsClient) GetRegion(regionId string) *SRegion {
return nil
}
func (self *SAwsClient) GetIHostById(id string) (cloudprovider.ICloudHost, error) {
panic("implement me")
}
func (self *SAwsClient) GetIVpcById(id string) (cloudprovider.ICloudVpc, error) {
panic("implement me")
}
func (self *SAwsClient) GetIStorageById(id string) (cloudprovider.ICloudStorage, error) {
panic("implement me")
}
func (self *SAwsClient) GetIStoragecacheById(id string) (cloudprovider.ICloudStoragecache, error) {
panic("implement me")
}
type SAccountBalance struct {
AvailableAmount float64
AvailableCashAmount float64
CreditAmount float64
MybankCreditAmount float64
Currency string
}
func (self *SAwsClient) QueryAccountBalance() (*SAccountBalance, error) {
panic("implement me")
}
func NewAwsClient(providerId string, providerName string, accessKey string, secret string) (*SAwsClient, error) {
client := SAwsClient{providerId: providerId, providerName: providerName, accessKey: accessKey, secret: secret}
err := client.fetchRegions()
if err != nil {
return nil, err
}
return &client, nil
}
+71
View File
@@ -0,0 +1,71 @@
package provider
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/cloudprovider"
"yunion.io/x/onecloud/pkg/util/aws"
)
type SAwsProviderFactory struct {
}
func (self *SAwsProviderFactory) GetId() string {
return aws.CLOUD_PROVIDER_AWS
}
func (self *SAwsProviderFactory) GetProvider(providerId, providerName, url, account, secret string) (cloudprovider.ICloudProvider, error) {
panic("implement me")
}
func init() {
factory := SAwsProviderFactory{}
cloudprovider.RegisterFactory(&factory)
}
type SAwsProvider struct {
client *aws.SAwsClient
}
func (self *SAwsProvider) GetId() string {
panic("implement me")
}
func (self *SAwsProvider) GetName() string {
panic("implement me")
}
func (self *SAwsProvider) GetIRegions() []cloudprovider.ICloudRegion {
panic("implement me")
}
func (self *SAwsProvider) GetSysInfo() (jsonutils.JSONObject, error) {
panic("implement me")
}
func (self *SAwsProvider) IsPublicCloud() bool {
panic("implement me")
}
func (self *SAwsProvider) GetIRegionById(id string) (cloudprovider.ICloudRegion, error) {
panic("implement me")
}
func (self *SAwsProvider) GetIHostById(id string) (cloudprovider.ICloudHost, error) {
panic("implement me")
}
func (self *SAwsProvider) GetIVpcById(id string) (cloudprovider.ICloudVpc, error) {
panic("implement me")
}
func (self *SAwsProvider) GetIStorageById(id string) (cloudprovider.ICloudStorage, error) {
panic("implement me")
}
func (self *SAwsProvider) GetIStoragecacheById(id string) (cloudprovider.ICloudStoragecache, error) {
panic("implement me")
}
func (self *SAwsProvider) GetBalance() (float64, error) {
panic("implement me")
}
+19
View File
@@ -0,0 +1,19 @@
package aws
import "yunion.io/x/onecloud/pkg/cloudprovider"
type SRegion struct {
client *SAwsClient
izones []cloudprovider.ICloudZone
ivpcs []cloudprovider.ICloudVpc
storageCache *SStoragecache
ID string
SubscriptionID string
Name string
DisplayName string
Latitude float32
Longitude float32
}
+9
View File
@@ -0,0 +1,9 @@
package aws
import "yunion.io/x/onecloud/pkg/cloudprovider"
type SStoragecache struct {
region *SRegion
iimages []cloudprovider.ICloudImage
}