class Aws::S3::Resource
resource = Aws::S3::Resource.new(client: client)
client = Aws::S3::Client.new(region: ‘us-west-2’)
If you do not pass ‘:client`, a default client will be constructed.
You can supply a client object with custom configuration that will be used for all resource operations.
resource = Aws::S3::Resource.new(region: ’us-west-2’)
To create a resource object:
This class provides a resource oriented interface for S3.
def bucket(name)
-
(Bucket)
-
Parameters:
-
name
(String
) --
def bucket(name) Bucket.new( name: name, client: @client ) end
def buckets(options = {})
-
(Bucket::Collection)
-
Parameters:
-
options
(Hash
) -- ({})
Other tags:
- Example: Request syntax with placeholder values -
def buckets(options = {}) batches = Enumerator.new do |y| batch = [] resp = @client.list_buckets(options) 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
def client
-
(Client)
-
def client @client end
def create_bucket(options = {})
-
(Bucket)
-
Options Hash:
(**options)
-
:object_lock_enabled_for_bucket
(Boolean
) -- -
:grant_write_acp
(String
) -- -
:grant_write
(String
) -- -
:grant_read_acp
(String
) -- -
:grant_read
(String
) -- -
:grant_full_control
(String
) -- -
:create_bucket_configuration
(Types::CreateBucketConfiguration
) -- -
:bucket
(required, String
) -- -
:acl
(String
) --
Parameters:
-
options
(Hash
) -- ({})
Other tags:
- Example: Request syntax with placeholder values -
def create_bucket(options = {}) resp = @client.create_bucket(options) Bucket.new( name: options[:bucket], client: @client ) end
def initialize(options = {})
(**options)
-
:client
(Client
) --
Parameters:
-
options
({}
) --
def initialize(options = {}) @client = options[:client] || Client.new(options) end