Class: Puppet::HTTP::Service::Ca Private
- Inherits:
-
Puppet::HTTP::Service
- Object
- Puppet::HTTP::Service
- Puppet::HTTP::Service::Ca
- Defined in:
- lib/puppet/http/service/ca.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The Ca service is used to handle certificate requests
Constant Summary collapse
- HEADERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns default headers for the ca service.
{ 'Accept' => 'text/plain' }.freeze
- API =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Returns default API for the ca service.
'/puppet-ca/v1'.freeze
Constants inherited from Puppet::HTTP::Service
EXCLUDED_FORMATS, SERVICE_NAMES
Instance Attribute Summary
Attributes inherited from Puppet::HTTP::Service
Instance Method Summary collapse
-
#get_certificate(name, ssl_context: nil) ⇒ Array<Puppet::HTTP::Response, String>
private
Submit a GET request to retrieve the named certificate from the server.
-
#get_certificate_revocation_list(if_modified_since: nil, ssl_context: nil) ⇒ Array<Puppet::HTTP::Response, String>
private
Submit a GET request to retrieve the certificate revocation list from the server.
-
#initialize(client, session, server, port) ⇒ Ca
constructor
private
A new instance of Ca.
-
#put_certificate_request(name, csr, ssl_context: nil) ⇒ Puppet::HTTP::Response
private
Submit a PUT request to send a certificate request to the server.
Methods inherited from Puppet::HTTP::Service
#connect, create_service, valid_name?, #with_base_url
Constructor Details
#initialize(client, session, server, port) ⇒ Ca
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Ca.
27 28 29 30 |
# File 'lib/puppet/http/service/ca.rb', line 27 def initialize(client, session, server, port) url = build_url(API, server || Puppet[:ca_server], port || Puppet[:ca_port]) super(client, session, url) end |
Instance Method Details
#get_certificate(name, ssl_context: nil) ⇒ Array<Puppet::HTTP::Response, String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Submit a GET request to retrieve the named certificate from the server
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/puppet/http/service/ca.rb', line 43 def get_certificate(name, ssl_context: nil) response = @client.get( with_base_url("/certificate/#{name}"), headers: add_puppet_headers(HEADERS), options: {ssl_context: ssl_context} ) process_response(response) [response, response.body.to_s] end |
#get_certificate_revocation_list(if_modified_since: nil, ssl_context: nil) ⇒ Array<Puppet::HTTP::Response, String>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Submit a GET request to retrieve the certificate revocation list from the
server
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/puppet/http/service/ca.rb', line 68 def get_certificate_revocation_list(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_revocation_list/ca"), headers: headers, options: {ssl_context: ssl_context} ) process_response(response) [response, response.body.to_s] end |
#put_certificate_request(name, csr, ssl_context: nil) ⇒ Puppet::HTTP::Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Submit a PUT request to send a certificate request to the server
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/puppet/http/service/ca.rb', line 95 def put_certificate_request(name, csr, ssl_context: nil) headers = add_puppet_headers(HEADERS) headers['Content-Type'] = 'text/plain' response = @client.put( with_base_url("/certificate_request/#{name}"), csr.to_pem, headers: headers, options: { ssl_context: ssl_context } ) process_response(response) response end |