Class: ForemanPuppet::Api::V2::HostgroupClassesController
- Inherits:
-
PuppetBaseController
- Object
- Api::V2::BaseController
- PuppetBaseController
- ForemanPuppet::Api::V2::HostgroupClassesController
- Defined in:
- app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 |
# File 'app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb', line 21 def create @hostgroup_class = HostgroupClass.create!(hostgroup_puppet_facet_id: @hostgroup.puppet.id, puppetclass_id: params[:puppetclass_id].to_i) render json: { hostgroup_id: @hostgroup.puppet.hostgroup_id, puppetclass_id: @hostgroup_class.puppetclass_id } end |
#destroy ⇒ Object
30 31 32 33 |
# File 'app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb', line 30 def destroy @hostgroup_class = HostgroupClass.where(hostgroup_puppet_facet_id: @hostgroup.puppet.id, puppetclass_id: params[:id]) process_response @hostgroup_class.destroy_all end |
#index ⇒ Object
13 14 15 |
# File 'app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb', line 13 def index render json: { root_node_name => HostgroupClass.where(hostgroup_puppet_facet_id: @hostgroup.puppet.id).pluck('puppetclass_id') } end |
#resource_class ⇒ Object
35 36 37 |
# File 'app/controllers/foreman_puppet/api/v2/hostgroup_classes_controller.rb', line 35 def resource_class ForemanPuppet::HostgroupClass end |