Class: ForemanPuppet::Api::V2::HostClassesController
- Inherits:
-
PuppetBaseController
- Object
- Api::V2::BaseController
- PuppetBaseController
- ForemanPuppet::Api::V2::HostClassesController
- Defined in:
- app/controllers/foreman_puppet/api/v2/host_classes_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 |
# File 'app/controllers/foreman_puppet/api/v2/host_classes_controller.rb', line 22 def create @host_class = HostClass.create!(host_puppet_facet_id: @host.puppet.id, puppetclass_id: @puppetclass.id) render json: { host_id: @host.id, puppetclass_id: @host_class.puppetclass_id } end |
#destroy ⇒ Object
31 32 33 34 |
# File 'app/controllers/foreman_puppet/api/v2/host_classes_controller.rb', line 31 def destroy @host_class = HostClass.(:edit_classes).where(host_puppet_facet_id: @host.puppet.id, puppetclass_id: @puppetclass.id) process_response @host_class.destroy_all end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/foreman_puppet/api/v2/host_classes_controller.rb', line 14 def index render json: { root_node_name => HostClass.(:edit_classes).where(host_puppet_facet_id: @host.puppet.id).pluck('puppetclass_id') } end |
#resource_class ⇒ Object
36 37 38 |
# File 'app/controllers/foreman_puppet/api/v2/host_classes_controller.rb', line 36 def resource_class ForemanPuppet::HostClass end |