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 30
def initialize(attributes)
  self.snapshot_id=attributes["DiskDeviceMappings"]["DiskDeviceMapping"][0]["SnapshotId"]
  super
end

Public Instance Methods

destroy() click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 44
def destroy
  requires :id
  service.delete_image(id)
  true
end
ready?() click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 50
def ready?
  state == 'Available'
end
save(options={}) click to toggle source
# File lib/fog/aliyun/models/compute/image.rb, line 35
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 54
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 61
def snapshot=(new_snapshot)
  self.snapshot_id = new_snapshot.id
end