Class: Nexpose::Blackout
Overview
Configuration structure for blackouts.
Instance Attribute Summary collapse
-
#blackout_duration ⇒ Object
The amount of time, in minutes, a blackout period should last.
-
#blackout_interval ⇒ Object
The repeat interval based upon type.
-
#blackout_start ⇒ Object
The earliest date to generate the report on (in ISO 8601 format).
-
#blackout_type ⇒ Object
Valid schedule types: daily, hourly, monthly-date, monthly-day, weekly.
-
#enabled ⇒ Object
Whether or not this blackout is enabled.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(start, enabled = true, duration, type, interval) ⇒ Blackout
constructor
A new instance of Blackout.
- #to_h ⇒ Object
Methods inherited from APIObject
Constructor Details
#initialize(start, enabled = true, duration, type, interval) ⇒ Blackout
Returns a new instance of Blackout.
16 17 18 19 20 21 22 |
# File 'lib/nexpose/blackout.rb', line 16 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 |
Instance Attribute Details
#blackout_duration ⇒ Object
The amount of time, in minutes, a blackout period should last.
14 15 16 |
# File 'lib/nexpose/blackout.rb', line 14 def blackout_duration @blackout_duration end |
#blackout_interval ⇒ Object
The repeat interval based upon type.
10 11 12 |
# File 'lib/nexpose/blackout.rb', line 10 def blackout_interval @blackout_interval end |
#blackout_start ⇒ Object
The earliest date to generate the report on (in ISO 8601 format).
12 13 14 |
# File 'lib/nexpose/blackout.rb', line 12 def blackout_start @blackout_start end |
#blackout_type ⇒ Object
Valid schedule types: daily, hourly, monthly-date, monthly-day, weekly.
8 9 10 |
# File 'lib/nexpose/blackout.rb', line 8 def blackout_type @blackout_type end |
#enabled ⇒ Object
Whether or not this blackout is enabled.
6 7 8 |
# File 'lib/nexpose/blackout.rb', line 6 def enabled @enabled end |
Class Method Details
.from_hash(hash) ⇒ Object
24 25 26 27 28 |
# File 'lib/nexpose/blackout.rb', line 24 def self.from_hash(hash) repeat_blackout_hash = hash[:repeat_blackout] blackout = new(hash[:start_date], hash[:blackout_duration], repeat_blackout_hash[:type], repeat_blackout_hash[:interval]) blackout end |
Instance Method Details
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/nexpose/blackout.rb', line 30 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 |