Method: Fog::Storage::Softlayer::Mock#delete_container

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

#delete_container(name) ⇒ Object



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

def delete_container(name)
  response = Excon::Response.new
  if @containers[name].nil? # Container doesn't exist.
    response.body = '<html><h1>Not Found</h1><p>The resource could not be found.</p></html>'
    response.status = 404
  elsif @containers[name].length > 0  # Container not empty
    response.body = '<html><h1>Conflict</h1><p>There was a conflict when trying to complete your request.</p></html>'
    response.status = 409
  else # Success
    response.body = ''
    response.status = 204
  end
  response
end