bmc-tpl-code-all-around/src/TplBuiltIns.ts

244 lines
23 KiB
TypeScript
Raw Normal View History

export interface TplBuiltInMethod {
description: string;
snippets: string[];
}
export const tplBuiltIns: Record<string, Record<string, TplBuiltInMethod>> = {
"built_in_globals": {
"datatype": {
snippets: ["${1:item}"],
description: `Returns a string indicating the type of the item.\n\nPossible return values are:\n"node"\n"relationship"\n"text"\n"boolean"\n"number"\n"float"\n"list"\n"table"\n"none"\n"void"\n"datetime"\n"nodeset"\n"unknown" (used for anything else)`
},
"size": {
snippets: ["${1:collection}"],
description: `Returns the number of items in the collection.\n\nWhere the collection is a list, or a set of nodes retrieved with a search expression.\nWhere the collection is a string, the number of characters is returned.\nTo determine the type of the collection, you can use the datatype function.`
}
},
"log": {
"debug": { snippets: ["${1:output}"], description: `Log the given message with a debug level message.` },
"info": { snippets: ["${1:output}"], description: `Log the given message with an info level message.` },
"warn": { snippets: ["${1:output}"], description: `Log the given message with a warn level message.` },
"error": { snippets: ["${1:output}"], description: `Log the given message with an error level message.` },
"critical": { snippets: ["${1:output}"], description: `Log the given message with a critical level message.` }
},
"text": {
"lower": { snippets: ["${1:input}"], description: `Returns the lower-cased version of the string argument.` },
"upper": { snippets: ["${1:input}"], description: `Returns the upper-cased version of the string argument.` },
"toNumber": {
snippets: ["${1:input}", "${1:input},${2:base}"],
description: `Converts its string argument into a number. By default, the number is treated as a base 10 value; if the optional base is provided, the number is treated as being in the specified base. Bases from 2 to 36 are supported.`
},
"replace": {
snippets: ["${1:input}, ${2:old},${3:new}"],
description: `Returns a modified version of the string formed by replacing all occurrences of the string old with new.`
},
"join": {
snippets: ["${1:list},${2:separator}"],
description: `Returns a string containing all items in a list of strings joined with the specified separator.`
},
"split": {
snippets: ["${1:input}", "${1:input},${2:separator}"],
description: `Returns a list consisting of portions of the string split according to the separator string, where specified.`
},
"strip": {
snippets: ["${1:input}", "${1:input},${2:characters}"],
description: `Strips unwanted characters from the start and end of the given string.`
},
"leftStrip": {
snippets: ["${1:input}", "${1:input},${2:characters}"],
description: `Equivalent to text.strip, but only strips from the left side of the string.`
},
"rightStrip": {
snippets: ["${1:input}", "${1:input},${2:characters}"],
description: `Equivalent to text.strip, but only strips from the right side of the string.`
},
"hash": { snippets: ["${1:input}"], description: `Returns a hashed form of the string, generated with the MD5 hash algorithm.` },
"ordinal": { snippets: ["${1:input}"], description: `Returns the ordinal value of the string argument. The string must be one character in length.` }
},
"number": {
"toChar": { snippets: ["${1:number}"], description: `Converts the integer number in the ASCII range to a character.` },
"toText": {
snippets: ["${1:number}", "${1:number}, ${2:base}", "${1:number}, ${2:base},${3:width}"],
description: `Converts the integer number to a text form. The default is to use the base 10 representation. If the optional base argument is given, conversion uses that base instead.`
},
"range": { snippets: ["${1:number}"], description: `Generate a list containing 0 to number - 1.` }
},
"regex": {
"extract": {
snippets: ["${1:string}, ${2:expression}", "${1:string}, ${2:expression},${3:substitution}", "${1:string},${2:expression}, ${3:substitution},${4:no_match}"],
description: `Returns the result of extracting the regular expression from the string.`
},
"extractAll": { snippets: ["${1:string},${2:pattern}"], description: `Returns a list containing all the non-overlapping matches of the pattern in the string.` },
"replace": {
snippets: ["${1:string}, ${2:pattern},${3:replacement}", "${1:string},${2:pattern}, ${3:replacement}, count:=${4:0}"],
description: `Return a string with all non-overlapping matches of pattern replaced by replacement.`
},
"escape": { snippets: ["${1:string}"], description: `Returns a string with regex special characters suitably escaped.` }
},
"xpath": {
"openDocument": { snippets: ["${1:string}"], description: `Returns the DOM object resulting from parsing the XML string.` },
"evaluate": {
snippets: ["${1:sourceXML}, ${2:expression}", "${1:sourceXML}, ${2:expression},${3:namespaces}", "${1:sourceXML},${2:expression}, ${3:namespaces},${4:return_elements}"],
description: `Returns the result of evaluating the XPath expression against the XML string.`
},
"closeDocument": { snippets: ["${1:dom_object}"], description: `Closes an XML document opened with xpath.openDocument.` }
},
"table": {
"remove": { snippets: ["${1:table},${2:key}"], description: `Removes the specified key from the specified table.` },
"get": {
snippets: ["${1:table}, ${2:key}", "${1:table}, ${2:key}, default_val:=${3:none}"],
description: `Returns the key from table if it exists, or if it does not exist, returns the specified default_val.`
},
"keys": { snippets: ["${1:table}"], description: `Returns a list of the keys in the table.` },
"values": { snippets: ["${1:table}"], description: `Returns a list of the values in the table.` }
},
"Future": {
"runCommand": {
snippets: ["${1:target}, ${2:command},${3:path_to_command}"],
description: `Returns a DiscoveredCommandResult node containing the result of running the specified command. Enables command paths to be restricted.`
}
},
"discovery": {
"fileGet": {
snippets: ["${1:target}, ${2:filename}", "${1:target}, ${2:filename}, container_context:=${3:true}", "${1:target},${2:filename}, container_context:=${3:true}, win64_redirect:=${4:true}"],
description: `Retrieves the specified file.\n\nThe function takes the following parameters:\n\ntarget: a node used to identify the discovery target.\nfilename: the name of the file on which to return information.\ncontainer_context: an optional flag to specify how container context is interpreted.\nwin64_redirect: an optional flag which enables you to specify whether the search for the file should take place in the 32 bit directory if not found in the 64 bit directory.\n\nReturns a DiscoveredFile node.`
},
"fileInfo": {
snippets: ["${1:target}, ${2:filename}", "${1:target}, ${2:filename}, container_context:=${3:true}", "${1:target},${2:filename}, container_context:=${3:true}, win64_redirect:=${4:true}"],
description: `Retrieves information about the specified file, but not the file content. This information is useful if the file is a binary file or particularly large.\n\nReturns a DiscoveredFile node with no content attribute.`
},
"listDirectory": {
snippets: ["${1:target}, ${2:path}", "${1:target}, ${2:path}, container_context:=${3:true}", "${1:target},${2:path}, container_context:=${3:true}, win64_redirect:=${4:true}"],
description: `Retrieves the directory listing of the directory specified by the path on the specified target.\n\nThe function takes the following parameters:\n\ntarget, where target is:\na node used to identify the discovery target, either a directly discovered data node, or a Host node. Or,\na data source against which the request is performed. See also, discovery-dataSource.\npath – the path to the directory on which to return information. You cannot use wildcards in the path. \ncontainer_context is an optional flag to specify how container context is interpreted for the command. When a pattern triggers on a DiscoveredProcess or RuntimeEnvironment within a container, or on a ContainedSoftwareInstance or SoftwareContainer node, then the requests are executed in the container. This behavior is the default; container_context = true. However, on occasions where you want to run the request on the host, for example, you might be examining the /proc file system, you must specify container_context = false. When the pattern triggers outside a container, then there is no container context, and the flag has no effect.\nwin64_redirect is an optional flag which enables you to specify whether the search for the file should take place in the 32 bit directory if not found in the 64 bit directory. TRUE means search the 32 bit directory, FALSE means do not search the 32 bit directory if the file is not found in the 64 bit directory. The default is TRUE.\nReturns a list of Discovered Directory Entry nodes.\n\n64 bit Windows hosts have the following system directories for holding executables, DLLs, and so forth:\n\n%windir%\\system32 — 64 bit executables and DLLs\n%windir%\\SysWOW64 — 32 bit executables and DLLs\nPaths that do not start with %windir%\\system32 or %systemroot%\\system32 are never checked for redirection.\n\nOn non-Windows and 32 bit Windows systems win64_redirect has no effect.\n\nIf the call fails, it returns none and records the failure reason in the Directory Listing node.\n\nRestrictions\nOn Windows systems, owner and group information is not recovered.\nGroup names which include spaces are not supported.\nConfig.sys is not listed as a system file.\nDirectory Listing nodes are not created for empty Windows directories.`
},
"getNames": { snippets: ["${1:target},${2:ip_address}"], description: `Performs a DNS lookup on the IP address and returns a list of FQDN strings.` },
"lookupAddresses": { snippets: ["${1:target},${2:name}"], description: `Performs a DNS lookup on the supplied DNS resolvable name and returns a list of IP addresses.` },
"listRegistry": {
snippets: ["${1:target}, ${2:key_path}", "${1:target}, ${2:key_path}, win64_redirect:=${3:true}"],
description: `Returns a list of the registry entries of the registry key specified by the key_path.`
},
"registryKey": {
snippets: ["${1:target}, ${2:key}", "${1:target}, ${2:key}, win64_redirect:=${3:true}"],
description: `Retrieves a registry key from a Windows computer.\nReturns a DiscoveredRegistryValue node.`
},
"wmiQuery": {
snippets: ["${1:target}, ${2:query},${3:namespace}"],
description: `Performs a WMI query on a Windows computer.\nReturns a list of DiscoveredWMI nodes.`
},
"wbemQuery": {
snippets: ["${1:target}, ${2:class_name},${3:namespace}", "${1:target},${2:class_name}, ${3:properties},${4:namespace}"],
description: `Performs a WBEM query on the target and returns a list of DiscoveredWBEM DDD nodes.`
},
"wbemEnumInstances": {
snippets: ["${1:target}, ${2:class_name},${3:properties}, ${4:namespace}, filter_locally:=${5:false}"],
description: `Performs a WBEM query on the target and returns a list of DiscoveredWBEMInstance DDD nodes.`
},
"runCommand": {
snippets: ["${1:target}, ${2:command},${3:restrict_paths}, ${4:dialect}", "${1:target}, ${2:command},${3:restrict_paths}, ${4:dialect}, container_context:=${5:true}"],
description: `Returns a DiscoveredCommandResult node containing the result of running the specified command.`
},
"runPowerShell": {
snippets: ["${1:target}, ${2:script},${3:restrict_paths}"],
description: `Returns a DiscoveredCommandResult node containing the result of running the specified PowerShell script.`
},
"snmpGet": {
snippets: ["${1:target}, ${2:oid_table}", "${1:target}, ${2:oid_table},${3:binary_oid_list}"],
description: `Performs an SNMP query on the target and returns a DiscoveredSNMP node.`
},
"snmpGetTable": {
snippets: ["${1:target}, ${2:table_oid},${3:column_table}", "${1:target},${2:table_oid}, ${3:column_table},${4:binary_oid_list}"],
description: `Performs an SNMP query that returns a table on the target. Returns a list of DiscoveredSNMPRow nodes or none if the SNMP query failed.`
},
"scan": {
snippets: ["${1:target},${2:company}, ${3:outpost_id},${4:scope}"],
description: `Adds an open scan for the given target and returns a count of the number of endpoints included in the open scan.`
},
"process": { snippets: ["${1:source}"], description: `Returns the process node corresponding to the source node.` },
"children": { snippets: ["${1:process}"], description: `Returns a list of the child processes for the given DiscoveredProcess node.` },
"descendents": { snippets: ["${1:process}"], description: `Returns a list consisting of the children of the given DiscoveredProcess node, and recursively all of the children's children.` },
"parent": { snippets: ["${1:process}"], description: `Returns the parent process for the given DiscoveredProcess node.` },
"allProcesses": { snippets: ["${1:source}"], description: `Returns a list of all processes corresponding to the directly discovered data source node.` },
"access": { snippets: ["${1:source}"], description: `Returns the Discovery Access node for the source DDD node, if given.` },
"startTime": { snippets: ["${1:source}"], description: `Returns the start time of the scan which discovered the source DDD node.` }
},
"binary": {
"toHexString": { snippets: ["${1:value}"], description: `Returns the given binary value as a hex string.` },
"toIPv4": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of an IPv4 address.` },
"toIPv4z": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of an IPv4 address with a zone index.` },
"toIPv6": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of a canonical IPv6 address.` },
"toIPv6z": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of a canonical IPv6 address with zone index.` },
"toMACAddress": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of a MAC address.` },
"toValue": { snippets: ["${1:data},${2:format}"], description: `Converts the given binary value into the specified format.` },
"toWWN": { snippets: ["${1:value}"], description: `Returns the given binary value as the text representation of a WWN value.` }
},
"json": {
"encode": { snippets: ["${1:value}"], description: `Converts value to a JSON encoded string. Where value is a string, table, or a list including nested structures.` },
"decode": { snippets: ["${1:value}"], description: `Decodes a JSON encoded string and returns a structure containing a number, boolean, null, string, table or list including nested structures.` }
},
"jmespath": {
"evaluate": { snippets: ["${1:source},${2:expression}"], description: `Returns the https://jmespath.org/ evaluation for the expression given a source table or list.` }
},
"yaml": {
"encode": { snippets: ["${1:object}"], description: `Converts the given object into a YAML-encoded string.` },
"decode": { snippets: ["${1:value}"], description: `Converts the given YAML encoded string into an object.` },
"decodeAll": { snippets: ["${1:value}"], description: `Converts the given YAML encoded string into a list of objects.` }
},
"list": {
"append": { snippets: ["${1:list},${2:value}"], description: `Appends an item to a specified list.` },
"sorted": { snippets: ["${1:items}", "${1:items}, reverse:=${2:false}"], description: `Returns a sorted copy of items list, leaving the items unchanged. If reverse is true, sorts in reverse order.` }
},
"model": {
"addContainment": { snippets: ["${1:container},${2:containees}"], description: `Adds the containees to the container by creating suitable relationships between the nodes.` },
"setContainment": { snippets: ["${1:container},${2:containees}"], description: `Equivalent to addContainment, except that at the end of the pattern body, any relationships to contained nodes that have not been confirmed are removed.` },
"destroy": { snippets: ["${1:node}"], description: `Destroy the specified node or relationship in the model.` },
"withdraw": { snippets: ["${1:node},${2:attribute}"], description: `Removes the named attribute from the node.` },
"setRemovalGroup": { snippets: ["${1:node}", "${1:node},${2:name}"], description: `Add the specified node or nodes to a named removal group.` },
"anchorRemovalGroup": { snippets: ["${1:node}", "${1:node},${2:name}"], description: `Specify an anchor node for a named removal group.` },
"suppressRemovalGroup": { snippets: ["${1:name}"], description: `Suppress removal of the named removal group.` },
"host": { snippets: ["${1:node}"], description: `Returns the Host node corresponding to the given node.` },
"hosts": { snippets: ["${1:node}"], description: `Returns a list of all the Host nodes corresponding to the given node.` },
"findPackages": { snippets: ["${1:node},${2:regexes}"], description: `Traverses from the node, and returns a set of all Package nodes that have names matching the provided list of regular expressions.` },
"addDisplayAttribute": { snippets: ["${1:node},${2:value}"], description: `Adds a named attribute, or a list of named attributes to the additional attributes displayed in a node view.` },
"removeDisplayAttribute": { snippets: ["${1:node},${2:value}"], description: `Removes a named attribute, or a list of named attributes from the additional attributes displayed in a node view.` },
"kind": { snippets: ["${1:node}"], description: `Returns the node kind corresponding to the given node.` },
"confirm": { snippets: ["${1:node}"], description: `Sends a confirmed event for the node.` },
"findCandidate": { snippets: ["${1:kind},${2:data}"], description: `Finds a candidate node of a kind that matches table data.` },
"findCandidates": { snippets: ["${1:kind}, ${2:data},${3:limit}"], description: `Finds ranked candidates.` },
"publish": { snippets: ["${1:node},${2:auto_rels}"], description: `Takes a node of kind ModelDefinition and publishes it, creating a BusinessService, TechnicalService or BusinessApplicationInstance node.` },
"unpublish": { snippets: ["${1:node}"], description: `Takes a node of kind ModelDefinition that has been published, and unpublishes it.` }
},
"related": {
"host": { snippets: ["${1:node}"], description: `Returns the Host node corresponding to the given node.` },
"detailContainer": { snippets: ["${1:node}"], description: `Returns the Software Component, Software Instance, or Business Application Instance node containing the given node.` },
"hostingNode": { snippets: ["${1:fallback_kind},${2:attributes}"], description: `Returns a Host or Cluster node that is associated with the node that triggered the pattern.` }
},
"mail": {
"send": {
snippets: ["${1:recipients},${2:subject}, ${3:message}", "${1:recipients}, ${2:subject},${3:message}, ${4:cc_addrs}", "${1:recipients}, ${2:subject},${3:message}, ${4:cc_addrs},${5:bcc_addrs}"],
description: `Sends an email.`
}
},
"time": {
"current": { snippets: [""], description: `Returns an internal datetime object representing the current UTC time.` },
"delta": { snippets: ["${1:days},${2:hours}, ${3:minutes},${4:seconds}"], description: `Creates a time delta that can be added to or subtracted from a time represented by an internal datetime object.` },
"parseLocal": { snippets: ["${1:string}"], description: `Converts a string representing a local time into an internal UTC datetime object.` },
"parseUTC": { snippets: ["${1:string}"], description: `Takes a UTC time string and converts it into an internal datetime object.` },
"formatLocal": { snippets: ["${1:datetime}", "${1:datetime},${2:format}"], description: `Formats an internal datetime object into a human-readable string. Converts the time into the appliance's timezone.` },
"formatUTC": { snippets: ["${1:datetime}", "${1:datetime},${2:format}"], description: `Formats an internal datetime object into a human-readable string. Performs no timezone conversion.` },
"toTicks": { snippets: ["${1:datetime}"], description: `Converts an internal datetime object (UTC) to ticks.` },
"fromTicks": { snippets: ["${1:ticks}"], description: `Converts ticks to an internal datetime object (UTC).` },
"deltaFromTicks": { snippets: ["${1:ticks}"], description: `Converts ticks into a time delta.` }
},
"inference": {
"associate": { snippets: ["${1:inferred_node},${2:associate}"], description: `Create associate inference relationship(s) from the specified node(s) to the inferred node.` },
"contributor": { snippets: ["${1:inferred_node}, ${2:contributor},${3:contributes}"], description: `Create contributor inference relationship(s).` },
"primary": { snippets: ["${1:inferred_node}, ${2:evidence}", "${1:inferred_node}, ${2:evidence}, replace:=${3:false}"], description: `Create or replace primary inference relationship(s).` },
"relation": { snippets: ["${1:inferred_relationship},${2:source}"], description: `Create relation inference relationship(s) from the specified node(s) to the inferred relationship.` },
"withdrawal": { snippets: ["${1:inferred_node}, ${2:evidence},${3:withdrawn}"], description: `Create withdrawal inference relationship(s).` },
"destruction": { snippets: ["${1:destroyed_node},${2:source}"], description: `When destroying a node, indicate that the source node was responsible for its destruction.` }
},
"system": {
"getOption": { snippets: ["${1:option_name}"], description: `Takes the name of a BMC Helix Discovery system option and returns the value.` },
"cmdbSync": { snippets: ["${1:nodes}"], description: `Adds the given root node or list of root nodes to the CMDB synchronization queue.` }
}
};