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



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

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

.master_url_prefixObject



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

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

.type_for(indirection) ⇒ Object



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

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

.url_prefix_for(indirection_name) ⇒ Object



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

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