2011-08-24 21:29:14 -04:00
|
|
|
require 'fog/ecloud/models/compute/task'
|
2011-02-17 13:44:46 -05:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class Ecloud
|
2011-02-17 13:44:46 -05:00
|
|
|
class Tasks < Fog::Ecloud::Collection
|
2012-06-07 12:50:11 -04:00
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::Ecloud::Task
|
2011-02-17 13:44:46 -05:00
|
|
|
|
2012-06-07 12:50:11 -04:00
|
|
|
identity :href
|
|
|
|
attribute :other_links, :aliases => :Links
|
|
|
|
attribute :total_count, :aliases => :TotalCount
|
2011-02-17 13:44:46 -05:00
|
|
|
|
|
|
|
def all
|
2012-06-07 12:50:11 -04:00
|
|
|
data = connection.get_tasks(href).body
|
|
|
|
data = data[:Task] ? data[:Task] : data
|
|
|
|
load(data)
|
2011-02-17 13:44:46 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(uri)
|
|
|
|
if data = connection.get_task(uri)
|
|
|
|
new(data.body)
|
|
|
|
end
|
|
|
|
rescue Fog::Errors::NotFound
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-06-07 12:50:11 -04:00
|
|
|
|