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.20.0.20140305101839 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/requests/iam/get_user.rb
fog-1.20.0 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/requests/iam/get_user.rb
fog-1.19.0 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/aws/requests/iam/get_user.rb