handlers

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 43 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(context.Context) ([]string, error)
	Create(context.Context, string) error
	Delete(context.Context, string) error
	Inspect(context.Context, string) (*resources.Bucket, error)
	Mount(context.Context, string, string, string) error
	Unmount(context.Context, string, string) error
}

BucketAPI defines API to manipulate buckets

func NewBucketHandler

func NewBucketHandler(svc iaas.Service) BucketAPI

NewBucketHandler creates a Bucket service

type BucketHandler

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

BucketHandler bucket service

func (*BucketHandler) Create

func (handler *BucketHandler) Create(ctx context.Context, name string) (err error)

Create a bucket

func (*BucketHandler) Delete

func (handler *BucketHandler) Delete(ctx context.Context, name string) (err error)

Delete a bucket

func (*BucketHandler) Inspect

func (handler *BucketHandler) Inspect(ctx context.Context, name string) (mb *resources.Bucket, err error)

Inspect a bucket

func (*BucketHandler) List

func (handler *BucketHandler) List(ctx context.Context) (rv []string, err error)

List retrieves all available buckets

func (*BucketHandler) Mount

func (handler *BucketHandler) Mount(ctx context.Context, bucketName, hostName, path string) (err error)

Mount a bucket on an host on the given mount point

func (*BucketHandler) Unmount

func (handler *BucketHandler) Unmount(ctx context.Context, bucketName, hostName string) (err error)

Unmount a bucket

type DataAPI

type DataAPI interface {
	List(ctx context.Context) ([]string, []string, []int64, [][]string, error)
	Push(ctx context.Context, fileLocalPath string, fileName string) error
	Get(ctx context.Context, fileLocalPath string, fileName string) error
	Delete(ctx context.Context, fileName string) error
}

DataAPI defines API to manipulate Data

func NewDataHandler

func NewDataHandler(svc *iaas.StorageServices) DataAPI

NewDataHandler creates a Data service

type DataHandler

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

DataHandler bucket service

func (*DataHandler) Delete

func (handler *DataHandler) Delete(ctx context.Context, fileName string) (err error)

Delete ...

func (*DataHandler) Get

func (handler *DataHandler) Get(ctx context.Context, fileLocalPath string, fileName string) (err error)

Get ...

func (*DataHandler) List

func (handler *DataHandler) List(
	ctx context.Context,
) (
	fileNames []string,
	uploadDates []string,
	fileSizes []int64,
	fileBuckets [][]string,
	err error,
)

List returns []fileName []UploadDate []fileSize [][]buckets, error

func (*DataHandler) Push

func (handler *DataHandler) Push(ctx context.Context, fileLocalPath string, fileName string) (err error)

Push ...

type HostAPI

type HostAPI interface {
	Create(ctx context.Context, name string, net string, os string, public bool, sizingParam interface{}, force bool) (*resources.Host, error)
	List(ctx context.Context, all bool) ([]*resources.Host, error)
	ForceInspect(ctx context.Context, ref string) (*resources.Host, error)
	Inspect(ctx context.Context, ref string) (*resources.Host, error)
	Delete(ctx context.Context, ref string) error
	SSH(ctx context.Context, ref string) (*system.SSHConfig, error)
	Reboot(ctx context.Context, ref string) error
	Resize(ctx context.Context, name string, cpu int, ram float32, disk int, gpuNumber int, freq float32) (*resources.Host, error)
	Start(ctx context.Context, ref string) error
	Stop(ctx context.Context, ref string) error
}

HostAPI defines API to manipulate hosts

func NewHostHandler

func NewHostHandler(svc iaas.Service) HostAPI

NewHostHandler ...

type HostHandler

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

HostHandler host service

func (*HostHandler) Create

func (handler *HostHandler) Create(
	ctx context.Context,
	name string, net string, los string, public bool, sizingParam interface{}, force bool,
) (newHost *resources.Host, err error)

Create creates a host func (handler *HostHandler) Create(

ctx context.Context,
name string, net string, cpu int, ram float32, disk int, los string, public bool, gpuNumber int, freq float32,
force bool,

func (*HostHandler) Delete

func (handler *HostHandler) Delete(ctx context.Context, ref string) (err error)

Delete deletes host referenced by ref

func (*HostHandler) ForceInspect

func (handler *HostHandler) ForceInspect(ctx context.Context, ref string) (host *resources.Host, err error)

ForceInspect ... If not found, return (nil, err)

func (*HostHandler) Inspect

func (handler *HostHandler) Inspect(ctx context.Context, ref string) (host *resources.Host, err error)

Inspect returns the host identified by ref, ref can be the name or the id If not found, returns (nil, nil)

func (*HostHandler) List

func (handler *HostHandler) List(ctx context.Context, all bool) (hosts []*resources.Host, err error)

List returns the host list

func (*HostHandler) Reboot

func (handler *HostHandler) Reboot(ctx context.Context, ref string) (err error)

Reboot reboots a host

func (*HostHandler) Resize

func (handler *HostHandler) Resize(ctx context.Context, ref string, cpu int, ram float32, disk int, gpuNumber int, freq float32) (newHost *resources.Host, err error)

Resize ...

func (*HostHandler) SSH

func (handler *HostHandler) SSH(ctx context.Context, ref string) (sshConfig *system.SSHConfig, err error)

SSH returns ssh parameters to access the host referenced by ref

func (*HostHandler) Start

func (handler *HostHandler) Start(ctx context.Context, ref string) (err error)

Start starts a host

func (*HostHandler) Stop

func (handler *HostHandler) Stop(ctx context.Context, ref string) (err error)

Stop stops a host

type ImageAPI

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

ImageAPI defines API to manipulate images

func NewImageHandler

func NewImageHandler(svc iaas.Service) ImageAPI

NewImageHandler creates an host service

type ImageHandler

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

ImageHandler image service

func (*ImageHandler) Filter

func (handler *ImageHandler) Filter(ctx context.Context, osname string) (image []resources.Image, err error)

Filter filters the images that do not fit osname

func (*ImageHandler) List

func (handler *ImageHandler) List(ctx context.Context, all bool) (images []resources.Image, err error)

List returns the image list

func (*ImageHandler) Select

func (handler *ImageHandler) Select(ctx context.Context, osname string) (image *resources.Image, err error)

Select selects the image that best fits osname

type JobManagerAPI

type JobManagerAPI interface {
	List(ctx context.Context) (map[string]string, error)
	Stop(ctx context.Context, uuid string)
}

JobManagerAPI defines API to manipulate process

func NewJobHandler

func NewJobHandler(svc iaas.Service) JobManagerAPI

NewJobHandler creates a Volume service

type JobManagerHandler

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

JobManagerHandler service

func (*JobManagerHandler) List

func (pmh *JobManagerHandler) List(ctx context.Context) (map[string]string, error)

List returns the Running Process list

func (*JobManagerHandler) Stop

func (pmh *JobManagerHandler) Stop(ctx context.Context, uuid string)

Stop stop the designed Process

type NetworkAPI

NetworkAPI defines API to manage networks

func NewNetworkHandler

func NewNetworkHandler(svc iaas.Service) NetworkAPI

NewNetworkHandler Creates new Network service

type NetworkHandler

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

NetworkHandler an implementation of NetworkAPI

func (*NetworkHandler) Create

func (handler *NetworkHandler) Create(
	ctx context.Context,
	name string, cidr string, ipVersion IPVersion.Enum,
	sizing resources.SizingRequirements, theos string, gwname string,
	failover bool,
) (network *resources.Network, err error)

Create creates a network

func (*NetworkHandler) Delete

func (handler *NetworkHandler) Delete(ctx context.Context, ref string) (err error)

Delete deletes network referenced by ref

func (*NetworkHandler) Inspect

func (handler *NetworkHandler) Inspect(ctx context.Context, ref string) (network *resources.Network, err error)

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

func (*NetworkHandler) List

func (handler *NetworkHandler) List(ctx context.Context, all bool) (netList []*resources.Network, err error)

List returns the network list

type SSHAPI

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

SSHAPI defines ssh management API

type SSHHandler

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

SSHHandler SSH service

func NewSSHHandler

func NewSSHHandler(svc iaas.Service) *SSHHandler

NewSSHHandler ...

func (*SSHHandler) Copy

func (handler *SSHHandler) Copy(ctx context.Context, from, to string) (retCode int, stdOut string, stdErr string, err error)

Copy copy file/directory

func (*SSHHandler) GetConfig

func (handler *SSHHandler) GetConfig(ctx context.Context, hostParam interface{}) (sshConfig *system.SSHConfig, err error)

GetConfig creates SSHConfig to connect to an host

func (*SSHHandler) Run

func (handler *SSHHandler) Run(ctx context.Context, hostName, cmd string) (retCode int, stdOut string, stdErr string, err error)

Run tries to execute command 'cmd' on the host

func (*SSHHandler) WaitServerReady

func (handler *SSHHandler) WaitServerReady(ctx context.Context, hostParam interface{}, timeout time.Duration) (err error)

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

type ShareAPI

ShareAPI defines API to manipulate Shares

func NewShareHandler

func NewShareHandler(svc iaas.Service) ShareAPI

NewShareHandler creates a ShareHandler

type ShareHandler

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

ShareHandler nas service

func (*ShareHandler) Create

func (handler *ShareHandler) Create(
	ctx context.Context,
	shareName, hostName, path string, securityModes []string,
	readOnly, rootSquash, secure, async, noHide, crossMount, subtreeCheck bool,
) (share *propsv1.HostShare, err error)

Create a share on host

func (*ShareHandler) Delete

func (handler *ShareHandler) Delete(ctx context.Context, name string) (err error)

Delete a share from host

func (*ShareHandler) ForceInspect

func (handler *ShareHandler) ForceInspect(
	ctx context.Context,
	shareName string,
) (host *resources.Host, share *propsv1.HostShare, props map[string]*propsv1.HostRemoteMount, err error)

ForceInspect returns the host and share corresponding to 'shareName'

func (*ShareHandler) Inspect

func (handler *ShareHandler) Inspect(
	ctx context.Context,
	shareName string,
) (host *resources.Host, share *propsv1.HostShare, props map[string]*propsv1.HostRemoteMount, err error)

Inspect returns the host and share corresponding to 'shareName' If share isn't found, return (nil, nil, nil, utils.ErrNotFound)

func (*ShareHandler) List

func (handler *ShareHandler) List(ctx context.Context) (props map[string]map[string]*propsv1.HostShare, err error)

List return the list of all shares from all servers

func (*ShareHandler) Mount

func (handler *ShareHandler) Mount(
	ctx context.Context,
	shareName, hostName, path string,
	withCache bool,
) (mount *propsv1.HostRemoteMount, err error)

Mount a share on a local directory of an host

func (*ShareHandler) Unmount

func (handler *ShareHandler) Unmount(ctx context.Context, shareName, hostName string) (err error)

Unmount a share from local directory of an host

type TemplateAPI

type TemplateAPI interface {
	List(ctx context.Context, all bool) ([]resources.HostTemplate, error)
}

TemplateAPI defines API to manipulate hosts

func NewTemplateHandler

func NewTemplateHandler(svc iaas.Service) TemplateAPI

NewTemplateHandler creates a template service

type TemplateHandler

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

TemplateHandler template service

func (*TemplateHandler) List

func (handler *TemplateHandler) List(ctx context.Context, all bool) (tlist []resources.HostTemplate, err error)

List returns the template list

type VolumeAPI

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

VolumeAPI defines API to manipulate hosts

func NewVolumeHandler

func NewVolumeHandler(svc iaas.Service) VolumeAPI

NewVolumeHandler creates a Volume service

type VolumeHandler

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

VolumeHandler volume service

func (*VolumeHandler) Attach

func (handler *VolumeHandler) Attach(ctx context.Context, volumeName, hostName, path, format string, doNotFormat bool) (err error)

Attach a volume to an host

func (*VolumeHandler) Create

func (handler *VolumeHandler) Create(ctx context.Context, name string, size int, speed VolumeSpeed.Enum) (volume *resources.Volume, err error)

Create a volume

func (*VolumeHandler) Delete

func (handler *VolumeHandler) Delete(ctx context.Context, ref string) (err error)

Delete deletes volume referenced by ref

func (*VolumeHandler) Detach

func (handler *VolumeHandler) Detach(ctx context.Context, volumeName, hostName string) (err error)

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

func (*VolumeHandler) Inspect

func (handler *VolumeHandler) Inspect(
	ctx context.Context,
	ref string,
) (volume *resources.Volume, mounts map[string]*propsv1.HostLocalMount, err error)

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

func (*VolumeHandler) List

func (handler *VolumeHandler) List(ctx context.Context, all bool) (volumes []resources.Volume, err error)

List returns the network list

Jump to

Keyboard shortcuts

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