sift_py.rule.config
¶
| CLASS | DESCRIPTION |
|---|---|
ExpressionChannelReference |
|
ExpressionChannelReferenceChannelConfig |
|
RuleAction |
|
RuleActionAnnotationKind |
|
RuleActionCreateDataReviewAnnotation |
Action to create a data-review annotation when a rule evaluates to a truthy value. |
RuleActionCreatePhaseAnnotation |
Action to create a phase annotation when a rule evaluates to a truthy value. |
RuleActionKind |
|
RuleActionKindStrRep |
|
RuleConfig |
Defines a rule to be used during ingestion. If a rule's expression validates to try, then |
ExpressionChannelReference
¶
Bases: TypedDict
channel_reference: The channel reference (e.g. '$1') used in the expression.
channel_identifier: The channel name.
| ATTRIBUTE | DESCRIPTION |
|---|---|
channel_identifier |
TYPE:
|
channel_reference |
TYPE:
|
ExpressionChannelReferenceChannelConfig
¶
Bases: TypedDict
channel_reference: The channel reference (e.g. '$1') used in the expression.
channel_config: Instance of sift_py.ingestion.channel.ChannelConfig.
| ATTRIBUTE | DESCRIPTION |
|---|---|
channel_config |
TYPE:
|
channel_reference |
TYPE:
|
RuleAction
¶
RuleActionAnnotationKind
¶
RuleActionCreateDataReviewAnnotation
¶
RuleActionCreateDataReviewAnnotation(
assignee: Optional[str] = None,
tags: Optional[List[str]] = None,
)
Bases: RuleAction
Action to create a data-review annotation when a rule evaluates to a truthy value.
tags: List of tag names to associate with the newly created data-review annotation.assignee: Email of user in organization to assign the newly created data-review annotation.
| METHOD | DESCRIPTION |
|---|---|
kind |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
assignee |
|
tags |
|
RuleActionCreatePhaseAnnotation
¶
Bases: RuleAction
Action to create a phase annotation when a rule evaluates to a truthy value.
tags: List of tag names to associate with the newly created data-review annotation.
| METHOD | DESCRIPTION |
|---|---|
kind |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
tags |
|
RuleActionKind
¶
RuleActionKindStrRep
¶
Bases: Enum
| ATTRIBUTE | DESCRIPTION |
|---|---|
ANNOTATION |
|
NOTIFICATION |
|
RuleConfig
¶
RuleConfig(
name: str,
channel_references: List[
Union[
ExpressionChannelReference,
ExpressionChannelReferenceChannelConfig,
]
],
description: str = "",
expression: str = "",
action: Optional[RuleAction] = None,
rule_client_key: Optional[str] = None,
asset_names: Optional[List[str]] = None,
tag_names: Optional[List[str]] = None,
sub_expressions: Dict[str, Any] = {},
contextual_channels: Optional[List[str]] = None,
is_external: bool = False,
)
Bases: AsJson
Defines a rule to be used during ingestion. If a rule's expression validates to try, then
a specific action will take place as specified by the kind attribute.
name: Name of the rule.description: Description of the rule.expression: A CEL string expression that executes theactionwhen evaluated to a truthy value.action: The action to execute if the result of anexpressionevaluates to a truthy value.channel_references: Reference to channel. If an expression is "$1 < 10", then "$1" is the reference and thus should the key in the dict.rule_client_key: User defined unique string that uniquely identifies this rule.asset_names: A list of asset names that this rule should be applied to. ONLY VALID if defining rules outside of a telemetry config.tag_names: A list of asset names that this rule should be applied to. ONLY VALID if defining rules outside of a telemetry config.contextual_channels: A list of channel names that provide context but aren't directly used in the expression.is_external: If this is an external rule.
| METHOD | DESCRIPTION |
|---|---|
as_json |
Produces the appropriate JSON structure that's suitable for the Rules API. |
interpolate_sub_expressions |
|
| ATTRIBUTE | DESCRIPTION |
|---|---|
action |
TYPE:
|
asset_names |
|
channel_references |
TYPE:
|
contextual_channels |
|
description |
TYPE:
|
expression |
TYPE:
|
is_external |
TYPE:
|
name |
TYPE:
|
rule_client_key |
|
channel_references
instance-attribute
¶
channel_references: List[ExpressionChannelReference] = (
_channel_references_from_dicts(channel_references)
)
expression
instance-attribute
¶
expression: str = interpolate_sub_expressions(
expression, sub_expressions
)