2011-08-10 15:03:51 +02:00
|
|
|
require 'fog/core/collection'
|
2011-09-08 16:07:04 -05:00
|
|
|
require 'fog/glesys/models/compute/template'
|
2011-08-10 15:03:51 +02:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Glesys
|
|
|
|
class Templates < Fog::Collection
|
|
|
|
|
2013-02-10 13:34:01 +01:00
|
|
|
model Fog::Compute::Glesys::Template
|
2011-08-10 15:03:51 +02:00
|
|
|
|
|
|
|
def all
|
2013-01-26 15:17:04 +01:00
|
|
|
# Only select OpenVZ and Xen platforms
|
|
|
|
# Glesys only offers Xen and OpenVZ but they have other platforms in the list
|
2013-02-10 13:33:04 +01:00
|
|
|
images = platform :openvz, :xen
|
|
|
|
load(images)
|
|
|
|
end
|
|
|
|
|
|
|
|
def openvz
|
|
|
|
images = platform :openvz
|
|
|
|
load(images)
|
|
|
|
end
|
|
|
|
|
|
|
|
def xen
|
|
|
|
images = platform :xen
|
|
|
|
load(images)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2013-01-26 15:17:04 +01:00
|
|
|
|
2013-02-10 13:33:04 +01:00
|
|
|
def platform(*platforms)
|
|
|
|
images = service.template_list.body['response']['templates']
|
|
|
|
images.select do |platform, images|
|
|
|
|
platforms.include?(platform.downcase.to_sym)
|
|
|
|
end.collect{|platform, images| images}.flatten
|
2011-08-10 15:03:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|