2009-11-19 11:19:46 -05:00
|
|
|
module Fog
|
|
|
|
module Rackspace
|
|
|
|
class Servers
|
|
|
|
|
|
|
|
class Image < Fog::Model
|
|
|
|
|
|
|
|
identity :id
|
|
|
|
|
|
|
|
attribute :name
|
2010-01-08 18:05:29 -05:00
|
|
|
attribute :created_at, 'created'
|
|
|
|
attribute :updated_at, 'updated'
|
2009-11-19 11:19:46 -05:00
|
|
|
attribute :status
|
|
|
|
attribute :server_id, 'serverId'
|
|
|
|
|
|
|
|
def server=(new_server)
|
2009-11-21 16:56:39 -05:00
|
|
|
requires :id
|
|
|
|
|
2009-11-19 11:19:46 -05:00
|
|
|
@server_id = new_server.id
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
2009-11-21 16:56:39 -05:00
|
|
|
requires :id
|
|
|
|
|
2009-11-19 11:19:46 -05:00
|
|
|
connection.delete_image(@id)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
2009-11-21 16:56:39 -05:00
|
|
|
requires :server_id
|
|
|
|
|
2009-11-19 11:19:46 -05:00
|
|
|
data = connection.create_server(@server_id)
|
|
|
|
merge_attributes(data.body['image'])
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|