class OpenNebula::MarketPlace
Constants
- MARKETPLACE_METHODS
Constants and Class Methods
Public Class Methods
Creates a MarketPlace
description with just its identifier this method should be used to create plain MarketPlace
objects. id
the id of the user
Example:
marketplace = MarketPlace.new(MarketPlace.build_xml(3),rpc_client)
# File lib/opennebula/marketplace.rb, line 42 def MarketPlace.build_xml(pe_id=nil) if pe_id marketplace_xml = "<MARKETPLACE><ID>#{pe_id}</ID></MARKETPLACE>" else marketplace_xml = "<MARKETPLACE></MARKETPLACE>" end XMLElement.build_xml(marketplace_xml,'MARKETPLACE') end
Class constructor
# File lib/opennebula/marketplace.rb, line 53 def initialize(xml, client) super(xml,client) end
Public Instance Methods
Allocates a new marketplace in OpenNebula
@param description [String] The template of the marketplace.
@return [Integer, OpenNebula::Error
] the new ID in case of
success, error otherwise
# File lib/opennebula/marketplace.rb, line 74 def allocate(description) super(MARKETPLACE_METHODS[:allocate], description) end
Changes the marketplace permissions. Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
@return [nil, OpenNebula::Error
] nil in case of success, Error
otherwise
# File lib/opennebula/marketplace.rb, line 120 def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) super(MARKETPLACE_METHODS[:chmod], owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) end
Changes the marketplace permissions.
@param octet [String] Permissions octed , e.g. 640 @return [nil, OpenNebula::Error
] nil in case of success, Error
otherwise
# File lib/opennebula/marketplace.rb, line 111 def chmod_octet(octet) super(MARKETPLACE_METHODS[:chmod], octet) end
Changes the owner/group
@param uid [Integer] the new owner id. Set to -1 to leave the current one @param gid [Integer] the new group id. Set to -1 to leave the current one
@return [nil, OpenNebula::Error
] nil in case of success, Error
otherwise
# File lib/opennebula/marketplace.rb, line 102 def chown(uid, gid) super(MARKETPLACE_METHODS[:chown], uid, gid) end
Returns whether or not the marketplace app with id ‘id’ is part of this marketplace
# File lib/opennebula/marketplace.rb, line 142 def contains(id) #This doesn't work in ruby 1.8.5 #return self["MARKETPLACE/MARKETPLACEAPPS/ID[.=#{uid}]"] != nil id_array = retrieve_elements('MARKETPLACEAPPS/ID') return id_array != nil && id_array.include?(uid.to_s) end
Deletes the marketplace
# File lib/opennebula/marketplace.rb, line 79 def delete() super(MARKETPLACE_METHODS[:delete]) end
Retrieves the information of the given marketplace.
# File lib/opennebula/marketplace.rb, line 62 def info() super(MARKETPLACE_METHODS[:info], 'MARKETPLACE') end
Returns an array with the numeric image ids
# File lib/opennebula/marketplace.rb, line 151 def marketapp_ids array = Array.new self.each("MARKETPLACEAPPS/ID") do |id| array << id.text.to_i end return array end
Renames this marketplace
@param name [String] New name for the marketplace
@return [nil, OpenNebula::Error
] nil in case of success, Error
otherwise
# File lib/opennebula/marketplace.rb, line 132 def rename(name) return call(MARKETPLACE_METHODS[:rename], @pe_id, name) end
Replaces the template contents
@param new_template [String] New template contents @param append [true, false] True to append new attributes instead of
replace the whole template
@return [nil, OpenNebula::Error
] nil in case of success, Error
otherwise
# File lib/opennebula/marketplace.rb, line 91 def update(new_template, append=false) super(MARKETPLACE_METHODS[:update], new_template, append ? 1 : 0) end