cloud

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cloud contains CloudStack related functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrTooManyResults = errors.New("too many results")
)

Specific errors

Functions

This section is empty.

Types

type Config

type Config struct {
	APIURL    string
	APIKey    string
	SecretKey string
	VerifySSL bool
}

Config holds CloudStack connection configuration.

func ReadConfig

func ReadConfig(configFilePath string) (*Config, error)

ReadConfig reads a config file with a format defined by CloudStack Cloud Controller Manager, and returns a CloudStackConfig.

type Interface

type Interface interface {
	GetNodeInfo(ctx context.Context, vmName string) (*VM, error)
	GetVMByID(ctx context.Context, vmID string) (*VM, error)

	ListZonesID(ctx context.Context) ([]string, error)

	GetVolumeByID(ctx context.Context, volumeID string) (*Volume, error)
	GetVolumeByName(ctx context.Context, name string) (*Volume, error)
	CreateVolume(ctx context.Context, diskOfferingID, zoneID, name string, sizeInGB int64) (string, error)
	DeleteVolume(ctx context.Context, id string) error
	AttachVolume(ctx context.Context, volumeID, vmID string) (string, error)
	DetachVolume(ctx context.Context, volumeID string, vmID string) error
}

Interface is the CloudStack client interface.

func New

func New(config *Config) Interface

New creates a new cloud connector, given its configuration.

type VM

type VM struct {
	ID     string
	ZoneID string
}

VM represents a CloudStack Virtual Machine.

type Volume

type Volume struct {
	ID   string
	Name string

	// Size in Bytes
	Size int64

	DiskOfferingID string
	ZoneID         string

	VirtualMachineID string
	DeviceID         string
}

Volume represents a CloudStack volume.

Directories

Path Synopsis
Package fake provides a fake implementation of the cloud connector interface, to be used in tests.
Package fake provides a fake implementation of the cloud connector interface, to be used in tests.

Jump to

Keyboard shortcuts

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