lib/miam/client.rb in miam-0.2.4.beta16 vs lib/miam/client.rb in miam-0.2.4.beta17
- old
+ new
@@ -1,10 +1,13 @@
class Miam::Client
include Miam::Logger::Helper
def initialize(options = {})
- @options = {:format => :ruby}.merge(options)
+ @options = {
+ format: :ruby,
+ exclude: []
+ }.merge(options)
aws_config = options.delete(:aws_config) || {}
@iam = Aws::IAM::Client.new(aws_config)
@sts = Aws::STS::Client.new(aws_config)
@driver = Miam::Driver.new(@iam, @sts, options)
@password_manager = options[:password_manager] || Miam::PasswordManager.new('-', options)
@@ -56,10 +59,11 @@
private
def walk(file)
expected = load_file(file)
+ @options[:exclude] += expected[:exclude]
actual, group_users, instance_profile_roles = Miam::Exporter.export(@iam, @options)
updated = pre_walk_managed_policies(expected[:policies], actual[:policies])
updated = walk_groups(expected[:groups], actual[:groups], actual[:users], group_users) || updated
updated = walk_users(expected[:users], actual[:users], group_users) || updated
@@ -537,10 +541,10 @@
def target_matched?(name)
result = true
if @options[:exclude]
- result &&= @options[:exclude].all? {|r| name !~ r}
+ result &&= @options[:exclude].all? {|r| name !~ r }
end
if @options[:target]
result &&= @options[:target].any? {|r| name =~ r}
end