nsmcp::AccessSlowDayTool method options (public)
<instance of nsmcp::AccessSlowDayTool> options arguments
Defined in /usr/local/ns/tcl/nsmcp/access-tools.tcl
- Parameters:
- arguments (required)
- Testcases:
- No testcase defined.
Source code: if {[lindex $arguments 1] ne "object"} {error "Expected arguments object"} set options [dict create timezone :Europe/Vienna pool {}] foreach {key type value} [lindex $arguments 2] { if {$key eq "focusMinutes"} { if {$type ne "number" || ![string is entier -strict $value] || $value<1 || $value>15} { error "focusMinutes must be 1..15" } } elseif {$key ni {date timezone pool focusTime rangeStart rangeEnd} || $type ne "string"} { error "Expected date, timezone, pool, focusTime, rangeStart or rangeEnd string" } dict set options $key $value } set timezone [dict get $options timezone] if {![regexp {^:?[A-Za-z][A-Za-z0-9_+/-]{0,63}$} $timezone]} {error "Invalid timezone"} if {![dict exists $options date]} { dict set options date [clock format [clock seconds] -timezone $timezone -format %Y-%m-%d] } set date [dict get $options date] if {![regexp {^[0-9]{4}-[0-9]{2}-[0-9]{2}$} $date]} {error "Expected date YYYY-MM-DD"} set start [clock scan $date -format %Y-%m-%d -timezone $timezone] if {[clock format $start -timezone $timezone -format %Y-%m-%d] ne $date} {error "Invalid date"} if {$start>[clock seconds] || $start<[clock seconds]-8*86400} {error "Day is outside retained access data"} if {[string length [dict get $options pool]]>64} {error "Pool name too long"} if {[dict exists $options focusTime]} { if {![regexp {^([01][0-9]|2[0-3]):[0-5][0-9]$} [dict get $options focusTime]]} { error "focusTime must be HH:MM" } if {![dict exists $options focusMinutes]} {dict set options focusMinutes 10} } elseif {[dict exists $options focusMinutes]} { error "focusMinutes requires focusTime" } if {[dict exists $options rangeStart] != [dict exists $options rangeEnd]} { error "rangeStart and rangeEnd must be supplied together" } if {[dict exists $options rangeStart]} { if {[dict exists $options focusTime]} {error "range interval cannot be combined with focusTime"} foreach key {rangeStart rangeEnd} { if {![regexp {^([01][0-9]|2[0-3]):[0-5][0-9]$} [dict get $options $key]]} { error "$key must be HH:MM" } } set from [clock scan "$date [dict get $options rangeStart]" -format {%Y-%m-%d %H:%M} -timezone $timezone] set to [clock scan "$date [dict get $options rangeEnd]" -format {%Y-%m-%d %H:%M} -timezone $timezone] if {$to<=$from || $to-$from>180*60} {error "range interval must be 1..180 minutes"} } return $optionsXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)