Class: Miam::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/miam/exporter.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iam, options = {}) ⇒ Exporter

Returns a new instance of Exporter.



7
8
9
10
11
12
# File 'lib/miam/exporter.rb', line 7

def initialize(iam, options = {})
  @iam = iam
  @options = options
  @mutex = Mutex.new
  @concurrency = options[:export_concurrency] || 16
end

Class Method Details

.export(iam, options = {}) ⇒ Object



3
4
5
# File 'lib/miam/exporter.rb', line 3

def self.export(iam, options = {})
  self.new(iam, options).export
end

Instance Method Details

#exportObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/miam/exporter.rb', line 14

def export
   = 

  users = [:user_detail_list]
  groups = [:group_detail_list]
  roles = [:role_detail_list]
  instance_profiles = list_instance_profiles
  group_users = {}
  instance_profile_roles = {}

  unless @options[:no_progress]
    progress_total = users.length + groups.length + roles.length + instance_profiles.length

    @progressbar = ProgressBar.create(
                     :format => ' %bᗧ%i %p%%',
                     :progress_mark  => ' ',
                     :remainder_mark => '',
                     :total => progress_total,
                     :output => $stderr)
  end

  expected = {
    :users => export_users(users, group_users),
    :groups => export_groups(groups),
    :roles => export_roles(roles, instance_profile_roles),
    :instance_profiles => export_instance_profiles(instance_profiles),
  }

  [expected, group_users, instance_profile_roles]
end