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.



20
21
22
# File 'lib/puppet/network/client_request.rb', line 20

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

Instance Attribute Details

#authenticatedObject

Returns the value of attribute authenticated.



5
6
7
# File 'lib/puppet/network/client_request.rb', line 5

def authenticated
  @authenticated
end

#handlerObject

Returns the value of attribute handler.



5
6
7
# File 'lib/puppet/network/client_request.rb', line 5

def handler
  @handler
end

#ipObject

Returns the value of attribute ip.



5
6
7
# File 'lib/puppet/network/client_request.rb', line 5

def ip
  @ip
end

#methodObject

Returns the value of attribute method.



5
6
7
# File 'lib/puppet/network/client_request.rb', line 5

def method
  @method
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/puppet/network/client_request.rb', line 5

def name
  @name
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


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

def authenticated?
  self.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)


14
15
16
17
18
# File 'lib/puppet/network/client_request.rb', line 14

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

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

#to_sObject



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

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