Storm Types
Storm Objects are used as view objects for manipulating data in the Storm Runtime and in the Cortex itself.
aha:pool
Implements the Storm API for an AHA pool.
add(svcname)
Add a service to the AHA pool
- Examples:
Add a service to a pool with its relative name:
$pool = $lib.aha.pool.get(pool00.cortex...) $pool.add(00.cortex...)
- Args:
svcname (str): The name of the AHA service to add. It is easiest to use the relative name of a service, ending with “…”.
- Returns:
The return type is
null
.
del(svcname)
Remove a service from the AHA pool.
- Examples:
Remove a service from a pool with its relative name:
$pool = $lib.aha.pool.get(pool00.cortex...) $pool.del(00.cortex...)
- Args:
svcname (str): The name of the AHA service to remove. It is easiest to use the relative name of a service, ending with “…”.
- Returns:
The service removed from the pool or null if a service was not removed. The return type may be one of the following:
null
, str.
auth:gate
Implements the Storm API for an AuthGate.
iden
The iden of the AuthGate.
- Returns:
The type is str.
roles
The role idens which are a member of the Authgate.
- Returns:
The type is list.
type
The type of the AuthGate.
- Returns:
The type is str.
users
The user idens which are a member of the Authgate.
- Returns:
The type is list.
auth:role
Implements the Storm API for a Role.
addRule(rule, gateiden=$lib.null, indx=$lib.null)
Add a rule to the Role
- Args:
rule (list): The rule tuple to added to the Role.
gateiden (str): The gate iden used for the rule.
indx (int): The position of the rule as a 0 based index.
- Returns:
The return type is
null
.
delRule(rule, gateiden=$lib.null)
Remove a rule from the Role.
- Args:
rule (list): The rule tuple to removed from the Role.
gateiden (str): The gate iden used for the rule.
- Returns:
The return type is
null
.
gates()
Return a list of auth gates that the role has rules for.
- Returns:
A list of
auth:gates
that the role has rules for. The return type is list.
get(name)
Get a arbitrary property from the Role definition.
- Args:
name (str): The name of the property to return.
- Returns:
The requested value. The return type is
prim
.
getRules(gateiden=$lib.null)
Get the rules for the role and optional auth gate.
- Args:
gateiden (str): The gate iden used for the rules.
- Returns:
A list of rules. The return type is list.
iden
The Role iden.
- Returns:
The type is str.
name
A role’s name. This can also be used to set the role name.
- Example:
Change a role’s name:
$role=$lib.auth.roles.byname(analyst) $role.name=superheroes
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
pack()
Get the packed version of the Role.
- Returns:
The packed Role definition. The return type is dict.
popRule(indx, gateiden=$lib.null)
Remove a rule by index from the Role.
- Args:
indx (int): The index of the rule to remove.
gateiden (str): The gate iden used for the rule.
- Returns:
The rule which was removed. The return type is list.
setRules(rules, gateiden=$lib.null)
Replace the rules on the Role with new rules.
- Args:
rules (list): A list of rules to set on the Role.
gateiden (str): The gate iden used for the rules.
- Returns:
The return type is
null
.
auth:user
Implements the Storm API for a User.
addRule(rule, gateiden=$lib.null, indx=$lib.null)
Add a rule to the User.
- Args:
rule (list): The rule tuple to add to the User.
gateiden (str): The gate iden used for the rule.
indx (int): The position of the rule as a 0 based index.
- Returns:
The return type is
null
.
allowed(permname, gateiden=$lib.null, default=$lib.false)
Check if the user has a given permission.
- Args:
permname (str): The permission string to check.
gateiden (str): The authgate iden.
default (boolean): The default value.
- Returns:
True if the rule is allowed, False otherwise. The return type is boolean.
delApiKey(iden)
Delete an existing API key.
- Args:
iden (str): The iden of the API key.
- Returns:
True when the key was deleted. The return type is boolean.
delRule(rule, gateiden=$lib.null)
Remove a rule from the User.
- Args:
rule (list): The rule tuple to removed from the User.
gateiden (str): The gate iden used for the rule.
- Returns:
The return type is
null
.
email
A user’s email. This can also be used to set the user’s email.
- Example:
Change a user’s email address:
$user=$lib.auth.users.byname(bob) $user.email="[email protected]"
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
gates()
Return a list of auth gates that the user has rules for.
- Returns:
A list of
auth:gates
that the user has rules for. The return type is list.
genApiKey(name, duration=$lib.null)
Generate a new API key for the user.
- Notes:
The secret API key returned by this function cannot be accessed again.
- Args:
name (str): The name of the API key.
duration (integer): Duration of time for the API key to be valid, in milliseconds.
- Returns:
A list, containing the secret API key and a dictionary containing metadata about the key. The return type is list.
get(name)
Get a arbitrary property from the User definition.
- Args:
name (str): The name of the property to return.
- Returns:
The requested value. The return type is
prim
.
getAllowedReason(permname, gateiden=$lib.null, default=$lib.false)
Return an allowed status and reason for the given perm.
- Args:
permname (str): The permission string to check.
gateiden (str): The authgate iden.
default (boolean): The default value.
- Returns:
An (allowed, reason) tuple. The return type is list.
getApiKey(iden)
Get information about a user’s existing API key.
- Args:
iden (str): The iden of the API key.
- Returns:
A dictionary containing metadata about the key. The return type is dict.
getRules(gateiden=$lib.null)
Get the rules for the user and optional auth gate.
- Args:
gateiden (str): The gate iden used for the rules.
- Returns:
A list of rules. The return type is list.
grant(iden, indx=$lib.null)
Grant a Role to the User.
- Args:
iden (str): The iden of the Role.
indx (int): The position of the Role as a 0 based index.
- Returns:
The return type is
null
.
iden
The User iden.
- Returns:
The type is str.
listApiKeys()
Get information about all the API keys the user has.
- Returns:
A list of dictionaries containing metadata about each key. The return type is list.
modApiKey(iden, name, valu)
Modify metadata about an existing API key.
- Args:
iden (str): The iden of the API key.
name (str): The name of the valu to update.
valu (any): The new value of the API key.
- Returns:
An updated dictionary with metadata about the key. The return type is dict.
name
A user’s name. This can also be used to set a user’s name.
- Example:
Change a user’s name:
$user=$lib.auth.users.byname(bob) $user.name=robert
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
notify(mesgtype, mesgdata)
Send an arbitrary user notification.
- Args:
mesgtype (str): The notification type.
mesgdata (dict): The notification data.
- Returns:
The return type is
null
.
pack()
Get the packed version of the User.
- Returns:
The packed User definition. The return type is dict.
popRule(indx, gateiden=$lib.null)
Remove a rule by index from the User.
- Args:
indx (int): The index of the rule to remove.
gateiden (str): The gate iden used for the rule.
- Returns:
The rule which was removed. The return type is list.
profile
A user profile dictionary. This can be used as an application level key-value store.
- Example:
Set a value:
$user=$lib.auth.users.byname(bob) $user.profile.somekey="somevalue"
Get a value:
$user=$lib.auth.users.byname(bob) $value = $user.profile.somekey
- Returns:
The return type is auth:user:profile.
revoke(iden)
Remove a Role from the User
- Args:
iden (str): The iden of the Role.
- Returns:
The return type is
null
.
roles()
Get the Roles for the User.
- Returns:
A list of
auth:roles
which the user is a member of. The return type is list.
setAdmin(admin, gateiden=$lib.null)
Set the Admin flag for the user.
- Args:
admin (boolean): True to make the User an admin, false to remove their admin status.
gateiden (str): The gate iden used for the operation.
- Returns:
The return type is
null
.
setArchived(archived)
Set the archived status for a user.
- Notes:
Setting a user as “archived” will also lock the user. Removing a users “archived” status will not unlock the user.
- Args:
archived (boolean): True to archive the user, false to unarchive them.
- Returns:
The return type is
null
.
setEmail(email)
Set the email address of the User.
- Args:
email (str): The email address to set for the User.
- Returns:
The return type is
null
.
setLocked(locked)
Set the locked status for a user.
- Args:
locked (boolean): True to lock the user, false to unlock them.
- Returns:
The return type is
null
.
setPasswd(passwd)
Set the Users password.
- Args:
passwd (str): The new password for the user. This is best passed into the runtime as a variable.
- Returns:
The return type is
null
.
setRoles(idens)
Replace all the Roles of the User with a new list of roles.
- Notes:
The roleiden for the “all” role must be present in the new list of roles. This replaces all existing roles that the user has with the new roles.
- Args:
idens (list): The idens of the Roles to set on the User.
- Returns:
The return type is
null
.
setRules(rules, gateiden=$lib.null)
Replace the rules on the User with new rules.
- Args:
rules (list): A list of rule tuples.
gateiden (str): The gate iden used for the rules.
- Returns:
The return type is
null
.
tell(text)
Send a tell notification to a user.
- Args:
text (str): The text of the message to send.
- Returns:
The return type is
null
.
vars
Get a dictionary representing the user’s persistent variables.
- Returns:
The return type is auth:user:vars.
auth:user:json
Implements per-user JSON storage.
del(path, prop=$lib.null)
Delete a stored JSON object or object property for the user.
- Args:
path (str|list): A path string or list of path parts.
prop (str|list): A property name or list of name parts.
- Returns:
True if the del operation was successful. The return type is boolean.
get(path, prop=$lib.null)
Return a stored JSON object or object property for the user.
- Args:
path (str|list): A path string or list of path parts.
prop (str|list): A property name or list of name parts.
- Returns:
The previously stored value or $lib.null The return type is
prim
.
iter(path=$lib.null)
Yield (<path>, <valu>) tuples for the users JSON objects.
- Args:
path (str|list): A path string or list of path parts.
- Yields:
(<path>, <item>) tuples. The return type is list.
set(path, valu, prop=$lib.null)
Set a JSON object or object property for the user.
- Args:
path (str|list): A path string or list of path elements.
valu (prim): The value to set as the JSON object or object property.
prop (str|list): A property name or list of name parts.
- Returns:
True if the set operation was successful. The return type is boolean.
auth:user:profile
The Storm deref/setitem/iter convention on top of User profile information.
auth:user:vars
The Storm deref/setitem/iter convention on top of User vars information.
boolean
Implements the Storm API for a boolean instance.
bytes
Implements the Storm API for a Bytes object.
bunzip()
Decompress the bytes using bzip2.
- Example:
Decompress bytes with bzip2:
$foo = $mybytez.bunzip()
- Returns:
Decompressed bytes. The return type is bytes.
bzip()
Compress the bytes using bzip2 and return them.
- Example:
Compress bytes with bzip:
$foo = $mybytez.bzip()
- Returns:
The bzip2 compressed bytes. The return type is bytes.
decode(encoding=utf8, errors=surrogatepass)
Decode bytes to a string.
- Args:
encoding (str): The encoding to use.
errors (str): The error handling scheme to use.
- Returns:
The decoded string. The return type is str.
gunzip()
Decompress the bytes using gzip and return them.
- Example:
Decompress bytes with bzip2:
$foo = $mybytez.gunzip()
- Returns:
Decompressed bytes. The return type is bytes.
gzip()
Compress the bytes using gzip and return them.
- Example:
Compress bytes with gzip:
$foo = $mybytez.gzip()
- Returns:
The gzip compressed bytes. The return type is bytes.
json(encoding=$lib.null, errors=surrogatepass)
Load JSON data from bytes.
- Notes:
The bytes must be UTF8, UTF16 or UTF32 encoded.
- Example:
Load bytes to a object:
$foo = $mybytez.json()
- Args:
encoding (str): Specify an encoding to use.
errors (str): Specify an error handling scheme to use.
- Returns:
The deserialized object. The return type is
prim
.
slice(start, end=$lib.null)
Slice a subset of bytes from an existing bytes.
- Examples:
Slice from index to 1 to 5:
$subbyts = $byts.slice(1,5)
Slice from index 3 to the end of the bytes:
$subbyts = $byts.slice(3)
- Args:
start (int): The starting byte index.
end (int): The ending byte index. If not specified, slice to the end.
- Returns:
The slice of bytes. The return type is bytes.
unpack(fmt, offset=(0))
Unpack structures from bytes using python struct.unpack syntax.
- Examples:
Unpack 3 unsigned 16 bit integers in little endian format:
($x, $y, $z) = $byts.unpack("<HHH")
- Args:
fmt (str): A python struck.pack format string.
offset (int): An offset to begin unpacking from.
- Returns:
The unpacked primitive values. The return type is list.
cache:fixed
A StormLib API instance of a Storm Fixed Cache.
clear()
Clear all items from the cache.
- Returns:
The return type is
null
.
get(key)
Get an item from the cache by key.
- Args:
key (any): The key to lookup.
- Returns:
The value from the cache, or the callback query if it does not exist The return type is
any
.
pop(key)
Pop an item from the cache.
- Args:
key (any): The key to pop.
- Returns:
The value from the cache, or $lib.null if it does not exist The return type is
any
.
put(key, value)
Put an item into the cache.
- Args:
key (any): The key put in the cache.
value (any): The value to assign to the key.
- Returns:
The return type is
null
.
query
Get the callback Storm query as string.
- Returns:
The callback Storm query text. The return type is str.
cmdopts
A dictionary like object that holds a reference to a command options namespace. ( This allows late-evaluation of command arguments rather than forcing capture )
cronjob
Implements the Storm api for a cronjob instance.
iden
The iden of the Cron Job.
- Returns:
The type is str.
kill()
If the job is currently running, terminate the task.
- Returns:
A boolean value which is true if the task was terminated. The return type is boolean.
pack()
Get the Cronjob definition.
- Returns:
The definition. The return type is dict.
pprint()
Get a dictionary containing user friendly strings for printing the CronJob.
- Returns:
A dictionary containing structured data about a cronjob for display purposes. The return type is dict.
set(name, valu)
Set an editable field in the cron job definition.
- Example:
Change the name of a cron job:
$lib.cron.get($iden).set(name, "foo bar cron job")
- Args:
name (str): The name of the field being set
valu (any): The value to set on the definition.
- Returns:
The
cronjob
The return type is cronjob.
dict
Implements the Storm API for a Dictionary object.
hive:dict
A Storm Primitive representing a HiveDict.
get(name, default=$lib.null)
Get the named value from the HiveDict.
- Args:
name (str): The name of the value.
default (prim): The default value to return if the name is not set.
- Returns:
The requested value. The return type is
prim
.
list()
List the keys and values in the HiveDict.
- Returns:
A list of tuples containing key, value pairs. The return type is list.
pop(name, default=$lib.null)
Remove a value out of the HiveDict.
- Args:
name (str): The name of the value.
default (prim): The default value to return if the name is not set.
- Returns:
The requested value. The return type is
prim
.
set(name, valu)
Set a value in the HiveDict.
- Args:
name (str): The name of the value to set
valu (prim): The value to store in the HiveDict
- Returns:
Old value of the dictionary if the value was previously set, or none. The return type may be one of the following:
null
,prim
.
http:api
Extended HTTP API object.
This object represents an extended HTTP API that has been configured on the Cortex.
authenticated
Boolean value indicating if the Extended HTTP API requires an authenticated user or session.
- Returns:
The return type is boolean. When this is used to set the value, it does not have a return type.
created
The time the Extended HTTP API was created.
- Returns:
The type is
int
.
creator
The user that created the Extended HTTP API.
- Returns:
The return type is auth:user.
desc
The description of the API instance.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
iden
The iden of the Extended HTTP API.
- Returns:
The type is str.
methods
The dictionary containing the Storm code used to implement the HTTP methods.
- Returns:
The return type is http:api:methods.
name
The name of the API instance.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
owner
The user that runs the endpoint query logic when runas=”owner”.
- Returns:
The return type is auth:user. When this is used to set the value, it does not have a return type.
pack()
Get a packed copy of the HTTP API object.
- Returns:
The return type is dict.
path
The path of the API instance.
This path may contain regular expression capture groups, which are used to populate request arguments.
- Note:
The Cortex does not inspect paths in order to identify duplicates or overlapping paths. It is the responsibility of the Cortex administrator to configure their Extended HTTP API paths so that they are correct for their use cases.
- Example:
Update an API path to contain a single wildcard argument:
$api.path = 'foo/bar/(.*)/baz'
Update an API path to contain a two wildcard arguments with restricted character sets:
$api.path = 'hehe/([a-z]*)/([0-9]{1-4})'
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
perms
The permissions an authenticated user must have in order to access the HTTP API.
- Returns:
The return type is http:api:perms. When this is used to set the value, it does not have a return type.
pool
Boolean value indicating if the handler responses may be executed as part of a Storm pool.
- Returns:
The return type is boolean. When this is used to set the value, it does not have a return type.
readonly
Boolean value indicating if the Storm methods are executed in a readonly Storm runtime.
- Returns:
The return type is boolean. When this is used to set the value, it does not have a return type.
runas
String indicating whether the requests run as the owner or the authenticated user.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
updated
The time the Extended HTTP API was last modified.
- Returns:
The return type is
int
.
vars
The Storm runtime variables specific for the API instance.
- Returns:
The return type is http:api:vars. When this is used to set the value, it does not have a return type.
view
The View of the API instance. This is the view that Storm methods are executed in.
- Returns:
The return type is view. When this is used to set the value, it does not have a return type.
http:api:methods
Accessor dictionary for getting and setting Extended HTTP API methods.
- Notes:
The Storm code used to run these methods will have a $request object injected into them. This allows the method to send data back to the caller when it is run.
- Examples:
Setting a simple GET method:
$api.methods.get = ${ $data = ({"someKey": "someValue}) $headers = ({"someHeader": "someOtherValue"}) $request.reply(200, headers=$headers, body=$data) }
Removing a PUT method:
$api.methods.put = $lib.undef
Crafting a custom text response:
$api.methods.get = ${ // Create the body $data = 'some value' // Encode the response as bytes $data = $data.encode() // Set the headers $headers = ({"Content-Type": "text/plain", "Content-Length": $lib.len($data}) $request.reply(200, headers=$headers, body=$data) }
Streaming multiple chunks of data as JSON lines. This sends the code, headers and body separately:
$api.methods.get = ${ $request.sendcode(200) $request.sendheaders(({"Content-Type": "text/plain; charset=utf8"})) $values = ((1), (2), (3)) for $i in $values { $body=`{$lib.json.save(({"value": $i}))} $request.sendbody($body.encode()) } }
delete
The DELETE request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
get
The GET request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
head
The HEAD request Storm code
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
options
The OPTIONS request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
patch
The PATCH request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
post
The POST request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
put
The PUT request Storm code.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
http:api:perms
Accessor list for getting and setting http:api permissions.
append(valu)
Append a permission to the list.
- Args:
valu (any): The permission to append to the list.
- Returns:
The return type is
null
.
extend(valu)
Extend a list using another iterable.
- Args:
valu (list): A list or other iterable.
- Returns:
The return type is
null
.
has(valu)
Check it a permission is in the list.
- Args:
valu (any): The permission to check.
- Returns:
True if the permission is in the list, false otherwise. The return type is boolean.
index(valu)
Return a single permission from the list by index.
- Args:
valu (int): The list index value.
- Returns:
The permission present in the list at the index position. The return type is
any
.
length()
Warning
$http:api:perms.length
has been deprecated and will be removed in version v3.0.0.
Get the length of the list. This is deprecated; please use .size()
instead.
- Returns:
The size of the list. The return type is
int
.
pop()
Pop and return the last permission in the list.
- Returns:
The last permission from the list. The return type is
any
.
reverse()
Reverse the order of the list in place
- Returns:
The return type is
null
.
size()
Return the length of the list.
- Returns:
The size of the list. The return type is
int
.
slice(start, end=$lib.null)
Get a slice of the list.
- Args:
start (int): The starting index.
end (int): The ending index. If not specified, slice to the end of the list.
- Returns:
The slice of the list. The return type is list.
http:api:request
Extended HTTP API Request object.
api
The http:api object for the request.
- Returns:
The return type is http:api.
args
A list of path arguments made as part of the HTTP API request. These are the results of any capture groups defined in the Extended HTTP API path regular expression.
- Returns:
The type is list.
body
The raw request body.
- Returns:
The type is bytes.
client
The remote IP of the requester.
- Returns:
The type is str.
headers
The request headers.
- Returns:
The return type is http:api:request:headers.
json
The request body as json.
- Returns:
The return type is dict.
method
The request method
- Returns:
The type is str.
params
Request parameters.
- Returns:
The type is dict.
path
The path which was matched against the Extended HTTPAPI endpoint.
- Returns:
The type is str.
sendbody(body)
Send the HTTP response body.
- Args:
body (bytes): The response body.
- Returns:
The return type is
null
.
sendcode(code)
Send the HTTP response code.
- Args:
code (int): The response code.
- Returns:
The return type is
null
.
sendheaders(headers)
Send the HTTP response headers.
- Args:
headers (dict): The response headers.
- Returns:
The return type is
null
.
uri
The full request URI.
- Returns:
The type is str.
user
The user iden who made the HTTP API request.
- Returns:
The type is str.
http:api:request:headers
Immutable lowercase key access dictionary for HTTP request headers.
- Example:
Request headers can be accessed in a case insensitive manner:
$valu = $request.headers.Cookie // or the lower case value $valu = $request.headers.cookie
http:api:vars
Accessor dictionary for getting and setting Extended HTTP API variables.
This can be used to set, unset or iterate over the runtime variables that are set for an Extended HTTP API endpoint. These variables are set in the Storm runtime for all of the HTTP methods configured to be executed by the endpoint.
- Example:
Set a few variables on a given API:
$api.vars.foo = 'the foo string' $api.vars.bar = (1234)
Remove a variable:
$api.vars.foo = $lib.undef
Iterate over the variables set for the endpoint:
for ($key, $valu) in $api.vars { $lib.print(`{$key) -> {$valu}`) }
Overwrite all of the variables for a given API with a new dictionary:
$api.vars = ({"foo": "a new string", "bar": (137)})
inet:http:oauth:v1:client
A client for doing OAuth V1 Authentication from Storm.
sign(baseurl, method=GET, headers=$lib.null, params=$lib.null, body=$lib.null)
Sign an OAuth request to a particular URL.
- Args:
baseurl (str): The base url to sign and query.
method (dict): The HTTP Method to use as part of signing.
headers (dict): Optional headers used for signing. Can override the “Content-Type” header if the signature type is set to SIG_BODY
params (dict): Optional query parameters to pass to url construction and/or signing.
body (bytes): Optional HTTP body to pass to request signing.
- Returns:
A 3-element tuple of ($url, $headers, $body). The OAuth signature elements will be embedded in the element specified when constructing the client. The return type is list.
inet:http:resp
Implements the Storm API for a HTTP response.
body
The raw HTTP response body as bytes.
- Returns:
The type is bytes.
code
The HTTP status code. It is -1 if an exception occurred.
- Returns:
The type is
int
.
err
Tuple of the error type and information if an exception occurred.
- Returns:
The type is list.
headers
The HTTP Response headers.
- Returns:
The type is dict.
history
A list of response objects representing the history of the response. This is populated when responses are redirected.
- Returns:
A list of
inet:http:resp
objects. The return type is list.
json(encoding=$lib.null, errors=surrogatepass)
Get the JSON deserialized response.
- Args:
encoding (str): Specify an encoding to use.
errors (str): Specify an error handling scheme to use.
- Returns:
The return type is
prim
.
msgpack()
Yield the msgpack deserialized objects.
- Yields:
Unpacked values. The return type is
prim
.
reason
The reason phrase for the HTTP status code.
- Returns:
The type is str.
request_headers
The HTTP Request headers.
- Returns:
The type is dict.
url
The response URL. If the request was redirected, this would be the final URL in the redirection chain. If the status code is -1, then this is the request URL.
- Returns:
The type is str.
inet:http:socket
Implements the Storm API for a Websocket.
rx(timeout=$lib.null)
Receive a message from the web socket.
- Args:
timeout (int): The timeout to wait for
- Returns:
An ($ok, $valu) tuple. The return type is list.
tx(mesg)
Transmit a message over the web socket.
- Args:
mesg (dict): A JSON compatible message.
- Returns:
An ($ok, $valu) tuple. The return type is list.
inet:imap:server
An IMAP server for retrieving email messages.
delete(uid_set)
Mark an RFC2060 UID message as deleted and expunge the mailbox.
The command uses the +FLAGS.SILENT command and applies the Deleted flag. The actual behavior of these commands are mailbox configuration dependent.
- Examples:
Mark a single message as deleted and expunge:
($ok, $valu) = $server.delete("8182")
Mark ranges of messages as deleted and expunge:
($ok, $valu) = $server.delete("1:3,6:9")
- Args:
uid_set (str): The UID message set to apply the flag to.
- Returns:
An ($ok, $valu) tuple. The return type is list.
fetch(uid)
Fetch a message by UID in RFC822 format.
The message is saved to the Axon, and a file:bytes
node is returned.
- Examples:
Fetch a message, save to the Axon, and yield
file:bytes
node:yield $server.fetch("8182")
- Args:
uid (str): The single message UID.
- Returns:
The file:bytes node representing the message. The return type is node.
list(reference_name=””, pattern=*)
List mailbox names.
By default this method uses a reference_name and pattern to return all mailboxes from the root.
- Args:
reference_name (str): The mailbox reference name.
pattern (str): The pattern to filter by.
- Returns:
An ($ok, $valu) tuple where $valu is a list of names if $ok=True. The return type is list.
login(user, passwd)
Login to the IMAP server.
- Args:
user (str): The username to login with.
passwd (str): The password to login with.
- Returns:
An ($ok, $valu) tuple. The return type is list.
markSeen(uid_set)
Mark messages as seen by an RFC2060 UID message set.
The command uses the +FLAGS.SILENT command and applies the Seen flag.
- Examples:
Mark a single messsage as seen:
($ok, $valu) = $server.markSeen("8182")
Mark ranges of messages as seen:
($ok, $valu) = $server.markSeen("1:3,6:9")
- Args:
uid_set (str): The UID message set to apply the flag to.
- Returns:
An ($ok, $valu) tuple. The return type is list.
search(*args, charset=utf-8)
Search for messages using RFC2060 syntax.
- Examples:
Retrieve all messages:
($ok, $uids) = $server.search("ALL")
Search by FROM and SINCE:
($ok, $uids) = $server.search("FROM", "[email protected]", "SINCE", "01-Oct-2021")
Search by a subject substring:
($ok, $uids) = $search.search("HEADER", "Subject", "An email subject")
- Args:
*args (str): A set of search criteria to use.
charset: The CHARSET used for the search. May be set to $lib.null to disable CHARSET. The input type may be one of the following:
str
,null
.- Returns:
An ($ok, $valu) tuple, where $valu is a list of UIDs if $ok=True. The return type is list.
select(mailbox=INBOX)
Select a mailbox to use in subsequent commands.
- Args:
mailbox (str): The mailbox name to select.
- Returns:
An ($ok, $valu) tuple. The return type is list.
inet:smtp:message
An SMTP message to compose and send.
headers
A dictionary of email header values.
- Returns:
The type is dict.
html
The HTML body of the email message. This can also be used to set an HTML body in the message.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
recipients
An array of RCPT TO email addresses.
- Returns:
The type is list.
send(host, port=(25), user=$lib.null, passwd=$lib.null, usetls=$lib.false, starttls=$lib.false, timeout=(60), ssl_verify=$lib.true)
Transmit a message over the web socket.
- Args:
host (str): The hostname or IP address of the SMTP server.
port (int): The port that the SMTP server is listening on.
user (str): The user name to use authenticating to the SMTP server.
passwd (str): The password to use authenticating to the SMTP server.
usetls (bool): Initiate a TLS connection to the SMTP server.
starttls (bool): Use the STARTTLS directive with the SMTP server.
timeout (int): The timeout (in seconds) to wait for message delivery.
ssl_verify (bool): Perform SSL/TLS verification.
- Returns:
An ($ok, $valu) tuple. The return type is list.
sender
The inet:email to use in the MAIL FROM request. This can also be used to set the sender for the message.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
text
The text body of the email message. This can also be used to set the body of the message.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
json:schema
A JsonSchema validation object for use in validating data structures in Storm.
schema()
The schema belonging to this object.
- Returns:
A copy of the schema used for this object. The return type is dict.
validate(item)
Validate a structure against the Json Schema
- Args:
item (prim): A JSON structure to validate (dict, list, etc…)
- Returns:
An ($ok, $valu) tuple. If $ok is True, then $valu should be used as the validated data structure. If $ok is False, $valu is a dictionary with a “mesg” key. The return type is list.
layer
Implements the Storm api for a layer instance.
addPull(url, offs=(0), queue_size=(10000), chunk_size=(1000))
Configure the layer to pull edits from a remote layer/feed.
- Args:
url (str): The telepath URL to a layer/feed.
offs (int): The offset to begin from.
queue_size (int): The queue size of the puller.
chunk_size (int): The chunk size of the puller when consuming edits.
- Returns:
Dictionary containing the pull definition. The return type is dict.
addPush(url, offs=(0), queue_size=(10000), chunk_size=(1000))
Configure the layer to push edits to a remote layer/feed.
- Args:
url (str): A telepath URL of the target layer/feed.
offs (int): The local layer offset to begin pushing from
queue_size (int): The queue size of the pusher.
chunk_size (int): The chunk size of the pusher when pushing edits.
- Returns:
Dictionary containing the push definition. The return type is dict.
delPull(iden)
Remove a pull config from the layer.
- Args:
iden (str): The iden of the push config to remove.
- Returns:
The return type is
null
.
delPush(iden)
Remove a push config from the layer.
- Args:
iden (str): The iden of the push config to remove.
- Returns:
The return type is
null
.
edited()
Return the last time the layer was edited or null if no edits are present.
- Returns:
The last time the layer was edited. The return type is
time
.
edits(offs=(0), wait=$lib.true, size=$lib.null, reverse=$lib.false)
Yield (offs, nodeedits) tuples from the given offset.
- Notes:
Specifying reverse=(true) disables the wait behavior.
- Args:
offs (int): Offset to start getting nodeedits from the layer at.
wait (boolean): If true, wait for new edits, otherwise exit the generator when there are no more edits.
size (int): The maximum number of nodeedits to yield.
reverse (boolean): Yield the edits in reverse order.
- Yields:
Yields offset, nodeedit tuples from a given offset. The return type is list.
get(name, defv=$lib.null)
Get a arbitrary value in the Layer definition.
- Args:
name (str): Name of the value to get.
defv (prim): The default value returned if the name is not set in the Layer.
- Returns:
The value requested or the default value. The return type is
prim
.
getEdges()
Yield (n1iden, verb, n2iden) tuples for any light edges in the layer.
- Example:
Iterate the light edges in
$layer
:for ($n1iden, $verb, $n2iden) in $layer.getEdges() { $lib.print(`{$n1iden} -({$verb})> {$n2iden}`) }
- Yields:
Yields (<n1iden>, <verb>, <n2iden>) tuples The return type is list.
getEdgesByN1(nodeid)
Yield (verb, n2iden) tuples for any light edges in the layer for the source node iden.
- Example:
Iterate the N1 edges for
$node
:for ($verb, $n2iden) in $layer.getEdgesByN1($node.iden()) { $lib.print(`-({$verb})> {$n2iden}`) }
- Args:
nodeid (str): The hex string of the node iden.
- Yields:
Yields (<verb>, <n2iden>) tuples The return type is list.
getEdgesByN2(nodeid)
Yield (verb, n1iden) tuples for any light edges in the layer for the target node iden.
- Example:
Iterate the N2 edges for
$node
:for ($verb, $n1iden) in $layer.getEdgesByN2($node.iden()) { $lib.print(`-({$verb})> {$n1iden}`) }
- Args:
nodeid (str): The hex string of the node iden.
- Yields:
Yields (<verb>, <n1iden>) tuples The return type is list.
getFormCounts()
Get the formcounts for the Layer.
- Example:
Get the formcounts for the current Layer:
$counts = $lib.layer.get().getFormCounts()
- Returns:
Dictionary containing form names and the count of the nodes in the Layer. The return type is dict.
getMirrorStatus()
Return a dictionary of the mirror synchronization status for the layer.
- Returns:
An info dictionary describing mirror sync status. The return type is dict.
getNodeData(nodeid)
Yield (name, valu) tuples for any node data in the layer for the target node iden.
- Example:
Iterate the node data for
$node
:for ($name, $valu) in $layer.getNodeData($node.iden()) { $lib.print(`{$name} = {$valu}`) }
- Args:
nodeid (str): The hex string of the node iden.
- Yields:
Yields (<name>, <valu>) tuples The return type is list.
getPropArrayCount(propname, valu=$lib.undef)
Get the number of individual value rows in the layer for the given array property name.
- Args:
propname (str): The property name to look up.
valu (any): A specific value in the array property to look up.
- Returns:
The count of rows. The return type is
int
.
getPropCount(propname, maxsize=$lib.null, valu=$lib.undef)
Get the number of property rows in the layer for the given full form or property name.
- Args:
propname (str): The property or form name to look up.
maxsize (int): The maximum number of rows to look up.
valu (any): A specific value of the property to look up.
- Returns:
The count of rows. The return type is
int
.
getPropValues(propname)
Yield unique property values in the layer for the given form or property name.
- Args:
propname (str): The property or form name to look up.
- Yields:
Unique property values. The return type is
any
.
getStorNode(nodeid)
Retrieve the raw storage node for the specified node iden.
- Args:
nodeid (str): The hex string of the node iden.
- Returns:
The storage node dictionary. The return type is dict.
getStorNodes()
Get buid, sode tuples representing the data stored in the layer.
- Notes:
The storage nodes represent only the data stored in the layer and may not represent whole nodes.
- Yields:
Tuple of buid, sode values. The return type is list.
getStorNodesByForm(form)
Get buid, sode tuples representing the data stored in the layer for a given form.
- Notes:
The storage nodes represent only the data stored in the layer and may not represent whole nodes. If the only data stored in the layer for a given buid is an N2 edge reference, a storage node will not be returned.
- Args:
form (str): The name of the form to get storage nodes for.
- Yields:
Tuple of buid, sode values. The return type is list.
getTagCount(tagname, formname=$lib.null)
Return the number of tag rows in the layer for the given tag and optional form.
- Examples:
Get the number of
inet:ipv4
nodes with the$foo.bar
tag:$count = $lib.layer.get().getTagCount(foo.bar, formname=inet:ipv4)
- Args:
tagname (str): The name of the tag to look up.
formname (str): The form to constrain the look up by.
- Returns:
The count of tag rows. The return type is
int
.
getTagPropCount(tag, propname, form=$lib.null, valu=$lib.undef)
Get the number of rows in the layer for the given tag property.
- Args:
tag (str): The tag to look up.
propname (str): The property name to look up.
form (str): The optional form to look up.
valu (any): A specific value of the property to look up.
- Returns:
The count of rows. The return type is
int
.
iden
The iden of the Layer.
- Returns:
The type is str.
liftByProp(propname, propvalu=$lib.null, propcmpr==)
Lift and yield nodes with the property and optional value set within the layer.
- Example:
Yield all nodes with the property
ou:org:name
set in the top layer:yield $lib.layer.get().liftByProp(ou:org:name)
Yield all nodes with the property
ou:org:name=woot
in the top layer:yield $lib.layer.get().liftByProp(ou:org:name, woot)
Yield all nodes with the property
ou:org:name^=woot
in the top layer:yield $lib.layer.get().liftByProp(ou:org:name, woot, "^=")
- Args:
propname (str): The full property name to lift by.
propvalu (obj): The value for the property.
propcmpr (str): The comparison operation to use on the value.
- Yields:
Yields nodes. The return type is node.
liftByTag(tagname, formname=$lib.null)
Lift and yield nodes with the tag set within the layer.
- Example:
Yield all nodes with the tag #foo set in the layer:
yield $lib.layer.get().liftByTag(foo)
Yield all inet:fqdn with the tag #foo set in the layer:
yield $lib.layer.get().liftByTag(foo, inet:fqdn)
- Args:
tagname (str): The tag name to lift by.
formname (str): The optional form to lift.
- Yields:
Yields nodes. The return type is node.
pack()
Get the Layer definition.
- Returns:
Dictionary containing the Layer definition. The return type is dict.
repr()
Get a string representation of the Layer.
- Returns:
A string that can be printed, representing a Layer. The return type is str.
set(name, valu)
Set an arbitrary value in the Layer definition.
- Args:
name (str): The name to set.
valu (any): The value to set.
- Returns:
The return type is
null
.
verify(config=$lib.null)
Verify consistency between the node storage and indexes in the given layer.
- Example:
Get all messages about consistency issues in the default layer:
for $mesg in $lib.layer.get().verify() { $lib.print($mesg) }
- Notes:
The config format argument and message format yielded by this API is considered BETA and may be subject to change! The formats will be documented when the convention stabilizes.
- Args:
config (dict): The scan config to use (default all enabled).
- Yields:
Yields messages describing any index inconsistencies. The return type is list.
list
Implements the Storm API for a List instance.
append(valu)
Append a value to the list.
- Args:
valu (any): The item to append to the list.
- Returns:
The return type is
null
.
extend(valu)
Extend a list using another iterable.
- Examples:
Populate a list by extending it with to other lists:
$list = $lib.list() $foo = (f, o, o) $bar = (b, a, r) $list.extend($foo) $list.extend($bar) // $list is now (f, o, o, b, a, r)
- Args:
valu (list): A list or other iterable.
- Returns:
The return type is
null
.
has(valu)
Check if a value is in the list.
- Args:
valu (any): The value to check.
- Returns:
True if the item is in the list, false otherwise. The return type is boolean.
index(valu)
Return a single field from the list by index.
- Args:
valu (int): The list index value.
- Returns:
The item present in the list at the index position. The return type is
any
.
length()
Warning
$list.length
has been deprecated and will be removed in version v3.0.0.
Get the length of the list. This is deprecated; please use .size()
instead.
- Returns:
The size of the list. The return type is
int
.
pop(index=(-1))
Pop and return the entry at the specified index in the list. If no index is specified, pop the last entry.
- Args:
index (int): Index of entry to pop.
- Returns:
The entry at the specified index in the list. The return type is
any
.
rem(item, all=$lib.false)
Remove a specific item from anywhere in the list.
- Args:
item (any): An item in the list.
all (boolean): Remove all instances of item from the list.
- Returns:
Boolean indicating if the item was removed from the list. The return type is boolean.
reverse()
Reverse the order of the list in place
- Returns:
The return type is
null
.
size()
Return the length of the list.
- Returns:
The size of the list. The return type is
int
.
slice(start, end=$lib.null)
Get a slice of the list.
- Examples:
Slice from index to 1 to 5:
$x=(f, o, o, b, a, r) $y=$x.slice(1,5) // (o, o, b, a)
Slice from index 3 to the end of the list:
$y=$x.slice(3) // (b, a, r)
- Args:
start (int): The starting index.
end (int): The ending index. If not specified, slice to the end of the list.
- Returns:
The slice of the list. The return type is list.
sort(reverse=$lib.false)
Sort the list in place.
- Args:
reverse (boolean): Sort the list in reverse order.
- Returns:
The return type is
null
.
unique()
Get a copy of the list containing unique items.
- Returns:
The return type is list.
model:form
Implements the Storm API for a Form.
name
The name of the Form
- Returns:
The type is str.
prop(name)
Get a Property on the Form
- Args:
name (str): The property to retrieve.
- Returns:
The
model:property
instance if the property if present on the form or null. The return type may be one of the following: model:property,null
.
type
Get the Type for the form.
- Returns:
The return type is model:type.
model:property
Implements the Storm API for a Property.
form
Get the Form for the Property.
- Returns:
The return type may be one of the following: model:form,
null
.
full
The full name of the Property.
- Returns:
The type is str.
name
The short name of the Property.
- Returns:
The type is str.
type
Get the Type for the Property.
- Returns:
The return type is model:type.
model:tagprop
Implements the Storm API for a Tag Property.
name
The name of the Tag Property.
- Returns:
The type is str.
type
Get the Type for the Tag Property.
- Returns:
The return type is model:type.
model:type
A Storm types wrapper around a lib.types.Type
name
The name of the Type.
- Returns:
The type is str.
norm(valu)
Get the norm and info for the Type.
- Args:
valu (any): The value to norm.
- Returns:
A tuple of the normed value and its information dictionary. The return type is list.
opts
The options for the Type.
- Returns:
The type is dict.
repr(valu)
Get the repr of a value for the Type.
- Args:
valu (any): The value to get the repr of.
- Returns:
The string form of the value as represented by the type. The return type is str.
stortype
The storetype of the Type.
- Returns:
The type is
int
.
node
Implements the Storm api for a node instance.
addEdge(verb, iden)
Add a light-weight edge.
- Args:
verb (str): The edge verb to add.
iden (str): The node iden of the destination node.
- Returns:
The return type is
null
.
delEdge(verb, iden)
Remove a light-weight edge.
- Args:
verb (str): The edge verb to remove.
iden (str): The node iden of the destination node to remove.
- Returns:
The return type is
null
.
edges(verb=$lib.null, reverse=$lib.false)
Yields the (verb, iden) tuples for this nodes edges.
- Args:
verb (str): If provided, only return edges with this verb.
reverse (boolean): If true, yield edges with this node as the dest rather than source.
- Yields:
A tuple of (verb, iden) values for this nodes edges. The return type is list.
form()
Get the form of the Node.
- Returns:
The form of the Node. The return type is str.
getByLayer()
Return a dict you can use to lookup which props/tags came from which layers.
- Returns:
property / tag lookup dictionary. The return type is dict.
getStorNodes()
Return a list of “storage nodes” which were fused from the layers to make this node.
- Returns:
List of storage node objects. The return type is list.
iden()
Get the iden of the Node.
- Returns:
The nodes iden. The return type is str.
isform(name)
Check if a Node is a given form.
- Args:
name (str): The form to compare the Node against.
- Returns:
True if the form matches, false otherwise. The return type is boolean.
ndef()
Get the form and primary property of the Node.
- Returns:
A tuple of the form and primary property. The return type is list.
pack(dorepr=$lib.false)
Return the serializable/packed version of the Node.
- Args:
dorepr (boolean): Include repr information for human readable versions of properties.
- Returns:
A tuple containing the ndef and property bag of the node. The return type is list.
repr(name=$lib.null, defv=$lib.null)
Get the repr for the primary property or secondary property of a Node.
- Args:
name (str): The name of the secondary property to get the repr for.
defv (str): The default value to return if the secondary property does not exist
- Returns:
The string representation of the requested value. The return type is str.
value()
Get the value of the primary property of the Node.
- Returns:
The primary property. The return type is
prim
.
node:data
A Storm Primitive representing the NodeData stored for a Node.
cacheget(name, asof=now)
Retrieve data stored with cacheset() if it was stored more recently than the asof argument.
- Args:
name (str): The name of the data to load.
asof (time): The max cache age.
- Returns:
The cached value or null. The return type is
prim
.
cacheset(name, valu)
Set a node data value with an envelope that tracks time for cache use.
- Args:
name (str): The name of the data to set.
valu (prim): The data to store.
- Returns:
The return type is
null
.
get(name)
Get the Node data for a given name for the Node.
- Args:
name (str): Name of the data to get.
- Returns:
The stored node data. The return type is
prim
.
has(name)
Check if the Node data has the given key set on it
- Args:
name (str): Name of the data to check for.
- Returns:
True if the key is found, otherwise false. The return type is boolean.
list()
Get a list of the Node data names on the Node.
- Returns:
List of the names of values stored on the node. The return type is list.
load(name)
Load the Node data onto the Node so that the Node data is packed and returned by the runtime.
- Args:
name (str): The name of the data to load.
- Returns:
The return type is
null
.
pop(name)
Pop (remove) a the Node data from the Node.
- Args:
name (str): The name of the data to remove from the node.
- Returns:
The data removed. The return type is
prim
.
set(name, valu)
Set the Node data for a given name on the Node.
- Args:
name (str): The name of the data.
valu (prim): The data to store.
- Returns:
The return type is
null
.
node:path
Implements the Storm API for the Path object.
idens()
The list of Node idens which this Path has been forked from during pivot operations.
- Returns:
A list of node idens. The return type is list.
listvars()
List variables available in the path of a storm query.
- Returns:
List of tuples containing the name and value of path variables. The return type is list.
meta
The PathMeta object for the Path.
- Returns:
The type is node:path:meta.
vars
The PathVars object for the Path.
- Returns:
The type is node:path:vars.
node:path:meta
Put the storm deref/setitem/iter convention on top of path meta information.
node:path:vars
Put the storm deref/setitem/iter convention on top of path variables.
node:props
A Storm Primitive representing the properties on a Node.
get(name)
Get a specific property value by name.
- Args:
name (str): The name of the property to return.
- Returns:
The requested value. The return type is
prim
.
list()
List the properties and their values from the $node
.
- Returns:
A list of (name, value) tuples. The return type is list.
set(prop, valu)
Set a specific property value by name.
- Args:
prop (str): The name of the property to set.
valu (prim): The value to set the property to.
- Returns:
The set value. The return type is
prim
.
number
Implements the Storm API for a Number instance.
Storm Numbers are high precision fixed point decimals corresponding to the the hugenum storage type.
scaleb(other)
Return the number multiplied by 10**other.
- Example:
Multiply the value by 10**-18:
$baz.scaleb(-18)
- Args:
other (int): The amount to adjust the exponent.
- Returns:
The exponent adjusted number. The return type is number.
tofloat()
Return the number as a float.
- Returns:
The number as a float. The return type is
float
.
toint(rounding=$lib.null)
Return the number as an integer.
By default, decimal places will be truncated. Optionally, rounding rules can be specified by providing the name of a Python decimal rounding mode to the ‘rounding’ argument.
- Example:
Round the value stored in $baz up instead of truncating:
$baz.toint(rounding=ROUND_UP)
- Args:
rounding (str): An optional rounding mode to use.
- Returns:
The number as an integer. The return type is
int
.
tostr()
Return the number as a string.
- Returns:
The number as a string. The return type is str.
pipe
A Storm Pipe provides fast ephemeral queues.
put(item)
Add a single item to the Pipe.
- Args:
item (any): An object to add to the Pipe.
- Returns:
The return type is
null
.
puts(items)
Add a list of items to the Pipe.
- Args:
items (list): A list of items to add.
- Returns:
The return type is
null
.
size()
Retrieve the number of items in the Pipe.
- Returns:
The number of items in the Pipe. The return type is
int
.
slice(size=(1000))
Return a list of up to size items from the Pipe.
- Args:
size (int): The max number of items to return.
- Returns:
A list of at least 1 item from the Pipe. The return type is list.
slices(size=(1000))
Yield lists of up to size items from the Pipe.
- Notes:
The loop will exit when the Pipe is closed and empty.
- Examples:
Operation on slices from a pipe one at a time:
for $slice in $pipe.slices(1000) { for $item in $slice { $dostuff($item) } }
Operate on slices from a pipe in bulk:
for $slice in $pipe.slices(1000) { $dostuff_batch($slice) }
- Args:
size (int): The max number of items to yield per slice.
- Yields:
Yields objects from the Pipe. The return type is
any
.
proj:comment
Implements the Storm API for a ProjectTicketComment
del()
Delete the comment.
- Returns:
True if the ProjectTicketComment was deleted The return type is boolean.
text
The comment text. This can be used to set the text as well.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
proj:comments
Implements the Storm API for ProjectTicketComments objects, which are collections of comments associated with a ticket.
add(text)
Add a comment to the ticket.
- Args:
text (str): The text for the new ProjectTicketComment.
- Returns:
The newly created proj:comment object The return type is proj:comment.
get(guid)
Get a ticket comment by guid.
- Args:
guid (str): The guid of the ProjectTicketComment to get.
- Returns:
The proj:comment object The return type is proj:comment.
proj:epic
Implements the Storm API for a ProjectEpic
name
The name of the Epic. This can be used to set the name as well.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
proj:epics
Implements the Storm API for ProjectEpics objects, which are collections of ProjectEpic objects associated with a particular Project
add(name)
Add an epic.
- Args:
name (str): The name for the new ProjectEpic.
- Returns:
The newly created proj:epic object The return type is proj:epic.
del(name)
Delete an epic by name.
- Args:
name (str): The name of the ProjectEpic to delete.
- Returns:
True if the ProjectEpic can be found and deleted, otherwise False The return type is boolean.
get(name)
Get an epic by name.
- Args:
name (str): The name (or iden) of the ProjectEpic to get.
- Returns:
The proj:epic object The return type is proj:epic.
proj:project
Implements the Storm API for Project objects, which are used for managing a scrum style project in the Cortex
epics
A proj:epics object that contains the epics associated with the given project.
- Returns:
The return type is proj:epics.
name
The name of the project. This can also be used to set the name of the project.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
sprints
A proj:sprints object that contains the sprints associated with the given project.
- Returns:
The return type is proj:sprints.
tickets
A proj:tickets object that contains the tickets associated with the given project.
- Returns:
The return type is proj:tickets.
proj:sprint
Implements the Storm API for a ProjectSprint
desc
A description of the sprint. This can also be used to set the description.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
name
The name of the sprint. This can also be used to set the name.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
status
The status of the sprint. This can also be used to set the status.
- Returns:
The return type may be one of the following:
int
,null
. When this is used to set the value, it does not have a return type.
tickets
Yields out the tickets associated with the given sprint (no call needed).
- Returns:
The return type is
generator
.
proj:sprints
Implements the Storm API for ProjectSprints objects, which are collections of sprints associated with a single project
add(name, period=$lib.null)
Add a sprint.
- Args:
name (str): The name for the new ProjectSprint.
period (ival): The time interval the ProjectSprint runs for
- Returns:
The newly created proj:sprint object The return type is proj:sprint.
del(name)
Delete a sprint by name.
- Args:
name (str): The name of the Sprint to delete.
- Returns:
True if the ProjectSprint can be found and deleted, otherwise False The return type is boolean.
get(name)
Get a sprint by name.
- Args:
name (str): The name (or iden) of the ProjectSprint to get.
- Returns:
The proj:sprint object The return type is proj:sprint.
proj:ticket
Implements the Storm API for a ProjectTicket.
assignee
The user the ticket is assigned to. This can be used to set the assignee of the ticket.
- Returns:
The return type may be one of the following:
int
,null
. When this is used to set the value, it does not have a return type.
desc
A description of the ticket. This can be used to set the description.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
epic
The epic associated with the ticket. This can be used to set the epic.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
name
The name of the ticket. This can be used to set the name of the ticket.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
priority
An integer value from the enums [0, 10, 20, 30, 40, 50] of the priority of the ticket. This can be used to set the priority of the ticket.
- Returns:
The return type may be one of the following:
int
,null
. When this is used to set the value, it does not have a return type.
sprint
The sprint the ticket is in. This can be used to set the sprint this ticket is in.
- Returns:
The return type may be one of the following:
int
,null
. When this is used to set the value, it does not have a return type.
status
The status of the ticket. This can be used to set the status of the ticket.
- Returns:
The return type may be one of the following:
int
,null
. When this is used to set the value, it does not have a return type.
proj:tickets
Implements the Storm API for ProjectTickets objects, which are collections of tickets associated with a project
add(name, desc=)
Add a ticket.
- Args:
name (str): The name for the new ProjectTicket.
desc (str): A description of the new ticket
- Returns:
The newly created proj:ticket object The return type is proj:ticket.
del(name)
Delete a sprint by name.
- Args:
name (str): The name of the ProjectTicket to delete.
- Returns:
True if the ProjectTicket can be found and deleted, otherwise False The return type is boolean.
get(name)
Get a ticket by name.
- Args:
name (str): The name (or iden) of the ProjectTicket to get.
- Returns:
The proj:ticket object The return type is proj:ticket.
queue
A StormLib API instance of a named channel in the Cortex multiqueue.
cull(offs)
Remove items from the queue up to, and including, the offset.
- Args:
offs (int): The offset which to cull records from the queue.
- Returns:
The return type is
null
.
get(offs=(0), cull=$lib.true, wait=$lib.true)
Get a particular item from the Queue.
- Args:
offs (int): The offset to retrieve an item from.
cull (boolean): Culls items up to, but not including, the specified offset.
wait (boolean): Wait for the offset to be available before returning the item.
- Returns:
A tuple of the offset and the item from the queue. If wait is false and the offset is not present, null is returned. The return type is list.
gets(offs=(0), wait=$lib.true, cull=$lib.false, size=$lib.null)
Get multiple items from the Queue as a iterator.
- Args:
offs (int): The offset to retrieve an items from.
wait (boolean): Wait for the offset to be available before returning the item.
cull (boolean): Culls items up to, but not including, the specified offset.
size (int): The maximum number of items to yield
- Yields:
Yields tuples of the offset and item. The return type is list.
name
The name of the Queue.
- Returns:
The type is str.
pop(offs=$lib.null, wait=$lib.false)
Pop a item from the Queue at a specific offset.
- Args:
offs (int): Offset to pop the item from. If not specified, the first item in the queue will be popped.
wait (boolean): Wait for an item to be available to pop.
- Returns:
The offset and item popped from the queue. If there is no item at the offset or the queue is empty and wait is false, it returns null. The return type is list.
put(item)
Put an item into the queue.
- Args:
item (prim): The item being put into the queue.
- Returns:
The queue offset of the item. The return type is
int
.
puts(items)
Put multiple items into the Queue.
- Args:
items (list): The items to put into the Queue.
- Returns:
The queue offset of the first item. The return type is
int
.
size()
Get the number of items in the Queue.
- Returns:
The number of items in the Queue. The return type is
int
.
random
A random number generator.
int(maxval, minval=(0))
Generate a random integer.
- Args:
maxval (int): The maximum random value.
minval (int): The minimum random value.
- Returns:
A random integer in the range min-max inclusive. The return type is
int
.
seed
The seed used for the generator. Setting this value resets the generator state.
- Returns:
The return type may be one of the following: str,
null
. When this is used to set the value, it does not have a return type.
set
Implements the Storm API for a Set object.
add(*items)
Add a item to the set. Each argument is added to the set.
- Args:
*items (any): The items to add to the set.
- Returns:
The return type is
null
.
adds(*items)
Add the contents of a iterable items to the set.
- Args:
*items (any): Iterables items to add to the set.
- Returns:
The return type is
null
.
has(item)
Check if a item is a member of the set.
- Args:
item (any): The item to check the set for membership.
- Returns:
True if the item is in the set, false otherwise. The return type is boolean.
list()
Get a list of the current members of the set.
- Returns:
A list containing the members of the set. The return type is list.
rem(*items)
Remove an item from the set.
- Args:
*items (any): Items to be removed from the set.
- Returns:
The return type is
null
.
rems(*items)
Remove the contents of a iterable object from the set.
- Args:
*items (any): Iterables items to remove from the set.
- Returns:
The return type is
null
.
size()
Get the size of the set.
- Returns:
The size of the set. The return type is
int
.
spooled:set
A StormLib API instance of a Storm Set object that can fallback to lmdb.
add(*items)
Add a item to the set. Each argument is added to the set.
- Args:
*items (any): The items to add to the set.
- Returns:
The return type is
null
.
adds(*items)
Add the contents of a iterable items to the set.
- Args:
*items (any): Iterables items to add to the set.
- Returns:
The return type is
null
.
has(item)
Check if a item is a member of the set.
- Args:
item (any): The item to check the set for membership.
- Returns:
True if the item is in the set, false otherwise. The return type is boolean.
list()
Get a list of the current members of the set.
- Returns:
A list containing the members of the set. The return type is list.
rem(*items)
Remove an item from the set.
- Args:
*items (any): Items to be removed from the set.
- Returns:
The return type is
null
.
rems(*items)
Remove the contents of a iterable object from the set.
- Args:
*items (any): Iterables items to remove from the set.
- Returns:
The return type is
null
.
size()
Get the size of the set.
- Returns:
The size of the set. The return type is
int
.
stat:tally
A tally object.
An example of using it:
$tally = $lib.stats.tally()
$tally.inc(foo)
for $name, $total in $tally {
$doStuff($name, $total)
}
get(name)
Get the value of a given counter.
- Args:
name (str): The name of the counter to get.
- Returns:
The value of the counter, or 0 if the counter does not exist. The return type is
int
.
inc(name, valu=(1))
Increment a given counter.
- Args:
name (str): The name of the counter to increment.
valu (int): The value to increment the counter by.
- Returns:
The return type is
null
.
sorted(byname=$lib.false, reverse=$lib.false)
Get a list of (counter, value) tuples in sorted order.
- Args:
byname (bool): Sort by counter name instead of value.
reverse (bool): Sort in descending order instead of ascending order.
- Returns:
List of (counter, value) tuples in sorted order. The return type is list.
stix:bundle
Implements the Storm API for creating and packing a STIX bundle for v2.1
add(node, stixtype=$lib.null)
Make one or more STIX objects from a node, and add it to the bundle.
- Examples:
Example Storm which would be called remotely via the
callStorm()
API:init { $bundle = $lib.stix.bundle() } #aka.feye.thr.apt1 $bundle.add($node) fini { return($bundle) }
- Args:
node (node): The node to make a STIX object from.
stixtype (str): The explicit name of the STIX type to map the node to. This will override the default mapping.
- Returns:
The stable STIX id of the added object. The return type is str.
pack()
Return the bundle as a STIX JSON object.
- Returns:
The return type is dict.
size()
Return the number of STIX objects currently in the bundle.
- Returns:
The return type is
int
.
storm:query
A storm primitive representing an embedded query.
exec()
Execute the Query in a sub-runtime.
- Notes:
The
.exec()
method can return a value if the Storm query contains areturn( ... )
statement in it.- Returns:
A value specified with a return statement, or none. The return type may be one of the following:
null
,any
.
size(limit=(1000))
Execute the Query in a sub-runtime and return the number of nodes yielded.
- Args:
limit (int): Limit the maximum number of nodes produced by the query.
- Returns:
The number of nodes yielded by the query. The return type is
int
.
str
Implements the Storm API for a String object.
encode(encoding=utf8)
Encoding a string value to bytes.
- Args:
encoding (str): Encoding to use. Defaults to utf8.
- Returns:
The encoded string. The return type is bytes.
endswith(text)
Check if a string ends with text.
- Args:
text (str): The text to check.
- Returns:
True if the text ends with the string, false otherwise. The return type is boolean.
find(valu)
Find the offset of a given string within another.
- Examples:
Find values in the string
asdf
:$x = asdf $x.find(d) // returns 2 $x.find(v) // returns null
- Args:
valu (str): The substring to find.
- Returns:
The first offset of substring or null. The return type is
int
.
format(**kwargs)
Format a text string from an existing string.
- Examples:
Format a string with a fixed argument and a variable:
$template='Hello {name}, list is {list}!' $list=(1,2,3,4) $new=$template.format(name='Reader', list=$list)
- Args:
**kwargs (any): Keyword values which are substituted into the string.
- Returns:
The new string. The return type is str.
json()
Parse a JSON string and return the deserialized data.
- Returns:
The JSON deserialized object. The return type is
prim
.
ljust(size, fillchar= )
Left justify the string.
- Args:
size (int): The length of character to left justify.
fillchar (str): The character to use for padding.
- Returns:
The left justified string. The return type is str.
lower()
Get a lowercased copy of the string.
- Examples:
Printing a lowercased string:
$foo="Duck" $lib.print($foo.lower())
- Returns:
The lowercased string. The return type is str.
lstrip(chars=$lib.null)
Remove leading characters from a string.
- Examples:
Removing whitespace and specific characters:
$strippedFoo = $foo.lstrip() $strippedBar = $bar.lstrip(w)
- Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
- Returns:
The stripped string. The return type is str.
replace(oldv, newv, maxv=$lib.null)
Replace occurrences of a string with a new string, optionally restricting the number of replacements.
- Example:
Replace instances of the string “bar” with the string “baz”:
$foo.replace('bar', 'baz')
- Args:
oldv (str): The value to replace.
newv (str): The value to add into the string.
maxv (int): The maximum number of occurrences to replace.
- Returns:
The new string with replaced instances. The return type is str.
reverse()
Get a reversed copy of the string.
- Examples:
Printing a reversed string:
$foo="foobar" $lib.print($foo.reverse())
- Returns:
The reversed string. The return type is str.
rjust(size, fillchar= )
Right justify the string.
- Args:
size (int): The length of character to right justify.
fillchar (str): The character to use for padding.
- Returns:
The right justified string. The return type is str.
rsplit(text, maxsplit=(-1))
Split the string into multiple parts, from the right, based on a separator.
- Example:
Split a string on the colon character:
($foo, $bar) = $baz.rsplit(":", maxsplit=1)
- Args:
text (str): The text to split the string up with.
maxsplit (int): The max number of splits.
- Returns:
A list of parts representing the split string. The return type is list.
rstrip(chars=$lib.null)
Remove trailing characters from a string.
- Examples:
Removing whitespace and specific characters:
$strippedFoo = $foo.rstrip() $strippedBar = $bar.rstrip(asdf)
- Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
- Returns:
The stripped string. The return type is str.
size()
Return the length of the string.
- Returns:
The size of the string. The return type is
int
.
slice(start, end=$lib.null)
Get a substring slice of the string.
- Examples:
Slice from index to 1 to 5:
$x="foobar" $y=$x.slice(1,5) // "ooba"
Slice from index 3 to the end of the string:
$y=$x.slice(3) // "bar"
- Args:
start (int): The starting character index.
end (int): The ending character index. If not specified, slice to the end of the string
- Returns:
The slice substring. The return type is str.
split(text, maxsplit=(-1))
Split the string into multiple parts based on a separator.
- Example:
Split a string on the colon character:
($foo, $bar) = $baz.split(":")
- Args:
text (str): The text to split the string up with.
maxsplit (int): The max number of splits.
- Returns:
A list of parts representing the split string. The return type is list.
startswith(text)
Check if a string starts with text.
- Args:
text (str): The text to check.
- Returns:
True if the text starts with the string, false otherwise. The return type is boolean.
strip(chars=$lib.null)
Remove leading and trailing characters from a string.
- Examples:
Removing whitespace and specific characters:
$strippedFoo = $foo.strip() $strippedBar = $bar.strip(asdf)
- Args:
chars (str): A list of characters to remove. If not specified, whitespace is stripped.
- Returns:
The stripped string. The return type is str.
title()
Get a title cased copy of the string.
- Examples:
Printing a title cased string:
$foo="Hello world." $lib.print($foo.title())
- Returns:
The title cased string. The return type is str.
upper()
Get a uppercased copy of the string.
- Examples:
Printing a uppercased string:
$foo="Duck" $lib.print($foo.upper())
- Returns:
The uppercased string. The return type is str.
tabular:printer
A Storm object for printing tabular data using a defined configuration.
header()
Create a header row string.
- Returns:
The header row string. The return type is str.
row(data)
Create a new row string from a data list.
- Args:
data (list): The data to create the row from; length must match the number of configured columns.
- Returns:
The row string. The return type is str.
telepath:proxy
Implements the Storm API for a Telepath proxy.
These can be created via $lib.telepath.open()
. Storm Service objects
are also Telepath proxy objects.
Methods called off of these objects are executed like regular Telepath RMI calls.
An example of calling a method which returns data:
$prox = $lib.telepath.open($url)
$result = $prox.doWork($data)
return ( $result )
An example of calling a method which is a generator:
$prox = $lib.telepath.open($url)
for $item in $prox.genrStuff($data) {
$doStuff($item)
}
telepath:proxy:genrmethod
Implements the generator methods for the telepath:proxy.
An example of calling a method which is a generator:
$prox = $lib.telepath.open($url)
for $item in $prox.genrStuff($data) {
$doStuff($item)
}
telepath:proxy:method
Implements the call methods for the telepath:proxy.
An example of calling a method which returns data:
$prox = $lib.telepath.open($url)
$result = $prox.doWork($data)
$doStuff($result)
text
A mutable text type for simple text construction.
add(text, **kwargs)
Add text to the Text object.
- Args:
text (str): The text to add.
**kwargs (any): Keyword arguments used to format the text.
- Returns:
The return type is
null
.
str()
Get the text content as a string.
- Returns:
The current string of the text object. The return type is str.
trigger
Implements the Storm API for a Trigger.
iden
The Trigger iden.
- Returns:
The type is str.
move(viewiden)
Modify the Trigger to run in a different View.
- Args:
viewiden (str): The iden of the new View for the Trigger to run in.
- Returns:
The return type is
null
.
pack()
Get the trigger definition.
- Returns:
The definition. The return type is dict.
set(name, valu)
Set information in the Trigger.
- Args:
name (str): Name of the key to set.
valu (prim): The data to set
- Returns:
The return type is
null
.
user:profile:dict
A Storm Primitive that maps the HiveDict interface to a user profile dictionary.
get(name, default=$lib.null)
Get a user profile value.
- Args:
name (str): The name of the user profile value.
default (prim): The default value to return if not set.
- Returns:
The requested value. The return type is
prim
.
list()
List the user profile vars and their values.
- Returns:
A list of tuples containing var, value pairs. The return type is list.
pop(name, default=$lib.null)
Remove a user profile value.
- Args:
name (str): The name of the user profile value.
default (prim): The default value to return if not set.
- Returns:
The requested value. The return type is
prim
.
set(name, valu)
Set a user profile value.
- Args:
name (str): The name of the user profile value to set.
valu (prim): The value to store.
- Returns:
Old value if it was previously set, or none. The return type may be one of the following:
null
,prim
.
user:vars:dict
A Storm Primitive that maps the HiveDict interface to a user vars dictionary.
get(name, default=$lib.null)
Get the value for a user var.
- Args:
name (str): The name of the var.
default (prim): The default value to return if not set.
- Returns:
The requested value. The return type is
prim
.
list()
List the vars and their values.
- Returns:
A list of tuples containing var, value pairs. The return type is list.
pop(name, default=$lib.null)
Remove a user var value.
- Args:
name (str): The name of the var.
default (prim): The default value to return if not set.
- Returns:
The requested value. The return type is
prim
.
set(name, valu)
Set a user var value.
- Args:
name (str): The name of the var to set.
valu (prim): The value to store.
- Returns:
Old value of the var if it was previously set, or none. The return type may be one of the following:
null
,prim
.
vault
Implements the Storm API for a Vault.
Callers (instantiation) of this class must have already checked that the user has at least PERM_READ to the vault.
configs
The Vault configs data.
- Returns:
The return type is vault:data. When this is used to set the value, it does not have a return type.
delete()
Delete the Vault.
- Returns:
$lib.true if the vault was deleted, $lib.false otherwise. The return type is boolean.
iden
The Vault iden.
- Returns:
The type is str.
name
The Vault name.
- Returns:
The return type is str. When this is used to set the value, it does not have a return type.
owner
The Vault owner (user or role iden).
- Returns:
The type is str.
permissions
The Vault permissions.
- Returns:
The return type is dict.
scope
The Vault scope.
- Returns:
The type is str.
secrets
The Vault secrets data.
- Returns:
The return type is vault:data. When this is used to set the value, it does not have a return type.
setPerm(iden, level)
Set easy permissions on the Vault.
- Args:
iden (str): The user or role to modify.
level (str): The easyperm level for the iden. $lib.null to remove an existing permission.
- Returns:
$lib.true if the permission was set, $lib.false otherwise. The return type is boolean.
type
The Vault type.
- Returns:
The type is str.
vault:data
Implements the Storm API for Vault data. This is used for both vault configs and vault secrets.
view
Implements the Storm api for a View instance.
addNode(form, valu, props=$lib.null)
Transactionally add a single node and all it’s properties. If any validation fails, no changes are made.
- Args:
form (str): The form name.
valu (prim): The primary property value.
props (dict): An optional dictionary of props.
- Returns:
The node if the view is the current view, otherwise null. The return type is node.
addNodeEdits(edits)
Add NodeEdits to the view.
- Args:
edits (list): A list of nodeedits.
- Returns:
The return type is
null
.
children()
Yield Views which are children of this View.
- Yields:
Child Views. The return type is view.
delMergeRequest()
Remove the existing merge request.
- Returns:
The deleted merge request. The return type is dict.
delMergeVote(useriden=$lib.null)
Remove a previously created merge vote.
- Notes:
The default use case removes a vote cast by the current user. Specifying the useriden parameter allows you to remove a vote cast by another user but requires global admin permissions.
- Args:
useriden (str): Delete a merge vote by a different user.
- Returns:
The vote record that was removed. The return type is dict.
detach()
Detach the view from its parent. WARNING: This cannot be reversed.
- Returns:
The return type is
null
.
fork(name=$lib.null)
Fork a View in the Cortex.
- Args:
name (str): The name of the new view.
- Returns:
The
view
object for the new View. The return type is view.
get(name, defv=$lib.null)
Get a view configuration option.
- Args:
name (str): Name of the value to get.
defv (prim): The default value returned if the name is not set in the View.
- Returns:
The value requested or the default value. The return type is
prim
.
getEdgeVerbs()
Get the Edge verbs which exist in the View.
- Yields:
Yields the edge verbs used by Layers which make up the View. The return type is str.
getEdges(verb=$lib.null)
Get node information for Edges in the View.
- Args:
verb (str): The name of the Edges verb to iterate over.
- Yields:
Yields tuples containing the source iden, verb, and destination iden. The return type is list.
getFormCounts()
Get the formcounts for the View.
- Example:
Get the formcounts for the current View:
$counts = $lib.view.get().getFormCounts()
- Returns:
Dictionary containing form names and the count of the nodes in the View’s Layers. The return type is dict.
getMergeRequest()
Return the existing merge request or null.
- Returns:
The merge request. The return type is dict.
getMergeRequestSummary()
Return the merge request, votes, parent quorum definition, and current layer offset.
- Returns:
The summary info. The return type is dict.
getMerges()
Yields previously successful merges into the view.
- Yields:
Yields previously successful merges into the view. The return type is dict.
getMergingViews()
Get a list of idens of Views that have open merge requests to this View.
- Idens:
The list of View idens that have an open merge request into this View. The return type is list.
getPropArrayCount(propname, valu=$lib.undef)
Get the number of individual array property values in the View for the given array property name.
- Notes:
This is a fast approximate count calculated by summing the number of array property values in each layer of the view. Property values which are overwritten by different values in higher layers will still be included in the count.
- Args:
propname (str): The property name to look up.
valu (any): The value in the array property to look up.
- Returns:
The count of nodes. The return type is
int
.
getPropCount(propname, valu=$lib.undef)
Get the number of nodes in the View with a specific property and optional value.
- Notes:
This is a fast approximate count calculated by summing the number of nodes with the property value in each layer of the view. Property values which are overwritten by different values in higher layers will still be included in the count.
- Args:
propname (str): The property name to look up.
valu (any): The value of the property to look up.
- Returns:
The count of nodes. The return type is
int
.
getPropValues(propname)
Yield unique property values in the view for the given form or property name.
- Args:
propname (str): The property or form name to look up.
- Yields:
Unique property values. The return type is
any
.
getTagPropCount(tag, propname, form=$lib.null, valu=$lib.undef)
Get the number of nodes in the View with the given tag property and optional value.
- Notes:
This is a fast approximate count calculated by summing the number of nodes with the tag property value in each layer of the view. Values which are overwritten by different values in higher layers will still be included in the count.
- Args:
tag (str): The tag to look up.
propname (str): The property name to look up.
form (str): The optional form to look up.
valu (any): The value of the property to look up.
- Returns:
The count of nodes. The return type is
int
.
iden
The iden of the View.
- Returns:
The type is str.
insertParentFork(name=$lib.null)
Insert a new View between a forked View and its parent.
- Args:
name (str): The name of the new View.
- Returns:
The
view
object for the new View. The return type is view.
layers
The layer
objects associated with the view
.
- Returns:
The type is list.
merge(force=$lib.false)
Merge a forked View back into its parent View.
- Args:
force (boolean): Force the view to merge if possible.
- Returns:
The return type is
null
.
pack()
Get the View definition.
- Returns:
Dictionary containing the View definition. The return type is dict.
parent
The parent View. Will be $lib.null
if the view is not a fork.
- Returns:
The type is str.
repr()
Get a string representation of the View.
- Returns:
A list of lines that can be printed, representing a View. The return type is list.
set(name, valu)
Set a view configuration option.
Current runtime updatable view options include:
- name (str)
A terse name for the View.
- desc (str)
A description of the View.
- parent (str)
The parent View iden.
- nomerge (bool)
Deprecated - use protected. Updates to this option will be redirected to the protected option (below) until this option is removed.
- protected (bool)
Setting to $lib.true will prevent the layer from being merged or deleted.
- layers (list(str))
Set the list of layer idens for a non-forked view. Layers are specified in precedence order with the first layer in the list being the write layer.
- quorum (dict)
A dictionary of the quorum settings which require users to vote on merges. {
“count”: <int>, “roles”: [ <roleid>, … ]
} Once quorum is enabled for a view, any forks must use the setMergeRequest() API to request that the child view is merged. The $view.addMergeVote() API is used for users to add their votes if they have been granted one of the roles listed. Once the number of approvals are met and there are no vetoes, a background process will kick off which merges the nodes and ultimately deletes the view and top layer.
To maintain consistency with the view.fork() semantics, setting the “parent” option on a view has a few limitations:
The view must not already have a parent
The view must not have more than 1 layer
- Args:
name (str): The name of the value to set.
valu (prim): The value to set.
- Returns:
The return type is
null
.
setMergeComment(comment)
Set the main comment/description of a merge request.
- Args:
comment (str): The text comment to set for the merge request
- Returns:
The updated merge request. The return type is dict.
setMergeRequest(comment=$lib.null)
Setup a merge request for the view in the current state.
- Args:
comment (str): A text comment to include in the merge request.
- Returns:
The newly created merge request. The return type is dict.
setMergeVote(approved=$lib.true, comment=$lib.null)
Register a vote for or against the current merge request.
- Args:
approved (boolean): Set to (true) to approve the merge or (false) to veto it.
comment (str): A comment attached to the vote.
- Returns:
The vote record that was created. The return type is dict.
setMergeVoteComment(comment)
Set the comment associated with your vote on a merge request.
- Args:
comment (str): The text comment to set for the merge vote
- Returns:
The fully updated vote record. The return type is dict.
swapLayer()
Swaps the top layer for a fresh one and deletes the old layer.
- Returns:
The return type is
null
.
triggers
The trigger
objects associated with the view
.
- Returns:
The type is list.
wipeLayer()
Delete all nodes and nodedata from the write layer. Triggers will be run.
- Returns:
The return type is
null
.
xml:element
A Storm object for dealing with elements in an XML tree.
attrs
The element attributes list.
- Returns:
The type is dict.
find(name, nested=$lib.true)
Find all nested elements with the specified tag name.
- Args:
name (str): The name of the XML tag.
nested (bool): Set to $lib.false to only find direct children.
- Returns:
A generator which yields xml:elements. The return type is
generator
.
get(name)
Get a single child element by XML tag name.
- Args:
name (str): The name of the child XML element tag.
- Returns:
The child XML element or $lib.null The return type is xml:element.
name
The element tag name.
- Returns:
The type is str.
text
The element text body.
- Returns:
The type is str.
comments
A
proj:comments
object that contains comments associated with the given ticket.The return type is proj:comments.