Class: ForemanX509::CertificatesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanX509::CertificatesController
- Defined in:
- app/controllers/foreman_x509/certificates_controller.rb
Instance Method Summary collapse
- #certificate ⇒ Object
- #chain ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #key ⇒ Object
- #new ⇒ Object
- #resource_class ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#certificate ⇒ Object
40 41 42 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 40 def certificate send_data @certificate.certificate.to_pem, filename: "#{@certificate.name}_cert.pem" end |
#chain ⇒ Object
36 37 38 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 36 def chain send_data @certificate.issuer.bundle.map(&:to_pem).join('\n'), filename: "#{@certificate.name}_ca.pem" end |
#create ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 16 def create @certificate = Certificate.new(certificate_params) if @certificate.save process_success object: @certificate else process_error object: @certificate end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 48 def destroy if @certificate.destroy process_success object: @certificate else process_error object: @certificate end end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 8 def index @certificates = resource_base_search_and_page end |
#key ⇒ Object
44 45 46 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 44 def key send_data @certificate.key.to_pem, filename: "#{@certificate.name}_key.pem" end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 12 def new @certificate = Certificate.new end |
#resource_class ⇒ Object
56 57 58 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 56 def resource_class ForemanX509::Certificate end |
#show ⇒ Object
25 26 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 25 def show end |
#update ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/controllers/foreman_x509/certificates_controller.rb', line 28 def update if @certificate.update(certificate_params) process_success object: @certificate else process_error object: @certificate end end |