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.
110 111 112 113 114 |
# File 'lib/nexpose/common.rb', line 110 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.
108 109 110 |
# File 'lib/nexpose/common.rb', line 108 def max_duration @max_duration end |
#scan_template_id ⇒ Object
The template to use to scan the assets
105 106 107 |
# File 'lib/nexpose/common.rb', line 105 def scan_template_id @scan_template_id end |
#start ⇒ Object
Start time in ISO8601 format
102 103 104 |
# File 'lib/nexpose/common.rb', line 102 def start @start end |
Instance Method Details
#as_xml ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/nexpose/common.rb', line 116 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
124 125 126 127 128 |
# File 'lib/nexpose/common.rb', line 124 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
130 131 132 |
# File 'lib/nexpose/common.rb', line 130 def to_xml as_xml.to_s end |