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
182 183 184 185 186 187 |
# File 'lib/aws-sdk-s3/resource.rb', line 182 def bucket(name) Bucket.new( name: name, client: @client ) end |
#buckets(options = {}) ⇒ Bucket::Collection
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/aws-sdk-s3/resource.rb', line 218 def buckets( = {}) batches = Enumerator.new do |y| resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do @client.list_buckets() end resp.each_page do |page| batch = [] page.data.buckets.each do |b| batch << Bucket.new( name: b.name, data: b, client: @client ) end y.yield(batch) end end Bucket::Collection.new(batches) end |