Skip to content

Options

OptionsLink

In Sierra‑SDK, every Invoker entry‑point parameter must be wrapped with Param[...], supplying a SierraOption to describe its behavior and validation rules.

Options Example
Python
1
2
3
4
5
6
7
8
import sierra

def example(foo: sierra.Param[str, sierra.SierraOption(description="Foo is a foo")])->None:
"""
Foo is a string, the options add a metadata called description.
"""
result = sierra.create_tree_result([f"{foo}"])
print(result)

sierra.options Link

Sierra Options.Link

Type-safe option descriptors for annotating invoker script parameters.

Usage
Text Only
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import sierra

@invoker.entry_point
def run(
    domain: sierra.Param[
        str,
        sierra.SierraOption(
            description="Target domain to scan",
            mandatory="MANDATORY",
            primary=True,
        )
    ],
) -> None:
    ...

AttributesLink

Param module-attribute Link
Python
Param = typing.Annotated

ClassesLink

SierraOption Link
Python
SierraOption(*, description: str = '', mandatory: typing.Literal['MANDATORY'] | None = None, primary: bool = False, min_value: int | float | None = None, max_value: int | float | None = None, choices: list[typing.Any] | None = None, pattern: str | None = None)

Typed descriptor for marking a function parameter as a SIERRA option.

Provides metadata that controls how the parameter appears in the generated config.yaml and how SIERRA presents it to the user.

PARAMETER DESCRIPTION
description

Human-readable description of the parameter. Shown as a tooltip in the SIERRA canvas input dialog.

TYPE: str DEFAULT: ''

mandatory

Set to "MANDATORY" to block execution when the value is empty. Defaults to None (optional parameter).

TYPE: Literal[MANDATORY] or None DEFAULT: None

primary

If True, this parameter is flagged as PRIMARY in the YAML output, meaning SIERRA auto-populates it from the active node's value. Only one parameter per script should be primary.

TYPE: bool DEFAULT: False

Examples:

Python Console Session
1
2
3
4
5
6
>>> from sierra import SierraOption, Param
>>> def scan(
...     target: Param[str, SierraOption(description="IP address", mandatory="MANDATORY", primary=True)],
...     timeout: Param[int, SierraOption(description="Request timeout in seconds")] = 30,
... ) -> None:
...     ...
AttributesLink
description instance-attribute Link
Python
description: str = description
mandatory instance-attribute Link
Python
mandatory: typing.Literal['MANDATORY'] | None = mandatory
primary instance-attribute Link
Python
primary: bool = primary
min_value instance-attribute Link
Python
min_value: int | float | None = min_value
max_value instance-attribute Link
Python
max_value: int | float | None = max_value
choices instance-attribute Link
Python
choices: list[typing.Any] | None = choices
pattern instance-attribute Link
Python
pattern: str | None = pattern