ovc

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

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")
)
View Source
var (
	// ErrAuthentication represents an authentication error from the server 401
	ErrAuthentication = errors.New("OVC authentication error")
)

Functions

func SetJWTPublicKey added in v1.0.0

func SetJWTPublicKey(key string) error

SetJWTPublicKey configure the public key used to verify JWT token

Types

type Account

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

Account contains

type AccountList

type AccountList []struct {
	ID           int    `json:"id"`
	UpdateTime   int    `json:"updateTime"`
	CreationTime int    `json:"creationTime"`
	Name         string `json:"name"`
	ACL          []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"`
	} `json:"acl"`
}

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

type AccountService

type AccountService interface {
	GetIDByName(string) (int, error)
	List() (*AccountList, 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() (*AccountList, 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 a OpenVCloud API Client

func (*Client) Do

func (c *Client) Do(req *http.Request) ([]byte, error)

Do sends and API Request and returns the body as an array of bytes

func (*Client) GetLocation

func (c *Client) GetLocation() string

GetLocation parses the URL to return the location of the API

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               []struct {
		Status       string `json:"status"`
		CanBeDeleted bool   `json:"canBeDeleted"`
		Right        string `json:"right"`
		Type         string `json:"type"`
		UserGroupID  string `json:"userGroupId"`
	} `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      string  `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 CloudSpaceList

type CloudSpaceList []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               []struct {
		Status       string `json:"status"`
		CanBeDeleted bool   `json:"canBeDeleted"`
		Right        string `json:"right"`
		Type         string `json:"type"`
		UserGroupID  string `json:"userGroupId"`
	} `json:"acl"`
	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"`
	} `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"`
}

CloudSpaceList returns a list of CloudSpaces

type CloudSpaceService

type CloudSpaceService interface {
	List() (*CloudSpaceList, error)
	Get(string) (*CloudSpace, error)
	GetByNameAndAccount(string, string) (*CloudSpace, error)
	Create(*CloudSpaceConfig) (string, 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) (string, 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(cloudSpaceID string) (*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

List returns all cloudspaces

func (*CloudSpaceServiceOp) SetDefaultGateway added in v1.3.0

func (s *CloudSpaceServiceOp) SetDefaultGateway(cloudspaceID 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
	Verbose      bool
}

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 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 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              struct {
		TotalIopsSec int `json:"total_iops_sec"`
	} `json:"iotune"`
	Name    string        `json:"name"`
	SizeMax int           `json:"sizeMax"`
	Meta    []interface{} `json:"_meta"`
	ACL     struct {
	} `json:"acl"`
	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 DiskList

type DiskList []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"`
}

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

type DiskService

type DiskService interface {
	Resize(*DiskConfig) error
	List(int, string) (*DiskList, error)
	Get(string) (*DiskInfo, error)
	GetByName(string, int, string) (*DiskInfo, error)
	Create(*DiskConfig) (string, error)
	CreateAndAttach(*DiskConfig) (string, error)
	Attach(*DiskAttachConfig) error
	Detach(*DiskAttachConfig) error
	Update(*DiskConfig) error
	Delete(*DiskDeleteConfig) 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) (string, error)

Create a new Disk

func (*DiskServiceOp) CreateAndAttach

func (s *DiskServiceOp) CreateAndAttach(diskConfig *DiskConfig) (string, 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) Get

func (s *DiskServiceOp) Get(diskID string) (*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) (*DiskList, 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) Update

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

Update updates an existing disk

type ExternalNetworkConfig added in v1.3.0

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

ExternalNetworkConfig is used when getting an external network

type ExternalNetworkInfo added in v1.3.0

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 ExternalNetworkList added in v1.3.0

type ExternalNetworkList []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"`
}

ExternalNetworkList is a list of external networks Returned when using the List method

type ExternalNetworkService added in v1.3.0

type ExternalNetworkService interface {
	Get(string) (*ExternalNetworkInfo, error)
	List(int) (*ExternalNetworkList, error)
}

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

type ExternalNetworkServiceOp added in v1.3.0

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

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

func (*ExternalNetworkServiceOp) Get added in v1.3.0

Get external network

func (*ExternalNetworkServiceOp) GetByName added in v1.3.0

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

GetByName gets an individual external network from its name

func (*ExternalNetworkServiceOp) List added in v1.3.0

func (s *ExternalNetworkServiceOp) List(accountID int) (*ExternalNetworkList, error)

List all external networks

type ForwardingService

type ForwardingService interface {
	Create(*PortForwardingConfig) (int, error)
	List(*PortForwardingConfig) (*PortForwardingList, 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) (*PortForwardingList, error)

List all portforwards

func (*ForwardingServiceOp) Update

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

Update an existing portforward

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 added in v0.2.0

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 ImageList added in v0.2.0

type ImageList []ImageInfo

ImageList is a list of images Returned when using the List method

type ImageService

type ImageService interface {
	Upload(*ImageConfig) error
	DeleteByID(int) error
	DeleteSystemImageByID(int, string) error
	List(int) (*ImageList, 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) DeleteByID

func (s *ImageServiceOp) DeleteByID(imageID int) error

DeleteByID deletes an existing image by ID

func (*ImageServiceOp) DeleteSystemImageByID

func (s *ImageServiceOp) DeleteSystemImageByID(imageID int, reason string) error

DeleteSystemImageByID deletes an existing system image by ID

func (*ImageServiceOp) List added in v0.2.0

func (s *ImageServiceOp) List(accountID int) (*ImageList, 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 added in v1.1.0

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 IpsecList added in v1.1.0

type IpsecList []struct {
	RemoteAddr           string `json:"remoteAddr"`
	RemotePrivateNetwork string `json:"remoteprivatenetwork"`
	PSK                  string `json:"psk"`
}

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

type IpsecService added in v1.1.0

type IpsecService interface {
	Create(*IpsecConfig) (string, error)
	List(*IpsecConfig) (*IpsecList, error)
	Delete(*IpsecConfig) error
}

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

type IpsecServiceOp added in v1.1.0

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

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

func (*IpsecServiceOp) Create added in v1.1.0

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

Create a new ipsec tunnel

func (*IpsecServiceOp) Delete added in v1.1.0

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

Delete an existing ipsec tunnel

func (*IpsecServiceOp) List added in v1.1.0

func (s *IpsecServiceOp) List(ipsecConfig *IpsecConfig) (*IpsecList, error)

List all ipsec of a cloudspace

type JWT added in v1.0.0

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

JWT represents a JWT

func NewJWT added in v1.0.0

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

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

func (*JWT) Claim added in v1.0.0

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

Claim returns the value of Claim

func (*JWT) Get added in v1.0.0

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 added in v1.4.0

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 added in v1.4.0

type LocationList []LocationInfo

LocationList represents a list of location info

type LocationService added in v1.4.0

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

LocationService represents Location service interface

type LocationServiceOp added in v1.4.0

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

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

func (*LocationServiceOp) List added in v1.4.0

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

List lists all locations of the G8

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 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        []struct {
		Status  string `json:"status,omitempty"`
		SizeMax int    `json:"sizeMax,omitempty"`
		Name    string `json:"name,omitempty"`
		Descr   string `json:"descr,omitempty"`
		ACL     struct {
		} `json:"acl"`
		Type string `json:"type"`
		ID   int    `json:"id"`
	} `json:"disks"`
	Storage int `json:"storage"`
	ACL     []struct {
		Status       string `json:"status"`
		CanBeDeleted bool   `json:"canBeDeleted"`
		Right        string `json:"right"`
		Type         string `json:"type"`
		UserGroupID  string `json:"userGroupId"`
	} `json:"acl"`
	OsImage  string `json:"osImage"`
	Accounts []struct {
		GUID     string `json:"guid"`
		Login    string `json:"login"`
		Password string `json:"password"`
	} `json:"accounts"`
	Interfaces []struct {
		Status      string `json:"status"`
		MacAddress  string `json:"macAddress"`
		ReferenceID string `json:"referenceId"`
		DeviceName  string `json:"deviceName"`
		IPAddress   string `json:"ipAddress"`
		Params      string `json:"params"`
		NetworkID   int    `json:"networkId"`
		GUID        string `json:"guid"`
		Type        string `json:"type"`
	} `json:"interfaces"`
	ImageID     int         `json:"imageid"`
	ID          int         `json:"id"`
	Memory      int         `json:"memory"`
	Vcpus       int         `json:"vcpus"`
	Description interface{} `json:"description"`
}

MachineInfo contains all information related to a cloudspace

type MachineList

type MachineList []struct {
	Status      string `json:"status"`
	StackID     int    `json:"stackId"`
	UpdateTime  int    `json:"updateTime"`
	ReferenceID string `json:"referenceId"`
	Name        string `json:"name"`
	Nics        []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"`
	} `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"`
}

MachineList is a list of machines Returned when using the List method

type MachineService

type MachineService interface {
	List(int) (*MachineList, error)
	Get(string) (*MachineInfo, error)
	GetByName(string, string) (*MachineInfo, error)
	GetByReferenceID(string) (*MachineInfo, error)
	Create(*MachineConfig) (string, error)
	Update(*MachineConfig) (string, error)
	Resize(*MachineConfig) (string, error)
	Delete(*MachineConfig) error
	DeleteByID(int) error
	Template(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 added in v1.3.0

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

AddExternalIP adds external IP

func (*MachineServiceOp) Create

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

Create a new machine

func (*MachineServiceOp) Delete

func (s *MachineServiceOp) Delete(machineConfig *MachineConfig) error

Delete an existing machine

func (*MachineServiceOp) DeleteByID

func (s *MachineServiceOp) DeleteByID(machineID int) error

DeleteByID deletes an existing machine by ID

func (*MachineServiceOp) DeleteExternalIP added in v1.3.0

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

DeleteExternalIP removes external IP

func (*MachineServiceOp) Get

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

Get individual machine

func (*MachineServiceOp) GetByName

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

GetByName gets an individual machine from its name

func (*MachineServiceOp) GetByReferenceID added in v1.1.0

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) (*MachineList, 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(machineID int) error

Shutdown shuts a machine down

func (*MachineServiceOp) Start added in v1.4.0

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

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

func (*MachineServiceOp) Stop added in v1.4.0

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

Stop stops a machine

func (*MachineServiceOp) Template

func (s *MachineServiceOp) Template(machineID int, templateName string) error

Template creates an image of the existing machine by ID

func (*MachineServiceOp) Update

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

Update an existing machine

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 PortForwardingList

type PortForwardingList []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"`
}

PortForwardingList is a list of portforwards Returned when using the List 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 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 SizesList

type SizesList []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"`
}

SizesList is a list of sizes Returned when using the list method

type SizesService

type SizesService interface {
	List(string) (*SizesList, error)
	GetByVcpusAndMemory(int, int, string) (*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 string) (*Size, error)

GetByVcpusAndMemory gets sizes by vcpus and memory

func (*SizesServiceOp) List

func (s *SizesServiceOp) List(cloudspaceID string) (*SizesList, error)

List all sizes

type TemplateList

type TemplateList []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"`
}

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

type TemplateService

type TemplateService interface {
	List(int) (*TemplateList, 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) (*TemplateList, error)

List all images

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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