Documentation
¶
Index ¶
- Constants
- Variables
- func IsSupported(provider string) bool
- func RegisterFactory(factory ICloudProviderFactory)
- func WaitDeleted(res ICloudResource, interval time.Duration, timeout time.Duration) error
- func WaitStatus(res ICloudResource, expect string, interval time.Duration, ...) error
- type ICloudDisk
- type ICloudEIP
- type ICloudHost
- type ICloudImage
- type ICloudNetwork
- type ICloudNic
- type ICloudProvider
- type ICloudProviderFactory
- type ICloudRegion
- type ICloudResource
- type ICloudSecurityGroup
- type ICloudStorage
- type ICloudStoragecache
- type ICloudVM
- type ICloudVpc
- type ICloudWire
- type ICloudZone
Constants ¶
View Source
const ( CloudVMStatusRunning = "running" CloudVMStatusSuspend = "suspend" CloudVMStatusStopped = "stopped" CloudVMStatusOther = "other" )
Variables ¶
View Source
var ErrDuplicateId = errors.New("duplicate id")
View Source
var ErrInvalidStatus = errors.New("invalid status")
View Source
var ErrNotFound = errors.New("id not found")
View Source
var ErrTimeout = errors.New("timeout")
Functions ¶
func IsSupported ¶
func RegisterFactory ¶
func RegisterFactory(factory ICloudProviderFactory)
func WaitDeleted ¶
func WaitStatus ¶
Types ¶
type ICloudDisk ¶
type ICloudDisk interface {
ICloudResource
GetIStorge() ICloudStorage
// GetStatus() string
GetDiskFormat() string
GetDiskSizeMB() int // MB
GetIsAutoDelete() bool
GetTemplateId() string
GetDiskType() string
GetFsFormat() string
GetIsNonPersistent() bool
GetDriver() string
GetCacheMode() string
GetMountpoint() string
}
type ICloudHost ¶
type ICloudHost interface {
ICloudResource
GetIVMs() ([]ICloudVM, error)
GetIVMById(id string) (ICloudVM, error)
GetIWires() ([]ICloudWire, error)
GetIStorages() ([]ICloudStorage, error)
GetIStorageById(id string) (ICloudStorage, error)
// GetStatus() string // os status
GetEnabled() bool // is enabled
GetHostStatus() string // service status
GetAccessIp() string //
GetAccessMac() string //
GetSysInfo() jsonutils.JSONObject
GetSN() string
GetCpuCount() int8
GetNodeCount() int8
GetCpuDesc() string
GetCpuMhz() int
GetMemSizeMB() int
GetStorageSizeMB() int
GetStorageType() string
GetHostType() string
GetManagerId() string
CreateVM(name string, imgId string, sysDiskSize int, cpu int, memMB int, vswitchId string, ipAddr string, desc string,
passwd string, storageType string, diskSizes []int, publicKey string) (ICloudVM, error)
}
type ICloudImage ¶
type ICloudImage interface {
ICloudResource
GetIStoragecache() ICloudStoragecache
}
type ICloudNetwork ¶
type ICloudNetwork interface {
ICloudResource
GetIWire() ICloudWire
// GetStatus() string
GetIpStart() string
GetIpEnd() string
GetIpMask() int8
GetGateway() string
GetServerType() string
GetIsPublic() bool
Delete() error
}
type ICloudNic ¶
type ICloudNic interface {
GetIP() string
GetMAC() string
GetDriver() string
GetINetwork() ICloudNetwork
}
type ICloudProvider ¶
type ICloudProvider interface {
GetId() string
GetName() string
GetIRegions() []ICloudRegion
GetSysInfo() (jsonutils.JSONObject, error)
IsPublicCloud() bool
GetIRegionById(id string) (ICloudRegion, error)
GetIHostById(id string) (ICloudHost, error)
GetIVpcById(id string) (ICloudVpc, error)
GetIStorageById(id string) (ICloudStorage, error)
GetIStoragecacheById(id string) (ICloudStoragecache, error)
}
func GetProvider ¶
func GetProvider(providerId, providerName, accessUrl, account, secret, provider string) (ICloudProvider, error)
type ICloudProviderFactory ¶
type ICloudProviderFactory interface {
GetProvider(providerId, providerName, url, account, secret string) (ICloudProvider, error)
GetId() string
}
type ICloudRegion ¶
type ICloudRegion interface {
ICloudResource
GetLatitude() float32
GetLongitude() float32
GetIZones() ([]ICloudZone, error)
GetIVpcs() ([]ICloudVpc, error)
GetIZoneById(id string) (ICloudZone, error)
GetIVpcById(id string) (ICloudVpc, error)
GetIHostById(id string) (ICloudHost, error)
GetIStorageById(id string) (ICloudStorage, error)
GetIStoragecacheById(id string) (ICloudStoragecache, error)
CreateIVpc(name string, desc string, cidr string) (ICloudVpc, error)
GetProvider() string
}
type ICloudResource ¶
type ICloudSecurityGroup ¶
type ICloudSecurityGroup interface {
ICloudResource
}
type ICloudStorage ¶
type ICloudStorage interface {
ICloudResource
GetIStoragecache() ICloudStoragecache
GetIZone() ICloudZone
GetIDisks() ([]ICloudDisk, error)
GetStorageType() string
GetMediumType() string
GetCapacityMB() int // MB
GetStorageConf() jsonutils.JSONObject
GetEnabled() bool
GetManagerId() string
CreateIDisk(name string, sizeGb int, desc string) (ICloudDisk, error)
}
type ICloudStoragecache ¶
type ICloudStoragecache interface {
ICloudResource
GetIImages() ([]ICloudImage, error)
GetManagerId() string
UploadImage(userCred mcclient.TokenCredential, imageId string, extId string, isForce bool) (string, error)
}
type ICloudVM ¶
type ICloudVM interface {
ICloudResource
GetCreateTime() time.Time
GetIHost() ICloudHost
GetIDisks() ([]ICloudDisk, error)
GetINics() ([]ICloudNic, error)
GetEIP() ICloudEIP
// GetStatus() string
GetRemoteStatus() string
GetVcpuCount() int8
GetVmemSizeMB() int //MB
GetBootOrder() string
GetVga() string
GetVdi() string
GetOSType() string
GetOSName() string
GetBios() string
GetMachine() string
GetHypervisor() string
StartVM() error
StopVM(isForce bool) error
DeleteVM() error
GetVNCInfo() (jsonutils.JSONObject, error)
}
type ICloudVpc ¶
type ICloudVpc interface {
ICloudResource
GetRegion() ICloudRegion
GetIsDefault() bool
GetCidrBlock() string
// GetStatus() string
GetIWires() ([]ICloudWire, error)
GetManagerId() string
Delete() error
GetIWireById(wireId string) (ICloudWire, error)
}
type ICloudWire ¶
type ICloudWire interface {
ICloudResource
GetIVpc() ICloudVpc
GetIZone() ICloudZone
GetINetworks() ([]ICloudNetwork, error)
GetBandwidth() int
GetINetworkById(netid string) (ICloudNetwork, error)
CreateINetwork(name string, cidr string, desc string) (ICloudNetwork, error)
}
type ICloudZone ¶
type ICloudZone interface {
ICloudResource
GetIRegion() ICloudRegion
GetIHosts() ([]ICloudHost, error)
GetIHostById(id string) (ICloudHost, error)
GetIStorages() ([]ICloudStorage, error)
GetIStorageById(id string) (ICloudStorage, error)
}
Click to show internal directories.
Click to hide internal directories.