Class: Api::V2::SnapshotsController

Inherits:
V2::BaseController
  • Object
show all
Includes:
Api::Version2, Foreman::Controller::Parameters::Snapshot
Defined in:
app/controllers/api/v2/snapshots_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



34
35
36
37
# File 'app/controllers/api/v2/snapshots_controller.rb', line 34

def create
  @snapshot = resource_class.new(snapshot_params.to_h.merge(host: @nested_obj))
  process_response @snapshot.save
end

#destroyObject



52
53
54
# File 'app/controllers/api/v2/snapshots_controller.rb', line 52

def destroy
  process_response @snapshot.destroy
end

#indexObject



13
14
15
# File 'app/controllers/api/v2/snapshots_controller.rb', line 13

def index
  @snapshots = resource_scope_for_index
end

#revertObject



60
61
62
# File 'app/controllers/api/v2/snapshots_controller.rb', line 60

def revert
  process_response @snapshot.revert
end

#showObject



21
# File 'app/controllers/api/v2/snapshots_controller.rb', line 21

def show; end

#updateObject



44
45
46
# File 'app/controllers/api/v2/snapshots_controller.rb', line 44

def update
  process_response @snapshot.update_attributes(snapshot_params)
end