mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #696: Upgraded OCA (Ruby) API to match new filter functionality in pool.info methods
This commit is contained in:
parent
9e21a2adc6
commit
953c02c792
@ -47,9 +47,26 @@ module OpenNebula
|
||||
# XML-RPC Methods for the Image Object
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all or part of the Images in the pool.
|
||||
def info()
|
||||
super(IMAGE_POOL_METHODS[:info],@user_id)
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
def info(*args)
|
||||
case args.size
|
||||
when 0
|
||||
info_filter(IMAGE_POOL_METHODS[:info],@user_id,-1,-1)
|
||||
when 3
|
||||
info_filter(IMAGE_POOL_METHODS[:info],args[0],args[1],args[2])
|
||||
end
|
||||
end
|
||||
|
||||
def info_all()
|
||||
return super(IMAGE_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_mine()
|
||||
return super(IMAGE_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_group()
|
||||
return super(IMAGE_POOL_METHODS[:info])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -22,6 +22,10 @@ module OpenNebula
|
||||
include Enumerable
|
||||
|
||||
protected
|
||||
# Constants for info queries (include/RequestManagerPoolInfoFilter.h)
|
||||
INFO_GROUP = -1
|
||||
INFO_ALL = -2
|
||||
INFO_MINE = -3
|
||||
|
||||
#pool:: _String_ XML name of the root element
|
||||
#element:: _String_ XML name of the Pool elements
|
||||
@ -48,13 +52,36 @@ module OpenNebula
|
||||
#######################################################################
|
||||
# Common XML-RPC Methods for all the Pool Types
|
||||
#######################################################################
|
||||
|
||||
#Gets the pool without any filter. Host, Group and User Pools
|
||||
# xml_method:: _String_ the name of the XML-RPC method
|
||||
def info(xml_method)
|
||||
return xmlrpc_info(xml_method)
|
||||
end
|
||||
|
||||
def info_all(xml_method)
|
||||
return xmlrpc_info(xml_method,INFO_ALL,-1,-1)
|
||||
end
|
||||
|
||||
def info_mine(xml_method)
|
||||
return xmlrpc_info(xml_method,INFO_MINE,-1,-1)
|
||||
end
|
||||
|
||||
def info_group(xml_method)
|
||||
return xmlrpc_info(xml_method,INFO_GROUP,-1,-1)
|
||||
end
|
||||
|
||||
def info_filter(xml_method, who, start_id, end_id)
|
||||
return xmlrpc_info(xml_method,who, start_id, end_id)
|
||||
end
|
||||
|
||||
private
|
||||
# Calls to the corresponding info method to retreive the pool
|
||||
# representation in XML format
|
||||
# xml_method:: _String_ the name of the XML-RPC method
|
||||
# args:: _Array_ with additional arguments for the info call
|
||||
# [return] nil in case of success or an Error object
|
||||
def info(xml_method,*args)
|
||||
def xmlrpc_info(xml_method,*args)
|
||||
rc = @client.call(xml_method,*args)
|
||||
|
||||
if !OpenNebula.is_error?(rc)
|
||||
|
@ -46,10 +46,26 @@ module OpenNebula
|
||||
# ---------------------------------------------------------------------
|
||||
# XML-RPC Methods for the Template Object
|
||||
# ---------------------------------------------------------------------
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
def info(*args)
|
||||
case args.size
|
||||
when 0
|
||||
info_filter(TEMPLATE_POOL_METHODS[:info],@user_id,-1,-1)
|
||||
when 3
|
||||
info_filter(TEMPLATE_POOL_METHODS[:info],args[0],args[1],args[2])
|
||||
end
|
||||
end
|
||||
|
||||
# Retrieves all the Templates in the pool.
|
||||
def info()
|
||||
super(TEMPLATE_POOL_METHODS[:info], @user_id)
|
||||
def info_all()
|
||||
return super(TEMPLATE_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_mine()
|
||||
return super(TEMPLATE_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_group()
|
||||
return super(TEMPLATE_POOL_METHODS[:info])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -48,8 +48,25 @@ module OpenNebula
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
def info()
|
||||
super(VM_POOL_METHODS[:info],@user_id)
|
||||
def info(*args)
|
||||
case args.size
|
||||
when 0
|
||||
info_filter(VM_POOL_METHODS[:info],@user_id,-1,-1)
|
||||
when 3
|
||||
info_filter(VM_POOL_METHODS[:info],args[0],args[1],args[2])
|
||||
end
|
||||
end
|
||||
|
||||
def info_all()
|
||||
return super(VM_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_mine()
|
||||
return super(VM_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_group()
|
||||
return super(VM_POOL_METHODS[:info])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -47,9 +47,26 @@ module OpenNebula
|
||||
# XML-RPC Methods for the Virtual Network Object
|
||||
#######################################################################
|
||||
|
||||
# Retrieves all or part of the VirtualNetwork in the pool.
|
||||
def info()
|
||||
super(VN_POOL_METHODS[:info],@user_id)
|
||||
# Retrieves all or part of the VirtualMachines in the pool.
|
||||
def info(*args)
|
||||
case args.size
|
||||
when 0
|
||||
info_filter(VN_POOL_METHODS[:info],@user_id,-1,-1)
|
||||
when 3
|
||||
info_filter(VN_POOL_METHODS[:info],args[0],args[1],args[2])
|
||||
end
|
||||
end
|
||||
|
||||
def info_all()
|
||||
return super(VN_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_mine()
|
||||
return super(VN_POOL_METHODS[:info])
|
||||
end
|
||||
|
||||
def info_group()
|
||||
return super(VN_POOL_METHODS[:info])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user