Variable#
- class lumen.variables.base.Variable(*, default, label, materialize, required, secure, value, name)#
Variable components declare values that can be referenced from other components.
The source of the Variable value can be anything from an environment variable to a widget or URL parameter. Variable components allow a concise way to configure other components and make it possible to orchestrate actions across multiple components.
Parameters#
type: Any
default: None
Default value to use if no other value is defined
type: str
default: None
Optional label override for variable. Used wherever the variableshows up in the UI.
type: bool
default: False
Whether the variable should be inlined as a constant variable(in the Lumen Builder).
type: str
default: 'Variable'
String identifier for this object.
type: bool
default: False
Whether the variable should be treated as required.
type: bool
default: False
Whether the variable should be treated as secure.
type: Any
default: None
The materialized value of the variable.
Methods#
- Variable.as_materialized() Constant #
If the variable is to be materialized by the builder this implements the conversion from a variable that references some external value to a materialized value.
- Variable.to_spec(context: Dict[str, Any] | None = None) Dict[str, Any] #
Exports the full specification to reconstruct this component.
- Return type:
Resolved and instantiated Component object
Types#
Constant
declares a constant value that can be referenced.
EnvVariable
fetches an environment variable that can be referenced.
Widget
variables dynamically reflect the current widget value.
Parameter
variables reflect the current value of a parameter.
URLQuery
variables reflect the value of a URL query parameter.
Cookie
variables reflect the value of a cookie in the request.
UserInfo
variables reflect a value in the user info returned by an OAuth provider.
Header
variables reflect the value of a request header.