2011-06-15 18:00:33 -04:00
|
|
|
module Fog
|
2011-10-17 15:25:07 -04:00
|
|
|
module Storage
|
|
|
|
class HP
|
2011-06-15 18:00:33 -04:00
|
|
|
class Real
|
|
|
|
|
|
|
|
# Delete an existing object
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * container<~String> - Name of container to delete
|
|
|
|
# * object<~String> - Name of object to delete
|
|
|
|
#
|
|
|
|
def delete_object(container, object)
|
|
|
|
response = request(
|
|
|
|
:expects => 204,
|
|
|
|
:method => 'DELETE',
|
2012-03-21 16:59:08 -04:00
|
|
|
:path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
|
2011-06-15 18:00:33 -04:00
|
|
|
)
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-07-29 11:33:28 -04:00
|
|
|
|
|
|
|
class Mock # :nodoc:all
|
|
|
|
|
|
|
|
def delete_object(container_name, object_name, options = {})
|
|
|
|
response = Excon::Response.new
|
|
|
|
if container = self.data[:containers][container_name]
|
2012-04-02 15:30:42 -04:00
|
|
|
if (object = container[:objects][object_name])
|
|
|
|
response.status = 204
|
|
|
|
container[:objects].delete(object_name)
|
|
|
|
else
|
|
|
|
raise Fog::Storage::HP::NotFound
|
|
|
|
end
|
2011-07-29 11:33:28 -04:00
|
|
|
else
|
2012-04-02 15:30:42 -04:00
|
|
|
raise Fog::Storage::HP::NotFound
|
2011-07-29 11:33:28 -04:00
|
|
|
end
|
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2011-06-15 18:00:33 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|