class OpenNebula::Zone
Constants
- ZONE_METHODS
Constants and Class Methods
Public Class Methods
Creates a Zone description with just its identifier this method should be used to create plain Zone objects. @param id [Integer] the id of the Zone
Example:
zone = Zone.new(Zone.build_xml(3),rpc_client)
# File lib/opennebula/zone.rb, line 43 def Zone.build_xml(pe_id=nil) if pe_id zone_xml = "<ZONE><ID>#{pe_id}</ID></ZONE>" else zone_xml = "<ZONE></ZONE>" end XMLElement.build_xml(zone_xml,'ZONE') end
Class constructor
# File lib/opennebula/zone.rb, line 54 def initialize(xml, client) super(xml,client) end
Public Instance Methods
Adds servers to this Zone
@param name [String] Template with zone servers
SERVER = [ NAME = "<server_name>", ENDPOINT = "<rpc_ep>" ]
@return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/zone.rb, line 116 def add_servers(servers) return call(ZONE_METHODS[:addserver], @pe_id, servers) end
Allocates a new Zone in OpenNebula
@param description [String] The template of the Zone. @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/zone.rb, line 76 def allocate(description) super(ZONE_METHODS[:allocate], description) end
Deletes the Zone @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/zone.rb, line 95 def delete() super(ZONE_METHODS[:delete]) end
Retrieves the information of the given Zone. @return [nil, OpenNebula::Error] nil in case of success, Error
otherwise
# File lib/opennebula/zone.rb, line 65 def info() super(ZONE_METHODS[:info], 'ZONE') 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/zone.rb, line 88 def update(new_template=nil, append=false) super(ZONE_METHODS[:update], new_template, append ? 1 : 0) end