Sha256: 289f107db50d78c6bff3023939d3b63e325963a14467736234a85412c415673f
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
unless Fog.mocking? module Fog module AWS class S3 # Create an S3 bucket # # ==== Parameters # * bucket_name<~String> - name of bucket to create # * options<~Hash> - config arguments for bucket. Defaults to {}. # * :location_constraint<~Symbol> - sets the location for the bucket # # ==== Returns # * response<~Fog::AWS::Response>: # * status<~Integer> - 200 def put_bucket(bucket_name, options = {}) if options['LocationConstraint'] data = <<-DATA <CreateBucketConfiguration> <LocationConstraint>#{options['LocationConstraint']}</LocationConstraint> </CreateBucketConfiguration> DATA else data = nil end request({ :expects => 200, :body => data, :headers => {}, :host => "#{bucket_name}.#{@host}", :method => 'PUT' }) end end end end else module Fog module AWS class S3 def put_bucket(bucket_name, options = {}) response = Fog::Response.new response.status = 200 bucket = { :objects => {}, 'Name' => bucket_name, 'CreationDate' => Time.now, 'Payer' => 'BucketOwner' } if options['LocationConstraint'] bucket['LocationConstraint'] = options['LocationConstraint'] else bucket['LocationConstraint'] = '' end @data[:buckets][bucket_name] = bucket response end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
geemus-fog-0.0.0 | lib/fog/aws/requests/s3/put_bucket.rb |
geemus-fog-0.0.1 | lib/fog/aws/requests/s3/put_bucket.rb |
geemus-fog-0.0.3 | lib/fog/aws/requests/s3/put_bucket.rb |