Class: Marty::Aws::Base
- Inherits:
-
Object
- Object
- Marty::Aws::Base
- Defined in:
- lib/marty/aws/base.rb
Direct Known Subclasses
Constant Summary collapse
- META_DATA_HOST =
FIXME: should that be in public marty gem? aws reserved host used to get instance meta-data
'169.254.169.254'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #query_dynamic(query) ⇒ Object
- #query_meta_data(query) ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
29 30 31 32 33 34 35 |
# File 'lib/marty/aws/base.rb', line 29 def initialize @id = get_instance_id @doc = get_document @role = get_role @creds = get_credentials @version = '2016-11-15' end |
Class Method Details
.is_aws? ⇒ Boolean
21 22 23 24 25 26 27 |
# File 'lib/marty/aws/base.rb', line 21 def self.is_aws? # FIXME: hack to pass tests on CI return false if Rails.env.test? response = get("http://#{META_DATA_HOST}") rescue nil response.present? end |
Instance Method Details
#query_dynamic(query) ⇒ Object
41 42 43 |
# File 'lib/marty/aws/base.rb', line 41 def query_dynamic query self.class.get("http://#{META_DATA_HOST}/latest/dynamic/#{query}/") end |
#query_meta_data(query) ⇒ Object
37 38 39 |
# File 'lib/marty/aws/base.rb', line 37 def query self.class.get("http://#{META_DATA_HOST}/latest/meta-data/#{query}/") end |