class OpenNebula::Zone

Constants

ZONE_METHODS

Constants and Class Methods

Public Class Methods

build_xml(pe_id=nil) click to toggle source

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 41
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
new(xml, client) click to toggle source

Class constructor

Calls superclass method OpenNebula::PoolElement.new
# File lib/opennebula/zone.rb, line 52
def initialize(xml, client)
    super(xml,client)
end

Public Instance Methods

allocate(description) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#allocate
# File lib/opennebula/zone.rb, line 74
def allocate(description)
    super(ZONE_METHODS[:allocate], description)
end
delete() click to toggle source

Deletes the Zone @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#delete
# File lib/opennebula/zone.rb, line 93
def delete()
    super(ZONE_METHODS[:delete])
end
info() click to toggle source

Retrieves the information of the given Zone. @return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
Calls superclass method OpenNebula::PoolElement#info
# File lib/opennebula/zone.rb, line 63
def info()
    super(ZONE_METHODS[:info], 'ZONE')
end
Also aliased as: info!
info!()
Alias for: info
rename(name) click to toggle source

Renames this Zone

@param name [String] New name for the Zone.

@return [nil, OpenNebula::Error] nil in case of success, Error

otherwise
# File lib/opennebula/zone.rb, line 103
def rename(name)
    return call(ZONE_METHODS[:rename], @pe_id, name)
end
update(new_template=nil, append=false) click to toggle source

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
Calls superclass method OpenNebula::PoolElement#update
# File lib/opennebula/zone.rb, line 86
def update(new_template=nil, append=false)
    super(ZONE_METHODS[:update], new_template, append ? 1 : 0)
end