Class: Vcloud::Core::VappTemplate
- Inherits:
-
Object
- Object
- Vcloud::Core::VappTemplate
- Defined in:
- lib/vcloud/core/vapp_template.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #href ⇒ Object
-
#initialize(id) ⇒ VappTemplate
constructor
A new instance of VappTemplate.
- #name ⇒ Object
- #vcloud_attributes ⇒ Object
Constructor Details
#initialize(id) ⇒ VappTemplate
Returns a new instance of VappTemplate.
7 8 9 10 11 12 |
# File 'lib/vcloud/core/vapp_template.rb', line 7 def initialize(id) unless id =~ /^#{self.class.id_prefix}-[-0-9a-f]+$/ raise "#{self.class.id_prefix} id : #{id} is not in correct format" end @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/vcloud/core/vapp_template.rb', line 5 def id @id end |
Class Method Details
.get(catalog_name, catalog_item_name) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/vcloud/core/vapp_template.rb', line 26 def self.get catalog_name, catalog_item_name raise "provide catalog and catalog item name to load vappTemplate" unless catalog_name && catalog_item_name body = Vcloud::Fog::ServiceInterface.new.template(catalog_name, catalog_item_name) raise 'Could not find template vApp' unless body && body.key?(:href) self.new(body[:href].split('/').last) end |
.id_prefix ⇒ Object
33 34 35 |
# File 'lib/vcloud/core/vapp_template.rb', line 33 def self.id_prefix 'vappTemplate' end |
Instance Method Details
#href ⇒ Object
18 19 20 |
# File 'lib/vcloud/core/vapp_template.rb', line 18 def href vcloud_attributes[:href] end |
#name ⇒ Object
22 23 24 |
# File 'lib/vcloud/core/vapp_template.rb', line 22 def name vcloud_attributes[:name] end |
#vcloud_attributes ⇒ Object
14 15 16 |
# File 'lib/vcloud/core/vapp_template.rb', line 14 def vcloud_attributes Vcloud::Fog::ServiceInterface.new.get_vapp_template(id) end |