Class: Fog::Compute::QingCloud::Images

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/qingcloud/models/compute/images.rb

Constant Summary collapse

ACTIVE_STATUS =
%w[pending available deprecated suspended]

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Images

Creates a new machine image

QingCloud.images.new

Returns

Returns the details of the new image



24
25
26
27
28
# File 'lib/fog/qingcloud/models/compute/images.rb', line 24

def initialize(attributes)
  self.filters ||= {}
  filters['status'] = ACTIVE_STATUS unless filters['status']
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object



30
31
32
33
34
# File 'lib/fog/qingcloud/models/compute/images.rb', line 30

def all(filters = filters)
  self.filters = filters
  data = service.describe_images(filters).body
  load(data['images_set'])
end

#get(image_id) ⇒ Object



36
37
38
39
40
# File 'lib/fog/qingcloud/models/compute/images.rb', line 36

def get(image_id)
  if image_id
    self.class.new(:service => service).all('image-id' => image_id).first
  end
end