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



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

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

#destroyObject



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

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



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

def revert
  process_response @snapshot.revert
end

#showObject



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

def show; end

#updateObject



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

def update
  process_response @snapshot.update_attributes(snapshot_params)
end