Class: Api::V2::ForemanDatacenter::DevicesController
- Inherits:
-
BaseController
- Object
- V2::BaseController
- BaseController
- Api::V2::ForemanDatacenter::DevicesController
show all
- Includes:
- ForemanDatacenter::Controller::Parameters::Device
- Defined in:
- app/controllers/api/v2/foreman_datacenter/devices_controller.rb
Instance Method Summary
collapse
#action_permission, #controller_permission, #find_resource, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for
Instance Method Details
#create ⇒ Object
49
50
51
52
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 49
def create
@device = ::ForemanDatacenter::Device.new(device_params.merge(host_id: params[:host_id]))
process_response @device.save
end
|
#destroy ⇒ Object
65
66
67
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 65
def destroy
process_response @device.destroy
end
|
#destroy_interfaces ⇒ Object
72
73
74
75
76
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 72
def destroy_interfaces
@device.non_management_interfaces.
where(id: params[:interfaces]).
destroy_all
end
|
#index ⇒ Object
15
16
17
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 15
def index
@devices = resource_scope_for_index
end
|
#show ⇒ Object
22
23
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 22
def show
end
|
#sync_interfaces_with_host ⇒ Object
81
82
83
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 81
def sync_interfaces_with_host
@device.sync_interfaces_with_host
end
|
#update ⇒ Object
58
59
60
|
# File 'app/controllers/api/v2/foreman_datacenter/devices_controller.rb', line 58
def update
process_response @device.update(device_params)
end
|