|
4 | 4 |
|
5 | 5 | from __future__ import annotations
|
6 | 6 |
|
7 |
| -from typing import ClassVar, List, Optional |
| 7 | +from typing import ClassVar, List, Optional, overload |
8 | 8 |
|
9 | 9 | from pydantic.v1 import Field, validator
|
10 | 10 |
|
11 |
| -from pyatlan.model.enums import AIApplicationDevelopmentStage |
| 11 | +from pyatlan.model.enums import AIApplicationDevelopmentStage, AtlanConnectorType |
12 | 12 | from pyatlan.model.fields.atlan_fields import KeywordField, RelationField
|
| 13 | +from pyatlan.utils import init_guid, validate_required_fields, to_camel_case |
13 | 14 |
|
14 | 15 | from .a_i import AI
|
15 | 16 |
|
16 | 17 |
|
17 | 18 | class AIApplication(AI):
|
18 | 19 | """Description"""
|
19 | 20 |
|
| 21 | + @overload |
| 22 | + @classmethod |
| 23 | + def creator( |
| 24 | + cls, |
| 25 | + *, |
| 26 | + name: str, |
| 27 | + ai_application_version: str, |
| 28 | + ai_application_development_stage: AIApplicationDevelopmentStage, |
| 29 | + ) -> AIApplication: ... |
| 30 | + |
| 31 | + @overload |
| 32 | + @classmethod |
| 33 | + def creator( |
| 34 | + cls, |
| 35 | + *, |
| 36 | + name: str, |
| 37 | + ai_application_version: str, |
| 38 | + ai_application_development_stage: AIApplicationDevelopmentStage, |
| 39 | + owner_groups: set[str], |
| 40 | + owner_users: set[str], |
| 41 | + models: list[AIModel], |
| 42 | + ) -> AIApplication: ... |
| 43 | + |
| 44 | + @classmethod |
| 45 | + @init_guid |
| 46 | + def creator( |
| 47 | + cls, |
| 48 | + *, |
| 49 | + name: str, |
| 50 | + ai_application_version: str, |
| 51 | + ai_application_development_stage: AIApplicationDevelopmentStage, |
| 52 | + owner_groups: Optional[set[str]] = set(), |
| 53 | + owner_users: Optional[set[str]] = set(), |
| 54 | + models: Optional[list[AIModel]] = [], |
| 55 | + ) -> AIApplication: |
| 56 | + validate_required_fields( |
| 57 | + ["name", "ai_application_version", "ai_application_development_stage"], [name, ai_application_version, ai_application_development_stage] |
| 58 | + ) |
| 59 | + attributes = AIApplication.Attributes.creator( |
| 60 | + name=name, |
| 61 | + ai_application_version=ai_application_version, |
| 62 | + ai_application_development_stage=ai_application_development_stage, |
| 63 | + owner_groups=owner_groups, |
| 64 | + owner_users=owner_users, |
| 65 | + models=models, |
| 66 | + ) |
| 67 | + return cls(attributes=attributes) |
| 68 | + |
20 | 69 | type_name: str = Field(default="AIApplication", allow_mutation=False)
|
21 | 70 |
|
22 | 71 | @validator("type_name")
|
@@ -105,6 +154,35 @@ class Attributes(AI.Attributes):
|
105 | 154 | default=None, description=""
|
106 | 155 | ) # relationship
|
107 | 156 |
|
| 157 | + @classmethod |
| 158 | + @init_guid |
| 159 | + def creator( |
| 160 | + cls, |
| 161 | + *, |
| 162 | + name: str, |
| 163 | + ai_application_version: str, |
| 164 | + ai_application_development_stage: AIApplicationDevelopmentStage, |
| 165 | + owner_groups: Optional[set[str]] = set(), |
| 166 | + owner_users: Optional[set[str]] = set(), |
| 167 | + models: Optional[list[AIModel]] = [], |
| 168 | + ) -> AIApplication.Attributes: |
| 169 | + validate_required_fields( |
| 170 | + ["name", "ai_application_version", "ai_application_development_stage"], [name, ai_application_version, ai_application_development_stage] |
| 171 | + ) |
| 172 | + name_camel_case = to_camel_case(name) |
| 173 | + return AIApplication.Attributes( |
| 174 | + name=name, |
| 175 | + qualified_name=f"default/ai/aiapplication/{name_camel_case}", |
| 176 | + connector_name="ai", |
| 177 | + ai_application_version=ai_application_version, |
| 178 | + ai_application_development_stage=ai_application_development_stage, |
| 179 | + owner_groups=owner_groups, |
| 180 | + owner_users=owner_users, |
| 181 | + models=models, |
| 182 | + certificate_status="DRAFT", |
| 183 | + asset_cover_image="/assets/default-product-cover-DeQonY47.webp", |
| 184 | + ) |
| 185 | + |
108 | 186 | attributes: AIApplication.Attributes = Field(
|
109 | 187 | default_factory=lambda: AIApplication.Attributes(),
|
110 | 188 | description=(
|
|
0 commit comments