Class: AwsRotate::Keys
- Inherits:
-
Base
- Object
- Base
- AwsRotate::Keys
show all
- Defined in:
- lib/aws_rotate/keys.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
#iam, #sts
Instance Method Details
#filter_match?(profile) ⇒ Boolean
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/aws_rotate/keys.rb', line 13
def filter_match?(profile)
return true if @options[:select].nil? && @options[:reject].nil?
unless @options[:reject].nil?
reject_list = @options[:reject]
reject_list.map! { |f| Regexp.new(f) }
rejected = !!reject_list.detect do |regexp|
profile =~ regexp
end
return false if rejected
end
return true if @options[:select].nil?
select_list = @options[:select]
select_list.map! { |f| Regexp.new(f) }
selected = !!select_list.detect do |regexp|
profile =~ regexp
end
selected
end
|
#run ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/aws_rotate/keys.rb', line 3
def run
list = List.new(@options)
list.profiles.each do |profile|
next unless filter_match?(profile)
ENV['AWS_PROFILE'] = profile
Key.new(@options).run
end
end
|