1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
# frozen_string_literal: true
require 'fog/core/collection'
require 'fog/aliyun/models/compute/image'
module Fog
module Compute
class Aliyun
class Images < Fog::Collection
model Fog::Compute::Aliyun::Image
def all(filters_arg = {})
unless filters_arg.is_a?(Hash)
Fog::Logger.deprecation("all with #{filters_arg.class} param is deprecated, use all('diskIds' => []) instead [light_black](#{caller.first})[/]")
filters_arg = { imageId: filters_arg }
end
data = Fog::JSON.decode(service.list_images(filters_arg).body)['Images']['Image']
load(data)
end
def get(image_id)
self.class.new(service: service).all(imageId: image_id)[0] if image_id
end
end
end
end
end
|