Sha256: 4cc78013caca2ea3e6ab2c73e2cc5a6efeb3411b50e206eadf64eb2781e2dbb0

Contents?: true

Size: 1.21 KB

Versions: 20

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require_relative 'v3/environments'
require_relative '../../../../../puppet/network/http/api/indirected_routes'

module Puppet
  module Network
    module HTTP
      class API
        module Server
          class V3
            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

            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)) })

            def self.routes
              Puppet::Network::HTTP::Route.path(/v3/)
                                          .any
                                          .chain(ENVIRONMENTS, INDIRECTED)
            end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/network/http/api/server/v3.rb
puppet-8.10.0-x86-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.10.0-x64-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.10.0-universal-darwin lib/puppet/network/http/api/server/v3.rb
puppet-8.9.0 lib/puppet/network/http/api/server/v3.rb
puppet-8.9.0-x86-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.9.0-x64-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.9.0-universal-darwin lib/puppet/network/http/api/server/v3.rb
puppet-8.8.1 lib/puppet/network/http/api/server/v3.rb
puppet-8.8.1-x86-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.8.1-x64-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.8.1-universal-darwin lib/puppet/network/http/api/server/v3.rb
puppet-8.7.0 lib/puppet/network/http/api/server/v3.rb
puppet-8.7.0-x86-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.7.0-x64-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.7.0-universal-darwin lib/puppet/network/http/api/server/v3.rb
puppet-8.6.0 lib/puppet/network/http/api/server/v3.rb
puppet-8.6.0-x86-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.6.0-x64-mingw32 lib/puppet/network/http/api/server/v3.rb
puppet-8.6.0-universal-darwin lib/puppet/network/http/api/server/v3.rb