Class | AWS::S3::BucketCollection |
In: |
lib/aws/s3/bucket_collection.rb
|
Parent: | Object |
Represents a collection of buckets.
You can use this to create a bucket:
s3.buckets.create(:name => "mybucket")
You can get a handle for a specific bucket with indifferent access:
bucket = s3.buckets[:mybucket] bucket = s3.buckets['mybucket']
You can also use it to find out which buckets are in your account:
s3.buckets.collect(&:name) #=> ['bucket1', 'bucket2', ...]
Creates and returns a new Bucket. For example:
@note If your bucket name contains one or more periods and it
is hosted in a non-US region, you should make requests against the bucket using the S3 endpoint specific to the region in which your bucket resides. For example: s3 = AWS::S3.new(:s3_endpoint => "s3-eu-west-1.amazonaws.com") bucket = s3.buckets.create("my.eu.bucket") For a full list of endpoints and regions, see {http://docs.amazonwebservices.com/general/latest/gr/index.html?rande.html Regions and Endpoints} in the Amazon Web Services General Reference.
@example
bucket = s3.buckets.create('my-bucket') bucket.name #=> "my-bucket" bucket.exists? #=> true
@param [String] bucket_name @param [Hash] options
@option options [String] :location_constraint (nil) The
location where the bucket should be created. Defaults to the classic US region; however, if you configure a regional endpoint for Amazon S3 this option will default to the appropriate location constraint for the endpoint. For example: s3 = AWS::S3.new(:s3_endpoint => "s3-us-west-1.amazonaws.com") bucket = s3.buckets.create("my-us-west-bucket") bucket.location_constraint # => "us-west-1"
@option options [String] :acl (:private) Sets the ACL of the bucket
you are creating. Valid Values include :private, :public_read, :public_read_write, :authenticated_read, :bucket_owner_read and :bucket_owner_full_control
@return [Bucket]