Class: AWS::IAM::GroupUserCollection

Inherits:
Object
  • Object
show all
Includes:
Core::Collection::Simple
Defined in:
lib/aws/iam/group_user_collection.rb

Overview

A collection that provides access to IAM users belonging to a particular group.

group = AWS::IAM.new.groups.first
users = group.users
users.each { |u| puts u.name }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Collection::Simple

#each_batch

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Instance Attribute Details

#groupObject (readonly)



35
36
37
# File 'lib/aws/iam/group_user_collection.rb', line 35

def group
  @group
end

Instance Method Details

#add(user) ⇒ nil

Adds a user to the group.

Parameters:

  • user (User)

    The user to add.

Returns:

  • (nil)


41
42
43
44
45
46
47
48
49
# File 'lib/aws/iam/group_user_collection.rb', line 41

def add(user)

  client.add_user_to_group(
    :group_name => group.name,
    :user_name => user.name)

  nil

end

#clearnil

Removes all users from this group.

Returns:

  • (nil)


67
68
69
# File 'lib/aws/iam/group_user_collection.rb', line 67

def clear
  each {|user| remove(user) }
end

#remove(user) ⇒ nil

Remove a user from the group.

Parameters:

  • user (User)

    The user to remove.

Returns:

  • (nil)


55
56
57
58
59
60
61
62
63
# File 'lib/aws/iam/group_user_collection.rb', line 55

def remove(user)

  client.remove_user_from_group(
    :group_name => group.name,
    :user_name => user.name)

  nil

end