Sha256: d2bef64e6dada1e92c8f3ae0f955c2aa756d9d188d521704f0179dbb985a10db

Contents?: true

Size: 1.75 KB

Versions: 23

Compression:

Stored size: 1.75 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 
                                        },
                             'RequestId'   => Fog::AWS::Mock.request_id }
            response.status = 200
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 10 rubygems

Version Path
hpfog-0.0.20 lib/fog/aws/requests/iam/get_user.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/requests/iam/get_user.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/requests/iam/get_user.rb
fog-nirvanix-1.8.2 lib/fog/aws/requests/iam/get_user.rb
fog-nirvanix-1.8.1 lib/fog/aws/requests/iam/get_user.rb
fog-1.10.1 lib/fog/aws/requests/iam/get_user.rb
fog-parser-fix-1.6.1 lib/fog/aws/requests/iam/get_user.rb
fog-test-again-1.6.0 lib/fog/aws/requests/iam/get_user.rb
fog-test-me-1.10.0 lib/fog/aws/requests/iam/get_user.rb
fog-parser-fix-1.6.0 lib/fog/aws/requests/iam/get_user.rb
fog-1.10.0 lib/fog/aws/requests/iam/get_user.rb
fog-1.9.0 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.8.0.20130114204828 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.8.0.20130111070250 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.8.0.20130109172219 lib/fog/aws/requests/iam/get_user.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/requests/iam/get_user.rb
fog-sgonyea-1.8.1 lib/fog/aws/requests/iam/get_user.rb
fog-1.8.0 lib/fog/aws/requests/iam/get_user.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/requests/iam/get_user.rb
fog-1.7.0 lib/fog/aws/requests/iam/get_user.rb