1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
module Fog
module AWS
class Storage
class Version < Fog::Model
identity :version, :aliases => 'VersionId'
attribute :key, :aliases => 'Key'
attribute :last_modified, :aliases => ['Last-Modified', 'LastModified']
attribute :latest, :aliases => 'IsLatest', :type => :boolean
attribute :content_length, :aliases => ['Content-Length', 'Size'], :type => :integer
attribute :delete_marker, :type => :boolean
def file
@file ||= if collection.file
collection.file.directory.files.get(key, 'versionId' => version)
else
collection.directory.files.get(key, 'versionId' => version)
end
end
def destroy
if collection.file
collection.service.delete_object(collection.file.directory.key, key, 'versionId' => version)
else
collection.service.delete_object(collection.directory.key, key, 'versionId' => version)
end
end
end
end
end
end
|