Sha256: fe7dfbd4cc743ee57791652a7fbead406132c3b711b944cb12f05df7ba31a200

Contents?: true

Size: 1.71 KB

Versions: 71

Compression:

Stored size: 1.71 KB

Contents

module Fog
  module AWS
    class IAM
      class Real
        require 'fog/aws/parsers/iam/login_profile'

        # Retrieves the login profile for a user
        #
        # http://docs.amazonwebservices.com/IAM/latest/APIReference/API_CreateLoginProfile.html
        # ==== Parameters
        # * user_name<~String> - Name of user to retrieve the login profile for
        # * password<~String> - The new password for this user
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * 'LoginProfile'<~Hash>
        #        * UserName<~String>
        #        * CreateDate
        #     * 'RequestId'<~String> - Id of the request
        #
        #
        def get_login_profile(user_name)
          request({
            'Action'    => 'GetLoginProfile',
            'UserName'  => user_name,
            :parser     => Fog::Parsers::AWS::IAM::LoginProfile.new
          })
        end
      end

      class Mock
        def get_login_profile(user_name)
          unless self.data[:users].key?(user_name)
            raise Fog::AWS::IAM::NotFound.new("The user with name #{user_name} cannot be found.")
          end

          profile = self.data[:users][user_name][:login_profile]

          unless profile
            raise Fog::AWS::IAM::NotFound, "Cannot find Login Profile for User #{user_name}"
          end

          response = Excon::Response.new
          response.status = 200

          response.body = {
            "LoginProfile" => {
              "UserName"   => user_name,
              "CreateDate" => profile[:created_at]
            },
            "RequestId" => Fog::AWS::Mock.request_id
          }

          response
        end
      end
    end
  end
end

Version data entries

71 entries across 69 versions & 3 rubygems

Version Path
fog-aws-3.10.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.9.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.8.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.7.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.7 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.6 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.5 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.4 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.3 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.6.2 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.5.2 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.5.1 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.5.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.4.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.3.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.2.0 lib/fog/aws/requests/iam/get_login_profile.rb
fog-aws-3.1.0 lib/fog/aws/requests/iam/get_login_profile.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/iam/get_login_profile.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/iam/get_login_profile.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-aws-2.0.1/lib/fog/aws/requests/iam/get_login_profile.rb