1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/vcloud_director/models/compute/task.rb

48 lines
1.1 KiB
Ruby
Raw Normal View History

2013-06-20 13:36:34 -04:00
require 'fog/core/model'
module Fog
module Compute
2013-08-27 05:19:54 -04:00
class VcloudDirector
2013-06-20 13:36:34 -04:00
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 08:23:54 -04:00
attribute :progress, :aliases => :Progress
2013-06-20 13:36:34 -04:00
2013-06-26 08:23:54 -04:00
def ready?
status == 'success'
end
def success?
status == 'success'
end
2013-07-05 10:33:51 -04:00
def non_running?
if status == 'running'
if progress.to_i == 0
printf '.'
else
print " #{progress} %\r"
2013-07-05 10:33:51 -04:00
end
else
puts " #{status}"
2013-07-05 10:33:51 -04:00
end
status != 'running'
end
2013-06-20 13:36:34 -04:00
end
end
end
end