2011-08-10 09:03:51 -04:00
|
|
|
require 'fog/core/collection'
|
2011-09-08 17:07:04 -04:00
|
|
|
require 'fog/glesys/models/compute/template'
|
2011-08-10 09:03:51 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Glesys
|
|
|
|
class Templates < Fog::Collection
|
|
|
|
|
2013-02-10 07:34:01 -05:00
|
|
|
model Fog::Compute::Glesys::Template
|
2011-08-10 09:03:51 -04:00
|
|
|
|
|
|
|
def all
|
2013-01-26 09:17:04 -05:00
|
|
|
# Only select OpenVZ and Xen platforms
|
|
|
|
# Glesys only offers Xen and OpenVZ but they have other platforms in the list
|
2013-02-10 07:33:04 -05: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 09:17:04 -05:00
|
|
|
|
2013-02-10 07:33:04 -05: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 09:03:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|