Class: Api::V2::DiscoveryRulesController

Inherits:
BaseController
  • Object
show all
Includes:
Foreman::Controller::Parameters::DiscoveryRule
Defined in:
app/controllers/api/v2/discovery_rules_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



47
48
49
50
51
# File 'app/controllers/api/v2/discovery_rules_controller.rb', line 47

def create
  @discovery_rule = DiscoveryRule.new(discovery_rule_params)
  @discovery_rule.priority = DiscoveryRule.suggest_priority if discovery_rule_params[:priority].blank?
  process_response @discovery_rule.save
end

#destroyObject



64
65
66
# File 'app/controllers/api/v2/discovery_rules_controller.rb', line 64

def destroy
  process_response @discovery_rule.destroy
end

#indexObject



20
21
22
# File 'app/controllers/api/v2/discovery_rules_controller.rb', line 20

def index
  @discovery_rules = resource_scope.search_for(*search_options).paginate(paginate_options)
end

#showObject



27
28
# File 'app/controllers/api/v2/discovery_rules_controller.rb', line 27

def show
end

#updateObject



57
58
59
# File 'app/controllers/api/v2/discovery_rules_controller.rb', line 57

def update
  process_response @discovery_rule.update(discovery_rule_params)
end