@@ -414,10 +414,14 @@ def _update_req_from_rule_config(
414414 if config .tag_names
415415 else None
416416 )
417- annotation_tags = list_tags_impl (
418- self ._tag_service_stub ,
419- names = [tag for tag in config .action .tags ],
420- tag_type = TagType .TAG_TYPE_ANNOTATION ,
417+ annotation_tags = (
418+ list_tags_impl (
419+ self ._tag_service_stub ,
420+ names = [tag for tag in config .action .tags ],
421+ tag_type = TagType .TAG_TYPE_ANNOTATION ,
422+ )
423+ if config .action .tags
424+ else None
421425 )
422426
423427 actions = []
@@ -427,6 +431,10 @@ def _update_req_from_rule_config(
427431 "Please contact the Sift team for assistance."
428432 )
429433 elif config .action .kind () == RuleActionKind .ANNOTATION :
434+ annotation_tag_ids = (
435+ [tag .tag_id for tag in annotation_tags ] if annotation_tags else None
436+ )
437+
430438 if isinstance (config .action , RuleActionCreateDataReviewAnnotation ):
431439 assignee = config .action .assignee
432440 user_id = None
@@ -446,7 +454,7 @@ def _update_req_from_rule_config(
446454 annotation = AnnotationActionConfiguration (
447455 assigned_to_user_id = user_id ,
448456 annotation_type = AnnotationType .ANNOTATION_TYPE_DATA_REVIEW ,
449- tag_ids = annotation_tags ,
457+ tag_ids = annotation_tag_ids ,
450458 )
451459 ),
452460 )
@@ -457,7 +465,7 @@ def _update_req_from_rule_config(
457465 configuration = RuleActionConfiguration (
458466 annotation = AnnotationActionConfiguration (
459467 annotation_type = AnnotationType .ANNOTATION_TYPE_PHASE ,
460- tag_ids = annotation_tags ,
468+ tag_ids = annotation_tag_ids ,
461469 )
462470 ),
463471 )
@@ -640,7 +648,10 @@ def _get_assets(self, names: List[str] = [], ids: List[str] = []) -> List[Asset]
640648 return list_assets_impl (self ._asset_service_stub , names , ids )
641649
642650 def _get_tags (
643- self , names : List [str ] = [], ids : List [str ] = [], tag_type : Optional [TagType ] = None
651+ self ,
652+ names : List [str ] = [],
653+ ids : List [str ] = [],
654+ tag_type : TagType .ValueType = TagType .TAG_TYPE_UNSPECIFIED ,
644655 ) -> List [Tag ]:
645656 if self ._enable_caching :
646657 return self ._get_tags_cached (tuple (sorted (names )), tuple (sorted (ids )), tag_type )
@@ -665,8 +676,11 @@ def _get_assets_cached(self, names: Tuple[str], ids: Tuple[str]) -> List[Asset]:
665676
666677 @cache
667678 def _get_tags_cached (
668- self , names : Tuple [str ], ids : Tuple [str ], tag_type : Optional [TagType ] = None
669- ) -> List [Asset ]:
679+ self ,
680+ names : Tuple [str ],
681+ ids : Tuple [str ],
682+ tag_type : TagType .ValueType = TagType .TAG_TYPE_UNSPECIFIED ,
683+ ) -> List [Tag ]:
670684 return list_tags_impl (self ._tag_service_stub , names , ids , tag_type )
671685
672686 @cache
0 commit comments