Class: AwsRotate::List

Inherits:
Base
  • Object
show all
Defined in:
lib/aws_rotate/list.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from AwsServices

#iam, #sts

Constructor Details

This class inherits a constructor from AwsRotate::Base

Instance Method Details

#profilesObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/aws_rotate/list.rb', line 8

def profiles
  lines = IO.readlines(@credentials_path)
  profiles = []
  lines.each do |line|
    next if line =~ /^\s*#/ # ignore comments

    md = line.match(/\[(.*)\]/)
    profiles << md[1] if md
  end
  profiles
end

#runObject



3
4
5
6
# File 'lib/aws_rotate/list.rb', line 3

def run
  puts "AWS Profiles:"
  puts profiles
end