2009-08-07 22:55:11 -04:00
|
|
|
unless Fog.mocking?
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class S3
|
|
|
|
|
|
|
|
# Delete an S3 bucket
|
|
|
|
#
|
|
|
|
# ==== Parameters
|
|
|
|
# * bucket_name<~String> - name of bucket to delete
|
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Fog::AWS::Response>:
|
|
|
|
# * status<~Integer> - 204
|
|
|
|
def delete_bucket(bucket_name)
|
|
|
|
request({
|
2009-08-16 14:44:50 -04:00
|
|
|
:expects => 204,
|
|
|
|
:headers => {},
|
|
|
|
:host => "#{bucket_name}.#{@host}",
|
|
|
|
:method => 'DELETE'
|
2009-08-07 22:55:11 -04:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
2009-08-07 22:55:11 -04:00
|
|
|
end
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
|
2009-08-07 22:55:11 -04:00
|
|
|
else
|
|
|
|
|
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class S3
|
|
|
|
|
|
|
|
def delete_bucket(bucket_name)
|
|
|
|
response = Fog::Response.new
|
2009-08-18 01:39:44 -04:00
|
|
|
if Fog::AWS::S3.data[:buckets].delete(bucket_name)
|
2009-08-08 15:31:32 -04:00
|
|
|
response.status = 204
|
|
|
|
else
|
2009-08-16 14:45:52 -04:00
|
|
|
response.status = 404
|
2009-08-16 16:31:36 -04:00
|
|
|
raise(Fog::Errors.status_error(204, 404, response))
|
2009-08-08 15:31:32 -04:00
|
|
|
end
|
2009-08-07 22:55:11 -04:00
|
|
|
response
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|
|
|
|
end
|
2009-08-07 22:55:11 -04:00
|
|
|
|
2009-07-13 22:14:59 -04:00
|
|
|
end
|