Class: Fog::Generators::Compute::VcloudDirector::Vm
- Inherits:
-
Object
- Object
- Fog::Generators::Compute::VcloudDirector::Vm
- Defined in:
- lib/fog/vcloud_director/generators/compute/vm.rb
Overview
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Instance Method Summary collapse
- #generate_xml ⇒ Object
-
#initialize(attrs = {}) ⇒ Vm
constructor
A new instance of Vm.
Constructor Details
#initialize(attrs = {}) ⇒ Vm
Returns a new instance of Vm.
10 11 12 |
# File 'lib/fog/vcloud_director/generators/compute/vm.rb', line 10 def initialize(attrs={}) @attrs = attrs end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
8 9 10 |
# File 'lib/fog/vcloud_director/generators/compute/vm.rb', line 8 def attrs @attrs end |
Instance Method Details
#generate_xml ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/vcloud_director/generators/compute/vm.rb', line 14 def generate_xml attrs = @attrs Nokogiri::XML::Builder.new do Vm('xmlns' => 'http://www.vmware.com/vcloud/v1.5', 'name' => attrs[:name]) { Description attrs[:Description] if attrs.key?(:Description) if attrs.key?(:StorageProfile) StorageProfile( 'type' => 'application/vnd.vmware.vcloud.vdcStorageProfile+xml', 'name' => attrs[:StorageProfile][:name], 'href' => attrs[:StorageProfile][:href] ) end } end.to_xml end |