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
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 |
# File 'lib/vcloud/core/vdc.rb', line 14 def self.get_by_name(name) q = Vcloud::Core::QueryRunner.new query_results = q.run('orgVdc', :filter => "name==#{name}") raise "Error finding vDC by name #{name}" unless query_results raise "vDc #{name} not found" unless query_results.size == 1 return self.new(query_results.first[:href].split('/').last) end |
Instance Method Details
#href ⇒ Object
30 31 32 |
# File 'lib/vcloud/core/vdc.rb', line 30 def href vcloud_attributes[:href] end |
#name ⇒ Object
26 27 28 |
# File 'lib/vcloud/core/vdc.rb', line 26 def name vcloud_attributes[:name] end |
#vcloud_attributes ⇒ Object
22 23 24 |
# File 'lib/vcloud/core/vdc.rb', line 22 def vcloud_attributes Vcloud::Core::Fog::ServiceInterface.new.get_vdc(id) end |