Class: Puppet::Network::HTTP::API::Server::V3

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/http/api/server/v3.rb,
lib/puppet/network/http/api/server/v3/environments.rb

Defined Under Namespace

Classes: Environments

Constant Summary collapse

INDIRECTED =
Puppet::Network::HTTP::Route.
path(/.*/).
any(wrap { Puppet::Network::HTTP::API::IndirectedRoutes.new } )
ENVIRONMENTS =
Puppet::Network::HTTP::Route.
path(%r{^/environments$}).
get(wrap { Environments.new(Puppet.lookup(:environments)) } )

Class Method Summary collapse

Class Method Details

.routesObject


29
30
31
32
33
# File 'lib/puppet/network/http/api/server/v3.rb', line 29

def self.routes
  Puppet::Network::HTTP::Route.path(%r{v3}).
      any.
      chain(ENVIRONMENTS, INDIRECTED)
end

.wrap(&block) ⇒ Object


11
12
13
14
15
16
17
18
19
# File 'lib/puppet/network/http/api/server/v3.rb', line 11

def self.wrap(&block)
  lambda do |request, response|
    Puppet::Network::Authorization.
      check_external_authorization(request.method,
                                   request.path)

    block.call.call(request, response)
  end
end