2013-06-20 19:36:34 +02:00
|
|
|
require 'fog/core/model'
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Vcloudng
|
|
|
|
|
|
|
|
class Task < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
|
|
|
|
attribute :name
|
|
|
|
attribute :type
|
|
|
|
attribute :href
|
|
|
|
attribute :status
|
|
|
|
attribute :operation
|
|
|
|
attribute :operation_name, :aliases => :operationName
|
|
|
|
attribute :expirity_time, :aliases => :expiryTime, :type => :time
|
|
|
|
attribute :end_time, :aliases => :endTime, :type => :time
|
|
|
|
attribute :error, :aliases => :Error
|
|
|
|
attribute :result, :aliases => :Result
|
2013-06-26 14:23:54 +02:00
|
|
|
attribute :progress, :aliases => :Progress
|
2013-06-20 19:36:34 +02:00
|
|
|
|
2013-06-26 14:23:54 +02:00
|
|
|
def reload
|
2013-06-20 19:36:34 +02:00
|
|
|
data = service.get_task(id).body
|
|
|
|
data[:id] = data[:href].split('/').last
|
|
|
|
service.tasks.new(data)
|
|
|
|
end
|
|
|
|
|
2013-06-26 14:23:54 +02:00
|
|
|
def ready?
|
|
|
|
status == 'success'
|
|
|
|
end
|
|
|
|
|
2013-06-20 19:36:34 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|