Class: Vcloud::Core::EdgeGateway
- Inherits:
-
Object
- Object
- Vcloud::Core::EdgeGateway
- Defined in:
- lib/vcloud/core/edge_gateway.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) ⇒ EdgeGateway
constructor
A new instance of EdgeGateway.
- #name ⇒ Object
- #vcloud_attributes ⇒ Object
Constructor Details
#initialize(id) ⇒ EdgeGateway
Returns a new instance of EdgeGateway.
7 8 9 10 11 12 |
# File 'lib/vcloud/core/edge_gateway.rb', line 7 def initialize(id) unless id =~ /^[-0-9a-f]+$/ raise "EdgeGateway 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/edge_gateway.rb', line 5 def id @id end |
Class Method Details
.get_by_name(name) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/vcloud/core/edge_gateway.rb', line 24 def self.get_by_name(name) ids = self.get_ids_by_name(name) raise "edgeGateway #{name} not found" if ids.size == 0 raise "edgeGateway #{name} is not unique" if ids.size > 1 return self.new(ids.first) end |
.get_ids_by_name(name) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/vcloud/core/edge_gateway.rb', line 14 def self.get_ids_by_name(name) q = Query.new('edgeGateway', :filter => "name==#{name}") unless res = q.get_all_results raise "Error finding edgeGateway by name #{name}" end res.collect do |record| record[:href].split('/').last if record.key?(:href) end end |
Instance Method Details
#href ⇒ Object
36 37 38 |
# File 'lib/vcloud/core/edge_gateway.rb', line 36 def href vcloud_attributes[:href] end |
#name ⇒ Object
40 41 42 |
# File 'lib/vcloud/core/edge_gateway.rb', line 40 def name vcloud_attributes[:name] end |
#vcloud_attributes ⇒ Object
31 32 33 34 |
# File 'lib/vcloud/core/edge_gateway.rb', line 31 def vcloud_attributes fsi = Vcloud::Fog::ServiceInterface.new fsi.get_edge_gateway(id) end |