Revision 3ccedecb
src/oca/ruby/OpenNebula/GroupPool.rb | ||
---|---|---|
25 | 25 |
|
26 | 26 |
|
27 | 27 |
GROUP_POOL_METHODS = { |
28 |
:info => "grouppool.info", |
|
29 |
:quotainfo => "groupquota.info", |
|
30 |
:quotaupdate => "groupquota.update" |
|
28 |
:info => "grouppool.info" |
|
31 | 29 |
} |
32 | 30 |
|
33 | 31 |
####################################################################### |
... | ... | |
39 | 37 |
super('GROUP_POOL','GROUP',client) |
40 | 38 |
end |
41 | 39 |
|
42 |
# Factory method to create Group objects
|
|
40 |
# Factory method to create User objects
|
|
43 | 41 |
def factory(element_xml) |
44 | 42 |
OpenNebula::Group.new(element_xml,@client) |
45 | 43 |
end |
46 | 44 |
|
47 | 45 |
####################################################################### |
48 |
# XML-RPC Methods for the GroupPool Object
|
|
46 |
# XML-RPC Methods for the User Object
|
|
49 | 47 |
####################################################################### |
50 | 48 |
|
51 | 49 |
# Retrieves all the Groups in the pool. |
52 | 50 |
def info() |
53 | 51 |
super(GROUP_POOL_METHODS[:info]) |
54 | 52 |
end |
55 |
|
|
56 |
# Gets the default group quota limits |
|
57 |
# |
|
58 |
# @return [String, OpenNebula::Error] the default group quota in case |
|
59 |
# of success, Error otherwise |
|
60 |
def get_quota() |
|
61 |
return @client.call(GROUP_POOL_METHODS[:quotainfo]) |
|
62 |
end |
|
63 |
|
|
64 |
# Sets the default group quota limits |
|
65 |
# @param quota [String] a template (XML or txt) with the new quota limits |
|
66 |
# |
|
67 |
# @return [nil, OpenNebula::Error] nil in case of success, Error |
|
68 |
# otherwise |
|
69 |
def set_quota(quota) |
|
70 |
return call(GROUP_POOL_METHODS[:quotaupdate], quota) |
|
71 |
end |
|
72 | 53 |
end |
73 | 54 |
end |
src/oca/ruby/OpenNebula/Pool.rb | ||
---|---|---|
48 | 48 |
# Common XML-RPC Methods for all the Pool Types |
49 | 49 |
####################################################################### |
50 | 50 |
|
51 |
# Common client call wrapper. Returns nil instead of the response |
|
52 |
# if it is successful |
|
53 |
# |
|
54 |
# @param [String] xml_method xml-rpc method |
|
55 |
# @param [Array] args any arguments for the xml-rpc method |
|
56 |
# |
|
57 |
# @return [nil, OpenNebula::Error] nil in case of success, Error |
|
58 |
# otherwise |
|
59 |
def call(xml_method, *args) |
|
60 |
rc = @client.call(xml_method, *args) |
|
61 |
rc = nil if !OpenNebula.is_error?(rc) |
|
62 |
|
|
63 |
return rc |
|
64 |
end |
|
65 |
|
|
66 | 51 |
#Gets the pool without any filter. Host, Group and User Pools |
67 | 52 |
# xml_method:: _String_ the name of the XML-RPC method |
68 | 53 |
def info(xml_method) |
src/oca/ruby/OpenNebula/UserPool.rb | ||
---|---|---|
24 | 24 |
####################################################################### |
25 | 25 |
|
26 | 26 |
USER_POOL_METHODS = { |
27 |
:info => "userpool.info", |
|
28 |
:quotainfo => "userquota.info", |
|
29 |
:quotaupdate => "userquota.update" |
|
27 |
:info => "userpool.info" |
|
30 | 28 |
} |
31 | 29 |
|
32 | 30 |
####################################################################### |
... | ... | |
44 | 42 |
end |
45 | 43 |
|
46 | 44 |
####################################################################### |
47 |
# XML-RPC Methods for the UserPool Object
|
|
45 |
# XML-RPC Methods for the User Object |
|
48 | 46 |
####################################################################### |
49 | 47 |
|
50 | 48 |
# Retrieves all the Users in the pool. |
51 | 49 |
def info() |
52 | 50 |
super(USER_POOL_METHODS[:info]) |
53 | 51 |
end |
54 |
|
|
55 |
# Gets the default user quota limits |
|
56 |
# |
|
57 |
# @return [String, OpenNebula::Error] the default user quota in case |
|
58 |
# of success, Error otherwise |
|
59 |
def get_quota() |
|
60 |
return @client.call(USER_POOL_METHODS[:quotainfo]) |
|
61 |
end |
|
62 |
|
|
63 |
# Sets the default user quota limits |
|
64 |
# @param quota [String] a template (XML or txt) with the new quota limits |
|
65 |
# |
|
66 |
# @return [nil, OpenNebula::Error] nil in case of success, Error |
|
67 |
# otherwise |
|
68 |
def set_quota(quota) |
|
69 |
return call(USER_POOL_METHODS[:quotaupdate], quota) |
|
70 |
end |
|
71 | 52 |
end |
72 | 53 |
end |
Also available in: Unified diff