class Fog::ArubaCloud::Compute::Templates
Public Instance Methods
all()
click to toggle source
Returns list of Template
@return [Fog::ArubaCloud::Compute::Template] Retrieves the complete Templates
list. @raise [Fog::ArubaCloud::Compute::NotFound]
# File lib/fog/arubacloud/compute/models/templates.rb, line 21 def all data = service.get_hypervisors objects = data['Value'] manipulated_objects = Array.new objects.each do |h| hv_type = h['HypervisorType'] h['Templates'].each do |t| t.merge!({'hypervisor' => hv_type}) manipulated_objects << t end end load(manipulated_objects) end
get(template_id)
click to toggle source
Retrieves Single Template
Item @param [String] template_id for server to be returned. @return [Fog::ArubaCloud::Compute::Template]
# File lib/fog/arubacloud/compute/models/templates.rb, line 60 def get(template_id) # TODO: Implement retrieve of a single template end
get_hypervisor(hv=4)
click to toggle source
Return only templates assigned to a specific service, default is smart (4) @param hv [Int] The ID of the hypervisor @return [Fog::ArubaCloud::Compute::Template] List of templates @raise [Fog::ArubaCloud::Compute::NotFound]
# File lib/fog/arubacloud/compute/models/templates.rb, line 39 def get_hypervisor(hv=4) manipulated_objects = Array.new data = service.get_hypervisors objects = data['Value'] objects.each do |h| hv_type = h['HypervisorType'] h['Templates'].each do |t| # select{|f| f['HypervisorType'].eql?(hv)} t.merge!({'hypervisor' => hv_type}) if t['hypervisor'].eql?(4) Fog::Logger.debug("Fog::ArubaCloud::Compute::Templates.get_hypervisors: t: #{h.to_yaml}") manipulated_objects << t end end end load(manipulated_objects) end