Class: Miam::Client
- Inherits:
-
Object
- Object
- Miam::Client
- Includes:
- Logger::Helper
- Defined in:
- lib/miam/client.rb
Instance Method Summary collapse
- #apply(file) ⇒ Object
- #export(export_options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Logger::Helper
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 10 |
# File 'lib/miam/client.rb', line 4 def initialize( = {}) @options = aws_config = .delete(:aws_config) || {} @iam = Aws::IAM::Client.new(aws_config) @driver = Miam::Driver.new(@iam, ) @password_manager = [:password_manager] || Miam::PasswordManager.new('-', ) end |
Instance Method Details
#apply(file) ⇒ Object
36 37 38 |
# File 'lib/miam/client.rb', line 36 def apply(file) walk(file) end |
#export(export_options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/miam/client.rb', line 12 def export( = {}) exported, group_users, instance_profile_roles = Miam::Exporter.export(@iam, @options) if block_given? [:users, :groups, :roles, :instance_profiles].each do |type| splitted = {:users => {}, :groups => {}, :roles => {}, :instance_profiles => {}} if [:split_more] exported[type].sort_by {|k, v| k }.each do |name, attrs| more_splitted = splitted.dup more_splitted[type] = {} more_splitted[type][name] = attrs yield(:type => type, :name => name, :dsl => Miam::DSL.convert(more_splitted, @options).strip) end else splitted[type] = exported[type] yield(:type => type, :dsl => Miam::DSL.convert(splitted, @options).strip) end end else Miam::DSL.convert(exported, @options) end end |