class ForemanApiClient::Host
Attributes
connection[RW]
manager_ref[RW]
Public Class Methods
new(connection, manager_ref)
click to toggle source
# File lib/foreman_api_client/host.rb, line 6 def initialize(connection, manager_ref) @connection = connection @manager_ref = manager_ref end
Public Instance Methods
attributes()
click to toggle source
# File lib/foreman_api_client/host.rb, line 40 def attributes connection.fetch(:hosts, :show, "id" => manager_ref).first end
building?()
click to toggle source
# File lib/foreman_api_client/host.rb, line 11 def building? attributes["build"] end
power_state(action = "status")
click to toggle source
valid actions are (on/start), (off/stop), (soft/reboot), (cycle/reset), (state/status)
# File lib/foreman_api_client/host.rb, line 24 def power_state(action = "status") connection.fetch(:hosts, :power, "id" => manager_ref, "power_action" => action).first["power"] end
powered_off?()
click to toggle source
# File lib/foreman_api_client/host.rb, line 28 def powered_off? power_state == "off" end
powered_on?()
click to toggle source
# File lib/foreman_api_client/host.rb, line 32 def powered_on? power_state == "on" end
set_boot_mode(mode = "pxe")
click to toggle source
# File lib/foreman_api_client/host.rb, line 36 def set_boot_mode(mode = "pxe") connection.fetch(:hosts, :boot, "id" => manager_ref, "device" => mode).first["boot"] end
start()
click to toggle source
# File lib/foreman_api_client/host.rb, line 15 def start power_state("on") end
stop()
click to toggle source
# File lib/foreman_api_client/host.rb, line 19 def stop power_state("off") end
update(params)
click to toggle source
# File lib/foreman_api_client/host.rb, line 44 def update(params) connection.fetch(:hosts, :update, "id" => manager_ref, "host" => params) end