Sha256: 43f60992c25e3d13f79e1724d9012a5387d27e9fcbfc13d4b7ae616afd6886d8

Contents?: true

Size: 853 Bytes

Versions: 8

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

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
      raise ArgumentError, _("Request is not set up; cannot build call") unless handler and method

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

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

    def to_s
      "#{self.name}(#{self.ip})"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
puppet-8.5.1 lib/puppet/network/client_request.rb
puppet-8.5.1-x86-mingw32 lib/puppet/network/client_request.rb
puppet-8.5.1-x64-mingw32 lib/puppet/network/client_request.rb
puppet-8.5.1-universal-darwin lib/puppet/network/client_request.rb
puppet-8.5.0 lib/puppet/network/client_request.rb
puppet-8.5.0-x86-mingw32 lib/puppet/network/client_request.rb
puppet-8.5.0-x64-mingw32 lib/puppet/network/client_request.rb
puppet-8.5.0-universal-darwin lib/puppet/network/client_request.rb