mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
change ruby oca documentation to play better with yardoc
This commit is contained in:
parent
8d7a76edd7
commit
6090b3f6b4
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
begin # require 'rubygems'
|
||||
require 'rubygems'
|
||||
rescue Exception
|
||||
@ -44,12 +45,10 @@ require 'OpenNebula/AclPool'
|
||||
|
||||
module OpenNebula
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# The Error Class represents a generic error in the OpenNebula
|
||||
# library. It contains a readable representation of the error.
|
||||
# Any function in the OpenNebula module will return an Error
|
||||
# object in case of error.
|
||||
# -------------------------------------------------------------------------
|
||||
class Error
|
||||
attr_reader :message
|
||||
|
||||
@ -63,18 +62,14 @@ module OpenNebula
|
||||
end
|
||||
end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Returns true if the object returned by a method of the OpenNebula
|
||||
# library is an Error
|
||||
# -------------------------------------------------------------------------
|
||||
def self.is_error?(value)
|
||||
value.class==OpenNebula::Error
|
||||
end
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# The client class, represents the connection with the core and handles the
|
||||
# xml-rpc calls.
|
||||
# -------------------------------------------------------------------------
|
||||
class Client
|
||||
attr_accessor :one_auth
|
||||
|
||||
|
@ -14,7 +14,9 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
module OpenNebula
|
||||
|
||||
# Abstract rules of the type USER RESOURCE RIGHTS
|
||||
# which are:
|
||||
# USER -> #<num>
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -22,15 +23,15 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
ACL_POOL_METHODS = {
|
||||
:info => "acl.info",
|
||||
:addrule => "acl.addrule",
|
||||
:delrule => "acl.delrule"
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Class constructor
|
||||
#######################################################################
|
||||
def initialize(client)
|
||||
super('ACL_POOL','ACL',client)
|
||||
end
|
||||
|
@ -14,13 +14,16 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class Group < PoolElement
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
GROUP_METHODS = {
|
||||
:info => "group.info",
|
||||
:allocate => "group.allocate",
|
||||
@ -54,18 +57,16 @@ module OpenNebula
|
||||
XMLElement.build_xml(group_xml,'GROUP')
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Class constructor
|
||||
# ---------------------------------------------------------------------
|
||||
def initialize(xml, client)
|
||||
super(xml,client)
|
||||
|
||||
@client = client
|
||||
end
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
#######################################################################
|
||||
# Group utils
|
||||
# --------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Creates ACLs for the group. The ACL rules are described in a file
|
||||
def create_acls(filename = GROUP_DEFAULT)
|
||||
@ -100,9 +101,9 @@ module OpenNebula
|
||||
return 0, msg
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the Group Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves the information of the given Group.
|
||||
def info()
|
||||
@ -128,7 +129,7 @@ module OpenNebula
|
||||
# Returns whether or not the user with id 'uid' is part of this group
|
||||
def contains(uid)
|
||||
# This doesn't work in ruby 1.8.5
|
||||
# return self["USERS/ID[.=#{uid}]"] != nil
|
||||
# return self["USERS/ID[.=#{uid}]"] != nil
|
||||
|
||||
id_array = retrieve_elements('USERS/ID')
|
||||
return id_array != nil && id_array.include?(uid.to_s)
|
||||
|
@ -14,21 +14,23 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class GroupPool < Pool
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class attribute accessors
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
GROUP_POOL_METHODS = {
|
||||
:info => "grouppool.info"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# +client+ a Client object that represents a XML-RPC connection
|
||||
def initialize(client)
|
||||
@ -40,13 +42,13 @@ module OpenNebula
|
||||
OpenNebula::Group.new(element_xml,@client)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the User Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all the Groups in the pool.
|
||||
def info()
|
||||
super(GROUP_POOL_METHODS[:info])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -21,6 +22,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
HOST_METHODS = {
|
||||
:info => "host.info",
|
||||
:allocate => "host.allocate",
|
||||
@ -56,9 +59,7 @@ module OpenNebula
|
||||
XMLElement.build_xml(host_xml, 'HOST')
|
||||
end
|
||||
|
||||
#######################################################################
|
||||
# Class constructor
|
||||
#######################################################################
|
||||
def initialize(xml, client)
|
||||
super(xml,client)
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -22,6 +23,7 @@ module OpenNebula
|
||||
# Constants and Class attribute accessors
|
||||
#######################################################################
|
||||
|
||||
|
||||
HOST_POOL_METHODS = {
|
||||
:info => "hostpool.info"
|
||||
}
|
||||
@ -29,7 +31,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
# +client+ a Client object that represents a XML-RPC connection
|
||||
def initialize(client)
|
||||
super('HOST_POOL','HOST',client)
|
||||
|
@ -14,14 +14,17 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
require 'fileutils'
|
||||
|
||||
module OpenNebula
|
||||
class Image < PoolElement
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
IMAGE_METHODS = {
|
||||
:info => "image.info",
|
||||
:allocate => "image.allocate",
|
||||
@ -118,7 +121,7 @@ module OpenNebula
|
||||
def unpublish
|
||||
set_publish(false)
|
||||
end
|
||||
|
||||
|
||||
# Makes the Image persistent
|
||||
def persistent
|
||||
set_persistent(true)
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -21,7 +22,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Constants and Class attribute accessors
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
IMAGE_POOL_METHODS = {
|
||||
:info => "imagepool.info"
|
||||
}
|
||||
@ -29,7 +31,7 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
# +client+ a Client object that represents a XML-RPC connection
|
||||
# +user_id+ is to refer to a Pool with Images from that user
|
||||
def initialize(client, user_id=-1)
|
||||
|
@ -14,10 +14,11 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
module OpenNebula
|
||||
|
||||
# The Pool class represents a generic OpenNebula Pool in XML format
|
||||
# and provides the basic functionality to handle the Pool elements
|
||||
|
||||
class Pool < XMLPool
|
||||
include Enumerable
|
||||
|
||||
|
@ -14,13 +14,16 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class Template < PoolElement
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
TEMPLATE_METHODS = {
|
||||
:allocate => "template.allocate",
|
||||
:instantiate => "template.instantiate",
|
||||
@ -48,18 +51,16 @@ module OpenNebula
|
||||
XMLElement.build_xml(obj_xml,'VMTEMPLATE')
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Class constructor
|
||||
# ---------------------------------------------------------------------
|
||||
def initialize(xml, client)
|
||||
super(xml,client)
|
||||
|
||||
@client = client
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the Template Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves the information of the given Template.
|
||||
def info()
|
||||
@ -118,9 +119,9 @@ module OpenNebula
|
||||
super(TEMPLATE_METHODS[:chown], uid, gid)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Helpers to get Template information
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Returns the group identifier
|
||||
# [return] _Integer_ the element's group ID
|
||||
|
@ -14,21 +14,23 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class TemplatePool < Pool
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class attribute accessors
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
TEMPLATE_POOL_METHODS = {
|
||||
:info => "templatepool.info"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# +client+ a Client object that represents an XML-RPC connection
|
||||
# +user_id+ used to refer to a Pool with Templates from that user
|
||||
@ -43,9 +45,10 @@ module OpenNebula
|
||||
OpenNebula::Template.new(element_xml,@client)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the Template Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
def info(*args)
|
||||
case args.size
|
||||
|
@ -14,13 +14,16 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class User < PoolElement
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
USER_METHODS = {
|
||||
:info => "user.info",
|
||||
:allocate => "user.allocate",
|
||||
@ -48,18 +51,16 @@ module OpenNebula
|
||||
XMLElement.build_xml(user_xml, 'USER')
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Class constructor
|
||||
# ---------------------------------------------------------------------
|
||||
def initialize(xml, client)
|
||||
super(xml,client)
|
||||
|
||||
@client = client
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the User Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves the information of the given User.
|
||||
def info()
|
||||
@ -104,9 +105,9 @@ module OpenNebula
|
||||
return rc
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Helpers to get User information
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Returns the group identifier
|
||||
# [return] _Integer_ the element's group ID
|
||||
|
@ -14,22 +14,23 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class UserPool < Pool
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class attribute accessors
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
USER_POOL_METHODS = {
|
||||
:info => "userpool.info"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
#######################################################################
|
||||
|
||||
# +client+ a Client object that represents a XML-RPC connection
|
||||
def initialize(client)
|
||||
super('USER_POOL','USER',client)
|
||||
@ -40,9 +41,9 @@ module OpenNebula
|
||||
OpenNebula::User.new(element_xml,@client)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the User Object
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all the Users in the pool.
|
||||
def info()
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -21,6 +22,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
VM_METHODS = {
|
||||
:info => "vm.info",
|
||||
:allocate => "vm.allocate",
|
||||
@ -101,9 +104,7 @@ module OpenNebula
|
||||
reason_str
|
||||
end
|
||||
|
||||
#######################################################################
|
||||
# Class constructor
|
||||
#######################################################################
|
||||
def initialize(xml, client)
|
||||
super(xml,client)
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -22,6 +23,7 @@ module OpenNebula
|
||||
# Constants and Class attribute accessors
|
||||
#######################################################################
|
||||
|
||||
|
||||
VM_POOL_METHODS = {
|
||||
:info => "vmpool.info"
|
||||
}
|
||||
@ -33,7 +35,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Class constructor & Pool Methods
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
# +client+ a Client object that represents a XML-RPC connection
|
||||
# +user_id+ is to refer to a Pool with VirtualMachines from that user
|
||||
def initialize(client, user_id=0)
|
||||
@ -50,7 +53,7 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# XML-RPC Methods for the Virtual Network Object
|
||||
#######################################################################
|
||||
|
||||
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
# No arguments, returns the not-in-done VMs for the user
|
||||
# [user_id, start_id, end_id]
|
||||
@ -107,9 +110,9 @@ module OpenNebula
|
||||
-1,
|
||||
INFO_NOT_DONE)
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def info_filter(xml_method, who, start_id, end_id, state)
|
||||
return xmlrpc_info(xml_method, who, start_id, end_id, state)
|
||||
end
|
||||
|
@ -14,13 +14,16 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
class VirtualNetwork < PoolElement
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Constants and Class Methods
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
|
||||
VN_METHODS = {
|
||||
:info => "vn.info",
|
||||
:allocate => "vn.allocate",
|
||||
@ -127,9 +130,9 @@ module OpenNebula
|
||||
super(VN_METHODS[:chown], uid, gid)
|
||||
end
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
# Helpers to get VirtualNetwork information
|
||||
# ---------------------------------------------------------------------
|
||||
#######################################################################
|
||||
|
||||
# Returns the group identifier
|
||||
# [return] _Integer_ the element's group ID
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
require 'OpenNebula/Pool'
|
||||
|
||||
module OpenNebula
|
||||
@ -21,7 +22,8 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Constants and Class attribute accessors
|
||||
#######################################################################
|
||||
|
||||
|
||||
|
||||
VN_POOL_METHODS = {
|
||||
:info => "vnpool.info"
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
|
||||
module OpenNebula
|
||||
|
||||
begin
|
||||
@ -30,11 +31,9 @@ module OpenNebula
|
||||
REXML_FORMATTERS=false
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
# The XMLElement class provides an abstraction of the underlying
|
||||
# XML parser engine. It provides XML-related methods for the Pool and
|
||||
# PoolElement classes
|
||||
###########################################################################
|
||||
class XMLElement
|
||||
|
||||
# xml:: _opaque xml object_ an xml object as returned by build_xml
|
||||
@ -310,10 +309,8 @@ module OpenNebula
|
||||
end
|
||||
end
|
||||
|
||||
###########################################################################
|
||||
# The XMLUtilsPool module provides an abstraction of the underlying
|
||||
# XML parser engine. It provides XML-related methods for the Pools
|
||||
###########################################################################
|
||||
class XMLPool < XMLElement
|
||||
|
||||
def initialize(xml=nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user