Class: Api::V2::ScansController

Inherits:
BaseController
  • Object
show all
Includes:
Api::Version2, Foreman::Renderer
Defined in:
app/controllers/foreman_probing/api/v2/scans_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/foreman_probing/api/v2/scans_controller.rb', line 34

def create
  @composer = ScanComposer.new_from_params(params[:foreman_probing_scan])
  @scan = @composer.compose!
  @scan.save!
  task = ForemanTasks.async_task(::Actions::ForemanProbing::PerformScan,
                                 @scan,
                                 @scan.ports)
  @scan.task = task
  @scan.save!
  set_auto_refresh
  redirect_to @scan
end

#indexObject



21
22
23
# File 'app/controllers/foreman_probing/api/v2/scans_controller.rb', line 21

def index
  @scans = resource_scope.order(:id => 'desc').paginate(:page => params[:page])
end

#rerunObject



49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/foreman_probing/api/v2/scans_controller.rb', line 49

def rerun
  composer = ScanComposer.new_from_scan(ForemanProbing::Scan.find(params['id']))
  @scan = composer.compose!
  @scan.save!
  task = ForemanTasks.async_task(::Actions::ForemanProbing::PerformScan,
                                 @scan,
                                 @scan.ports)
  @scan.task = task
  @scan.save!
  render :action => 'show'
end

#resource_classObject



15
16
17
# File 'app/controllers/foreman_probing/api/v2/scans_controller.rb', line 15

def resource_class
  ForemanProbing::Scan
end

#showObject



63
# File 'app/controllers/foreman_probing/api/v2/scans_controller.rb', line 63

def show; end