Class: Puppet::Network::ClientRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/client_request.rb

Overview

A struct-like class for passing around a client request. It’s mostly just used for validation and authorization.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, ip, authenticated) ⇒ ClientRequest

Returns a new instance of ClientRequest.



22
23
24
25
26
# File 'lib/puppet/network/client_request.rb', line 22

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

Instance Attribute Details

#authenticatedObject

Returns the value of attribute authenticated.



7
8
9
# File 'lib/puppet/network/client_request.rb', line 7

def authenticated
  @authenticated
end

#handlerObject

Returns the value of attribute handler.



7
8
9
# File 'lib/puppet/network/client_request.rb', line 7

def handler
  @handler
end

#ipObject

Returns the value of attribute ip.



7
8
9
# File 'lib/puppet/network/client_request.rb', line 7

def ip
  @ip
end

#methodObject

Returns the value of attribute method.



7
8
9
# File 'lib/puppet/network/client_request.rb', line 7

def method
  @method
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/puppet/network/client_request.rb', line 7

def name
  @name
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/puppet/network/client_request.rb', line 9

def authenticated?
  authenticated
end

#callObject

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.

Raises:

  • (ArgumentError)


16
17
18
19
20
# File 'lib/puppet/network/client_request.rb', line 16

def call
  raise ArgumentError, _("Request is not set up; cannot build call") unless handler and method

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

#to_sObject



28
29
30
# File 'lib/puppet/network/client_request.rb', line 28

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