Sha256: 5e2f9737e4572d6c4844b1084575f59c73345f4aaf4aeb09e776a9f2c6b395eb

Contents?: true

Size: 1001 Bytes

Versions: 4

Compression:

Stored size: 1001 Bytes

Contents

module Puppet::Network # :nodoc:
    # A struct-like class for passing around a client request.  It's mostly
    # just used for validation and authorization.
    class ClientRequest
        attr_accessor :name, :ip, :authenticated, :handler, :method

        def authenticated?
            self.authenticated
        end

        # A common way of talking about the full call.  Individual servers
        # are responsible for setting the values correctly, but this common
        # format makes it possible to check rights.
        def call
            unless handler and method
                raise ArgumentError, "Request is not set up; cannot build call"
            end

            [handler, method].join(".")
        end

        def initialize(name, ip, authenticated)
            @name, @ip, @authenticated = name, ip, authenticated
        end

        def to_s
            "%s(%s)" % [self.name, self.ip]
        end
    end
end

# $Id: client_request.rb 2259 2007-03-06 19:03:05Z luke $

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-0.22.4 lib/puppet/network/client_request.rb
puppet-0.23.0 lib/puppet/network/client_request.rb
puppet-0.23.1 lib/puppet/network/client_request.rb
puppet-0.23.2 lib/puppet/network/client_request.rb