Class: ForemanX509::Api::V2::CertificatesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/foreman_x509/api/v2/certificates_controller.rb

Instance Method Summary collapse

Instance Method Details

#certificateObject



37
38
39
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 37

def certificate
  send_data @certificate.certificate.to_pem, filename: "#{@certificate.name}_cert.pem"
end

#chainObject



31
32
33
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 31

def chain
  send_data @certificate.issuer.bundle.map(&:to_pem).join('\n'), filename: "#{@certificate.name}_ca.pem"
end

#createObject



20
21
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 20

def create
end

#destroyObject



49
50
51
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 49

def destroy
  process_response @certificate.destroy
end

#indexObject



16
17
18
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 16

def index
  @certificates = resource_scope_for_index
end

#keyObject



43
44
45
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 43

def key
  send_data @certificate.key.to_pem, filename: "#{@certificate.name}_key.pem"
end

#resource_classObject



53
54
55
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 53

def resource_class
  ForemanX509::Certificate
end

#showObject



23
24
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 23

def show
end

#updateObject



26
27
# File 'app/controllers/foreman_x509/api/v2/certificates_controller.rb', line 26

def update
end