2014-02-16 01:06:49 +02:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Fogdocker
|
|
|
|
class Image < Fog::Model
|
|
|
|
identity :id
|
|
|
|
|
|
|
|
attr_accessor :info
|
|
|
|
|
2014-02-27 12:40:39 +02:00
|
|
|
attribute :repo_tags
|
2014-02-16 01:06:49 +02:00
|
|
|
attribute :created
|
|
|
|
attribute :size
|
|
|
|
attribute :virtual_size
|
|
|
|
|
2014-02-27 12:40:39 +02:00
|
|
|
def name
|
|
|
|
repo_tags.empty? ? id : repo_tags.first
|
|
|
|
end
|
|
|
|
|
2014-02-16 01:06:49 +02:00
|
|
|
def ready?
|
|
|
|
!(status =~ /down/i)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy(options = {})
|
|
|
|
service.image_delete(id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
|
|
|
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
|
|
|
service.image_create(attributes)
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|