ruby/example_code/s3/auth_session_token_request_test.rb
# Creates a user in IAM.
#
# @param iam_client [Aws::IAM::Client] An initialized IAM client.
# @param user_name [String] The user's name.
# @return [AWS:IAM::Types::User] The new user.
# @example
#   iam_client = Aws::IAM::Client.new(region: 'us-west-2')
#   user = create_user(iam_client, 'my-user')
#   exit 1 unless user.user_name
Creates a user in IAM.
Creates a user in IAM .
def create_user(iam_client, user_name)
  response = iam_client.create_user(user_name: user_name)
  return response.user
rescue StandardError => e
  puts "Error while creating the user '#{user_name}': #{e.message}"
end
def create_user ( iam_client , user_name ) response = iam_client . create_user ( user_name : user_name ) return response . user rescue StandardError => e puts "Error while creating the user '#{user_name}': #{e.message}" end
Creates a user in IAM.
Creates a user in IAM .
The new user.
The new user .
AWS:IAM::Types::User
iam_client
An initialized IAM client.
An initialized IAM client .
user_name
The user's name.
The user ' s name .
example
iam_client = Aws::IAM::Client.new(region: 'us-west-2') user = create_user(iam_client, 'my-user') exit 1 unless user.user_name
iam_client = Aws :: IAM :: Client . new ( region : ' us - west - 2 ' ) user = create_user ( iam_client ' my - user ' ) exit 1 unless user . user_name