Class: Vcloud::Core::Vdc
- Inherits:
-
Object
- Object
- Vcloud::Core::Vdc
- Defined in:
- lib/vcloud/core/vdc.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) ⇒ Vdc
constructor
A new instance of Vdc.
- #name ⇒ Object
- #vcloud_attributes ⇒ Object
Constructor Details
#initialize(id) ⇒ Vdc
Returns a new instance of Vdc.
7 8 9 10 11 12 |
# File 'lib/vcloud/core/vdc.rb', line 7 def initialize(id) unless id =~ /^[-0-9a-f]+$/ raise "vdc 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/vdc.rb', line 5 def id @id end |
Class Method Details
.get_by_name(name) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/vcloud/core/vdc.rb', line 14 def self.get_by_name(name) q = QueryRunner.new unless res = q.run('orgVdc', :filter => "name==#{name}") raise "Error finding vDC by name #{name}" end raise "vDc #{name} not found" unless res.size == 1 return self.new(res.first[:href].split('/').last) end |
Instance Method Details
#href ⇒ Object
31 32 33 |
# File 'lib/vcloud/core/vdc.rb', line 31 def href vcloud_attributes[:href] end |
#name ⇒ Object
27 28 29 |
# File 'lib/vcloud/core/vdc.rb', line 27 def name vcloud_attributes[:name] end |
#vcloud_attributes ⇒ Object
23 24 25 |
# File 'lib/vcloud/core/vdc.rb', line 23 def vcloud_attributes Vcloud::Fog::ServiceInterface.new.get_vdc(id) end |