cloudprovider

package
v2.0.13+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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 ErrNotImplemented = errors.New("Not implemented")
View Source
var ErrNotSupported = errors.New("Not supported")
View Source
var ErrTimeout = errors.New("timeout")

Functions

func IsSupported

func IsSupported(provider string) bool

func RegisterFactory

func RegisterFactory(factory ICloudProviderFactory)

func WaitDeleted

func WaitDeleted(res ICloudResource, interval time.Duration, timeout time.Duration) error

func WaitStatus

func WaitStatus(res ICloudResource, expect string, interval time.Duration, timeout time.Duration) error

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 ICloudEIP

type ICloudEIP interface {
	GetIP() string
	GetAllocationId() string
	GetChargeType() 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 ICloudResource interface {
	GetId() string
	GetName() string
	GetGlobalId() string

	GetStatus() string

	Refresh() error

	IsEmulated() bool
}

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

	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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL