Class: Puppet::Network::HTTP::API::IndirectionType

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/http/api/indirection_type.rb

Constant Summary collapse

INDIRECTION_TYPE_MAP =
{
  "certificate" => :ca,
  "certificate_request" => :ca,
  "certificate_revocation_list" => :ca,
  "certificate_status" => :ca
}

Class Method Summary collapse

Class Method Details

.ca_url_prefixObject



15
16
17
# File 'lib/puppet/network/http/api/indirection_type.rb', line 15

def self.ca_url_prefix
  "#{Puppet::Network::HTTP::CA_URL_PREFIX}/v1"
end

.master_url_prefixObject



11
12
13
# File 'lib/puppet/network/http/api/indirection_type.rb', line 11

def self.master_url_prefix
  "#{Puppet::Network::HTTP::MASTER_URL_PREFIX}/v3"
end

.type_for(indirection) ⇒ Object



19
20
21
# File 'lib/puppet/network/http/api/indirection_type.rb', line 19

def self.type_for(indirection)
  INDIRECTION_TYPE_MAP[indirection] || :master
end

.url_prefix_for(indirection_name) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/puppet/network/http/api/indirection_type.rb', line 23

def self.url_prefix_for(indirection_name)
  case type_for(indirection_name)
  when :ca
    ca_url_prefix
  when :master
    master_url_prefix
  else
    raise ArgumentError, _("Not a valid indirection type")
  end
end