nsmcp::LogTool method validate (public)
<instance of nsmcp::LogTool> validate arguments
Defined in /usr/local/ns/tcl/nsmcp/lib/log-tools.tcl
- Parameters:
- arguments (required)
- Testcases:
- No testcase defined.
Source code: if {[lindex $arguments 1] ne "object"} { return -code error -errorcode {NSMCP RPC -32602} "Expected arguments object" } set allowed [dict get [dict create errors {} requestContext {identifier} results {jobHandle resultHandle cursor limit includePeerAddresses}] ${:operation}] foreach {key type value} [lindex $arguments 2] { if {$key ni $allowed} {return -code error -errorcode {NSMCP RPC -32602} "Unknown log argument"} set expected string if {$key eq "limit"} {set expected number} if {$key eq "includePeerAddresses"} {set expected boolean} if {$type ne $expected} {return -code error -errorcode {NSMCP RPC -32602} "Invalid log argument type"} if {$key in {jobHandle resultHandle} && ![regexp {^[0-9a-f]{64}$} $value]} { return -code error -errorcode {NSMCP RPC -32602} "Invalid log handle" } if {$key eq "limit" && (![string is integer -strict $value] || $value < 1 || $value > 100)} { return -code error -errorcode {NSMCP RPC -32602} "Limit must be between 1 and 100" } if {$key eq "cursor" && (![string is entier -strict $value] || $value < 0)} { return -code error -errorcode {NSMCP RPC -32602} "Invalid cursor" } } set values [:arguments $arguments] if {${:operation} eq "requestContext" && (![dict exists $values identifier] || ![::nsmcp::logRecordParser validRequestIdentifier [dict get $values identifier]])} { return -code error -errorcode {NSMCP RPC -32602} "Expected a dash-delimited log-thread identifier" } if {${:operation} eq "results"} { if {[dict exists $values jobHandle] == [dict exists $values resultHandle] || ([dict exists $values jobHandle] && [dict size $values] != 1)} { return -code error -errorcode {NSMCP RPC -32602} "Supply jobHandle alone or resultHandle with paging options" } }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)