Class: Jaxx::Environment
- Inherits:
-
Object
- Object
- Jaxx::Environment
- Defined in:
- lib/jaxx/environment.rb
Constant Summary collapse
- DEFAULT_ARGS =
{ 'service_timeout' => 1 }
- DEFAULT_CREDENTIALS =
{ :aws_access_key_id => "", :aws_secret_access_key => "", :aws_session_token => nil, :use_iam_profile => false }
Instance Attribute Summary collapse
-
#service_timeout ⇒ Object
readonly
Returns the value of attribute service_timeout.
Instance Method Summary collapse
- #credentials ⇒ Object
-
#initialize(args = {}) ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(args = {}) ⇒ Environment
Returns a new instance of Environment.
16 17 18 |
# File 'lib/jaxx/environment.rb', line 16 def initialize args = {} @service_timeout = DEFAULT_ARGS.dup.merge(args).delete('service_timeout') end |
Instance Attribute Details
#service_timeout ⇒ Object (readonly)
Returns the value of attribute service_timeout.
14 15 16 |
# File 'lib/jaxx/environment.rb', line 14 def service_timeout @service_timeout end |
Instance Method Details
#credentials ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/jaxx/environment.rb', line 20 def credentials Timeout::timeout(service_timeout) do DEFAULT_CREDENTIALS.merge Fog::Compute::AWS.fetch_credentials(:use_iam_profile => true) end rescue Errno::EHOSTDOWN, Errno::EHOSTUNREACH, Timeout::Error => exc DEFAULT_CREDENTIALS end |