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.



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

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

Instance Attribute Details

#authenticatedObject

Returns the value of attribute authenticated.



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

def authenticated
  @authenticated
end

#handlerObject

Returns the value of attribute handler.



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

def handler
  @handler
end

#ipObject

Returns the value of attribute ip.



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

def ip
  @ip
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#authenticated?Boolean

Returns:

  • (Boolean)


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

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)


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

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

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

#to_sObject



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

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