goca

package module
v0.0.0-...-b27ac56 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.1.0"

Version is the main version number that is being run at the moment.

Variables

View Source
var GitCommit string

GitCommit is the git commit that was compiled. This will be filled in by the compiler.

View Source
var VersionPrerelease = ""

VersionPrerelease is the pre-release marker for the version. If this is "" (empty string) then it means that it is a final release. Otherwise, this is a pre-release such as "dev" (in development)

Functions

This section is empty.

Types

type ACLsController

type ACLsController entitiesController

ACLsController is a controller for a pool of ACL

func (*ACLsController) CreateRule

func (ac *ACLsController) CreateRule(user, resource, rights string) (int, error)

CreateRule adds a new ACL rule. * user: User component of the new rule. A string containing a hex number. * resource: Resource component of the new rule. A string containing a hex number. * rights: Rights component of the new rule. A string containing a hex number.

func (*ACLsController) DeleteRule

func (ac *ACLsController) DeleteRule(aclID int) error

DeleteRule deletes an ACL rule.

func (*ACLsController) Info

func (ac *ACLsController) Info() (*acl.Pool, error)

Info returns an acl pool. A connection to OpenNebula is performed.

type Client

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

Client is a basic XML-RPC client implementing RPCCaller

func NewClient

func NewClient(conf OneConfig, httpClient *http.Client) *Client

NewClient return a new one client that allows setting a custom http.Client. If the httpClient is nil, it will return a NewDefaultClient

func NewDefaultClient

func NewDefaultClient(conf OneConfig) *Client

NewDefaultClient return a new basic one client

func (*Client) Call

func (c *Client) Call(method string, args ...interface{}) (*Response, error)

Call is an XML-RPC wrapper. It returns a pointer to response and an error.

type ClusterController

type ClusterController entityController

ClusterController is a controller for Cluster entity

func (*ClusterController) AddDatastore

func (cc *ClusterController) AddDatastore(dsID int) error

AddDatastore adds a datastore to the given cluster. * dsID: The datastore ID.

func (*ClusterController) AddHost

func (cc *ClusterController) AddHost(hostID int) error

AddHost adds a host to the given cluster. * hostID: The host ID.

func (*ClusterController) AddVnet

func (cc *ClusterController) AddVnet(vnetID int) error

AddVnet adds a vnet to the given cluster. * vnetID: The vnet ID.

func (*ClusterController) DelDatastore

func (cc *ClusterController) DelDatastore(dsID int) error

DelDatastore removes a datastore from the given cluster. * dsID: The datastore ID.

func (*ClusterController) DelHost

func (cc *ClusterController) DelHost(hostID int) error

DelHost removes a host from the given cluster. * hostID: The host ID.

func (*ClusterController) DelVnet

func (cc *ClusterController) DelVnet(vnetID int) error

DelVnet removes a vnet from the given cluster. * vnetID: The vnet ID.

func (*ClusterController) Delete

func (cc *ClusterController) Delete() error

Delete deletes the given cluster from the pool.

func (*ClusterController) Info

func (cc *ClusterController) Info() (*cluster.Cluster, error)

Info retrieves information for the cluster.

func (*ClusterController) Rename

func (cc *ClusterController) Rename(newName string) error

Rename renames a cluster. * newName: The new name.

func (*ClusterController) Update

func (cc *ClusterController) Update(tpl string, uType parameters.UpdateType) error

Update adds cluster content.

  • tpl: The new cluster contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type ClustersController

type ClustersController entitiesController

ClustersController is a controller for Clusters

func (*ClustersController) ByName

func (c *ClustersController) ByName(name string) (int, error)

ByName returns a Cluster ID from name

func (*ClustersController) Create

func (cc *ClustersController) Create(name string) (int, error)

Create allocates a new cluster. It returns the new cluster ID.

func (*ClustersController) Info

func (cc *ClustersController) Info(decrypt bool) (*cluster.Pool, error)

Info returns a cluster pool. A connection to OpenNebula is performed.

type Controller

type Controller struct {
	Client RPCCaller
}

Controller is the controller used to make requets on various entities

func NewController

func NewController(c RPCCaller) *Controller

NewController return a new one controller

func (*Controller) ACLs

func (c *Controller) ACLs() *ACLsController

ACLs returns a hosts controller.

func (*Controller) ByName

func (c *Controller) ByName(name string) (int, error)

ByName returns a Datastore ID from name

func (*Controller) Cluster

func (c *Controller) Cluster(id int) *ClusterController

Cluster returns a Cluster controller.

func (*Controller) Clusters

func (c *Controller) Clusters() *ClustersController

Clusters returns a Clusters controller.

func (*Controller) Datastore

func (c *Controller) Datastore(id int) *DatastoreController

Datastore returns a Datastore controller

func (*Controller) Datastores

func (c *Controller) Datastores() *DatastoresController

Datastores returns a Datastores controller

func (*Controller) Document

func (c *Controller) Document(id int) *DocumentController

Document returns a Document controller

func (*Controller) Documents

func (c *Controller) Documents(dType int) *DocumentsController

Documents returns a Documents controller

func (*Controller) Group

func (c *Controller) Group(id int) *GroupController

Group returns a Group Controller

func (*Controller) Groups

func (c *Controller) Groups() *GroupsController

Groups returns a Groups controller.

func (*Controller) Hook

func (c *Controller) Hook(id int) *HookController

Hook return an hook controller with an ID.

func (*Controller) HookLog

func (c *Controller) HookLog() *HookLogController

HookLog returns a Hook log.

func (*Controller) Hooks

func (c *Controller) Hooks() *HooksController

Hooks returns a Hooks controller.

func (*Controller) Host

func (c *Controller) Host(id int) *HostController

Host return an host controller with an ID.

func (*Controller) Hosts

func (c *Controller) Hosts() *HostsController

Hosts returns a hosts controller.

func (*Controller) Image

func (c *Controller) Image(id int) *ImageController

Image returns an Image controller

func (*Controller) Images

func (c *Controller) Images() *ImagesController

Images returns an Images controller

func (*Controller) MarketPlace

func (c *Controller) MarketPlace(id int) *MarketPlaceController

MarketPlace return MarketPlace controller

func (*Controller) MarketPlaceApp

func (c *Controller) MarketPlaceApp(id int) *MarketPlaceAppController

MarketPlaceApp returns a MarketPlaceApp controller

func (*Controller) MarketPlaceApps

func (c *Controller) MarketPlaceApps() *MarketPlaceAppsController

MarketPlaceApps returns a MarketPlaceApps controller

func (*Controller) MarketPlaces

func (c *Controller) MarketPlaces() *MarketPlacesController

MarketPlaces returns a MarketPlaces controller

func (*Controller) SecurityGroup

func (c *Controller) SecurityGroup(id int) *SecurityGroupController

SecurityGroup returns a SecurityGroup controller

func (*Controller) SecurityGroups

func (c *Controller) SecurityGroups() *SecurityGroupsController

SecurityGroups returns a SecurityGroups controller.

func (*Controller) SystemConfig

func (c *Controller) SystemConfig() (string, error)

SystemConfig returns the current OpenNebula config

func (*Controller) SystemVersion

func (c *Controller) SystemVersion() (string, error)

SystemVersion returns the current OpenNebula Version

func (*Controller) Template

func (c *Controller) Template(id int) *TemplateController

Template returns a Template controller

func (*Controller) Templates

func (c *Controller) Templates() *TemplatesController

Templates returns a Templates controller.

func (*Controller) User

func (c *Controller) User(id int) *UserController

User returns a User controller.

func (*Controller) UserByName

func (c *Controller) UserByName(name string) *UserByNameController

UserByName returns a UserByName controller.

func (*Controller) Users

func (c *Controller) Users() *UsersController

Users returns a Users controller.

func (*Controller) VDC

func (c *Controller) VDC(id int) *VDCController

Vdc returns a Vdc controller

func (*Controller) VDCs

func (c *Controller) VDCs() *VDCsController

VDCs returns a VDCs controller.

func (*Controller) VM

func (c *Controller) VM(id int) *VMController

VM returns a new vm controller.

func (*Controller) VMGroup

func (c *Controller) VMGroup(id int) *VMGroupController

VMGroup returns a VMGroup controller

func (*Controller) VMGroups

func (c *Controller) VMGroups() *VMGroupsController

VMGroups returns a VMGroups controller

func (*Controller) VMs

func (c *Controller) VMs() *VMsController

VMs returns a new vm pool controller.

func (*Controller) VNTemplate

func (c *Controller) VNTemplate(id int) *VNTemplateController

VNTemplate return an VNTemplate controller.

func (*Controller) VNTemplates

func (c *Controller) VNTemplates() *VNTemplatesController

VNTemplates returns a VNTemplates controller.

func (*Controller) VirtualNetwork

func (c *Controller) VirtualNetwork(id int) *VirtualNetworkController

VirtualNetwork returns a VirtualNetwork controller

func (*Controller) VirtualNetworks

func (c *Controller) VirtualNetworks() *VirtualNetworksController

VirtualNetworks returns a VirtualNetworks controller

func (*Controller) VirtualRouter

func (c *Controller) VirtualRouter(id int) *VirtualRouterController

VirtualRouter returns a VirtualRouter controller.

func (*Controller) VirtualRouterByName

func (c *Controller) VirtualRouterByName(name string, args ...int) (int, error)

VirtualRouterByName returns a VirtualRouter By name

func (*Controller) VirtualRouters

func (c *Controller) VirtualRouters() *VirtualRoutersController

VirtualRouters returns a VirtualRouters controller.

func (*Controller) Zone

func (c *Controller) Zone(id int) *ZoneController

Zone returns a Zone controller

func (*Controller) Zones

func (c *Controller) Zones() *ZonesController

Zones returns a Zones controller.

type DatastoreController

type DatastoreController entityController

DatastoreController is a controller for Datastore entity

func (*DatastoreController) Chmod

func (dc *DatastoreController) Chmod(perm *shared.Permissions) error

Chmod changes the permission bits of a datastore.

func (*DatastoreController) Chown

func (dc *DatastoreController) Chown(userID, groupID int) error

Chown changes the ownership of a datastore. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*DatastoreController) Delete

func (dc *DatastoreController) Delete() error

Delete deletes the given datastore from the pool.

func (*DatastoreController) Enable

func (dc *DatastoreController) Enable(enable bool) error

Enable enables or disables a datastore. * enable: True for enabling

func (*DatastoreController) Info

func (dc *DatastoreController) Info(decrypt bool) (*datastore.Datastore, error)

Info retrieves information for the datastore.

func (*DatastoreController) Rename

func (dc *DatastoreController) Rename(newName string) error

Rename renames a datastore. * newName: The new name.

func (*DatastoreController) Update

func (dc *DatastoreController) Update(tpl string, uType parameters.UpdateType) error

Update replaces the datastore contents.

  • tpl: The new datastore contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type DatastoresController

type DatastoresController entitiesController

DatastoresController is a controller for Datastore entities

func (*DatastoresController) Create

func (dc *DatastoresController) Create(tpl string, clusterID int) (int, error)

Create allocates a new datastore. It returns the new datastore ID. * tpl: template of the datastore * clusterID: The cluster ID. If it is -1, the default one will be used.

func (*DatastoresController) Info

func (dc *DatastoresController) Info() (*datastore.Pool, error)

Info returns a datastore pool. A connection to OpenNebula is performed.

type DocumentController

type DocumentController entityController

DocumentController is a controller for document entity

func (*DocumentController) Chmod

func (dc *DocumentController) Chmod(perm *shared.Permissions) error

Chmod changes the permission bits of a document.

func (*DocumentController) Chown

func (dc *DocumentController) Chown(userID, groupID int) error

Chown changes the ownership of a document. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*DocumentController) Clone

func (dc *DocumentController) Clone(newName string) error

Clone clones an existing document. * newName: Name for the new document.

func (*DocumentController) Delete

func (dc *DocumentController) Delete() error

Delete deletes the given document from the pool.

func (*DocumentController) Info

func (dc *DocumentController) Info(decrypt bool) (*document.Document, error)

Info retrieves information for the document.

func (*DocumentController) Lock

func (dc *DocumentController) Lock(level shared.LockLevel) error

Lock locks the document following lock level. See levels in locks.go.

func (*DocumentController) Rename

func (dc *DocumentController) Rename(newName string) error

Rename renames a document. * newName: The new name.

func (*DocumentController) Unlock

func (dc *DocumentController) Unlock() error

Unlock unlocks the document.

func (*DocumentController) Update

func (dc *DocumentController) Update(tpl string, uType parameters.UpdateType) error

Update adds document content.

  • tpl: The new document contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type DocumentsController

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

DocumentsController is a controller for documents entities

func (*DocumentsController) ByName

func (dc *DocumentsController) ByName(name string, args ...int) (int, error)

ByName returns a Document ID from name

func (*DocumentsController) Create

func (dc *DocumentsController) Create(tpl string) (int, error)

Create allocates a new document. It returns the new document ID.

func (*DocumentsController) Info

func (dc *DocumentsController) Info(args ...int) (*document.Pool, error)

Info returns a document pool. A connection to OpenNebula is performed.

type GroupController

type GroupController entityController

GroupController is a controller for Group entity

func (*GroupController) AddAdmin

func (gc *GroupController) AddAdmin(userID int) error

AddAdmin adds a User to the Group administrators set * userID: The user ID.

func (*GroupController) DelAdmin

func (gc *GroupController) DelAdmin(userID int) error

DelAdmin removes a User from the Group administrators set * userID: The user ID.

func (*GroupController) Delete

func (gc *GroupController) Delete() error

Delete deletes the given group from the pool.

func (*GroupController) Info

func (gc *GroupController) Info(decrypt bool) (*group.Group, error)

Info retrieves information for the group.

func (*GroupController) Quota

func (gc *GroupController) Quota(tpl string) error

Quota sets the group quota limits. * tpl: The new quota template contents. Syntax can be the usual attribute=value or XML.

func (*GroupController) Update

func (gc *GroupController) Update(tpl string, uType parameters.UpdateType) error

Update adds group content.

  • tpl: The new group contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type GroupsController

type GroupsController entitiesController

GroupsController is a controller for a Groups

func (*GroupsController) ByName

func (c *GroupsController) ByName(name string) (int, error)

ByName returns a Group ID from name

func (*GroupsController) Create

func (gc *GroupsController) Create(name string) (int, error)

Create allocates a new group. It returns the new group ID.

func (*GroupsController) Info

func (gc *GroupsController) Info() (*group.Pool, error)

Info returns a group pool. A connection to OpenNebula is performed.

type HookController

type HookController entityController

HookController is a controller for hook entities

func (*HookController) Delete

func (hc *HookController) Delete() error

Delete deletes the given hook from the pool

func (*HookController) Info

func (hc *HookController) Info(decrypt bool) (*hook.Hook, error)

Info retrieves information for the hook from ID

func (*HookController) Lock

func (hc *HookController) Lock(level shared.LockLevel) error

Lock locks the hook following lock level. See levels in locks.go.

func (*HookController) Rename

func (hc *HookController) Rename(newName string) error

Rename renames a hook. * newName: The new name.

func (*HookController) Retry

func (hc *HookController) Retry(exec_id int) error

Retry retry a hook execution

func (*HookController) Unlock

func (hc *HookController) Unlock() error

Unlock unlocks the hook.

func (*HookController) Update

func (hc *HookController) Update(tpl string, uType parameters.UpdateType) error

Update replaces the hook content.

  • tpl: The new hook contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type HookLogController

type HookLogController entitiesController

HookLogController is a controller for retrieve hook execution log information

func (*HookLogController) Info

func (hc *HookLogController) Info(minTs, maxTs, hookId, hook_rc int) (*hook.HookLog, error)

Info retrieves information for the hook from ID * minTs: Min timestamp to filter for. * maxTs: Max timestamp to filter for * hookId: Hook ID to filer for. * rc: return code of the hook execution to filer for. (-1 error, 0 all, 1 success)

type HooksController

type HooksController entitiesController

HooksController is a controller for create a hook or a pool of hooks

func (*HooksController) ByName

func (c *HooksController) ByName(name string) (int, error)

ByName finds a Hook ID from name

func (*HooksController) Create

func (hc *HooksController) Create(template string) (int, error)

Create allocates a new hook. It returns the new hook ID. * name: name of the hook * template: hook template.

func (*HooksController) Info

func (hc *HooksController) Info(args ...int) (*hook.Pool, error)

Info returns a hook pool. A connection to OpenNebula is performed

type HostController

type HostController entityController

HostController is a controller for host entities

func (*HostController) Delete

func (hc *HostController) Delete() error

Delete deletes the given host from the pool

func (*HostController) Info

func (hc *HostController) Info(decrypt bool) (*host.Host, error)

Info retrieves information for the host from ID

func (*HostController) Monitoring

func (hc *HostController) Monitoring() (string, error)

Monitoring returns the host monitoring records.

func (*HostController) Rename

func (hc *HostController) Rename(newName string) error

Rename renames a host. * newName: The new name.

func (*HostController) Status

func (hc *HostController) Status(status int) error

Status sets the status of the host * status: 0: ENABLED, 1: DISABLED, 2: OFFLINE

func (*HostController) Update

func (hc *HostController) Update(tpl string, uType parameters.UpdateType) error

Update adds host content.

  • tpl: The new host contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type HostsController

type HostsController entitiesController

HostsController is a controller for create an host or a pool of hosts

func (*HostsController) ByName

func (c *HostsController) ByName(name string) (int, error)

ByName finds a Host ID from name

func (*HostsController) Create

func (hc *HostsController) Create(name, im, vm string, clusterID int) (int, error)

Create allocates a new host. It returns the new host ID. * name: name of the host * im: information driver for the host * vm: virtualization driver for the host * clusterID: The cluster ID. If it is -1, the default one will be used.

func (*HostsController) Info

func (hc *HostsController) Info() (*host.Pool, error)

Info returns a host pool. A connection to OpenNebula is performed

type ImageController

type ImageController entityController

ImageController is a controller for Image entities

func (*ImageController) Chmod

func (ic *ImageController) Chmod(perm *shared.Permissions) error

Chmod changes the permissions of the image. If any perm is -1 it will not change

func (*ImageController) Chown

func (ic *ImageController) Chown(uid, gid int) error

Chown changes the owner/group of the image. If uid or gid is -1 it will not change

func (*ImageController) Chtype

func (ic *ImageController) Chtype(newType string) error

Chtype changes the type of the Image

func (*ImageController) Clone

func (ic *ImageController) Clone(cloneName string, dsid int) (int, error)

Clone clones an existing image. It returns the clone ID

func (*ImageController) Delete

func (ic *ImageController) Delete() error

Delete will remove the image from OpenNebula, which will remove it from the backend.

func (*ImageController) Enable

func (ic *ImageController) Enable(enable bool) error

Enable enables (or disables) the image

func (*ImageController) Info

func (ic *ImageController) Info(decrypt bool) (*image.Image, error)

Info connects to OpenNebula and fetches the information of the Image

func (*ImageController) Lock

func (ic *ImageController) Lock(level shared.LockLevel) error

Lock locks the image following lock level. See levels in locks.go.

func (*ImageController) Persistent

func (ic *ImageController) Persistent(persistent bool) error

Persistent sets the image as persistent (or not)

func (*ImageController) Rename

func (ic *ImageController) Rename(newName string) error

Rename changes the name of the image

func (*ImageController) Snapshot

func (ic *ImageController) Snapshot(id int) *ImageSnapshotController

Snapshot returns an Image snapshot controller

func (*ImageController) Unlock

func (ic *ImageController) Unlock() error

Unlock unlocks the image.

func (*ImageController) Update

func (ic *ImageController) Update(tpl string, uType parameters.UpdateType) error

Update adds image content.

  • tpl: The new image contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type ImageSnapshotController

type ImageSnapshotController subEntityController

ImageSnapshotController is a controller for an Image snapshot

func (*ImageSnapshotController) Delete

func (ic *ImageSnapshotController) Delete() error

Delete will delete a snapshot from the image

func (*ImageSnapshotController) Flatten

func (ic *ImageSnapshotController) Flatten() error

Flatten flattens the snapshot image and discards others

func (*ImageSnapshotController) Revert

func (ic *ImageSnapshotController) Revert() error

Revert reverts image state to a previous snapshot

type ImagesController

type ImagesController entitiesController

ImagesController is a controller for Images

func (*ImagesController) ByName

func (c *ImagesController) ByName(name string, args ...int) (int, error)

ByName returns an Image ID from name

func (*ImagesController) Create

func (ic *ImagesController) Create(template string, dsid uint) (int, error)

Create allocates a new image based on the template string provided. It returns the image ID.

func (*ImagesController) Info

func (ic *ImagesController) Info(args ...int) (*image.Pool, error)

Info returns a new image pool. It accepts the scope of the query.

type MarketPlaceAppController

type MarketPlaceAppController entityController

MarketPlaceAppController is a controller for MarketPlaceApp entities

func (*MarketPlaceAppController) Chmod

Chmod changes the permission bits of a marketplace app

func (*MarketPlaceAppController) Chown

func (mc *MarketPlaceAppController) Chown(userID, groupID int) error

Chown changes the ownership of a marketplace app. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*MarketPlaceAppController) Delete

func (mc *MarketPlaceAppController) Delete() error

Delete deletes the given marketplace app from the pool.

func (*MarketPlaceAppController) Enable

func (mc *MarketPlaceAppController) Enable(enable bool) error

Enable enables or disables a marketplace app. * enable: True for enabling, False for disabling

func (*MarketPlaceAppController) Info

Info retrieves information for the marketplace app.

func (*MarketPlaceAppController) Lock

Lock locks the marketplace app depending on blocking level. See levels in locks.go.

func (*MarketPlaceAppController) Rename

func (mc *MarketPlaceAppController) Rename(newName string) error

Rename renames a marketplace app. * newName: The new name.

func (*MarketPlaceAppController) Unlock

func (mc *MarketPlaceAppController) Unlock() error

Unlock unlocks the marketplace app.

func (*MarketPlaceAppController) Update

Update adds marketplace app content.

  • tpl: The new marketplace contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type MarketPlaceAppsController

type MarketPlaceAppsController entitiesController

MarketPlaceAppsController is a controller for a pool of MarketPlaceApps

func (*MarketPlaceAppsController) ByName

func (c *MarketPlaceAppsController) ByName(name string, args ...int) (int, error)

ByName returns a MarketPlace ID from name

func (*MarketPlaceAppsController) Create

func (mc *MarketPlaceAppsController) Create(tpl string, market int) (int, error)

Create allocates a new marketplace app. It returns the new marketplace app ID. * tpl: template of the marketplace app * market: market place ID

func (*MarketPlaceAppsController) Info

func (mc *MarketPlaceAppsController) Info(args ...int) (*marketplaceapp.Pool, error)

Info returns a marketplace app pool. A connection to OpenNebula is performed.

type MarketPlaceController

type MarketPlaceController entityController

MarketPlaceController is a controller for MarketPlace entities

func (*MarketPlaceController) Chmod

func (mc *MarketPlaceController) Chmod(perm *shared.Permissions) error

Chmod changes the permission bits of a marketplace

func (*MarketPlaceController) Chown

func (mc *MarketPlaceController) Chown(userID, groupID int) error

Chown changes the ownership of a marketplace. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*MarketPlaceController) Delete

func (mc *MarketPlaceController) Delete() error

Delete deletes the given marketplace from the pool.

func (*MarketPlaceController) Info

func (mc *MarketPlaceController) Info(decrypt bool) (*marketplace.MarketPlace, error)

Info retrieves information for the marketplace.

func (*MarketPlaceController) Rename

func (mc *MarketPlaceController) Rename(newName string) error

Rename renames a marketplace. * newName: The new name.

func (*MarketPlaceController) Update

func (mc *MarketPlaceController) Update(tpl string, uType parameters.UpdateType) error

Update adds marketplace content.

  • tpl: The new marketplace contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type MarketPlacesController

type MarketPlacesController entitiesController

MarketPlacesController is a controller for a pool of MarketPlaces

func (*MarketPlacesController) ByName

func (c *MarketPlacesController) ByName(name string) (int, error)

ByName return MarketPlace ID from name

func (*MarketPlacesController) Create

func (mc *MarketPlacesController) Create(tpl string) (int, error)

Create allocates a new marketplace. It returns the new marketplace ID. * tpl: template of the marketplace

func (*MarketPlacesController) Info

func (mc *MarketPlacesController) Info(args ...int) (*marketplace.Pool, error)

Info returns a marketplace pool. A connection to OpenNebula is performed.

type OneConfig

type OneConfig struct {
	// Token is the authentication string. In the format of <user>:<password>
	Token string

	// Endpoint contains OpenNebula's XML-RPC API endpoint. Defaults to
	// http://localhost:2633/RPC2
	Endpoint string
}

OneConfig contains the information to communicate with OpenNebula

func NewConfig

func NewConfig(user string, password string, endpoint string) OneConfig

NewConfig returns a new OneConfig object with the specified user, password, and endpoint

type RPCCaller

type RPCCaller interface {
	Call(method string, args ...interface{}) (*Response, error)
}

RPCCaller is the interface to satisfy in order to be usable by the controller

type Response

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

func (*Response) Body

func (r *Response) Body() string

Body accesses the body of the response

func (*Response) BodyInt

func (r *Response) BodyInt() int

BodyInt accesses the body of the response, if it's an int.

type SecurityGroupController

type SecurityGroupController entityController

SecurityGroupController is a controller for Security entities

func (*SecurityGroupController) Chmod

Chmod changes the permission bits of a security group

func (*SecurityGroupController) Chown

func (sc *SecurityGroupController) Chown(userID, groupID int) error

Chown changes the ownership of a security group. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*SecurityGroupController) Clone

func (sc *SecurityGroupController) Clone(cloneName string) (int, error)

Clone clones an existing security group. It returns the clone ID

func (*SecurityGroupController) Commit

func (sc *SecurityGroupController) Commit(recovery bool) error

Commit apply security group changes to associated VMs. * recovery: If set the commit operation will only operate on outdated and error VMs. If not set operate on all VMs

func (*SecurityGroupController) Delete

func (sc *SecurityGroupController) Delete() error

Delete deletes the given security group from the pool.

func (*SecurityGroupController) Info

Info retrieves information for the security group.

func (*SecurityGroupController) Rename

func (sc *SecurityGroupController) Rename(newName string) error

Rename renames a security group. * newName: The new name.

func (*SecurityGroupController) Update

func (sc *SecurityGroupController) Update(tpl string, uType parameters.UpdateType) error

Update adds security group content.

  • tpl: The new security group contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type SecurityGroupsController

type SecurityGroupsController entitiesController

SecurityGroupsController is a controller for a pool of Security

func (*SecurityGroupsController) ByName

func (c *SecurityGroupsController) ByName(name string, args ...int) (int, error)

ByName returns a SecurityGroup by Name

func (*SecurityGroupsController) Create

func (sc *SecurityGroupsController) Create(tpl string) (int, error)

Create allocates a new security group. It returns the new security group ID. * tpl: template of the security group

func (*SecurityGroupsController) Info

func (sc *SecurityGroupsController) Info(args ...int) (*securitygroup.Pool, error)

Info returns a security group pool. A connection to OpenNebula is performed.

type TemplateController

type TemplateController entityController

TemplateController is a controller for Template entities

func (*TemplateController) Chmod

func (tc *TemplateController) Chmod(perm *shared.Permissions) error

Chmod changes the permissions of a template. If any perm is -1 it will not change

func (*TemplateController) Chown

func (tc *TemplateController) Chown(uid, gid int) error

Chown changes the owner/group of a template. If uid or gid is -1 it will not change

func (*TemplateController) Clone

func (tc *TemplateController) Clone(name string, recursive bool) error

Clone an existing template. If recursive is true it will clone the template plus any image defined in DISK. The new IMAGE_ID is set into each DISK.

func (*TemplateController) Delete

func (tc *TemplateController) Delete() error

Delete will remove the template from OpenNebula.

func (*TemplateController) Info

func (tc *TemplateController) Info(extended, decrypt bool) (*template.Template, error)

Info connects to OpenNebula and fetches the information of the Template

func (*TemplateController) Instantiate

func (tc *TemplateController) Instantiate(name string, pending bool, extra string, clone bool) (int, error)

Instantiate will instantiate the template

func (*TemplateController) Lock

func (tc *TemplateController) Lock(level shared.LockLevel) error

Lock locks the template following block level. See levels in locks.go.

func (*TemplateController) Rename

func (tc *TemplateController) Rename(newName string) error

Rename changes the name of template

func (*TemplateController) Unlock

func (tc *TemplateController) Unlock() error

Unlock unlocks the template.

func (*TemplateController) Update

func (tc *TemplateController) Update(tpl string, uType parameters.UpdateType) error

Update adds template content.

  • tpl: The new template contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type TemplatesController

type TemplatesController entitiesController

TemplatesController is a controller for a pool of template

func (*TemplatesController) ByName

func (c *TemplatesController) ByName(name string, args ...int) (int, error)

ByName returns a Template by Name

func (*TemplatesController) Create

func (tc *TemplatesController) Create(template string) (int, error)

Create allocates a new template. It returns the new template ID.

func (*TemplatesController) Info

func (tc *TemplatesController) Info(args ...int) (*template.Pool, error)

Info returns a template pool. A connection to OpenNebula is performed.

type UserByNameController

type UserByNameController struct {
	Name string
	// contains filtered or unexported fields
}

UserByNameController is a controller for an user by it's name

func (*UserByNameController) Login

func (uc *UserByNameController) Login(token string, timeSeconds int, effectiveGID int) error

Login generates or sets a login token. * token: The token, if empty oned will generate one * timeSeconds: Valid period in seconds; 0 reset the token and -1 for a non-expiring token. * effectiveGID: Effective GID to use with this token. To use the current GID and user groups set it to -1

type UserController

type UserController entityController

UserController is a controller for User entities

func (*UserController) AddGroup

func (uc *UserController) AddGroup(groupID int) error

AddGroup adds the User to a secondary group. * groupID: The Group ID of the new group.

func (*UserController) Chauth

func (uc *UserController) Chauth(authDriver, password string) error

Chauth changes the authentication driver and the password for the given user. * authDriver: The new authentication driver. * password: The new password. If it is an empty string

func (*UserController) Chgrp

func (uc *UserController) Chgrp(groupID int) error

Chgrp changes the group of the given user. * groupID: The Group ID of the new group.

func (*UserController) DelGroup

func (uc *UserController) DelGroup(groupID int) error

DelGroup removes the User from a secondary group * groupID: The Group ID.

func (*UserController) Delete

func (uc *UserController) Delete() error

Delete deletes the given user from the pool.

func (*UserController) Info

func (uc *UserController) Info(decrypt bool) (*user.User, error)

Info retrieves information for the user from ID

func (*UserController) Login

func (uc *UserController) Login(token string, timeSeconds int, effectiveGID int) error

Login generates or sets a login token. * token: The token, if empty oned will generate one * timeSeconds: Valid period in seconds; 0 reset the token and -1 for a non-expiring token. * effectiveGID: Effective GID to use with this token. To use the current GID and user groups set it to -1 NOTE: This method make two XML-RPC calls, to make only one call, use UserByName(name).Login(...) method

func (*UserController) Passwd

func (uc *UserController) Passwd(password string) error

Passwd changes the password for the given user. * password: The new password

func (*UserController) Quota

func (uc *UserController) Quota(tpl string) error

Quota sets the user quota limits. * tpl: The new quota template contents. Syntax can be the usual attribute=value or XML.

func (*UserController) Update

func (uc *UserController) Update(tpl string, uType parameters.UpdateType) error

Update adds user content.

  • tpl: The new user contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type UsersController

type UsersController entitiesController

UsersController is a controller for a pool of Users

func (*UsersController) ByName

func (c *UsersController) ByName(name string) (int, error)

ByName returns a User by Name

func (*UsersController) Create

func (uc *UsersController) Create(name, password, authDriver string, groupIDs []int) (int, error)

Create allocates a new user. It returns the new user ID. * name: name of the user * password: password of the user * authDriver: auth driver * groupIDs: array of groupIDs to add to the user

func (*UsersController) Info

func (uc *UsersController) Info() (*user.Pool, error)

Info returns a user pool. A connection to OpenNebula is performed.

type VDCController

type VDCController entityController

VDCController is a controller for VDC entities

func (*VDCController) AddCluster

func (vc *VDCController) AddCluster(zoneID, clusterID int) error

AddCluster adds a cluster to the VDC * zoneID: The Zone ID. * clusterID: The Cluster ID.

func (*VDCController) AddDatastore

func (vc *VDCController) AddDatastore(zoneID, dsID int) error

AddDatastore adds a datastore to the VDC * zoneID: The Zone ID. * dsID: The Datastore ID.

func (*VDCController) AddGroup

func (vc *VDCController) AddGroup(groupID int) error

AddGroup adds a group to the VDC * groupID: The group ID.

func (*VDCController) AddHost

func (vc *VDCController) AddHost(zoneID, hostID int) error

AddHost adds a host to the VDC * zoneID: The Zone ID. * hostID: The Host ID.

func (*VDCController) AddVnet

func (vc *VDCController) AddVnet(zoneID, vnetID int) error

AddVnet adds a vnet to the VDC * zoneID: The Zone ID. * vnetID: The Vnet ID.

func (*VDCController) DelCluster

func (vc *VDCController) DelCluster(zoneID, clusterID int) error

DelCluster deletes a cluster from the VDC * zoneID: The Zone ID. * clusterID: The Cluster ID.

func (*VDCController) DelDatastore

func (vc *VDCController) DelDatastore(zoneID, dsID int) error

DelDatastore deletes a datastore from the VDC * zoneID: The Zone ID. * dsID: The Datastore ID.

func (*VDCController) DelGroup

func (vc *VDCController) DelGroup(groupID int) error

DelGroup deletes a group from the VDC * groupID: The group ID.

func (*VDCController) DelHost

func (vc *VDCController) DelHost(zoneID, hostID int) error

DelHost deletes a host from the VDC * zoneID: The Zone ID. * hostID: The Host ID.

func (*VDCController) DelVnet

func (vc *VDCController) DelVnet(zoneID, vnetID int) error

DelVnet deletes a vnet from the VDC * zoneID: The Zone ID. * vnetID: The Vnet ID.

func (*VDCController) Delete

func (vc *VDCController) Delete() error

Delete deletes the given VDC from the pool.

func (*VDCController) Info

func (vc *VDCController) Info(decrypt bool) (*vdc.VDC, error)

Info retrieves information for the VDC.

func (*VDCController) Rename

func (vc *VDCController) Rename(newName string) error

Rename renames a VDC. * newName: The new name.

func (*VDCController) Update

func (vc *VDCController) Update(tpl string, uType parameters.UpdateType) error

Update adds vdc content.

  • tpl: The new vdc contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type VDCsController

type VDCsController entitiesController

VDCsController is a controller for a pool of VDCs

func (*VDCsController) ByName

func (c *VDCsController) ByName(name string) (int, error)

ByName returns a Vdc ID from name

func (*VDCsController) Create

func (vc *VDCsController) Create(tpl string, clusterID int) (int, error)

Create allocates a new vdc. It returns the new vdc ID.

  • tpl: A string containing the template of the VDC. Syntax can be the usual attribute=value or XML.
  • clusterID: The cluster ID. If it is -1, this virtual network won’t be added to any cluster

func (*VDCsController) Info

func (vc *VDCsController) Info() (*vdc.Pool, error)

Info returns a vdc pool. A connection to OpenNebula is performed.

type VMController

type VMController entityController

VMController is a controller for VM entities

func (*VMController) Action

func (vc *VMController) Action(action string) error

Action is the generic method to run any action on the VM

func (*VMController) AttachNIC

func (vc *VMController) AttachNIC(tpl string) error

AttachNIC attaches new network interface to the virtual machine

func (*VMController) Chmod

func (vc *VMController) Chmod(perm *shared.Permissions) error

Chmod changes the permissions of a VM. If any perm is -1 it will not change

func (*VMController) Chown

func (vc *VMController) Chown(uid, gid int) error

Chown changes the owner/group of a VM. If uid or gid is -1 it will not change

func (*VMController) Delete

func (vc *VMController) Delete() error

Delete will remove the VM from OpenNebula

func (*VMController) Deploy

func (vc *VMController) Deploy(hostID int, enforce bool, dsID int) error

Deploy in the selected hostID and/or dsID. Enforce to return error in case of overcommitment. Enforce is automatically enabled for non-oneadmin users. Set dsID to -1 to let OpenNebula choose the datastore.

func (*VMController) DetachNIC

func (vc *VMController) DetachNIC(nicID int) error

DetachNIC detaches a network interface from the virtual machine

func (*VMController) Disk

func (vc *VMController) Disk(id int) *VMDiskController

Disk returns a new vm disk controller.

func (*VMController) DiskAttach

func (vc *VMController) DiskAttach(diskTemplate string) error

DiskAttach attach a new disk to the virtual machine. diskTemplate is a string containing a single DISK vector attribute. Syntax can be the usual attribute=value or XML

func (*VMController) Hold

func (vc *VMController) Hold() error

Hold action on the VM

func (*VMController) Info

func (vc *VMController) Info(decrypt bool) (*vm.VM, error)

Info connects to OpenNebula and fetches the information of the VM

func (*VMController) Lock

func (vc *VMController) Lock(level shared.LockLevel) error

Lock locks the vm following lock level. See levels in locks.go.

func (*VMController) Migrate

func (vc *VMController) Migrate(hostID int, live, enforce bool, dsID int, migrationType int) error

Migrate a VM to a target host and/or to another ds

func (*VMController) Monitoring

func (vc *VMController) Monitoring() (string, error)

Monitoring Returns the virtual machine monitoring records

func (*VMController) Poweroff

func (vc *VMController) Poweroff() error

Poweroff action on the VM

func (*VMController) PoweroffHard

func (vc *VMController) PoweroffHard() error

PoweroffHard action on the VM

func (*VMController) Reboot

func (vc *VMController) Reboot() error

Reboot action on the VM

func (*VMController) RebootHard

func (vc *VMController) RebootHard() error

RebootHard action on the VM

func (*VMController) Recover

func (vc *VMController) Recover(op int) error

Recover recovers a stuck VM that is waiting for a driver operation

func (*VMController) RecoverDelete

func (vc *VMController) RecoverDelete() error

RecoverDelete forces a delete

func (*VMController) RecoverDeleteRecreate

func (vc *VMController) RecoverDeleteRecreate() error

RecoverDeleteRecreate forces a delete

func (*VMController) RecoverFailure

func (vc *VMController) RecoverFailure() error

RecoverFailure forces a success

func (*VMController) RecoverRetry

func (vc *VMController) RecoverRetry() error

RecoverRetry forces a success

func (*VMController) RecoverSuccess

func (vc *VMController) RecoverSuccess() error

RecoverSuccess forces a success

func (*VMController) Release

func (vc *VMController) Release() error

Release action on the VM

func (*VMController) Rename

func (vc *VMController) Rename(newName string) error

Rename changes the name of a VM

func (*VMController) Resched

func (vc *VMController) Resched() error

Resched action on the VM

func (*VMController) Resize

func (vc *VMController) Resize(template string, enforce bool) error

Resize changes the capacity of the virtual machine

func (*VMController) Resume

func (vc *VMController) Resume() error

Resume action on the VM

func (*VMController) SnapshotCreate

func (vc *VMController) SnapshotCreate(name string) error

SnapshotCreate creates a new virtual machine snapshot. name can be empty

func (*VMController) SnapshotDelete

func (vc *VMController) SnapshotDelete(snapID int) error

SnapshotDelete deletes a virtual machine snapshot

func (*VMController) SnapshotRevert

func (vc *VMController) SnapshotRevert(snapID int) error

SnapshotRevert reverts a virtual machine to a snapshot

func (*VMController) Stop

func (vc *VMController) Stop() error

Stop action on the VM

func (*VMController) Suspend

func (vc *VMController) Suspend() error

Suspend action on the VM

func (*VMController) Terminate

func (vc *VMController) Terminate() error

Terminate action on the VM

func (*VMController) TerminateHard

func (vc *VMController) TerminateHard() error

TerminateHard action on the VM

func (*VMController) Undeploy

func (vc *VMController) Undeploy() error

Undeploy action on the VM

func (*VMController) UndeployHard

func (vc *VMController) UndeployHard() error

UndeployHard action on the VM

func (*VMController) Unlock

func (vc *VMController) Unlock() error

Unlock unlocks the vm.

func (*VMController) Unresched

func (vc *VMController) Unresched() error

Unresched action on the VM

func (*VMController) Update

func (vc *VMController) Update(tpl string, uType parameters.UpdateType) error

Update adds vm content.

  • tpl: The new vm contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

func (*VMController) UpdateConf

func (vc *VMController) UpdateConf(tpl string) error

UpdateConf updates (appends) a set of supported configuration attributes in the VM template

type VMDiskController

type VMDiskController subEntityController

VMDiskController is a controller for VM entities

func (*VMDiskController) Detach

func (vc *VMDiskController) Detach() error

Detach a disk from a virtual machine

func (*VMDiskController) Resize

func (vc *VMDiskController) Resize(size string) error

Resize a disk of a virtual machine

func (*VMDiskController) Saveas

func (vc *VMDiskController) Saveas(imageName, imageType string, snapID int) (int, error)

Saveas exports a disk to an image and returns the image ID. If imageType is empty the default one will be used. If snapID is -1 the current image state will be exported

func (*VMDiskController) SnapshotCreate

func (vc *VMDiskController) SnapshotCreate(description string) error

SnapshotCreate will create a snapshot of the disk image

func (*VMDiskController) SnapshotDelete

func (vc *VMDiskController) SnapshotDelete(snapID int) error

SnapshotDelete will delete a snapshot

func (*VMDiskController) SnapshotRename

func (vc *VMDiskController) SnapshotRename(snapID int, newName string) error

SnapshotRename renames a snapshot

func (*VMDiskController) SnapshotRevert

func (vc *VMDiskController) SnapshotRevert(snapID int) error

SnapshotRevert will revert disk state to a previously taken snapshot

type VMFilter

type VMFilter struct {
	Who     int
	StartID int
	EndID   int
	State   int

	// Pair is optional. Format: "KEY=VALUE"
	Pair string
}

VMFilter groups filtering criterias for VMs

func NewVMFilter

func NewVMFilter(who, start, end, state int) *VMFilter

NewVMFilter return a VM filter

func NewVMFilterDefault

func NewVMFilterDefault() *VMFilter

NewVMFilterDefault return a VM filter configured by default

func (*VMFilter) SetPair

func (f *VMFilter) SetPair(key string, value interface{}) error

SetPair set the optional argument pair to the filter

type VMGroupController

type VMGroupController entityController

VMGroupController is a controller for vm group entity

func (*VMGroupController) Chmod

func (vc *VMGroupController) Chmod(uu, um, ua, gu, gm, ga, ou, om, oa int) error

Chmod changes the permission bits of a vmGroup. * uu: USER USE bit. If set to -1, it will not change. * um: USER MANAGE bit. If set to -1, it will not change. * ua: USER ADMIN bit. If set to -1, it will not change. * gu: GROUP USE bit. If set to -1, it will not change. * gm: GROUP MANAGE bit. If set to -1, it will not change. * ga: GROUP ADMIN bit. If set to -1, it will not change. * ou: OTHER USE bit. If set to -1, it will not change. * om: OTHER MANAGE bit. If set to -1, it will not change. * oa: OTHER ADMIN bit. If set to -1, it will not change.

func (*VMGroupController) Chown

func (vc *VMGroupController) Chown(userID, groupID int) error

Chown changes the ownership of a vmGroup. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*VMGroupController) Clone

func (vc *VMGroupController) Clone(newName string) error

Clone clones an existing vmGroup. * newName: Name for the new vmGroup.

func (*VMGroupController) Delete

func (vc *VMGroupController) Delete() error

Delete deletes the given vmGroup from the pool.

func (*VMGroupController) Info

func (vc *VMGroupController) Info(decrypt bool) (*vmgroup.VMGroup, error)

Info retrieves information for the vm group.

func (*VMGroupController) Lock

func (vc *VMGroupController) Lock(level shared.LockLevel) error

Lock locks the vmGroup following lock level. See levels in locks.go.

func (*VMGroupController) Rename

func (vc *VMGroupController) Rename(newName string) error

Rename renames a vmGroup. * newName: The new name.

func (*VMGroupController) Unlock

func (vc *VMGroupController) Unlock() error

Unlock unlocks the vmGroup.

func (*VMGroupController) Update

func (vc *VMGroupController) Update(tpl string, uType int) error

Update replaces the vmGroup template content. * tpl: The new vmGroup template contents. Syntax can be the usual attribute=value or XML. * appendTemplate: Update type: 0: Replace the whole template. 1: Merge new template with the existing one.

type VMGroupsController

type VMGroupsController entitiesController

VMGroupsController is a controller for vm groups entities

func (*VMGroupsController) ByName

func (c *VMGroupsController) ByName(name string, args ...int) (int, error)

ByName returns a VMGroup ID from name

func (*VMGroupsController) Create

func (vc *VMGroupsController) Create(tpl string) (int, error)

Create allocates a new vmGroup. It returns the new vmGroup ID.

func (*VMGroupsController) Info

func (vc *VMGroupsController) Info(args ...int) (*vmgroup.Pool, error)

Info returns a vm group pool. A connection to OpenNebula is performed.

type VMsController

type VMsController entitiesController

VMsController is a controller for a pool of VMs

func (*VMsController) Accounting

func (vc *VMsController) Accounting(filter, startTime, endTime int) error

Accounting returns the virtual machine history records filter flag:

-4: Resources belonging to the user's primary group
-3: Resources belonging to the user
-2: All resources
-1: Resources belonging to the user and any of his groups
>= 0: UID User's Resources

if startTime and/or endTime are -1 it means no limit

func (*VMsController) ByName

func (c *VMsController) ByName(name string, args ...int) (int, error)

ByName returns VM ID from name

func (*VMsController) CalculateShowback

func (vc *VMsController) CalculateShowback(firstMonth, firstYear, lastMonth, lastYear int) error

CalculateShowback processes all the history records, and stores the monthly cost for each VM firstMonth: January is 1. Can be -1, in which case the time interval won't have

a left boundary.

firstYear: Can be -1, in which case the time interval won't have a left

boundary.

lastMonth: January is 1. Can be -1, in which case the time interval won't have

a right boundary.

lastYear: Can be -1, in which case the time interval won't have a right

boundary.

func (*VMsController) Create

func (vc *VMsController) Create(template string, pending bool) (int, error)

Create allocates a new VM based on the template string provided. It returns the image ID

func (*VMsController) Info

func (vc *VMsController) Info(args ...int) (*vm.Pool, error)

Info returns a new VM pool. It accepts the scope of the query.

func (*VMsController) InfoExtended

func (vc *VMsController) InfoExtended(args ...int) (*vm.Pool, error)

InfoExtended connects to OpenNebula and fetches the whole VM_POOL information

func (*VMsController) InfoExtendedFilter

func (vc *VMsController) InfoExtendedFilter(f *VMFilter) (*vm.Pool, error)

InfoExtendedFilter connects to OpenNebula and fetches the whole VM_POOL information

func (*VMsController) InfoFilter

func (vc *VMsController) InfoFilter(f *VMFilter) (*vm.Pool, error)

InfoFilter returns a new VM pool. It accepts the scope of the query.

func (*VMsController) Monitoring

func (vc *VMsController) Monitoring(filter int) (string, error)

Monitoring returns all the virtual machine monitoring records filter flag: -4: Resources belonging to the user's primary group -3: Resources belonging to the user -2: All resources -1: Resources belonging to the user and any of his groups >= 0: UID User's Resources

func (*VMsController) Showback

func (vc *VMsController) Showback(filter, firstMonth, firstYear, lastMonth, lastYear int) (string, error)

Showback returns the virtual machine showback records filter flag

<= -3: Connected user's resources
-2: All resources
-1: Connected user's and his group's resources
>= 0: UID User's Resources

firstMonth: January is 1. Can be -1, in which case the time interval won't have

a left boundary.

firstYear: Can be -1, in which case the time interval won't have a left

boundary.

lastMonth: January is 1. Can be -1, in which case the time interval won't have

a right boundary.

lastYear: Can be -1, in which case the time interval won't have a right

boundary.

type VNTemplateController

type VNTemplateController entityController

VNTemplateController is a controller for VNTemplate entities

func (*VNTemplateController) Chmod

func (vc *VNTemplateController) Chmod(perm *shared.Permissions) error

Chmod changes the permissions of a vntemplate. If any perm is -1 it will not change

func (*VNTemplateController) Chown

func (vc *VNTemplateController) Chown(uid, gid int) error

Chown changes the owner/group of a vntemplate. If uid or gid is -1 it will not change

func (*VNTemplateController) Clone

func (vc *VNTemplateController) Clone(name string) error

Clone an existing vntemplate.

func (*VNTemplateController) Create

func (vc *VNTemplateController) Create(vntemplate string) (int, error)

Create allocates a new vntemplate. It returns the new vntemplate ID.

func (*VNTemplateController) Delete

func (vc *VNTemplateController) Delete() error

Delete will remove the vntemplate from OpenNebula.

func (*VNTemplateController) Info

func (vc *VNTemplateController) Info(decrypt bool) (*vntemplate.VNTemplate, error)

Info connects to OpenNebula and fetches the information of the VNTemplate

func (*VNTemplateController) Instantiate

func (vc *VNTemplateController) Instantiate(name string, extra string) (int, error)

Instantiate will instantiate the template

func (*VNTemplateController) Lock

func (vc *VNTemplateController) Lock(level shared.LockLevel) error

Lock an existing vntemplate. See levels in locks.go.

func (*VNTemplateController) Rename

func (vc *VNTemplateController) Rename(newName string) error

Rename changes the name of vntemplate

func (*VNTemplateController) Unlock

func (vc *VNTemplateController) Unlock() error

Unlock an existing vntemplate

func (*VNTemplateController) Update

func (vc *VNTemplateController) Update(tpl string, uType parameters.UpdateType) error

Update adds vntemplate content.

  • tpl: The new vntemplate contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type VNTemplatesController

type VNTemplatesController entitiesController

VNTemplatesController is a controller for a pool of VNTemplate

func (*VNTemplatesController) ByName

func (c *VNTemplatesController) ByName(name string) (int, error)

ByName returns a VNTemplate id from name

func (*VNTemplatesController) Info

func (vc *VNTemplatesController) Info(args ...int) (*vntemplate.Pool, error)

Info returns a vntemplate pool. A connection to OpenNebula is performed.

type VirtualNetworkController

type VirtualNetworkController entityController

VirtualNetworkController is a controller for VirtualNetwork entities

func (*VirtualNetworkController) AddAR

func (vc *VirtualNetworkController) AddAR(tpl string) error

AddAR adds address ranges to a virtual network. * tpl: template of the address ranges to add. Syntax can be the usual attribute=value or XML

func (*VirtualNetworkController) Chmod

Chmod changes the permission bits of a virtual network.

func (*VirtualNetworkController) Chown

func (vc *VirtualNetworkController) Chown(userID, groupID int) error

Chown changes the ownership of a virtual network. * userID: The User ID of the new owner. If set to -1, it will not change. * groupID: The Group ID of the new group. If set to -1, it will not change.

func (*VirtualNetworkController) Delete

func (vc *VirtualNetworkController) Delete() error

Delete deletes the given virtual network from the pool.

func (*VirtualNetworkController) FreeAR

func (vc *VirtualNetworkController) FreeAR(arID int) error

FreeAR frees a reserved address range from a virtual network. * arID: ID of the address range to free.

func (*VirtualNetworkController) Hold

func (vc *VirtualNetworkController) Hold(tpl string) error

Hold holds a virtual network Lease as used. * tpl: template of the lease to hold

func (*VirtualNetworkController) Info

func (vc *VirtualNetworkController) Info(decrypt bool) (*vn.VirtualNetwork, error)

Info retrieves information for the virtual network.

func (*VirtualNetworkController) Lock

Lock locks the vn following lock level. See levels in locks.go.

func (*VirtualNetworkController) Release

func (vc *VirtualNetworkController) Release(tpl string) error

Release releases a virtual network Lease on hold. * tpl: template of the lease to release

func (*VirtualNetworkController) Rename

func (vc *VirtualNetworkController) Rename(newName string) error

Rename renames a virtual network. * newName: The new name.

func (*VirtualNetworkController) Reserve

func (vc *VirtualNetworkController) Reserve(tpl string) (int, error)

Reserve reserve network addresses. It returns the Reserved Virtual Network ID * tpl: Template

func (*VirtualNetworkController) RmAR

func (vc *VirtualNetworkController) RmAR(arID int) error

RmAR removes an address range from a virtual network. * arID: ID of the address range to remove.

func (*VirtualNetworkController) Unlock

func (vc *VirtualNetworkController) Unlock() error

Unlock unlocks the vn.

func (*VirtualNetworkController) Update

Update adds virtual network content.

  • tpl: The new virtual network contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

func (*VirtualNetworkController) UpdateAR

func (vc *VirtualNetworkController) UpdateAR(tpl string) error

UpdateAR updates the attributes of an address range. * tpl: template of the address ranges to update. Syntax can be the usual attribute=value or XML

type VirtualNetworksController

type VirtualNetworksController entitiesController

VirtualNetworksController is a controller for a pool of VirtualNetworks

func (*VirtualNetworksController) ByName

func (c *VirtualNetworksController) ByName(name string, args ...int) (int, error)

ByName returns a VirtualNetwork ID from name

func (*VirtualNetworksController) Create

func (vc *VirtualNetworksController) Create(tpl string, clusterID int) (int, error)

Create allocates a new virtualnetwork. It returns the new virtualnetwork ID. * tpl: template of the virtualnetwork * clusterID: The cluster ID. If it is -1, the default one will be used.

func (*VirtualNetworksController) Info

func (vc *VirtualNetworksController) Info(args ...int) (*vn.Pool, error)

Info returns a virtualnetwork pool.

type VirtualRouterController

type VirtualRouterController entityController

VirtualRouterController is a controller for VirtualRouter entities

func (*VirtualRouterController) AttachNic

func (vc *VirtualRouterController) AttachNic(tpl string) error

AttachNic attaches a new network interface to the virtual router and the virtual machines. * tpl: NIC template string

func (*VirtualRouterController) Chmod

Chmod changes the permissions of a virtual router. If any perm is -1 it will not change

func (*VirtualRouterController) Chown

func (vc *VirtualRouterController) Chown(uid, gid int) error

Chown changes the owner/group of a virtual router. If uid or gid is -1 it will not change

func (*VirtualRouterController) Delete

func (vc *VirtualRouterController) Delete() error

Delete will remove the virtual router from OpenNebula.

func (*VirtualRouterController) DetachNic

func (vc *VirtualRouterController) DetachNic(nicid int) error

DetachNic detaches a network interface from the virtual router and the virtual machines * nicid: NIC ID to detach

func (*VirtualRouterController) Info

func (vc *VirtualRouterController) Info(decrypt bool) (*vr.VirtualRouter, error)

Info connects to OpenNebula and fetches the information of the VirtualRouter

func (*VirtualRouterController) Instantiate

func (vc *VirtualRouterController) Instantiate(number, tplid int, name string, hold bool, extra string) (int, error)

Instantiate will instantiate the virtual router. It returns the ID of the new VM * number: Number of VMs to instantiate. * tplid: VM Template id to instantiate. * name: Name for the VM instances. If it is an empty string OpenNebula will set a default name. Wildcard %i can be used. * hold: False to create the VM on pending (default), True to create it on hold. * extra: A string containing an extra template to be merged with the one being instantiated. It can be empty. Syntax can be the usual attribute=value or XML.

func (*VirtualRouterController) Lock

Lock locks the virtual router depending on blocking level. See levels in locks.go.

func (*VirtualRouterController) Rename

func (vc *VirtualRouterController) Rename(newName string) error

Rename changes the name of virtual router

func (*VirtualRouterController) Unlock

func (vc *VirtualRouterController) Unlock() error

Unlock unlocks the virtual router.

func (*VirtualRouterController) Update

func (vc *VirtualRouterController) Update(tpl string, uType parameters.UpdateType) error

Update adds virtual router content.

  • tpl: The new virtual router contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type VirtualRoutersController

type VirtualRoutersController entitiesController

VirtualRoutersController is a controller for a pool of VirtualRouters

func (*VirtualRoutersController) Create

func (vc *VirtualRoutersController) Create(tpl string) (int, error)

Create allocates a new virtual router. It returns the new Virtual Router ID * tpl: template of the marketplace

func (*VirtualRoutersController) Info

func (vc *VirtualRoutersController) Info(args ...int) (*vr.Pool, error)

Info returns a virtual router pool. A connection to OpenNebula is performed.

type ZoneController

type ZoneController entityController

ZoneController is a controller for Zone entities

func (*ZoneController) Delete

func (zc *ZoneController) Delete() error

Delete deletes the given zone from the pool.

func (*ZoneController) Info

func (zc *ZoneController) Info(decrypt bool) (*zone.Zone, error)

Info retrieves information for the zone.

func (*ZoneController) Rename

func (zc *ZoneController) Rename(newName string) error

Rename renames a zone. * newName: The new name.

func (*ZoneController) Update

func (zc *ZoneController) Update(tpl string, uType parameters.UpdateType) error

Update adds zone content.

  • tpl: The new zone contents. Syntax can be the usual attribute=value or XML.
  • uType: Update type: Replace: Replace the whole template. Merge: Merge new template with the existing one.

type ZonesController

type ZonesController entitiesController

ZonesController is a controller for a pool of Zones

func (*ZonesController) ByName

func (c *ZonesController) ByName(name string) (int, error)

ByName returns a zone id from name

func (*ZonesController) Create

func (zc *ZonesController) Create(tpl string, clusterID int) (int, error)

Create allocates a new zone. It returns the new zc.ID.

  • tpl: A string containing the template of the ZONE. Syntax can be the usual attribute=value or XML.
  • clusterID: The id of the cluster. If -1, the default one will be used

func (*ZonesController) Info

func (zc *ZonesController) Info() (*zone.Pool, error)

Info returns a zone pool. A connection to OpenNebula is performed.

func (*ZonesController) ServerRaftStatus

func (zc *ZonesController) ServerRaftStatus() (*zone.ServerRaftStatus, error)

ServerRaftStatus give the raft status of the server behind the current RPC endpoint. To get endpoints make an info call.

Directories

Path Synopsis
schemas
acl
vdc
vm
vm/keys
-------------------------------------------------------------------------- Copyright 2002-2019, OpenNebula Project, OpenNebula Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
-------------------------------------------------------------------------- Copyright 2002-2019, OpenNebula Project, OpenNebula Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

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