Sha256: 58f98445d3d32e31313bf87c07edb0287f67d14e0439f92ae55d394d0de1cf63
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 KB
Contents
module Vcloud module Core class EdgeGateway attr_reader :id def initialize(id) unless id =~ /^[-0-9a-f]+$/ raise "EdgeGateway id : #{id} is not in correct format" end @id = id end 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 def update_configuration(config) fsi = Vcloud::Fog::ServiceInterface.new fsi.post_configure_edge_gateway_services(id, config) end def vcloud_gateway_interface_by_id gateway_interface_id gateway_interfaces = vcloud_attributes[:Configuration][:GatewayInterfaces][:GatewayInterface] unless gateway_interfaces.empty? return gateway_interfaces.find{ |interface| interface[:Network][:href].split('/').last == gateway_interface_id } end end 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 def vcloud_attributes fsi = Vcloud::Fog::ServiceInterface.new fsi.get_edge_gateway(id) end def href vcloud_attributes[:href] end def name vcloud_attributes[:name] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vcloud-core-0.0.5 | lib/vcloud/core/edge_gateway.rb |