From cb2fb6d3ed5a6c64b7793f5b6e32e4176001151e Mon Sep 17 00:00:00 2001 From: Rupak Ganguly Date: Thu, 16 Jun 2011 00:43:14 -0400 Subject: [PATCH] Add an implementation of copy method to copy files between containers. --- lib/fog/storage/models/hp/file.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/fog/storage/models/hp/file.rb b/lib/fog/storage/models/hp/file.rb index 7ecc4c7ef..93f56d14a 100644 --- a/lib/fog/storage/models/hp/file.rb +++ b/lib/fog/storage/models/hp/file.rb @@ -29,6 +29,13 @@ module Fog @directory end + def copy(target_directory_key, target_file_key) + requires :directory, :key + target_directory = connection.directories.new(:key => target_directory_key) + connection.put_object(target_directory_key, target_file_key, nil, {'X-Copy-From' => "/#{directory.key}/#{key}" }) + target_directory.files.get(target_file_key) + end + def destroy requires :directory, :key connection.delete_object(directory.key, key)