Module: ILO_SDK::DateTimeHelper
- Included in:
- Client
- Defined in:
- lib/ilo-sdk/helpers/date_time_helper.rb
Overview
Contains helper methods for Date and Time actions
Instance Method Summary collapse
-
#get_ntp ⇒ TrueClass, FalseClass
Get whether or not ntp servers are being used.
-
#get_ntp_servers ⇒ Array
Get the NTP Servers.
-
#get_time_zone ⇒ String
Get the Time Zone.
-
#set_ntp(use_ntp) ⇒ Object
Set whether or not ntp servers are being used.
-
#set_ntp_servers(ntp_servers) ⇒ Object
Set the NTP Servers.
-
#set_time_zone(time_zone) ⇒ Object
Set the Time Zone.
Instance Method Details
#get_ntp ⇒ TrueClass, FalseClass
Get whether or not ntp servers are being used
37 38 39 40 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 37 def get_ntp response = rest_get('/redfish/v1/Managers/1/EthernetInterfaces/1/') response_handler(response)['Oem']['Hp']['DHCPv4']['UseNTPServers'] end |
#get_ntp_servers ⇒ Array
Get the NTP Servers
56 57 58 59 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 56 def get_ntp_servers response = rest_get('/redfish/v1/Managers/1/DateTime/') response_handler(response)['StaticNTPServers'] end |
#get_time_zone ⇒ String
Get the Time Zone
16 17 18 19 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 16 def get_time_zone response = rest_get('/redfish/v1/Managers/1/DateTime/') response_handler(response)['TimeZone']['Name'] end |
#set_ntp(use_ntp) ⇒ Object
Set whether or not ntp servers are being used
46 47 48 49 50 51 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 46 def set_ntp(use_ntp) new_action = { 'Oem' => { 'Hp' => { 'DHCPv4' => { 'UseNTPServers' => use_ntp } } } } response = rest_patch('/redfish/v1/Managers/1/EthernetInterfaces/1/', body: new_action) response_handler(response) true end |
#set_ntp_servers(ntp_servers) ⇒ Object
Set the NTP Servers
65 66 67 68 69 70 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 65 def set_ntp_servers(ntp_servers) new_action = { 'StaticNTPServers' => ntp_servers } response = rest_patch('/redfish/v1/Managers/1/DateTime/', body: new_action) response_handler(response) true end |
#set_time_zone(time_zone) ⇒ Object
Set the Time Zone
25 26 27 28 29 30 31 32 |
# File 'lib/ilo-sdk/helpers/date_time_helper.rb', line 25 def set_time_zone(time_zone) time_response = rest_get('/redfish/v1/Managers/1/DateTime/') new_time_zone = response_handler(time_response)['TimeZoneList'].select { |timezone| timezone['Name'] == time_zone } new_action = { 'TimeZone' => { 'Index' => new_time_zone[0]['Index'] } } response = rest_patch('/redfish/v1/Managers/1/DateTime/', body: new_action) response_handler(response) true end |