Skip to content

Commit 498b3eb

Browse files
committed
Use rule_evaluation protos for rule evaluation.
1 parent 54a13ab commit 498b3eb

16 files changed

Lines changed: 437 additions & 293 deletions

File tree

python/lib/sift/rule_evaluation/v1/rule_evaluation_pb2.py

Lines changed: 26 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/lib/sift/rule_evaluation/v1/rule_evaluation_pb2.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ class EvaluateRulesRequest(google.protobuf.message.Message):
2525
RULES_FIELD_NUMBER: builtins.int
2626
RULE_VERSIONS_FIELD_NUMBER: builtins.int
2727
REPORT_TEMPLATE_FIELD_NUMBER: builtins.int
28+
ALL_APPLICABLE_RULES_FIELD_NUMBER: builtins.int
2829
ANNOTATION_OPTIONS_FIELD_NUMBER: builtins.int
2930
ORGANIZATION_ID_FIELD_NUMBER: builtins.int
3031
REPORT_NAME_FIELD_NUMBER: builtins.int
32+
all_applicable_rules: builtins.bool
3133
organization_id: builtins.str
3234
"""Only required if your user belongs to multiple organizations"""
3335
report_name: builtins.str
@@ -55,16 +57,17 @@ class EvaluateRulesRequest(google.protobuf.message.Message):
5557
rules: global___EvaluateRulesFromCurrentRuleVersions | None = ...,
5658
rule_versions: global___EvaluateRulesFromRuleVersions | None = ...,
5759
report_template: global___EvaluateRulesFromReportTemplate | None = ...,
60+
all_applicable_rules: builtins.bool = ...,
5861
annotation_options: global___EvaluateRulesAnnotationOptions | None = ...,
5962
organization_id: builtins.str = ...,
6063
report_name: builtins.str | None = ...,
6164
) -> None: ...
62-
def HasField(self, field_name: typing.Literal["_report_name", b"_report_name", "annotation_options", b"annotation_options", "assets", b"assets", "mode", b"mode", "report_name", b"report_name", "report_template", b"report_template", "rule_versions", b"rule_versions", "rules", b"rules", "run", b"run", "run_time_range", b"run_time_range", "time", b"time"]) -> builtins.bool: ...
63-
def ClearField(self, field_name: typing.Literal["_report_name", b"_report_name", "annotation_options", b"annotation_options", "assets", b"assets", "mode", b"mode", "organization_id", b"organization_id", "report_name", b"report_name", "report_template", b"report_template", "rule_versions", b"rule_versions", "rules", b"rules", "run", b"run", "run_time_range", b"run_time_range", "time", b"time"]) -> None: ...
65+
def HasField(self, field_name: typing.Literal["_report_name", b"_report_name", "all_applicable_rules", b"all_applicable_rules", "annotation_options", b"annotation_options", "assets", b"assets", "mode", b"mode", "report_name", b"report_name", "report_template", b"report_template", "rule_versions", b"rule_versions", "rules", b"rules", "run", b"run", "run_time_range", b"run_time_range", "time", b"time"]) -> builtins.bool: ...
66+
def ClearField(self, field_name: typing.Literal["_report_name", b"_report_name", "all_applicable_rules", b"all_applicable_rules", "annotation_options", b"annotation_options", "assets", b"assets", "mode", b"mode", "organization_id", b"organization_id", "report_name", b"report_name", "report_template", b"report_template", "rule_versions", b"rule_versions", "rules", b"rules", "run", b"run", "run_time_range", b"run_time_range", "time", b"time"]) -> None: ...
6467
@typing.overload
6568
def WhichOneof(self, oneof_group: typing.Literal["_report_name", b"_report_name"]) -> typing.Literal["report_name"] | None: ...
6669
@typing.overload
67-
def WhichOneof(self, oneof_group: typing.Literal["mode", b"mode"]) -> typing.Literal["rules", "rule_versions", "report_template"] | None: ...
70+
def WhichOneof(self, oneof_group: typing.Literal["mode", b"mode"]) -> typing.Literal["rules", "rule_versions", "report_template", "all_applicable_rules"] | None: ...
6871
@typing.overload
6972
def WhichOneof(self, oneof_group: typing.Literal["time", b"time"]) -> typing.Literal["run", "assets", "run_time_range"] | None: ...
7073

python/lib/sift/rules/v1/rules_pb2.py

Lines changed: 145 additions & 154 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/lib/sift/rules/v1/rules_pb2.pyi

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import google.protobuf.timestamp_pb2
2020
import sift.annotations.v1.annotations_pb2
2121
import sift.common.type.v1.resource_identifier_pb2
2222
import sift.common.type.v1.user_defined_functions_pb2
23+
import sift.metadata.v1.metadata_pb2
2324
import sys
2425
import typing
2526

@@ -112,6 +113,7 @@ class Rule(google.protobuf.message.Message):
112113
CONTEXTUAL_CHANNELS_FIELD_NUMBER: builtins.int
113114
DELETED_DATE_FIELD_NUMBER: builtins.int
114115
IS_EXTERNAL_FIELD_NUMBER: builtins.int
116+
METADATA_FIELD_NUMBER: builtins.int
115117
rule_id: builtins.str
116118
asset_id: builtins.str
117119
name: builtins.str
@@ -137,6 +139,8 @@ class Rule(google.protobuf.message.Message):
137139
def contextual_channels(self) -> global___ContextualChannels: ...
138140
@property
139141
def deleted_date(self) -> google.protobuf.timestamp_pb2.Timestamp: ...
142+
@property
143+
def metadata(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[sift.metadata.v1.metadata_pb2.MetadataValue]: ...
140144
def __init__(
141145
self,
142146
*,
@@ -157,9 +161,10 @@ class Rule(google.protobuf.message.Message):
157161
contextual_channels: global___ContextualChannels | None = ...,
158162
deleted_date: google.protobuf.timestamp_pb2.Timestamp | None = ...,
159163
is_external: builtins.bool = ...,
164+
metadata: collections.abc.Iterable[sift.metadata.v1.metadata_pb2.MetadataValue] | None = ...,
160165
) -> None: ...
161166
def HasField(self, field_name: typing.Literal["asset_configuration", b"asset_configuration", "contextual_channels", b"contextual_channels", "created_date", b"created_date", "deleted_date", b"deleted_date", "modified_date", b"modified_date", "rule_version", b"rule_version"]) -> builtins.bool: ...
162-
def ClearField(self, field_name: typing.Literal["asset_configuration", b"asset_configuration", "asset_id", b"asset_id", "client_key", b"client_key", "conditions", b"conditions", "contextual_channels", b"contextual_channels", "created_by_user_id", b"created_by_user_id", "created_date", b"created_date", "deleted_date", b"deleted_date", "description", b"description", "is_enabled", b"is_enabled", "is_external", b"is_external", "modified_by_user_id", b"modified_by_user_id", "modified_date", b"modified_date", "name", b"name", "organization_id", b"organization_id", "rule_id", b"rule_id", "rule_version", b"rule_version"]) -> None: ...
167+
def ClearField(self, field_name: typing.Literal["asset_configuration", b"asset_configuration", "asset_id", b"asset_id", "client_key", b"client_key", "conditions", b"conditions", "contextual_channels", b"contextual_channels", "created_by_user_id", b"created_by_user_id", "created_date", b"created_date", "deleted_date", b"deleted_date", "description", b"description", "is_enabled", b"is_enabled", "is_external", b"is_external", "metadata", b"metadata", "modified_by_user_id", b"modified_by_user_id", "modified_date", b"modified_date", "name", b"name", "organization_id", b"organization_id", "rule_id", b"rule_id", "rule_version", b"rule_version"]) -> None: ...
163168

164169
global___Rule = Rule
165170

@@ -523,12 +528,14 @@ class UpdateRuleRequest(google.protobuf.message.Message):
523528
ASSET_CONFIGURATION_FIELD_NUMBER: builtins.int
524529
CONTEXTUAL_CHANNELS_FIELD_NUMBER: builtins.int
525530
IS_EXTERNAL_FIELD_NUMBER: builtins.int
531+
METADATA_FIELD_NUMBER: builtins.int
526532
rule_id: builtins.str
527533
name: builtins.str
528534
description: builtins.str
529535
asset_id: builtins.str
530536
"""Deprecated - use asset_configuration instead."""
531537
is_enabled: builtins.bool
538+
"""Deprecated - use DeleteRule instead."""
532539
organization_id: builtins.str
533540
version_notes: builtins.str
534541
client_key: builtins.str
@@ -540,6 +547,8 @@ class UpdateRuleRequest(google.protobuf.message.Message):
540547
def asset_configuration(self) -> global___RuleAssetConfiguration: ...
541548
@property
542549
def contextual_channels(self) -> global___ContextualChannels: ...
550+
@property
551+
def metadata(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[sift.metadata.v1.metadata_pb2.MetadataValue]: ...
543552
def __init__(
544553
self,
545554
*,
@@ -555,9 +564,10 @@ class UpdateRuleRequest(google.protobuf.message.Message):
555564
asset_configuration: global___RuleAssetConfiguration | None = ...,
556565
contextual_channels: global___ContextualChannels | None = ...,
557566
is_external: builtins.bool = ...,
567+
metadata: collections.abc.Iterable[sift.metadata.v1.metadata_pb2.MetadataValue] | None = ...,
558568
) -> None: ...
559569
def HasField(self, field_name: typing.Literal["_client_key", b"_client_key", "_rule_id", b"_rule_id", "asset_configuration", b"asset_configuration", "client_key", b"client_key", "contextual_channels", b"contextual_channels", "rule_id", b"rule_id"]) -> builtins.bool: ...
560-
def ClearField(self, field_name: typing.Literal["_client_key", b"_client_key", "_rule_id", b"_rule_id", "asset_configuration", b"asset_configuration", "asset_id", b"asset_id", "client_key", b"client_key", "conditions", b"conditions", "contextual_channels", b"contextual_channels", "description", b"description", "is_enabled", b"is_enabled", "is_external", b"is_external", "name", b"name", "organization_id", b"organization_id", "rule_id", b"rule_id", "version_notes", b"version_notes"]) -> None: ...
570+
def ClearField(self, field_name: typing.Literal["_client_key", b"_client_key", "_rule_id", b"_rule_id", "asset_configuration", b"asset_configuration", "asset_id", b"asset_id", "client_key", b"client_key", "conditions", b"conditions", "contextual_channels", b"contextual_channels", "description", b"description", "is_enabled", b"is_enabled", "is_external", b"is_external", "metadata", b"metadata", "name", b"name", "organization_id", b"organization_id", "rule_id", b"rule_id", "version_notes", b"version_notes"]) -> None: ...
561571
@typing.overload
562572
def WhichOneof(self, oneof_group: typing.Literal["_client_key", b"_client_key"]) -> typing.Literal["client_key"] | None: ...
563573
@typing.overload
@@ -1128,14 +1138,14 @@ class ListRulesRequest(google.protobuf.message.Message):
11281138
"""
11291139
filter: builtins.str
11301140
"""A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string.
1131-
Available fields to filter by are `rule_id`, `client_key`, `name`, and `description`.
1141+
Available fields to filter by are `rule_id`, `client_key`, `name`, `description`, `asset_id`, `tag_id`, and `deleted_date`.
11321142
For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions).
11331143
Optional.
11341144
"""
11351145
order_by: builtins.str
11361146
"""How to order the retrieved Rules. Formatted as a comma-separated string i.e. "FIELD_NAME[ desc],...".
11371147
Available fields to order_by are `created_date` and `modified_date`.
1138-
If left empty, items are ordered by `created_date` in ascending order (oldest-first).
1148+
If left empty, items are ordered by `created_date` in descending order (newest-first).
11391149
"""
11401150
def __init__(
11411151
self,
@@ -1334,25 +1344,19 @@ class RuleConditionExpression(google.protobuf.message.Message):
13341344

13351345
SINGLE_CHANNEL_COMPARISON_FIELD_NUMBER: builtins.int
13361346
CALCULATED_CHANNEL_FIELD_NUMBER: builtins.int
1337-
PYTHON_CODE_FIELD_NUMBER: builtins.int
13381347
@property
13391348
def single_channel_comparison(self) -> global___SingleChannelComparisonExpression: ...
13401349
@property
13411350
def calculated_channel(self) -> global___CalculatedChannelConfig: ...
1342-
@property
1343-
def python_code(self) -> global___PythonCode:
1344-
"""Experimental - not currently enabled"""
1345-
13461351
def __init__(
13471352
self,
13481353
*,
13491354
single_channel_comparison: global___SingleChannelComparisonExpression | None = ...,
13501355
calculated_channel: global___CalculatedChannelConfig | None = ...,
1351-
python_code: global___PythonCode | None = ...,
13521356
) -> None: ...
1353-
def HasField(self, field_name: typing.Literal["calculated_channel", b"calculated_channel", "expression", b"expression", "python_code", b"python_code", "single_channel_comparison", b"single_channel_comparison"]) -> builtins.bool: ...
1354-
def ClearField(self, field_name: typing.Literal["calculated_channel", b"calculated_channel", "expression", b"expression", "python_code", b"python_code", "single_channel_comparison", b"single_channel_comparison"]) -> None: ...
1355-
def WhichOneof(self, oneof_group: typing.Literal["expression", b"expression"]) -> typing.Literal["single_channel_comparison", "calculated_channel", "python_code"] | None: ...
1357+
def HasField(self, field_name: typing.Literal["calculated_channel", b"calculated_channel", "expression", b"expression", "single_channel_comparison", b"single_channel_comparison"]) -> builtins.bool: ...
1358+
def ClearField(self, field_name: typing.Literal["calculated_channel", b"calculated_channel", "expression", b"expression", "single_channel_comparison", b"single_channel_comparison"]) -> None: ...
1359+
def WhichOneof(self, oneof_group: typing.Literal["expression", b"expression"]) -> typing.Literal["single_channel_comparison", "calculated_channel"] | None: ...
13561360

13571361
global___RuleConditionExpression = RuleConditionExpression
13581362

@@ -1464,46 +1468,6 @@ class ChannelReference(google.protobuf.message.Message):
14641468

14651469
global___ChannelReference = ChannelReference
14661470

1467-
@typing.final
1468-
class PythonChannelReference(google.protobuf.message.Message):
1469-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
1470-
1471-
REFERENCE_FIELD_NUMBER: builtins.int
1472-
NAME_FIELD_NUMBER: builtins.int
1473-
reference: builtins.str
1474-
name: builtins.str
1475-
def __init__(
1476-
self,
1477-
*,
1478-
reference: builtins.str = ...,
1479-
name: builtins.str = ...,
1480-
) -> None: ...
1481-
def ClearField(self, field_name: typing.Literal["name", b"name", "reference", b"reference"]) -> None: ...
1482-
1483-
global___PythonChannelReference = PythonChannelReference
1484-
1485-
@typing.final
1486-
class PythonCode(google.protobuf.message.Message):
1487-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
1488-
1489-
CHANNEL_REFERENCES_FIELD_NUMBER: builtins.int
1490-
CODE_FIELD_NUMBER: builtins.int
1491-
DEPENDENCIES_FIELD_NUMBER: builtins.int
1492-
code: builtins.str
1493-
dependencies: builtins.str
1494-
@property
1495-
def channel_references(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PythonChannelReference]: ...
1496-
def __init__(
1497-
self,
1498-
*,
1499-
channel_references: collections.abc.Iterable[global___PythonChannelReference] | None = ...,
1500-
code: builtins.str = ...,
1501-
dependencies: builtins.str = ...,
1502-
) -> None: ...
1503-
def ClearField(self, field_name: typing.Literal["channel_references", b"channel_references", "code", b"code", "dependencies", b"dependencies"]) -> None: ...
1504-
1505-
global___PythonCode = PythonCode
1506-
15071471
@typing.final
15081472
class RuleActionConfiguration(google.protobuf.message.Message):
15091473
DESCRIPTOR: google.protobuf.descriptor.Descriptor
@@ -1549,19 +1513,23 @@ class AnnotationActionConfiguration(google.protobuf.message.Message):
15491513
TAG_IDS_FIELD_NUMBER: builtins.int
15501514
ANNOTATION_TYPE_FIELD_NUMBER: builtins.int
15511515
ASSIGNED_TO_USER_ID_FIELD_NUMBER: builtins.int
1516+
METADATA_FIELD_NUMBER: builtins.int
15521517
annotation_type: sift.annotations.v1.annotations_pb2.AnnotationType.ValueType
15531518
assigned_to_user_id: builtins.str
15541519
@property
15551520
def tag_ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: ...
1521+
@property
1522+
def metadata(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[sift.metadata.v1.metadata_pb2.MetadataValue]: ...
15561523
def __init__(
15571524
self,
15581525
*,
15591526
tag_ids: collections.abc.Iterable[builtins.str] | None = ...,
15601527
annotation_type: sift.annotations.v1.annotations_pb2.AnnotationType.ValueType = ...,
15611528
assigned_to_user_id: builtins.str | None = ...,
1529+
metadata: collections.abc.Iterable[sift.metadata.v1.metadata_pb2.MetadataValue] | None = ...,
15621530
) -> None: ...
15631531
def HasField(self, field_name: typing.Literal["_assigned_to_user_id", b"_assigned_to_user_id", "assigned_to_user_id", b"assigned_to_user_id"]) -> builtins.bool: ...
1564-
def ClearField(self, field_name: typing.Literal["_assigned_to_user_id", b"_assigned_to_user_id", "annotation_type", b"annotation_type", "assigned_to_user_id", b"assigned_to_user_id", "tag_ids", b"tag_ids"]) -> None: ...
1532+
def ClearField(self, field_name: typing.Literal["_assigned_to_user_id", b"_assigned_to_user_id", "annotation_type", b"annotation_type", "assigned_to_user_id", b"assigned_to_user_id", "metadata", b"metadata", "tag_ids", b"tag_ids"]) -> None: ...
15651533
def WhichOneof(self, oneof_group: typing.Literal["_assigned_to_user_id", b"_assigned_to_user_id"]) -> typing.Literal["assigned_to_user_id"] | None: ...
15661534

15671535
global___AnnotationActionConfiguration = AnnotationActionConfiguration

0 commit comments

Comments
 (0)