Module: Conjur::PuppetModule::HTTP
- Defined in:
- lib/conjur/puppet_module/http.rb
Overview
This module is in charge of interacting with the Conjur endpoints
Class Method Summary collapse
- .get(host_url, path, ssl_certificate, token) ⇒ Object
- .post(host_url, path, ssl_certificate, data, token = nil) ⇒ Object
Class Method Details
.get(host_url, path, ssl_certificate, token) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/conjur/puppet_module/http.rb', line 10 def get(host_url, path, ssl_certificate, token) headers = {} if token encoded_token = Base64.urlsafe_encode64(token) headers['Authorization'] = "Token token=\"#{encoded_token}\"" end start_http_request(host_url, path, ssl_certificate) do |http, uri| http.get(uri.request_uri, headers) end end |
.post(host_url, path, ssl_certificate, data, token = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/conjur/puppet_module/http.rb', line 22 def post(host_url, path, ssl_certificate, data, token = nil) headers = {} if token headers['Authorization'] = "Token token=\"#{token}\"" end start_http_request(host_url, path, ssl_certificate) do |http, uri| http.post(uri.request_uri, data, headers) end end |