Class: Api::V2::ForemanDatacenter::PowerOutletsController

Inherits:
BaseController
  • Object
show all
Includes:
ForemanDatacenter::Controller::Parameters::PowerOutlet
Defined in:
app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#action_permission, #controller_permission, #find_resource, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for

Instance Method Details

#connectObject



58
59
60
61
62
63
64
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 58

def connect
         power_port = ::ForemanDatacenter::PowerPort.find(params[:power_port_id])
         power_port.connect(
           @power_outlet,
           params[:connection_status]
         )
end

#createObject



32
33
34
35
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 32

def create
  @power_outlet = ::ForemanDatacenter::PowerOutlet.new(power_outlet_params)
  process_response @power_outlet.save
end

#destroyObject



48
49
50
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 48

def destroy
  process_response @power_outlet.destroy
end

#disconnectObject



70
71
72
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 70

def disconnect
         process_response @power_outlet.power_port.disconnect
end

#indexObject



12
13
14
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 12

def index
  @power_outlets = resource_scope_for_index
end

#showObject



19
20
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 19

def show
end

#updateObject



41
42
43
# File 'app/controllers/api/v2/foreman_datacenter/power_outlets_controller.rb', line 41

def update
  process_response @power_outlet.update(power_outlet_params)
end