Class: OpenNebula::Zone
- Inherits:
-
PoolElement
- Object
- XMLElement
- PoolElement
- OpenNebula::Zone
- Defined in:
- lib/opennebula/zone.rb
Constant Summary collapse
- ZONE_METHODS =
Constants and Class Methods
{ :info => "zone.info", :allocate => "zone.allocate", :update => "zone.update", :rename => "zone.rename", :delete => "zone.delete" }
Class Method Summary collapse
-
.build_xml(pe_id = nil) ⇒ Object
Creates a Zone description with just its identifier this method should be used to create plain Zone objects.
Instance Method Summary collapse
-
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new Zone in OpenNebula.
-
#delete ⇒ nil, OpenNebula::Error
Deletes the Zone.
-
#info ⇒ nil, OpenNebula::Error
(also: #info!)
Retrieves the information of the given Zone.
-
#initialize(xml, client) ⇒ Zone
constructor
Class constructor.
-
#rename(name) ⇒ nil, OpenNebula::Error
Renames this Zone.
-
#update(new_template = nil, append = false) ⇒ nil, OpenNebula::Error
Replaces the template contents.
Methods inherited from PoolElement
#id, #name, new_with_id, #to_str
Methods inherited from XMLElement
#[], #add_element, #attr, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml
Constructor Details
#initialize(xml, client) ⇒ Zone
Class constructor
52 53 54 |
# File 'lib/opennebula/zone.rb', line 52 def initialize(xml, client) super(xml,client) end |
Class Method Details
.build_xml(pe_id = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# 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 |
Instance Method Details
#allocate(description) ⇒ nil, OpenNebula::Error
Allocates a new Zone in OpenNebula
74 75 76 |
# File 'lib/opennebula/zone.rb', line 74 def allocate(description) super(ZONE_METHODS[:allocate], description) end |
#delete ⇒ nil, OpenNebula::Error
Deletes the Zone
93 94 95 |
# File 'lib/opennebula/zone.rb', line 93 def delete() super(ZONE_METHODS[:delete]) end |
#info ⇒ nil, OpenNebula::Error Also known as: info!
Retrieves the information of the given Zone.
63 64 65 |
# File 'lib/opennebula/zone.rb', line 63 def info() super(ZONE_METHODS[:info], 'ZONE') end |
#rename(name) ⇒ nil, OpenNebula::Error
Renames this Zone
103 104 105 |
# 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) ⇒ nil, OpenNebula::Error
Replaces the template contents
86 87 88 |
# File 'lib/opennebula/zone.rb', line 86 def update(new_template=nil, append=false) super(ZONE_METHODS[:update], new_template, append ? 1 : 0) end |