class Fog::Compute::Aliyun::Image

Public Class Methods

new(attributes) click to toggle source
Calls superclass method
# File lib/fog/aliyun/models/compute/image.rb, line 31
def initialize(attributes)
  unless attributes['DiskDeviceMappings']['DiskDeviceMapping'].empty?
    self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId']
  end
  super
end

Public Instance Methods

destroy() click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 47
def destroy
  requires :id
  service.delete_image(id)
  true
end
ready?() click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 53
def ready?
  state == 'Available'
end
save(options = {}) click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 38
def save(options = {})
  requires :snapshot_id
  options[:name] = name if name
  options[:description] = description if description
  data = Fog::JSON.decode(service.create_image(snapshot_id, options).body)
  merge_attributes(data)
  true
end
snapshot() click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 57
def snapshot
  requires :snapshot_id
  Fog::Compute::Aliyun::Snapshots.new(service: service).all(snapshotIds: [snapshot_id])[0]
end

Private Instance Methods

snapshot=(new_snapshot) click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 64
def snapshot=(new_snapshot)
  self.snapshot_id = new_snapshot.id
end