Class: AwsCli::CLI::IAM::User

Inherits:
Thor
  • Object
show all
Defined in:
lib/awscli/cli/iam/user.rb

Instance Method Summary collapse

Instance Method Details

#addtogroupObject



87
88
89
90
# File 'lib/awscli/cli/iam/user.rb', line 87

def addtogroup
  create_iam_object
  @iam.add_user_to_group options[:user_name], options[:group_name]
end

#cakObject



51
52
53
54
# File 'lib/awscli/cli/iam/user.rb', line 51

def cak
  create_iam_object
  @iam.create_user_access_key options[:user_name]
end

#createObject



30
31
32
33
34
35
36
# File 'lib/awscli/cli/iam/user.rb', line 30

def create
  if options[:policy]
    abort 'Required --policy-doc, if --policy is passed' unless options[:policy_doc]
  end
  create_iam_object
  @iam.create options
end

#dakObject



66
67
68
69
# File 'lib/awscli/cli/iam/user.rb', line 66

def dak
  create_iam_object
  @iam.delete_user_access_key options[:user_name], options[:access_key_id]
end

#deleteObject



41
42
43
44
# File 'lib/awscli/cli/iam/user.rb', line 41

def delete
  create_iam_object
  @iam.delete options
end

#lakObject



58
59
60
61
# File 'lib/awscli/cli/iam/user.rb', line 58

def lak
  create_iam_object
  @iam.list_user_access_keys options[:user_name]
end

#listObject

method_option :marker, :aliases => ‘-m’, :desc => ‘used to paginate subsequent requests’ method_option :maxitems, :alises => ‘-i’, :type => :numeric, :desc => ‘limit results to this number per page’



14
15
16
17
# File 'lib/awscli/cli/iam/user.rb', line 14

def list
  create_iam_object
  @iam.list options[:path]
end

#listgroupsObject



102
103
104
105
# File 'lib/awscli/cli/iam/user.rb', line 102

def listgroups
  create_iam_object
  @iam.list_groups_for_user options[:user_name]
end

#passwdObject



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/awscli/cli/iam/user.rb', line 112

def passwd
  create_iam_object
  if options[:remove]
    @iam.remove_password options[:user_name]
  else
    if options[:generate]
      @iam.assign_password options[:user_name], options[:password]
    else
      @iam.generate_password options[:user_name]
    end
  end
end

#removefromgroupObject



95
96
97
98
# File 'lib/awscli/cli/iam/user.rb', line 95

def removefromgroup
  create_iam_object
  @iam.remove_user_from_group options[:user_name], options[:group_name]
end

#updateObject



75
76
77
78
79
80
81
82
# File 'lib/awscli/cli/iam/user.rb', line 75

def update
  create_iam_object
  if !options[:new_user_name] and !options[:new_path]
    puts 'Should pass atleast one option to change, either --new-user-name (or) --new-path'
    exit
  end
  @iam.update_user options
end