driver

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPlan             string = "1xCPU-2GB"
	DefaultHostname         string = "custom"
	EnvConfigUsername       string = "UPCLOUD_USERNAME"
	EnvConfigPassword       string = "UPCLOUD_PASSWORD"
	EnvConfigAPIToken       string = "UPCLOUD_TOKEN"
	EnvConfigUsernameLegacy string = "UPCLOUD_API_USER"
	EnvConfigPasswordLegacy string = "UPCLOUD_API_PASSWORD"
)

Variables

This section is empty.

Functions

func PasswordFromEnv added in v1.5.0

func PasswordFromEnv() string

func TokenFromEnv added in v1.7.0

func TokenFromEnv() string

func UsernameFromEnv added in v1.5.0

func UsernameFromEnv() string

Types

type Driver

Driver combines all management interfaces.

func NewDriver

func NewDriver(c *DriverConfig) Driver

type DriverConfig

type DriverConfig struct {
	Username    string
	Password    string
	Token       string
	Timeout     time.Duration
	SSHUsername string
}

type ServerManager added in v1.7.0

type ServerManager interface {
	CreateServer(ctx context.Context, opts *ServerOpts) (*upcloud.ServerDetails, error)
	DeleteServer(ctx context.Context, serverUUID string) error
	StopServer(ctx context.Context, serverUUID string) error
	// TODO: rename method or split into two separate method GetStorageByUUID and GetTemplateByName
	GetServerStorage(ctx context.Context, serverUUID string) (*upcloud.ServerStorageDevice, error)
}

ServerManager handles server lifecycle operations.

type ServerOpts

type ServerOpts struct {
	StorageUUID  string
	StorageSize  int
	Zone         string
	SSHPublicKey string
	Networking   []request.CreateServerInterface
	StorageTier  string
}

type StorageManager added in v1.7.0

type StorageManager interface {
	GetStorage(ctx context.Context, storageUUID, templateName string) (*upcloud.Storage, error)
	RenameStorage(ctx context.Context, storageUUID, name string) (*upcloud.Storage, error)
	CloneStorage(ctx context.Context, storageUUID, zone, title string) (*upcloud.Storage, error)
	CreateTemplateStorage(ctx context.Context, title, zone string, size int, tier string) (*upcloud.Storage, error)
	ImportStorage(ctx context.Context, storageUUID, contentType string, f io.Reader) (*upcloud.StorageImportDetails, error)
	WaitStorageOnline(ctx context.Context, storageUUID string) (*upcloud.Storage, error)
	DeleteStorage(ctx context.Context, storageUUID string) error
}

StorageManager handles storage operations.

type TemplateManager added in v1.7.0

type TemplateManager interface {
	GetTemplateByName(ctx context.Context, name, zone string) (*upcloud.Storage, error)
	CreateTemplate(ctx context.Context, storageUUID, templateTitle string) (*upcloud.Storage, error)
	DeleteTemplate(ctx context.Context, templateUUID string) error
}

TemplateManager handles template operations.

type ZoneManager added in v1.7.0

type ZoneManager interface {
	GetAvailableZones(ctx context.Context) []string
}

ZoneManager handles zone operations.

Jump to

Keyboard shortcuts

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