Class: Aws::S3::Resource
- Inherits:
-
Object
- Object
- Aws::S3::Resource
- Defined in:
- lib/aws-sdk-s3/resource.rb
Overview
This class provides a resource oriented interface for S3. To create a resource object:
resource = Aws::S3::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations. If you do not pass ‘:client`, a default client will be constructed.
client = Aws::S3::Client.new(region: 'us-west-2')
resource = Aws::S3::Resource.new(client: client)
Actions collapse
Associations collapse
Instance Method Summary collapse
- #client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#bucket(name) ⇒ Bucket
108 109 110 111 112 113 |
# File 'lib/aws-sdk-s3/resource.rb', line 108 def bucket(name) Bucket.new( name: name, client: @client ) end |
#buckets(options = {}) ⇒ Bucket::Collection
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/aws-sdk-s3/resource.rb', line 120 def buckets( = {}) batches = Enumerator.new do |y| batch = [] resp = @client.list_buckets() resp.data.buckets.each do |b| batch << Bucket.new( name: b.name, data: b, client: @client ) end y.yield(batch) end Bucket::Collection.new(batches) end |