class Nexpose::Blackout
Constants useful across the Nexpose
module. Configuration structure for blackouts.
Attributes
blackout_duration[RW]
The amount of time, in minutes, a blackout period should last.
blackout_interval[RW]
The repeat interval based upon type.
blackout_start[RW]
Starting time of the blackout (in unix epoch with milliseconds. Example: 1464956590000) The timezone is the timezone of the console. If the console timezone is not supported it defaults to utc.
blackout_type[RW]
Valid schedule types: daily, hourly, monthly-date, monthly-day, weekly.
enabled[RW]
Whether or not this blackout is enabled.
Public Class Methods
from_hash(hash)
click to toggle source
# File lib/nexpose/blackout.rb, line 25 def self.from_hash(hash) repeat_blackout_hash = hash[:repeat_blackout] if repeat_blackout_hash.nil? type = 'daily' interval = 0 else type = repeat_blackout_hash[:type] interval = repeat_blackout_hash[:interval] end new(hash[:start_date], hash[:enabled], hash[:blackout_duration], type, interval) end
new(start, enabled = true, duration, type, interval)
click to toggle source
# File lib/nexpose/blackout.rb, line 17 def initialize(start, enabled = true, duration, type, interval) @blackout_start = start @enabled = enabled @blackout_duration = duration.to_i @blackout_type = type @blackout_interval = interval.to_i end
Public Instance Methods
to_h()
click to toggle source
# File lib/nexpose/blackout.rb, line 37 def to_h blackout_hash = { start_date: @blackout_start, enabled: @enabled, blackout_duration: @blackout_duration } repeat_hash = { type: @blackout_type, interval: @blackout_interval } blackout_hash[:repeat_blackout] = repeat_hash blackout_hash end