provider

package
v0.0.0-...-a0f67ce Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProjectDescription = "This project was created automatically by garm to be used for github ephemeral action runners."
	DefaultProjectName        = "garm-project"
)

Variables

View Source
var (
	DefaultToolFetch      ToolFetchFunc      = util.GetTools
	DefaultGetCloudconfig GetCloudConfigFunc = cloudconfig.GetCloudConfig
)

Functions

func NewLXDProvider

func NewLXDProvider(configFile, controllerID string) (execution.ExternalProvider, error)

Types

type GetCloudConfigFunc

type GetCloudConfigFunc func(bootstrapParams commonParams.BootstrapInstance, tools commonParams.RunnerApplicationDownload, runnerName string) (string, error)

type InstanceServerInterface

type InstanceServerInterface interface {
	GetImageAliasArchitectures(string, string) (map[string]*api.ImageAliasesEntry, error)
	GetImage(fingerprint string) (*api.Image, string, error)
	GetProject(name string) (*api.Project, string, error)
	UseProject(name string) lxd.InstanceServer
	GetProfileNames() ([]string, error)
	CreateInstance(instance api.InstancesPost) (lxd.Operation, error)
	UpdateInstanceState(name string, state api.InstanceStatePut, ETag string) (lxd.Operation, error)
	GetInstanceFull(name string) (*api.InstanceFull, string, error)
	DeleteInstance(name string) (lxd.Operation, error)
	GetInstancesFull(instanceType api.InstanceType) ([]api.InstanceFull, error)
}

type LXD

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

func (*LXD) CreateInstance

func (l *LXD) CreateInstance(ctx context.Context, bootstrapParams commonParams.BootstrapInstance) (commonParams.ProviderInstance, error)

CreateInstance creates a new compute instance in the provider.

func (*LXD) DeleteInstance

func (l *LXD) DeleteInstance(ctx context.Context, instance string) error

Delete instance will delete the instance in a provider.

func (*LXD) GetInstance

func (l *LXD) GetInstance(ctx context.Context, instanceName string) (commonParams.ProviderInstance, error)

GetInstance will return details about one instance.

func (*LXD) ListInstances

func (l *LXD) ListInstances(ctx context.Context, poolID string) ([]commonParams.ProviderInstance, error)

ListInstances will list all instances for a provider.

func (*LXD) RemoveAllInstances

func (l *LXD) RemoveAllInstances(ctx context.Context) error

RemoveAllInstances will remove all instances created by this provider.

func (*LXD) Start

func (l *LXD) Start(ctx context.Context, instance string) error

Start boots up an instance.

func (*LXD) Stop

func (l *LXD) Stop(ctx context.Context, instance string, force bool) error

Stop shuts down the instance.

type MockLXDServer

type MockLXDServer struct {
	mock.Mock
}

func (*MockLXDServer) CreateInstance

func (m *MockLXDServer) CreateInstance(instance api.InstancesPost) (lxd.Operation, error)

func (*MockLXDServer) DeleteInstance

func (m *MockLXDServer) DeleteInstance(projectName string) (lxd.Operation, error)

func (*MockLXDServer) GetImage

func (m *MockLXDServer) GetImage(fingerprint string) (*api.Image, string, error)

func (*MockLXDServer) GetImageAliasArchitectures

func (m *MockLXDServer) GetImageAliasArchitectures(imageType string, imageName string) (map[string]*api.ImageAliasesEntry, error)

func (*MockLXDServer) GetInstanceFull

func (m *MockLXDServer) GetInstanceFull(projectName string) (*api.InstanceFull, string, error)

func (*MockLXDServer) GetInstancesFull

func (m *MockLXDServer) GetInstancesFull(instanceType api.InstanceType) ([]api.InstanceFull, error)

func (*MockLXDServer) GetProfileNames

func (m *MockLXDServer) GetProfileNames() ([]string, error)

func (*MockLXDServer) GetProject

func (m *MockLXDServer) GetProject(projectName string) (*api.Project, string, error)

func (*MockLXDServer) UpdateInstanceState

func (m *MockLXDServer) UpdateInstanceState(projectName string, state api.InstanceStatePut, instanceName string) (lxd.Operation, error)

func (*MockLXDServer) UseProject

func (m *MockLXDServer) UseProject(projectName string) lxd.InstanceServer

type MockOperation

type MockOperation struct {
	mock.Mock
}

func (*MockOperation) AddHandler

func (m *MockOperation) AddHandler(handler func(api.Operation)) (target *lxd.EventTarget, err error)

func (*MockOperation) Cancel

func (m *MockOperation) Cancel() error

func (*MockOperation) Get

func (m *MockOperation) Get() api.Operation

func (*MockOperation) GetWebsocket

func (m *MockOperation) GetWebsocket(secret string) (conn *websocket.Conn, err error)

func (*MockOperation) Refresh

func (m *MockOperation) Refresh() error

func (*MockOperation) RemoveHandler

func (m *MockOperation) RemoveHandler(target *lxd.EventTarget) error

func (*MockOperation) Wait

func (m *MockOperation) Wait() error

func (*MockOperation) WaitContext

func (m *MockOperation) WaitContext(ctx context.Context) error

Jump to

Keyboard shortcuts

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