Method: Fog::Storage::Softlayer::Mock#copy_object

Defined in:
lib/fog/softlayer/requests/storage/copy_object.rb

#copy_object(source_container, source_object, target_container, target_object, options = {}) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/softlayer/requests/storage/copy_object.rb', line 5

def copy_object(source_container, source_object, target_container, target_object, options={})
  response = Excon::Response.new
  if @containers[source_container].nil? || @containers[source_container][source_object].nil? || @containers[target_container].nil?
    response.body = '<html><h1>Not Found</h1><p>The resource could not be found.</p></html>'
    response.status = 404
  else # Success
    @containers[target_container][target_object] = @containers[source_container][source_object]
    response.body = ''
    response.status = 201
  end
  response
end