Class: S3Light::Client
- Inherits:
-
Object
- Object
- S3Light::Client
- Defined in:
- lib/s3-light/client.rb,
lib/s3-light/client/buckets_list.rb,
lib/s3-light/client/objects_list.rb
Defined Under Namespace
Classes: BucketsList, ObjectsList
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
-
#ssl_context ⇒ Object
readonly
Returns the value of attribute ssl_context.
Class Method Summary collapse
Instance Method Summary collapse
- #buckets ⇒ Object
- #build_thread_poll(concurrency) ⇒ Object
- #connection ⇒ Object
-
#initialize(endpoint: nil, access_key_id:, secret_access_key:, region: 'us-east-1', ssl_context: nil) ⇒ Client
constructor
A new instance of Client.
- #with_connection(&block) ⇒ Object
Constructor Details
#initialize(endpoint: nil, access_key_id:, secret_access_key:, region: 'us-east-1', ssl_context: nil) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 |
# File 'lib/s3-light/client.rb', line 6 def initialize(endpoint: nil, access_key_id:, secret_access_key:, region: 'us-east-1', ssl_context: nil) @access_key_id = access_key_id @secret_access_key = secret_access_key @region = region @ssl_context = ssl_context @endpoint = endpoint || amazon_default_endpoint end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
5 6 7 |
# File 'lib/s3-light/client.rb', line 5 def access_key_id @access_key_id end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/s3-light/client.rb', line 5 def endpoint @endpoint end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
5 6 7 |
# File 'lib/s3-light/client.rb', line 5 def region @region end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
5 6 7 |
# File 'lib/s3-light/client.rb', line 5 def secret_access_key @secret_access_key end |
#ssl_context ⇒ Object (readonly)
Returns the value of attribute ssl_context.
5 6 7 |
# File 'lib/s3-light/client.rb', line 5 def ssl_context @ssl_context end |
Class Method Details
.close_all_connections ⇒ Object
40 41 42 |
# File 'lib/s3-light/client.rb', line 40 def close_all_connections main_connections_manager.close_all_connections end |
.main_connections_manager ⇒ Object
36 37 38 |
# File 'lib/s3-light/client.rb', line 36 def main_connections_manager @main_connections_manager ||= ConnectionsManager::Main.new end |
Instance Method Details
#buckets ⇒ Object
14 15 16 |
# File 'lib/s3-light/client.rb', line 14 def buckets @buckets ||= BucketsList.new(self) end |
#build_thread_poll(concurrency) ⇒ Object
31 32 33 |
# File 'lib/s3-light/client.rb', line 31 def build_thread_poll(concurrency) S3Light::ConnectionsManager::Threaded.new(self, concurrency) end |
#connection ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/s3-light/client.rb', line 18 def connection return @connection if @connection @connection = Connection.new( endpoint: @endpoint, access_key_id: @access_key_id, secret_access_key: @secret_access_key, ssl_context: @ssl_context ) end |
#with_connection(&block) ⇒ Object
27 28 29 |
# File 'lib/s3-light/client.rb', line 27 def with_connection(&block) self.class.main_connections_manager.yield_connection(self, &block) end |