Class: Cumulus::IAM::Commands

Inherits:
Common::Commands show all
Defined in:
lib/iam/Commands.rb

Class Method Summary collapse

Methods inherited from Common::Commands

banner_message, format_message, help_message, manager_name, parse, usage_message, verify

Class Method Details

.command_detailsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/iam/Commands.rb', line 6

def self.command_details
  format_message([
    "groups - Manage IAM groups and users associated with those groups",
    ["diff", "get a list of groups that have different definitions locally than in AWS (supplying the name of the group will diff only that group)"],
    ["list", "list the groups defined in configuration"],
    ["migrate", "create group configuration files that match the definitions in AWS"],
    ["sync", "sync the local group definition with AWS (supplying the name of the group will sync only that group). Also adds and removes users from groups"],
    "roles - Manage IAM roles",
    ["diff", "get a list of roles that have different definitions locally than in AWS (supplying the name of the role will diff only that role)"],
    ["list", "list the roles defined in configuration"],
    ["migrate", "create role configuration files that match the definitions in AWS"],
    ["sync", "sync the local role definition with AWS (supplying the name of the role will sync only that role)"],
    "users - Manage IAM users",
    ["diff", "get a list of users that have different definitions locally than in AWS (supplying the name of the user will diff only that user)"],
    ["list", "list the users defined in configuration"],
    ["migrate", "create user configuration files that match the definitions in AWS"],
    ["sync", "sync the local user definition with AWS (supplying the name of the user will sync only that user)"],
  ], indent: 1)
end

.execute(arguments) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/iam/Commands.rb', line 35

def self.execute(arguments)
  resource = super(arguments)

  if arguments[1] == "diff" and arguments.size == 3
    resource.diff_one(arguments[2])
  elsif arguments[1] == "sync" and arguments.size == 3
    resource.sync_one(arguments[2])
  else
    resource.method(arguments[1]).call
  end
end

.managerObject



30
31
32
33
# File 'lib/iam/Commands.rb', line 30

def self.manager
  require "iam/manager/Manager"
  Cumulus::IAM::Manager.new
end

.valid_optionsObject



26
27
28
# File 'lib/iam/Commands.rb', line 26

def self.valid_options
  [["groups", "roles", "users"], ["diff", "list", "migrate", "sync"]]
end