Class | AWS::IAM::UserCollection |
In: |
lib/aws/iam/user_collection.rb
|
Parent: | Object |
A collection that provides access to IAM users belonging to this account.
iam = AWS::IAM.new users = iam.users
To create an IAM user you need only provide a user name.
user = users.create('username')
You can also provide an optional +:path+ that can be used to organize users.
user = users.create('johndoe', :path => '/staff/customer_support/')
You can get a referene to a user by using array notation:
user = users['username']
A user collection can also be used to enumerate users:
users.each do |user| puts user.name end
You can also find/enumerate users who‘s path begins with a given prefix:
users.each(:path_prefix => '/staff/developers/ruby').each do |ruby_dev| puts "#{ruby_dev.name} is awesome!" end
Returns a reference to the user with the given name:
user = iam.users['username']
@param [String] name Name of the user to return a reference for. @return [User] Returns a reference to the named user.
@param [String] name Name of the user to create. @option options [String] :path (’/’) The path for the user name.
For more information about paths, see {Identifiers for IAM Entities}[http://docs.amazonwebservices.com/IAM/latest/UserGuide/index.html?Using_Identifiers.html]
@return [User] Returns the newly created user.
Yields once for each user.
You can limit the number of users yielded using +:limit+ and +:path_prefix+.
@param [Hash] options
@option options [String] :path_prefix (’/’) A path prefix that
filters according to the path of the user.
@option options [Integer] :limit The maximum number of users to yield.
@option options [Integer] :batch_size The maximum number of users
to retrieve with each service request.
@yieldparam [User] user @return [nil]