Class: S3Light::Client

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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_idObject (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

#endpointObject (readonly)

Returns the value of attribute endpoint.



5
6
7
# File 'lib/s3-light/client.rb', line 5

def endpoint
  @endpoint
end

#regionObject (readonly)

Returns the value of attribute region.



5
6
7
# File 'lib/s3-light/client.rb', line 5

def region
  @region
end

#secret_access_keyObject (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_contextObject (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_connectionsObject



40
41
42
# File 'lib/s3-light/client.rb', line 40

def close_all_connections
  main_connections_manager.close_all_connections
end

.main_connections_managerObject



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

#bucketsObject



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

#connectionObject



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