cloud

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cloud contains CloudStack related functions.

Package cloud is a generated GoMock package.

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 Cloud added in v0.8.1

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

	GetZoneIDByName(ctx context.Context, name string) (string, 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) (*Volume, error)
	DeleteVolume(ctx context.Context, id string) error
	AttachVolume(ctx context.Context, volumeID, vmID string) (string, error)
	DetachVolume(ctx context.Context, volumeID string) error
	ExpandVolume(ctx context.Context, volumeID string, newSizeInGB int64) error
}

Cloud is the CloudStack client interface.

func New

func New(config *Config) Cloud

New creates a new cloud connector, given its configuration.

type Config

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

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 MockCloud added in v0.8.1

type MockCloud struct {
	// contains filtered or unexported fields
}

MockCloud is a mock of Cloud interface.

func NewMockCloud added in v0.8.1

func NewMockCloud(ctrl *gomock.Controller) *MockCloud

NewMockCloud creates a new mock instance.

func (*MockCloud) AttachVolume added in v0.8.1

func (m *MockCloud) AttachVolume(ctx context.Context, volumeID, vmID string) (string, error)

AttachVolume mocks base method.

func (*MockCloud) CreateVolume added in v0.8.1

func (m *MockCloud) CreateVolume(ctx context.Context, diskOfferingID, zoneID, name string, sizeInGB int64) (*Volume, error)

CreateVolume mocks base method.

func (*MockCloud) DeleteVolume added in v0.8.1

func (m *MockCloud) DeleteVolume(ctx context.Context, id string) error

DeleteVolume mocks base method.

func (*MockCloud) DetachVolume added in v0.8.1

func (m *MockCloud) DetachVolume(ctx context.Context, volumeID string) error

DetachVolume mocks base method.

func (*MockCloud) EXPECT added in v0.8.1

func (m *MockCloud) EXPECT() *MockCloudMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCloud) ExpandVolume added in v0.8.1

func (m *MockCloud) ExpandVolume(ctx context.Context, volumeID string, newSizeInGB int64) error

ExpandVolume mocks base method.

func (*MockCloud) GetNodeInfo added in v0.8.1

func (m *MockCloud) GetNodeInfo(ctx context.Context, vmName string) (*VM, error)

GetNodeInfo mocks base method.

func (*MockCloud) GetVMByID added in v0.8.1

func (m *MockCloud) GetVMByID(ctx context.Context, vmID string) (*VM, error)

GetVMByID mocks base method.

func (*MockCloud) GetVolumeByID added in v0.8.1

func (m *MockCloud) GetVolumeByID(ctx context.Context, volumeID string) (*Volume, error)

GetVolumeByID mocks base method.

func (*MockCloud) GetVolumeByName added in v0.8.1

func (m *MockCloud) GetVolumeByName(ctx context.Context, name string) (*Volume, error)

GetVolumeByName mocks base method.

func (*MockCloud) GetZoneIDByName added in v0.10.0

func (m *MockCloud) GetZoneIDByName(ctx context.Context, name string) (string, error)

GetZoneIDByName mocks base method.

func (*MockCloud) ListZonesID added in v0.8.1

func (m *MockCloud) ListZonesID(ctx context.Context) ([]string, error)

ListZonesID mocks base method.

type MockCloudMockRecorder added in v0.8.1

type MockCloudMockRecorder struct {
	// contains filtered or unexported fields
}

MockCloudMockRecorder is the mock recorder for MockCloud.

func (*MockCloudMockRecorder) AttachVolume added in v0.8.1

func (mr *MockCloudMockRecorder) AttachVolume(ctx, volumeID, vmID any) *gomock.Call

AttachVolume indicates an expected call of AttachVolume.

func (*MockCloudMockRecorder) CreateVolume added in v0.8.1

func (mr *MockCloudMockRecorder) CreateVolume(ctx, diskOfferingID, zoneID, name, sizeInGB any) *gomock.Call

CreateVolume indicates an expected call of CreateVolume.

func (*MockCloudMockRecorder) DeleteVolume added in v0.8.1

func (mr *MockCloudMockRecorder) DeleteVolume(ctx, id any) *gomock.Call

DeleteVolume indicates an expected call of DeleteVolume.

func (*MockCloudMockRecorder) DetachVolume added in v0.8.1

func (mr *MockCloudMockRecorder) DetachVolume(ctx, volumeID any) *gomock.Call

DetachVolume indicates an expected call of DetachVolume.

func (*MockCloudMockRecorder) ExpandVolume added in v0.8.1

func (mr *MockCloudMockRecorder) ExpandVolume(ctx, volumeID, newSizeInGB any) *gomock.Call

ExpandVolume indicates an expected call of ExpandVolume.

func (*MockCloudMockRecorder) GetNodeInfo added in v0.8.1

func (mr *MockCloudMockRecorder) GetNodeInfo(ctx, vmName any) *gomock.Call

GetNodeInfo indicates an expected call of GetNodeInfo.

func (*MockCloudMockRecorder) GetVMByID added in v0.8.1

func (mr *MockCloudMockRecorder) GetVMByID(ctx, vmID any) *gomock.Call

GetVMByID indicates an expected call of GetVMByID.

func (*MockCloudMockRecorder) GetVolumeByID added in v0.8.1

func (mr *MockCloudMockRecorder) GetVolumeByID(ctx, volumeID any) *gomock.Call

GetVolumeByID indicates an expected call of GetVolumeByID.

func (*MockCloudMockRecorder) GetVolumeByName added in v0.8.1

func (mr *MockCloudMockRecorder) GetVolumeByName(ctx, name any) *gomock.Call

GetVolumeByName indicates an expected call of GetVolumeByName.

func (*MockCloudMockRecorder) GetZoneIDByName added in v0.10.0

func (mr *MockCloudMockRecorder) GetZoneIDByName(ctx, name any) *gomock.Call

GetZoneIDByName indicates an expected call of GetZoneIDByName.

func (*MockCloudMockRecorder) ListZonesID added in v0.8.1

func (mr *MockCloudMockRecorder) ListZonesID(ctx any) *gomock.Call

ListZonesID indicates an expected call of ListZonesID.

type VM

type VM struct {
	ID       string
	ZoneID   string
	ZoneName 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
	ZoneName       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