Sha256: 56e739f3354ca9b86989d98c90a8b688ffa2dc87f56b7a9d3e570c662264fc0a
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Larrow module Qingcloud class Image < Base attr_accessor :platform, :provider destroy_action 'DeleteImages' def self.list(provider=:system,ids:[]) describe(ids,{:provider => provider,:'status.1' => :available}) do |hash| new(hash['image_id'], {'status' => hash['status'], 'platform' => hash['platform'], 'provider' => hash['provider']} ) end end def self.create instance_id result = conn.get 'CaptureInstance', instance: instance_id info "image created(instance: #{instance_id}): #{result}" image = new result['image_id'] promise(timeout:90){ image.wait_for :available } end def self.create_from_snapshot snapshot_id result = conn.get 'CaptureInstanceFromSnapshot', snapshot: snapshot_id info "image created(snapshot: #{snapshot_id}): #{result}" image = new result['image_id'] promise(timeout:90){ image.wait_for :available } end def wait_for status super do |data| self.status = status self.platform = data['platform'] self.provider = data['provider'] end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
larrow-qingcloud-0.0.2 | lib/larrow/qingcloud/image.rb |