Class: Train::Transports::Aws::Connection
- Inherits:
-
BaseConnection
- Object
- BaseConnection
- Train::Transports::Aws::Connection
- Defined in:
- lib/train/transports/aws.rb
Instance Method Summary collapse
- #aws_client(klass) ⇒ Object
- #aws_resource(klass, args) ⇒ Object
- #connect ⇒ Object
-
#initialize(options) ⇒ Connection
constructor
A new instance of Connection.
- #platform ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(options) ⇒ Connection
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/train/transports/aws.rb', line 21 def initialize() # Override for any cli options # aws://region/my-profile [:region] = [:host] || [:region] if [:path] # string the leading / from path [:profile] = [:path][1..-1] end super() @cache_enabled[:api_call] = true @cache[:api_call] = {} connect end |
Instance Method Details
#aws_client(klass) ⇒ Object
41 42 43 44 |
# File 'lib/train/transports/aws.rb', line 41 def aws_client(klass) return klass.new unless cache_enabled?(:api_call) @cache[:api_call][klass.to_s.to_sym] ||= klass.new end |
#aws_resource(klass, args) ⇒ Object
46 47 48 |
# File 'lib/train/transports/aws.rb', line 46 def aws_resource(klass, args) klass.new(args) end |
#connect ⇒ Object
50 51 52 53 |
# File 'lib/train/transports/aws.rb', line 50 def connect ENV['AWS_PROFILE'] = [:profile] if [:profile] ENV['AWS_REGION'] = [:region] if [:region] end |
#platform ⇒ Object
37 38 39 |
# File 'lib/train/transports/aws.rb', line 37 def platform direct_platform('aws') end |
#uri ⇒ Object
55 56 57 |
# File 'lib/train/transports/aws.rb', line 55 def uri "aws://#{@options[:region]}" end |