|
21 | 21 | from pyatlan.errors import ErrorCode
|
22 | 22 | from pyatlan.model.atlan_image import AtlanImage
|
23 | 23 | from pyatlan.model.constants import (
|
| 24 | + AIAssetTypes, |
24 | 25 | AssetTypes,
|
25 | 26 | DomainTypes,
|
26 | 27 | EntityTypes,
|
|
192 | 193 | "DataProduct",
|
193 | 194 | }
|
194 | 195 |
|
| 196 | +_all_ai_asset_types: AIAssetTypes = {"AIApplication", "AIModel"} |
195 | 197 | _all_other_types: OtherAssetTypes = {"File"}
|
196 | 198 |
|
197 | 199 |
|
@@ -494,6 +496,12 @@ class Options(AtlanObject):
|
494 | 496 | "These cover asset types in data products and data domains. "
|
495 | 497 | "Only assets of one of these types will have this attribute available.",
|
496 | 498 | )
|
| 499 | + applicable_ai_asset_types: Optional[str] = Field( |
| 500 | + default=None, |
| 501 | + alias="aiAssetsTypeList", |
| 502 | + description="AI asset type names to which this attribute is restricted. " |
| 503 | + "Only AI assets of the specified types will have this attribute available.", |
| 504 | + ) |
497 | 505 | applicable_other_asset_types: Optional[str] = Field(
|
498 | 506 | default=None,
|
499 | 507 | alias="otherAssetTypeList",
|
@@ -639,6 +647,7 @@ def __setattr__(self, name, value):
|
639 | 647 | "applicable_connections",
|
640 | 648 | "applicable_glossaries",
|
641 | 649 | "applicable_domains",
|
| 650 | + "applicable_ai_asset_types", |
642 | 651 | ]
|
643 | 652 |
|
644 | 653 | @property
|
@@ -747,6 +756,30 @@ def applicable_domain_types(self, domain_types: DomainTypes):
|
747 | 756 | )
|
748 | 757 | self.options.applicable_domain_types = json.dumps(list(domain_types))
|
749 | 758 |
|
| 759 | + @property |
| 760 | + def applicable_ai_asset_types(self) -> AIAssetTypes: |
| 761 | + """ |
| 762 | + AI asset type names to which this attribute is restricted. |
| 763 | + Only AI assets of the specified types will have this attribute available. |
| 764 | + """ |
| 765 | + if self.options and self.options.applicable_ai_asset_types: |
| 766 | + return set(json.loads(self.options.applicable_ai_asset_types)) |
| 767 | + return set() |
| 768 | + |
| 769 | + @applicable_ai_asset_types.setter |
| 770 | + def applicable_ai_asset_types(self, ai_asset_types: AIAssetTypes): |
| 771 | + if self.options is None: |
| 772 | + raise ErrorCode.MISSING_OPTIONS.exception_with_parameters() |
| 773 | + if not isinstance(ai_asset_types, set): |
| 774 | + raise ErrorCode.INVALID_PARAMETER_TYPE.exception_with_parameters( |
| 775 | + "applicable_ai_asset_types", AIAssetTypes |
| 776 | + ) |
| 777 | + if not ai_asset_types.issubset(_all_ai_asset_types): |
| 778 | + raise ErrorCode.INVALID_PARAMETER_VALUE.exception_with_parameters( |
| 779 | + ai_asset_types, "applicable_ai_asset_types", _all_ai_asset_types |
| 780 | + ) |
| 781 | + self.options.applicable_ai_asset_types = json.dumps(list(ai_asset_types)) |
| 782 | + |
750 | 783 | @property
|
751 | 784 | def applicable_other_asset_types(self) -> OtherAssetTypes:
|
752 | 785 | """
|
@@ -855,6 +888,7 @@ def create(
|
855 | 888 | applicable_other_asset_types: Optional[OtherAssetTypes] = None,
|
856 | 889 | applicable_domains: Optional[Set[str]] = None,
|
857 | 890 | applicable_domain_types: Optional[DomainTypes] = None,
|
| 891 | + applicable_ai_asset_types: Optional[AIAssetTypes] = None, |
858 | 892 | description: Optional[str] = None,
|
859 | 893 | ) -> AttributeDef:
|
860 | 894 | from pyatlan.utils import validate_required_fields
|
@@ -918,6 +952,7 @@ def create(
|
918 | 952 | applicable_glossaries or _get_all_qualified_names(client, "AtlasGlossary")
|
919 | 953 | )
|
920 | 954 | attr_def.applicable_domains = applicable_domains or _all_domains
|
| 955 | + attr_def.applicable_ai_asset_types = applicable_ai_asset_types or set() |
921 | 956 | return attr_def
|
922 | 957 |
|
923 | 958 | def is_archived(self) -> bool:
|
|
0 commit comments