Sha256: 5ae95d20326c1032dbfeda4263a8f20dcb5c745bccc854caa578628e018795e3

Contents?: true

Size: 1.84 KB

Versions: 53

Compression:

Stored size: 1.84 KB

Contents

module Fog
  module AWS
    class IAM
      class Real

        require 'fog/aws/parsers/iam/get_user'

        # Get User
        # 
        # ==== Parameters
        # * username<String>
        # * options<~Hash>:
        #   * 'UserName'<~String>: Name of the User. Defaults to current user
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'User'<~Hash> - User
        #       * Arn<~String> -
        #       * UserId<~String> -
        #       * UserName<~String> -
        #       * Path<~String> -
        #
        # ==== See Also
        # http://docs.amazonwebservices.com/IAM/latest/APIReference/API_Getuser.html
        #
        def get_user(username, options = {})
          request({
            'Action'    => 'GetUser',
            'UserName'  => username,
            :parser     => Fog::Parsers::AWS::IAM::GetUser.new
          }.merge!(options))
        end

      end
      
      class Mock
        def get_user(user, options = {})
          raise Fog::AWS::IAM::NotFound.new(
            "The user with name #{user} cannot be found."
          ) unless self.data[:users].key?(user)
          Excon::Response.new.tap do |response|
            response.body = {'User' =>  { 
                                          'UserId'     => data[:users][user][:user_id],
                                          'Path'       => data[:users][user][:path],
                                          'UserName'   => user,
                                          'Arn'        => (data[:users][user][:arn]).strip,
                                          'CreateDate' => data[:users][user][:created_at]
                                        },
                             'RequestId'   => Fog::AWS::Mock.request_id }
            response.status = 200
          end
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 3 rubygems

Version Path
fog-maestrodev-1.18.0.20131205181604 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/aws/requests/iam/get_user.rb
gapinc-fog-1.12.1.2.1 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/aws/requests/iam/get_user.rb
fog-1.18.0 lib/fog/aws/requests/iam/get_user.rb
fog-1.17.0 lib/fog/aws/requests/iam/get_user.rb
fog-1.16.0 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/aws/requests/iam/get_user.rb