ovc

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DiskExposeProtocolNBD = "nbd"

DiskExposeProtocolNBD is a constant representing the storage protocol NBD (Network Block Device)

Variables

View Source
var (
	// ErrAuthentication represents an authentication error from the server 401
	ErrAuthentication = errors.New("OVC authentication error")
	// ErrNotFound represents a resource not found error from the server 404
	ErrNotFound = errors.New("Resource not found")
)
View Source
var (
	// ErrExpiredJWT represents an expired JWT error
	ErrExpiredJWT = fmt.Errorf("JWT is expired")
	// ErrInvalidJWT represents an invalid JWT error
	ErrInvalidJWT = fmt.Errorf("invalid JWT token")
	// ErrClaimNotPresent represents an error where a claim was not found in the token
	ErrClaimNotPresent = fmt.Errorf("claim was not found in the JWT token")
)

Functions

func GetLock

func GetLock(vmID int)

GetLock returns when its safe to execute a synchronized action towards a certain vm

func ReleaseLock

func ReleaseLock(vmID int)

ReleaseLock free's access to execute a certain action towards a certain vm

func SetJWTPublicKey

func SetJWTPublicKey(key string) error

SetJWTPublicKey configure the public key used to verify JWT token

Types

type ACL

type ACL struct {
	Status       string `json:"status"`
	CanBeDeleted bool   `json:"canBeDeleted"`
	Right        string `json:"right"`
	Type         string `json:"type"`
	UserGroupID  string `json:"userGroupId"`
}

ACL basic information

type Account

type Account struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Account contains

type AccountACL

type AccountACL struct {
	Status      string `json:"status"`
	Right       string `json:"right"`
	Explicit    bool   `json:"explicit"`
	UserGroupID string `json:"userGroupId"`
	GUID        string `json:"guid"`
	Type        string `json:"type"`
}

AccountACL holds Account ACL configuration

type AccountInfo

type AccountInfo struct {
	ID           int          `json:"id"`
	UpdateTime   int          `json:"updateTime"`
	CreationTime int          `json:"creationTime"`
	Name         string       `json:"name"`
	ACL          []AccountACL `json:"acl"`
}

AccountInfo is a list of accounts Returned when using the List method

type AccountService

type AccountService interface {
	GetIDByName(string) (int, error)
	List() (*[]AccountInfo, error)
}

AccountService is an interface for interfacing with the Account endpoints of the OVC API

type AccountServiceOp

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

AccountServiceOp handles communication with the account related methods of the OVC API

func (*AccountServiceOp) GetIDByName

func (s *AccountServiceOp) GetIDByName(account string) (int, error)

GetIDByName returns the account ID based on the account name

func (*AccountServiceOp) List

func (s *AccountServiceOp) List() (*[]AccountInfo, error)

List all accounts

type Client

type Client struct {
	JWT       *JWT
	ServerURL string
	Access    string

	Machines         MachineService
	CloudSpaces      CloudSpaceService
	Accounts         AccountService
	Disks            DiskService
	Portforwards     ForwardingService
	Templates        TemplateService
	Sizes            SizesService
	Images           ImageService
	Ipsec            IpsecService
	ExternalNetworks ExternalNetworkService
	Locations        LocationService
	// contains filtered or unexported fields
}

Client struct

func NewClient

func NewClient(c *Config) (*Client, error)

NewClient returns an OpenVCloud API Client

func (*Client) GetLocation

func (c *Client) GetLocation() string

GetLocation parses the URL to return the location of the API

func (*Client) Post

func (c *Client) Post(endpoint string, in interface{}, timeout ResponseTimeout) ([]byte, error)

Post marshals `in` to JSON and POSTs a request to `c.ServerUrl + endpoint`

func (*Client) PostRaw

func (c *Client) PostRaw(endpoint string, raw io.Reader, timeout ResponseTimeout) ([]byte, error)

PostRaw POSTs a request with `raw` as data (nil is permitted) to `c.ServerUrl + endpoint`

type CloudSpace

type CloudSpace struct {
	Status            string         `json:"status"`
	UpdateTime        int            `json:"updateTime"`
	Externalnetworkip string         `json:"externalnetworkip"`
	Description       string         `json:"description"`
	ResourceLimits    ResourceLimits `json:"resourceLimits"`
	ID                int            `json:"id"`
	AccountID         int            `json:"accountId"`
	Name              string         `json:"name"`
	CreationTime      int            `json:"creationTime"`
	ACL               []ACL          `json:"acl"`
	Secret            string         `json:"secret"`
	GridID            int            `json:"gid"`
	Location          string         `json:"location"`
	Publicipaddress   string         `json:"publicipaddress"`
	PrivateNetwork    string         `json:"privatenetwork"`
	Type              string         `json:"type"`
	Mode              string         `json:"mode"`
}

CloudSpace contains all information related to a CloudSpace

type CloudSpaceConfig

type CloudSpaceConfig struct {
	CloudSpaceID           int     `json:"cloudspaceId,omitempty"`
	AccountID              int     `json:"accountId,omitempty"`
	Location               string  `json:"location,omitempty"`
	Name                   string  `json:"name,omitempty"`
	Access                 string  `json:"access,omitempty"`
	MaxMemoryCapacity      float64 `json:"maxMemoryCapacity,omitempty"`
	MaxCPUCapacity         int     `json:"maxCPUCapacity,omitempty"`
	MaxDiskCapacity        int     `json:"maxVDiskCapacity,omitempty"`
	MaxNetworkPeerTransfer int     `json:"maxNetworkPeerTransfer,omitempty"`
	MaxNumPublicIP         int     `json:"maxNumPublicIP,omitempty"`
	AllowedVMSizes         []int   `json:"allowedVMSizes,omitempty"`
	PrivateNetwork         string  `json:"privatenetwork,omitempty"`
	Mode                   string  `json:"mode,omitempty"`
	Type                   string  `json:"type,omitempty"`
	ExternalnetworkID      int     `json:"externalnetworkId,omitempty"`
}

CloudSpaceConfig is used when creating a CloudSpace

type CloudSpaceDeleteConfig

type CloudSpaceDeleteConfig struct {
	CloudSpaceID int  `json:"cloudspaceId"`
	Permanently  bool `json:"permanently"`
}

CloudSpaceDeleteConfig used to delete a CloudSpace

type CloudSpaceInfo

type CloudSpaceInfo struct {
	Status            string     `json:"status"`
	UpdateTime        int        `json:"updateTime"`
	Externalnetworkip string     `json:"externalnetworkip"`
	Name              string     `json:"name"`
	Descr             string     `json:"descr"`
	CreationTime      int        `json:"creationTime"`
	ACL               []ACL      `json:"acl"`
	AccountACL        AccountACL `json:"accountAcl"`
	GridID            int        `json:"gid"`
	Location          string     `json:"location"`
	Mode              string     `json:"mode"`
	Type              string     `json:"type"`
	Publicipaddress   string     `json:"publicipaddress"`
	AccountName       string     `json:"accountName"`
	ID                int        `json:"id"`
	AccountID         int        `json:"accountId"`
}

CloudSpaceInfo returns a list of CloudSpaces

type CloudSpaceService

type CloudSpaceService interface {
	List() (*[]CloudSpaceInfo, error)
	Get(int) (*CloudSpace, error)
	GetByNameAndAccount(string, string) (*CloudSpace, error)
	Create(*CloudSpaceConfig) (int, error)
	Update(*CloudSpaceConfig) error
	Delete(*CloudSpaceDeleteConfig) error
	SetDefaultGateway(int, string) error
}

CloudSpaceService is an interface for interfacing with the CloudSpace endpoints of the OVC API

type CloudSpaceServiceOp

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

CloudSpaceServiceOp handles communication with the cloudspace related methods of the OVC API

func (*CloudSpaceServiceOp) Create

func (s *CloudSpaceServiceOp) Create(cloudSpaceConfig *CloudSpaceConfig) (int, error)

Create a new CloudSpace

func (*CloudSpaceServiceOp) Delete

func (s *CloudSpaceServiceOp) Delete(cloudSpaceConfig *CloudSpaceDeleteConfig) error

Delete a CloudSpace

func (*CloudSpaceServiceOp) Get

func (s *CloudSpaceServiceOp) Get(id int) (*CloudSpace, error)

Get individual CloudSpace

func (*CloudSpaceServiceOp) GetByNameAndAccount

func (s *CloudSpaceServiceOp) GetByNameAndAccount(cloudSpaceName string, account string) (*CloudSpace, error)

GetByNameAndAccount gets an individual cloudspace

func (*CloudSpaceServiceOp) List

func (s *CloudSpaceServiceOp) List() (*[]CloudSpaceInfo, error)

List returns all cloudspaces

func (*CloudSpaceServiceOp) SetDefaultGateway

func (s *CloudSpaceServiceOp) SetDefaultGateway(id int, gateway string) error

SetDefaultGateway sets default gateway of the cloudspace to the given IP address

func (*CloudSpaceServiceOp) Update

func (s *CloudSpaceServiceOp) Update(cloudSpaceConfig *CloudSpaceConfig) error

Update an existing CloudSpace

type Config

type Config struct {
	URL          string
	ClientID     string
	ClientSecret string
	JWT          string
	// Deprecated: only used if no Logger is passed in.
	// Use an appropriately configured logger instead.
	Verbose bool
	Logger  Logger
}

Config used to connect to the API

type Credentials

type Credentials struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

Credentials used to authenticate

type Disk

type Disk struct {
	Username    interface{} `json:"username"`
	Status      string      `json:"status"`
	Description string      `json:"description"`
	Name        string      `json:"name"`
	Size        int         `json:"sizeMax"`
	Type        string      `json:"type"`
	ID          int         `json:"id"`
	AccountID   int         `json:"accountId"`
}

Disk is a list of disks Returned when using the List method

type DiskAttachConfig

type DiskAttachConfig struct {
	DiskID    int `json:"diskId"`
	MachineID int `json:"machineId"`
}

DiskAttachConfig is used when attatching a disk to a machine

type DiskConfig

type DiskConfig struct {
	AccountID   int    `json:"accountId,omitempty"`
	GridID      int    `json:"gid,omitempty"`
	MachineID   int    `json:"machineId,omitempty"`
	DiskName    string `json:"diskName,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Size        int    `json:"size,omitempty"`
	Type        string `json:"type,omitempty"`
	SSDSize     int    `json:"ssdSize,omitempty"`
	IOPS        int    `json:"iops,omitempty"`
	DiskID      int    `json:"diskId,omitempty"`
	Detach      bool   `json:"detach,omitempty"`
	Permanently string `json:"permanently,omitempty"`
}

DiskConfig is used when creating a disk

type DiskDeleteConfig

type DiskDeleteConfig struct {
	DiskID      int  `json:"diskId"`
	Detach      bool `json:"detach"`
	Permanently bool `json:"permanently"`
}

DiskDeleteConfig is used when deleting a disk

type DiskEndPointDescriptor

type DiskEndPointDescriptor interface {
	Protocol() string
}

DiskEndPointDescriptor is an interface that a type representing a storage protocol endpoint shall implement to facilitate accessing protocol specific information in DiskExposeInfo

type DiskExposeConfig

type DiskExposeConfig struct {
	Protocol     string `json:"-"`
	DiskID       int    `json:"diskId"`
	CloudSpaceID int    `json:"cloudspaceId"`
	IOPS         int    `json:"iops"`
}

DiskExposeConfig is used to request that a given disk is exposed via a given cloudspace and protocol

type DiskExposeInfo

type DiskExposeInfo struct {
	Protocol string                 `json:"protocol"`
	EndPoint DiskEndPointDescriptor `json:"endpoint"`
}

DiskExposeInfo contains information on how to access a disk exposed using a given storage protocol.

func (*DiskExposeInfo) UnmarshalJSON

func (i *DiskExposeInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON deserializes DiskInfo from a buffer containing a JSON representation of DiskInfo

type DiskInfo

type DiskInfo struct {
	ReferenceID         string        `json:"referenceId"`
	DiskPath            string        `json:"diskPath"`
	Images              []interface{} `json:"images"`
	GUID                int           `json:"guid"`
	ID                  int           `json:"id"`
	PCIBus              int           `json:"pci_bus"`
	PCISlot             int           `json:"pci_slot"`
	AccountID           int           `json:"accountId"`
	SizeUsed            int           `json:"sizeUsed"`
	Descr               string        `json:"descr"`
	GridID              int           `json:"gid"`
	Role                string        `json:"role"`
	Params              string        `json:"params"`
	Type                string        `json:"type"`
	Status              string        `json:"status"`
	RealityDeviceNumber int           `json:"realityDeviceNumber"`
	Passwd              string        `json:"passwd"`
	Iotune              IOTune        `json:"iotune"`
	Name                string        `json:"name"`
	SizeMax             int           `json:"sizeMax"`
	Meta                []interface{} `json:"_meta"`
	Iqn                 string        `json:"iqn"`
	BootPartition       int           `json:"bootPartition"`
	Login               string        `json:"login"`
	Order               int           `json:"order"`
	Ckey                string        `json:"_ckey"`
}

DiskInfo contains all information related to a disk

type DiskService

type DiskService interface {
	Resize(*DiskConfig) error
	List(int, string) (*[]Disk, error)
	Get(int) (*DiskInfo, error)
	GetByName(string, int, string) (*DiskInfo, error)
	Create(*DiskConfig) (int, error)
	CreateAndAttach(*DiskConfig) (int, error)
	Attach(*DiskAttachConfig) error
	Detach(*DiskAttachConfig) error
	Update(*DiskConfig) error
	Delete(*DiskDeleteConfig) error
	Expose(*DiskExposeConfig) (*DiskExposeInfo, error)
	Unexpose(*DiskUnexposeConfig) error
}

DiskService is an interface for interfacing with the Disk endpoints of the OVC API

type DiskServiceOp

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

DiskServiceOp handles communication with the disk related methods of the OVC API

func (*DiskServiceOp) Attach

func (s *DiskServiceOp) Attach(diskAttachConfig *DiskAttachConfig) error

Attach attaches an existing disk to a machine

func (*DiskServiceOp) Create

func (s *DiskServiceOp) Create(diskConfig *DiskConfig) (int, error)

Create a new Disk

func (*DiskServiceOp) CreateAndAttach

func (s *DiskServiceOp) CreateAndAttach(diskConfig *DiskConfig) (int, error)

CreateAndAttach a new Disk and attaches it to a machine

func (*DiskServiceOp) Delete

func (s *DiskServiceOp) Delete(diskConfig *DiskDeleteConfig) error

Delete an existing Disk

func (*DiskServiceOp) Detach

func (s *DiskServiceOp) Detach(diskAttachConfig *DiskAttachConfig) error

Detach detaches an existing disk from a machine

func (*DiskServiceOp) Expose

func (s *DiskServiceOp) Expose(diskExposeConfig *DiskExposeConfig) (*DiskExposeInfo, error)

Expose a disk using the requested protocol (currently only NBD is supported) via the cloudspace specified in the DiskExposeConfig.

func (*DiskServiceOp) Get

func (s *DiskServiceOp) Get(id int) (*DiskInfo, error)

Get individual Disk

func (*DiskServiceOp) GetByName

func (s *DiskServiceOp) GetByName(name string, accountID int, diskType string) (*DiskInfo, error)

GetByName gets a disk by its name

func (*DiskServiceOp) List

func (s *DiskServiceOp) List(accountID int, diskType string) (*[]Disk, error)

List all disks

func (*DiskServiceOp) Resize

func (s *DiskServiceOp) Resize(diskConfig *DiskConfig) error

Resize resizes a disk. Can only increase the size of a disk

func (*DiskServiceOp) Unexpose

func (s *DiskServiceOp) Unexpose(diskUnexposeConfig *DiskUnexposeConfig) error

Unexpose a previously exposed disk. Unexposing a non-exposed disk returns an error.

func (*DiskServiceOp) Update

func (s *DiskServiceOp) Update(diskConfig *DiskConfig) error

Update updates an existing disk

type DiskUnexposeConfig

type DiskUnexposeConfig struct {
	DiskID int `json:"diskId"`
}

DiskUnexposeConfig is used to request that a given exposed disk is exposed

type EmptyMachineConfig

type EmptyMachineConfig struct {
	CloudspaceID int    `json:"cloudspaceId,omitempty"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Memory       int    `json:"memory,omitempty"`
	Vcpus        int    `json:"vcpus,omitempty"`
	Disksize     int    `json:"disksize,omitempty"`
	DataDisks    []int  `json:"datadisks,omitempty"`
	Userdata     string `json:"userdata,omitempty"`
}

EmptyMachineConfig is used when creating a new "empty" machine. A machine is considered "empty" if it's not created from an existing image.

type ExternalNetworkConfig

type ExternalNetworkConfig struct {
	Name      string `json:"name"`
	AccountID int    `json:"accountId"`
}

ExternalNetworkConfig is used when getting an external network

type ExternalNetworkInfo

type ExternalNetworkInfo struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	AccountID  int    `json:"accountId"`
	Network    string `json:"network"`
	Gateway    string `json:"gateway"`
	Subnetmask string `json:"subnetmask"`
	DHCP       bool   `json:"dhcp"`
}

ExternalNetworkInfo contains information about the external network returned by API

type ExternalNetworkService

type ExternalNetworkService interface {
	Get(int) (*ExternalNetworkInfo, error)
	List(int) (*[]ExternalNetworkInfo, error)
}

ExternalNetworkService is an interface for interfacing with the external networks of the OVC API

type ExternalNetworkServiceOp

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

ExternalNetworkServiceOp handles communication with the external network related methods of the OVC API

func (*ExternalNetworkServiceOp) Get

Get external network

func (*ExternalNetworkServiceOp) GetByName

func (s *ExternalNetworkServiceOp) GetByName(name string, accountID string) (*ExternalNetworkInfo, error)

GetByName gets an individual external network from its name

func (*ExternalNetworkServiceOp) List

func (s *ExternalNetworkServiceOp) List(accountID int) (*[]ExternalNetworkInfo, error)

List all external networks

type ForwardingService

type ForwardingService interface {
	Create(*PortForwardingConfig) (int, error)
	List(*PortForwardingConfig) (*[]PortForwardingInfo, error)
	Delete(*PortForwardingConfig) error
	DeleteByPort(int, string, int) error
	Update(*PortForwardingConfig) error
	Get(*PortForwardingConfig) (*PortForwardingInfo, error)
}

ForwardingService is an interface for interfacing with the portforwards endpoints of the OVC API

type ForwardingServiceOp

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

ForwardingServiceOp handles communication with the machine related methods of the OVC API

func (*ForwardingServiceOp) Create

func (s *ForwardingServiceOp) Create(portForwardingConfig *PortForwardingConfig) (int, error)

Create a new portforward

func (*ForwardingServiceOp) Delete

func (s *ForwardingServiceOp) Delete(portForwardingConfig *PortForwardingConfig) error

Delete an existing portforward

func (*ForwardingServiceOp) DeleteByPort

func (s *ForwardingServiceOp) DeleteByPort(publicPort int, publicIP string, cloudSpaceID int) error

DeleteByPort Deletes a portforward by publicIP, public port and cloudspace ID

func (*ForwardingServiceOp) Get

func (s *ForwardingServiceOp) Get(portForwardingConfig *PortForwardingConfig) (*PortForwardingInfo, error)

Get a portforward based on ID

func (*ForwardingServiceOp) List

func (s *ForwardingServiceOp) List(portForwardingConfig *PortForwardingConfig) (*[]PortForwardingInfo, error)

List all portforwards

func (*ForwardingServiceOp) Update

func (s *ForwardingServiceOp) Update(portForwardingConfig *PortForwardingConfig) error

Update an existing portforward

type IOTune

type IOTune struct {
	TotalIopsSec int `json:"total_iops_sec"`
}

IOTune is used for specifying tuning information

type ImageConfig

type ImageConfig struct {
	Name      string `json:"name"`
	URL       string `json:"url"`
	GridID    int    `json:"gid"`
	BootType  string `json:"boottype"`
	Type      string `json:"imagetype"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	AccountID int    `json:"accountId"`
}

ImageConfig is used when uploading an image

type ImageInfo

type ImageInfo struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Size        int    `json:"size"`
	Status      string `json:"status"`
	Type        string `json:"type"`
	AccountID   int    `json:"accountId"`
	Username    string `json:"username"`
}

ImageInfo contains information about the image returned by API

type ImageService

type ImageService interface {
	Upload(*ImageConfig) error
	Delete(int) error
	DeleteSystemImage(int, string) error
	List(int) (*[]ImageInfo, error)
}

ImageService is an interface for interfacing with the images of the OVC API

type ImageServiceOp

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

ImageServiceOp handles communication with the image related methods of the OVC API

func (*ImageServiceOp) Delete

func (s *ImageServiceOp) Delete(id int) error

Delete deletes an existing image by ID

func (*ImageServiceOp) DeleteSystemImage

func (s *ImageServiceOp) DeleteSystemImage(id int, reason string) error

DeleteSystemImage deletes an existing system image by ID

func (*ImageServiceOp) List

func (s *ImageServiceOp) List(accountID int) (*[]ImageInfo, error)

List all system images

func (*ImageServiceOp) Upload

func (s *ImageServiceOp) Upload(imageConfig *ImageConfig) error

Upload uploads an image to the system API

type IpsecConfig

type IpsecConfig struct {
	CloudspaceID         int    `json:"cloudspaceId"`
	RemotePublicAddr     string `json:"remotePublicAddr,omitempty"`
	RemotePrivateNetwork string `json:"remotePrivateNetwork,omitempty"`
	PskSecret            string `json:"pskSecret,omitempty"`
}

IpsecConfig is used when creating/deleting/listing ipsec

type IpsecInfo

type IpsecInfo struct {
	RemoteAddr           string `json:"remoteAddr"`
	RemotePrivateNetwork string `json:"remoteprivatenetwork"`
	PSK                  string `json:"psk"`
}

IpsecInfo is a list of ipsec of a cloudspace Returned when using the List method

type IpsecService

type IpsecService interface {
	Create(*IpsecConfig) (string, error)
	List(*IpsecConfig) (*[]IpsecInfo, error)
	Delete(*IpsecConfig) error
}

IpsecService is an interface for interfacing with ipsec endpoints of the OVC API

type IpsecServiceOp

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

IpsecServiceOp handles communication with the ipsec related methods of the OVC API

func (*IpsecServiceOp) Create

func (s *IpsecServiceOp) Create(ipsecConfig *IpsecConfig) (string, error)

Create a new ipsec tunnel

func (*IpsecServiceOp) Delete

func (s *IpsecServiceOp) Delete(ipsecConfig *IpsecConfig) error

Delete an existing ipsec tunnel

func (*IpsecServiceOp) List

func (s *IpsecServiceOp) List(ipsecConfig *IpsecConfig) (*[]IpsecInfo, error)

List all ipsec of a cloudspace

type JWT

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

JWT represents a JWT

func NewJWT

func NewJWT(jwtStr string, idProvider string, logger *logrus.Entry) (*JWT, error)

NewJWT returns a new JWT type supported identity providers: IYO (itsyou.online) Deprecated. Use NewJWTFromIYO instead.

func NewJWTFromIYO

func NewJWTFromIYO(jwtStr string, logger Logger) (*JWT, error)

NewJWTFromIYO returns a new JWT type from a token string obtained from itsyou.online

func (*JWT) Claim

func (j *JWT) Claim(key string) (interface{}, error)

Claim returns the value of Claim

func (*JWT) Get

func (j *JWT) Get() (string, error)

Get returns the JWT If the JWT is expired (or nearly so) and refreshable, a refreshed token is returned

type LocationInfo

type LocationInfo struct {
	Name   string `json:"name"`
	ID     int    `json:"id"`
	GUID   int    `json:"guid"`
	GridID int    `json:"gid"`
	Code   string `json:"locationCode"`
	Flag   string `json:"flag"`
}

LocationInfo represents the information of the location

type LocationList

type LocationList []LocationInfo

LocationList represents a list of location info

type LocationService

type LocationService interface {
	List() (*LocationList, error)
}

LocationService represents Location service interface

type LocationServiceOp

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

LocationServiceOp handles communication with the location related methods of the OVC API

func (*LocationServiceOp) List

func (s *LocationServiceOp) List() (*LocationList, error)

List lists all locations of the G8

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithFields(fields map[string]interface{}) Logger
	WithError(err error) Logger

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})
}

Logger describes the logging interface. Essentially a trimmed down version of logrus' FieldLogger, fixing up the With* methods to return a Logger interface instead of a concrete type (*logrus.Entry).

type LogrusAdapter

type LogrusAdapter struct {
	logrus.FieldLogger
}

LogrusAdapter adapts a logrus.FieldLogger to the Logger interface

func (LogrusAdapter) WithError

func (l LogrusAdapter) WithError(err error) Logger

WithError implements the eponymous method of Logger

func (LogrusAdapter) WithField

func (l LogrusAdapter) WithField(key string, value interface{}) Logger

WithField implements the eponymous method of Logger

func (LogrusAdapter) WithFields

func (l LogrusAdapter) WithFields(fields map[string]interface{}) Logger

WithFields implements the eponymous method of Logger

type Machine

type Machine struct {
	Status       string `json:"status"`
	StackID      int    `json:"stackId"`
	UpdateTime   int    `json:"updateTime"`
	ReferenceID  string `json:"referenceId"`
	Name         string `json:"name"`
	Nics         []NIC  `json:"nics"`
	SizeID       int    `json:"sizeId"`
	Disks        []int  `json:"disks"`
	CreationTime int    `json:"creationTime"`
	ImageID      int    `json:"imageId"`
	Storage      int    `json:"storage"`
	Vcpus        int    `json:"vcpus"`
	Memory       int    `json:"memory"`
	ID           int    `json:"id"`
}

Machine basic information

type MachineConfig

type MachineConfig struct {
	MachineID    string        `json:"machineId,omitempty"`
	CloudspaceID int           `json:"cloudspaceId,omitempty"`
	Name         string        `json:"name,omitempty"`
	Description  string        `json:"description,omitempty"`
	Memory       int           `json:"memory,omitempty"`
	Vcpus        int           `json:"vcpus,omitempty"`
	SizeID       int           `json:"sizeId,omitempty"`
	ImageID      int           `json:"imageId,omitempty"`
	Disksize     int           `json:"disksize,omitempty"`
	DataDisks    []interface{} `json:"datadisks,omitempty"`
	Permanently  bool          `json:"permanently,omitempty"`
	Userdata     string        `json:"userdata,omitempty"`
}

MachineConfig is used when creating a machine

type MachineDisk

type MachineDisk struct {
	Status  string `json:"status,omitempty"`
	SizeMax int    `json:"sizeMax,omitempty"`
	Name    string `json:"name,omitempty"`
	Descr   string `json:"descr,omitempty"`
	Type    string `json:"type"`
	ID      int    `json:"id"`
}

MachineDisk basic information

type MachineInfo

type MachineInfo struct {
	CloudspaceID int           `json:"cloudspaceid"`
	Status       string        `json:"status"`
	UpdateTime   int           `json:"updateTime"`
	Hostname     string        `json:"hostname"`
	Locked       bool          `json:"locked"`
	Name         string        `json:"name"`
	CreationTime int           `json:"creationTime"`
	SizeID       int           `json:"sizeid"`
	Disks        []MachineDisk `json:"disks"`
	Storage      int           `json:"storage"`
	ACL          []ACL         `json:"acl"`
	OsImage      string        `json:"osImage"`
	Accounts     []UserAccount `json:"accounts"`
	Interfaces   []NIC         `json:"interfaces"`
	ImageID      int           `json:"imageid"`
	ID           int           `json:"id"`
	Memory       int           `json:"memory"`
	Vcpus        int           `json:"vcpus"`
	Description  *string       `json:"description"`
}

MachineInfo contains all information related to a cloudspace

type MachineService

type MachineService interface {
	List(int) (*[]Machine, error)
	Get(int) (*MachineInfo, error)
	GetByName(string, int) (*MachineInfo, error)
	GetByReferenceID(string) (*MachineInfo, error)
	Create(*MachineConfig) (int, error)
	CreateEmpty(*EmptyMachineConfig) (int, error)
	Update(*MachineConfig) (string, error)
	Resize(*MachineConfig) (string, error)
	Delete(int, bool) error
	CreateImage(int, string) error
	Shutdown(int) error
	AddExternalIP(int, int) error
	DeleteExternalIP(int, int, string) error
	Stop(int, bool) error
	Start(int, int) error
}

MachineService is an interface for interfacing with the Machine endpoints of the OVC API

type MachineServiceOp

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

MachineServiceOp handles communication with the machine related methods of the OVC API

func (*MachineServiceOp) AddExternalIP

func (s *MachineServiceOp) AddExternalIP(id int, externalNetworkID int) error

AddExternalIP adds external IP

func (*MachineServiceOp) Create

func (s *MachineServiceOp) Create(machineConfig *MachineConfig) (int, error)

Create a new machine

func (*MachineServiceOp) CreateEmpty

func (s *MachineServiceOp) CreateEmpty(emptyMachineConfig *EmptyMachineConfig) (int, error)

CreateEmpty a new "empty" machine (= not based on an existing image)

func (*MachineServiceOp) CreateImage

func (s *MachineServiceOp) CreateImage(id int, imageName string) error

CreateImage creates an image of the existing machine by ID

func (*MachineServiceOp) Delete

func (s *MachineServiceOp) Delete(id int, permanently bool) error

Delete deletes an existing machine

func (*MachineServiceOp) DeleteExternalIP

func (s *MachineServiceOp) DeleteExternalIP(id int, externalNetworkID int, externalNetworkIP string) error

DeleteExternalIP removes external IP

func (*MachineServiceOp) Get

func (s *MachineServiceOp) Get(id int) (*MachineInfo, error)

Get individual machine

func (*MachineServiceOp) GetByName

func (s *MachineServiceOp) GetByName(name string, cloudspaceID int) (*MachineInfo, error)

GetByName gets an individual machine from its name

func (*MachineServiceOp) GetByReferenceID

func (s *MachineServiceOp) GetByReferenceID(referenceID string) (*MachineInfo, error)

GetByReferenceID gets an individual machine from its reference ID

func (*MachineServiceOp) List

func (s *MachineServiceOp) List(cloudSpaceID int) (*[]Machine, error)

List all machines

func (*MachineServiceOp) Resize

func (s *MachineServiceOp) Resize(machineConfig *MachineConfig) (string, error)

Resize an existing machine

func (*MachineServiceOp) Shutdown

func (s *MachineServiceOp) Shutdown(id int) error

Shutdown shuts a machine down

func (*MachineServiceOp) Start

func (s *MachineServiceOp) Start(id int, diskID int) error

Start starts a machine, boots from ISO if diskID is given

func (*MachineServiceOp) Stop

func (s *MachineServiceOp) Stop(id int, force bool) error

Stop stops a machine

func (*MachineServiceOp) Update

func (s *MachineServiceOp) Update(machineConfig *MachineConfig) (string, error)

Update an existing machine

type NBDDiskEndPointDescriptor

type NBDDiskEndPointDescriptor struct {
	Address string `json:"address"`
	Port    int    `json:"port"`
	Name    string `json:"name"`
	User    string `json:"user"`
	Psk     string `json:"psk"`
}

NBDDiskEndPointDescriptor contains NBD specific information on how to access a disk exposed as a Network Block Device

func (*NBDDiskEndPointDescriptor) Protocol

func (*NBDDiskEndPointDescriptor) Protocol() string

Protocol implements DiskEndPointDescriptor.Protocol

type NIC

type NIC struct {
	Status      string `json:"status"`
	MacAddress  string `json:"macAddress"`
	ReferenceID string `json:"referenceId"`
	DeviceName  string `json:"deviceName"`
	Type        string `json:"type"`
	Params      string `json:"params"`
	NetworkID   int    `json:"networkId"`
	GUID        string `json:"guid"`
	IPAddress   string `json:"ipAddress"`
}

NIC basic information

type PortForwardingConfig

type PortForwardingConfig struct {
	CloudspaceID     int    `json:"cloudspaceId,omitempty"`
	SourcePublicIP   string `json:"sourcePublicIp,omitempty"`
	SourcePublicPort int    `json:"sourcePublicPort,omitempty"`
	SourceProtocol   string `json:"sourceProtocol,omitempty"`
	PublicIP         string `json:"publicIp,omitempty"`
	PublicPort       int    `json:"publicPort,omitempty"`
	MachineID        int    `json:"machineId,omitempty"`
	LocalPort        int    `json:"localPort,omitempty"`
	Protocol         string `json:"protocol,omitempty"`
	ID               int    `json:"id,omitempty"`
}

PortForwardingConfig is used when creating a portforward

type PortForwardingInfo

type PortForwardingInfo struct {
	Protocol    string `json:"protocol"`
	LocalPort   string `json:"localPort"`
	MachineName string `json:"machineName"`
	PublicIP    string `json:"publicIp"`
	LocalIP     string `json:"localIp"`
	MachineID   int    `json:"machineId"`
	PublicPort  string `json:"publicPort"`
	ID          int    `json:"id"`
}

PortForwardingInfo is returned when using the get method

type ResourceLimits

type ResourceLimits struct {
	CUM  float64 `json:"CU_M"`
	CUD  int     `json:"CU_D"`
	CUNP int     `json:"CU_NP"`
	CUI  int     `json:"CU_I"`
	CUC  int     `json:"CU_C"`
}

ResourceLimits contains all information related to resource limits

type ResponseTimeout

type ResponseTimeout time.Duration

ResponseTimeout for specific api requests

const (
	// ModelActionTimeout is used for actions that only interfere with the model in the G8
	ModelActionTimeout ResponseTimeout = ResponseTimeout(time.Minute)
	// OperationalActionTimeout is used for actions that tamper with deploy resources
	OperationalActionTimeout ResponseTimeout = ResponseTimeout(time.Minute * 10)
	// DataActionTimeout is used for actions that involve moving data
	DataActionTimeout ResponseTimeout = ResponseTimeout(time.Hour * 24)
)

type Size

type Size struct {
	ID          int    `json:"id"`
	Vcpus       int    `json:"vcpus"`
	Disks       []int  `json:"disks"`
	Name        string `json:"name"`
	Memory      int    `json:"memory"`
	Description string `json:"description,omitempty"`
}

Size contains all information related to a disk

type SizesService

type SizesService interface {
	List(int) (*[]Size, error)
	GetByVcpusAndMemory(int, int, int) (*Size, error)
}

SizesService is an interface for interfacing with the Sizes endpoints of the OVC API

type SizesServiceOp

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

SizesServiceOp handles communication with the size related methods of the OVC API

func (*SizesServiceOp) GetByVcpusAndMemory

func (s *SizesServiceOp) GetByVcpusAndMemory(vcpus int, memory int, cloudspaceID int) (*Size, error)

GetByVcpusAndMemory gets sizes by vcpus and memory

func (*SizesServiceOp) List

func (s *SizesServiceOp) List(cloudspaceID int) (*[]Size, error)

List all sizes

type Template

type Template struct {
	Username    interface{} `json:"username"`
	Status      string      `json:"status"`
	Description string      `json:"description"`
	Name        string      `json:"name"`
	Size        int         `json:"size"`
	Type        string      `json:"type"`
	ID          int         `json:"id"`
	AccountID   int         `json:"accountId"`
}

Template is a list of templates Returned when using the List method

type TemplateService

type TemplateService interface {
	List(int) (*[]Template, error)
}

TemplateService is an interface for interfacing with the Images endpoints of the OVC API

type TemplateServiceOp

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

TemplateServiceOp handles communication with the image related methods of the OVC API

func (*TemplateServiceOp) List

func (s *TemplateServiceOp) List(accountID int) (*[]Template, error)

List all images

type UserAccount

type UserAccount struct {
	GUID     string `json:"guid"`
	Login    string `json:"login"`
	Password string `json:"password"`
}

UserAccount basic information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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