services

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketAPI

type BucketAPI interface {
	List() ([]string, error)
	Create(string) error
	Delete(string) error
	Inspect(string) (*model.Bucket, error)
	Mount(string, string, string) error
	Unmount(string, string) error
}

BucketAPI defines API to manipulate buckets

func NewBucketService

func NewBucketService(api *providers.Service) BucketAPI

NewBucketService creates a Bucket service

type BucketService

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

BucketService bucket service

func (*BucketService) Create

func (svc *BucketService) Create(name string) error

Create a bucket

func (*BucketService) Delete

func (svc *BucketService) Delete(name string) error

Delete a bucket

func (*BucketService) Inspect

func (svc *BucketService) Inspect(name string) (*model.Bucket, error)

Inspect a bucket

func (*BucketService) List

func (svc *BucketService) List() ([]string, error)

List retrieves all available buckets

func (*BucketService) Mount

func (svc *BucketService) Mount(bucketName, hostName, path string) error

Mount a bucket on an host on the given mount point

func (*BucketService) Unmount

func (svc *BucketService) Unmount(bucketName, hostName string) error

Unmount a bucket

type HostAPI

type HostAPI interface {
	Create(name string, net string, cpu int, ram float32, disk int, os string, public bool, gpuNumber int, freq float32, force bool) (*model.Host, error)
	List(all bool) ([]*model.Host, error)
	Get(ref string) (*model.Host, error)
	Delete(ref string) error
	SSH(ref string) (*system.SSHConfig, error)
	Reboot(ref string) error
	Start(ref string) error
	Stop(ref string) error
}

HostAPI defines API to manipulate hosts

func NewHostService

func NewHostService(api *providers.Service) HostAPI

NewHostService ...

type HostService

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

HostService host service

func (*HostService) Create

func (svc *HostService) Create(
	name string, net string, cpu int, ram float32, disk int, los string, public bool, gpuNumber int, freq float32, force bool,
) (*model.Host, error)

Create creates a host

func (*HostService) Delete

func (svc *HostService) Delete(ref string) error

Delete deletes host referenced by ref

func (*HostService) Get

func (svc *HostService) Get(ref string) (*model.Host, error)

Get returns the host identified by ref, ref can be the name or the id

func (*HostService) List

func (svc *HostService) List(all bool) ([]*model.Host, error)

List returns the host list

func (*HostService) Reboot

func (svc *HostService) Reboot(ref string) error

Reboot reboots a host

func (*HostService) SSH

func (svc *HostService) SSH(ref string) (*system.SSHConfig, error)

SSH returns ssh parameters to access the host referenced by ref

func (*HostService) Start

func (svc *HostService) Start(ref string) error

Start starts a host

func (*HostService) Stop

func (svc *HostService) Stop(ref string) error

Stop stops a host

type ImageAPI

type ImageAPI interface {
	List(all bool) ([]model.Image, error)
	Select(osfilter string) (*model.Image, error)
	Filter(osfilter string) ([]model.Image, error)
}

ImageAPI defines API to manipulate hosts

func NewImageService

func NewImageService(api *providers.Service) ImageAPI

NewImageService creates an host service

type ImageService

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

ImageService image service

func (*ImageService) Filter

func (srv *ImageService) Filter(osname string) ([]model.Image, error)

Filter filters the images that do not fit osname

func (*ImageService) List

func (srv *ImageService) List(all bool) ([]model.Image, error)

List returns the image list

func (*ImageService) Select

func (srv *ImageService) Select(osname string) (*model.Image, error)

Select selects the image that best fits osname

type NetworkAPI

type NetworkAPI interface {
	Create(net string, cidr string, ipVersion IPVersion.Enum, cpu int, ram float32, disk int, os string, gwname string) (*model.Network, error)
	List(all bool) ([]*model.Network, error)
	Get(ref string) (*model.Network, error)
	Delete(ref string) error
}

NetworkAPI defines API to manage networks

func NewNetworkService

func NewNetworkService(api *providers.Service) NetworkAPI

NewNetworkService Creates new Network service

type NetworkService

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

NetworkService an implementation of NetworkAPI

func (*NetworkService) Create

func (svc *NetworkService) Create(
	name string, cidr string, ipVersion IPVersion.Enum, cpu int, ram float32, disk int, os string, gwname string,
) (*model.Network, error)

Create creates a network

func (*NetworkService) Delete

func (svc *NetworkService) Delete(ref string) error

Delete deletes network referenced by ref

func (*NetworkService) Get

func (svc *NetworkService) Get(ref string) (*model.Network, error)

Get returns the network identified by ref, ref can be the name or the id

func (*NetworkService) List

func (svc *NetworkService) List(all bool) ([]*model.Network, error)

List returns the network list

type SSHAPI

type SSHAPI interface {
	// Connect(name string) error
	Run(hostname, cmd string) (int, string, string, error)
	Copy(from string, to string) (int, string, string, error)
	GetConfig(interface{}) (*system.SSHConfig, error)
}

SSHAPI defines ssh management API

type SSHService

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

SSHService SSH service

func NewSSHService

func NewSSHService(api *providers.Service) *SSHService

NewSSHService ...

func (*SSHService) Copy

func (svc *SSHService) Copy(from, to string) (int, string, string, error)

Copy copy file/directory

func (*SSHService) GetConfig

func (svc *SSHService) GetConfig(hostParam interface{}) (*system.SSHConfig, error)

GetConfig creates SSHConfig to connect to an host

func (*SSHService) Run

func (svc *SSHService) Run(hostName, cmd string) (int, string, string, error)

Run tries to execute command 'cmd' on the host

func (*SSHService) WaitServerReady

func (svc *SSHService) WaitServerReady(hostParam interface{}, timeout time.Duration) error

WaitServerReady waits for remote SSH server to be ready. After timeout, fails

type ShareAPI

type ShareAPI interface {
	Create(name, host, path string) (*propsv1.HostShare, error)
	Delete(name string) error
	List() (map[string]map[string]*propsv1.HostShare, error)
	Mount(name, host, path string) (*propsv1.HostRemoteMount, error)
	Unmount(name, host string) error
	Inspect(name string) (*model.Host, *propsv1.HostShare, map[string]*propsv1.HostRemoteMount, error)
}

ShareAPI defines API to manipulate Shares

func NewShareService

func NewShareService(api *providers.Service) ShareAPI

NewShareService creates a ShareService

type ShareService

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

ShareService nas service

func (*ShareService) Create

func (svc *ShareService) Create(shareName, hostName, path string) (*propsv1.HostShare, error)

Create a share on host

func (*ShareService) Delete

func (svc *ShareService) Delete(name string) error

Delete a share from host

func (*ShareService) Inspect

func (svc *ShareService) Inspect(shareName string) (*model.Host, *propsv1.HostShare, map[string]*propsv1.HostRemoteMount, error)

Inspect returns the host and share corresponding to 'shareName'

func (*ShareService) List

func (svc *ShareService) List() (map[string]map[string]*propsv1.HostShare, error)

List return the list of all shares from all servers

func (*ShareService) Mount

func (svc *ShareService) Mount(shareName, hostName, path string) (*propsv1.HostRemoteMount, error)

Mount a share on a local directory of an host

func (*ShareService) Unmount

func (svc *ShareService) Unmount(shareName, hostName string) error

Unmount a share from local directory of an host

type TemplateAPI

type TemplateAPI interface {
	List(all bool) ([]model.HostTemplate, error)
}

TemplateAPI defines API to manipulate hosts

func NewTemplateService

func NewTemplateService(api *providers.Service) TemplateAPI

NewTemplateService creates a template service

type TemplateService

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

TemplateService template service

func (*TemplateService) List

func (srv *TemplateService) List(all bool) ([]model.HostTemplate, error)

List returns the template list

type VolumeAPI

type VolumeAPI interface {
	Delete(ref string) error
	Get(ref string) (*model.Volume, error)
	Inspect(ref string) (*model.Volume, map[string]*propsv1.HostLocalMount, error)
	List(all bool) ([]model.Volume, error)
	Create(name string, size int, speed VolumeSpeed.Enum) (*model.Volume, error)
	Attach(volume string, host string, path string, format string) error
	Detach(volume string, host string) error
}

VolumeAPI defines API to manipulate hosts

func NewVolumeService

func NewVolumeService(api *providers.Service) VolumeAPI

NewVolumeService creates a Volume service

type VolumeService

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

VolumeService volume service

func (*VolumeService) Attach

func (svc *VolumeService) Attach(volumeName, hostName, path, format string) error

Attach a volume to an host

func (*VolumeService) Create

func (svc *VolumeService) Create(name string, size int, speed VolumeSpeed.Enum) (*model.Volume, error)

Create a volume

func (*VolumeService) Delete

func (svc *VolumeService) Delete(ref string) error

Delete deletes volume referenced by ref

func (*VolumeService) Detach

func (svc *VolumeService) Detach(volumeName, hostName string) error

Detach detach the volume identified by ref, ref can be the name or the id

func (*VolumeService) Get

func (svc *VolumeService) Get(ref string) (*model.Volume, error)

Get returns the volume identified by ref, ref can be the name or the id

func (*VolumeService) Inspect

func (svc *VolumeService) Inspect(ref string) (*model.Volume, map[string]*propsv1.HostLocalMount, error)

Inspect returns the volume identified by ref and its attachment (if any)

func (*VolumeService) List

func (svc *VolumeService) List(all bool) ([]model.Volume, error)

List returns the network list

Jump to

Keyboard shortcuts

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