def get_user(username = nil, options = {})
response = Excon::Response.new
user_body = nil
if username.nil?
user = self.current_user
user_body = {
'UserId' => user[:user_id],
'Arn' => user[:arn].strip,
'CreateDate' => user[:created_at]
}
unless @current_user_name == "root"
user_body.merge!(
'Path' => user[:path],
'UserName' => @current_user_name
)
end
elsif !self.data[:users].key?(username)
raise Fog::AWS::IAM::NotFound.new("The user with name #{username} cannot be found.")
else
user = self.data[:users][username]
user_body = {
'UserId' => user[:user_id],
'Path' => user[:path],
'UserName' => username,
'Arn' => user[:arn].strip,
'CreateDate' => user[:created_at]
}
end
response.status = 200
response.body = {
'User' => user_body,
'RequestId' => Fog::AWS::Mock.request_id
}
response
end