Class: Pgchief::Config::S3
- Inherits:
-
Object
- Object
- Pgchief::Config::S3
- Extended by:
- Forwardable
- Defined in:
- lib/pgchief/config/s3.rb
Overview
Class to store s3 configuration settings
Constant Summary collapse
- PREFIX_REGEX =
%r{\As3://(?<bucket>(\w|-)*)/(?<path>(\w|/|-)*/)\z}
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #bucket ⇒ Object
- #client ⇒ Object
- #configured? ⇒ Boolean
-
#initialize(config) ⇒ S3
constructor
A new instance of S3.
- #path ⇒ Object
Constructor Details
#initialize(config) ⇒ S3
Returns a new instance of S3.
22 23 24 |
# File 'lib/pgchief/config/s3.rb', line 22 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
20 21 22 |
# File 'lib/pgchief/config/s3.rb', line 20 def config @config end |
Instance Method Details
#bucket ⇒ Object
34 35 36 |
# File 'lib/pgchief/config/s3.rb', line 34 def bucket s3_match[:bucket] end |
#client ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/pgchief/config/s3.rb', line 26 def client @client ||= Aws::S3::Client.new( access_key_id: s3_key, secret_access_key: s3_secret, region: s3_region ) end |
#configured? ⇒ Boolean
42 43 44 45 46 47 48 49 |
# File 'lib/pgchief/config/s3.rb', line 42 def configured? [ s3_key, s3_secret, s3_region, s3_objects_path ].none?(&:nil?) end |
#path ⇒ Object
38 39 40 |
# File 'lib/pgchief/config/s3.rb', line 38 def path s3_match[:path] end |