Class: Nexpose::AdHocSchedule
- Defined in:
- lib/nexpose/common.rb
Overview
Configuration structure for ad-hoc schedules
Instance Attribute Summary collapse
-
#max_duration ⇒ Object
The amount of time, in minutes, to allow execution before stopping.
-
#scan_template_id ⇒ Object
The template to use to scan the assets.
-
#start ⇒ Object
Start time in ISO8601 format.
Instance Method Summary collapse
- #as_xml ⇒ Object
- #from_hash(hash) ⇒ Object
-
#initialize(start, scan_template_id, max_duration = nil) ⇒ AdHocSchedule
constructor
A new instance of AdHocSchedule.
- #to_xml ⇒ Object
Methods inherited from APIObject
Constructor Details
#initialize(start, scan_template_id, max_duration = nil) ⇒ AdHocSchedule
Returns a new instance of AdHocSchedule.
105 106 107 108 109 |
# File 'lib/nexpose/common.rb', line 105 def initialize(start, scan_template_id, max_duration = nil) @start = start @scan_template_id = scan_template_id @max_duration = max_duration if max_duration end |
Instance Attribute Details
#max_duration ⇒ Object
The amount of time, in minutes, to allow execution before stopping.
103 104 105 |
# File 'lib/nexpose/common.rb', line 103 def max_duration @max_duration end |
#scan_template_id ⇒ Object
The template to use to scan the assets
100 101 102 |
# File 'lib/nexpose/common.rb', line 100 def scan_template_id @scan_template_id end |
#start ⇒ Object
Start time in ISO8601 format
97 98 99 |
# File 'lib/nexpose/common.rb', line 97 def start @start end |
Instance Method Details
#as_xml ⇒ Object
111 112 113 114 115 116 117 |
# File 'lib/nexpose/common.rb', line 111 def as_xml xml = REXML::Element.new('AdHocSchedule') xml.attributes['start'] = @start xml.attributes['maxDuration'] = @max_duration if @max_duration xml.attributes['template'] = @scan_template_id xml end |
#from_hash(hash) ⇒ Object
119 120 121 122 123 |
# File 'lib/nexpose/common.rb', line 119 def from_hash(hash) schedule = AdHocSchedule.new(hash[:start], hash[:scan_template_id]) schedule.max_duration = hash[:max_duration] if hash[:max_duration] schedule end |
#to_xml ⇒ Object
125 126 127 |
# File 'lib/nexpose/common.rb', line 125 def to_xml as_xml.to_s end |