Class: OVIRT::Template
- Inherits:
-
BaseObject
- Object
- BaseObject
- OVIRT::Template
- Defined in:
- lib/ovirt/template.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#creation_time ⇒ Object
readonly
Returns the value of attribute creation_time.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#display ⇒ Object
readonly
Returns the value of attribute display.
-
#memory ⇒ Object
readonly
Returns the value of attribute memory.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Attributes inherited from BaseObject
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(client, xml) ⇒ Template
constructor
A new instance of Template.
- #interfaces ⇒ Object
- #volumes ⇒ Object
Methods inherited from BaseObject
Constructor Details
#initialize(client, xml) ⇒ Template
Returns a new instance of Template.
6 7 8 9 10 |
# File 'lib/ovirt/template.rb', line 6 def initialize(client, xml) super(client, xml[:id], xml[:href], (xml/'name').first.text) parse_xml_attributes!(xml) self end |
Instance Attribute Details
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def cluster @cluster end |
#comment ⇒ Object
Returns the value of attribute comment.
4 5 6 |
# File 'lib/ovirt/template.rb', line 4 def comment @comment end |
#creation_time ⇒ Object (readonly)
Returns the value of attribute creation_time.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def creation_time @creation_time end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def description @description end |
#display ⇒ Object (readonly)
Returns the value of attribute display.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def display @display end |
#memory ⇒ Object (readonly)
Returns the value of attribute memory.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def memory @memory end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def os @os end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def profile @profile end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def status @status end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def storage @storage end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/ovirt/template.rb', line 3 def version @version end |
Class Method Details
.to_xml(opts = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ovirt/template.rb', line 12 def self.to_xml(opts={}) builder = Nokogiri::XML::Builder.new do template_ { name_ opts[:name] || "t-#{Time.now.to_i}" description opts[:description] || '' comment opts[:comment] || '' vm(:id => opts[:vm]) } end Nokogiri::XML(builder.to_xml).root.to_s end |
Instance Method Details
#interfaces ⇒ Object
24 25 26 |
# File 'lib/ovirt/template.rb', line 24 def interfaces @interfaces ||= @client.template_interfaces(id) end |
#volumes ⇒ Object
28 29 30 |
# File 'lib/ovirt/template.rb', line 28 def volumes @volumes ||= @client.template_volumes(id) end |