Method: Puppet::HTTP::Service::Ca#get_certificate

Defined in:
lib/puppet/http/service/ca.rb

#get_certificate(name, if_modified_since: nil, ssl_context: nil) ⇒ Array<Puppet::HTTP::Response, String>

Submit a GET request to retrieve the named certificate from the server.

Parameters:

  • name (String)

    name of the certificate to request

  • if_modified_since (Time) (defaults to: nil)

    If not nil, only download the cert if it has been modified since the specified time.

  • ssl_context (Puppet::SSL::SSLContext) (defaults to: nil)

Returns:

  • (Array<Puppet::HTTP::Response, String>)

    An array containing the request response and the stringified body of the request response



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/puppet/http/service/ca.rb', line 40

def get_certificate(name, if_modified_since: nil, ssl_context: nil)
  headers = add_puppet_headers(HEADERS)
  headers['If-Modified-Since'] = if_modified_since.httpdate if if_modified_since

  response = @client.get(
    with_base_url("/certificate/#{name}"),
    headers: headers,
    options: { ssl_context: ssl_context }
  )

  process_response(response)

  [response, response.body.to_s]
end