Class: Lakitu::Provider::Aws
- Inherits:
-
Lakitu::Provider
- Object
- Lakitu::Provider
- Lakitu::Provider::Aws
- Defined in:
- lib/lakitu/providers/aws.rb
Constant Summary collapse
- CREDENTIALS_PATH =
'~/.aws/credentials'
- REGIONS =
%w( us-east-1 us-west-1 us-west-2 )
Instance Method Summary collapse
Methods inherited from Lakitu::Provider
Instance Method Details
#instances(profile, region) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/lakitu/providers/aws.rb', line 19 def instances profile, region result = ec2(profile, region) .instances .to_a .select { |x| x.state.name == "running" } .map { |x| to_hash x } result.each do |x| x[:profile] = profile x[:region] = region x[:provider] = 'aws' end end |
#profiles ⇒ Object
12 13 14 15 16 17 |
# File 'lib/lakitu/providers/aws.rb', line 12 def profiles IniParse.parse(File.read(File.(CREDENTIALS_PATH))).to_hash.keys.reject() do |x| x == '__anonymous__' end rescue Errno::ENOENT Lakitu.logger.info "No AWS credentials file found at #{CREDENTIALS_PATH}, skipping" [] end |
#regions ⇒ Object
33 34 35 |
# File 'lib/lakitu/providers/aws.rb', line 33 def regions REGIONS end |