Class: Api::V1::HostgroupsController

Inherits:
BaseController show all
Defined in:
app/controllers/api/v1/hostgroups_controller.rb

Direct Known Subclasses

Api::V2::HostgroupsController

Instance Method Summary collapse

Methods included from Api::Version1

#api_version

Methods inherited from BaseController

#get_resource, #resource_class, #resource_name, #resource_scope

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread, included

Instance Method Details

#createObject


38
39
40
41
# File 'app/controllers/api/v1/hostgroups_controller.rb', line 38

def create
  @hostgroup = Hostgroup.new(params[:hostgroup])
  process_response @hostgroup.save
end

#destroyObject


66
67
68
# File 'app/controllers/api/v1/hostgroups_controller.rb', line 66

def destroy
  process_response @hostgroup.destroy
end

#indexObject


12
13
14
15
# File 'app/controllers/api/v1/hostgroups_controller.rb', line 12

def index
  @hostgroups = Hostgroup.includes(:hostgroup_classes, :group_parameters).
    search_for(*search_options).paginate(paginate_options)
end

#showObject


20
21
# File 'app/controllers/api/v1/hostgroups_controller.rb', line 20

def show
end

#updateObject


59
60
61
# File 'app/controllers/api/v1/hostgroups_controller.rb', line 59

def update
  process_response @hostgroup.update_attributes(params[:hostgroup])
end