Sha256: d7d8d59939c4fd3b5b99c0b3abb4d33af83e4cdfa5a408ac03024c0b94f0e91d
Contents?: true
Size: 1.24 KB
Versions: 25
Compression:
Stored size: 1.24 KB
Contents
unless Fog.mocking? module Fog module AWS class S3 # Delete an S3 bucket # # ==== Parameters # * bucket_name<~String> - name of bucket to delete # # ==== Returns # * response<~Excon::Response>: # * status<~Integer> - 204 def delete_bucket(bucket_name) request({ :expects => 204, :headers => {}, :host => "#{bucket_name}.#{@host}", :method => 'DELETE' }) end end end end else module Fog module AWS class S3 def delete_bucket(bucket_name) response = Excon::Response.new if Fog::AWS::S3.data[:buckets][bucket_name].nil? response.status = 404 raise(Excon::Errors.status_error({:expects => 204}, response)) elsif Fog::AWS::S3.data[:buckets][bucket_name] && !Fog::AWS::S3.data[:buckets][bucket_name][:objects].empty? response.status = 409 raise(Excon::Errors.status_error({:expects => 204}, response)) else Fog::AWS::S3.data[:buckets].delete(bucket_name) response.status = 204 end response end end end end end
Version data entries
25 entries across 25 versions & 1 rubygems