|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# Copyright 2025 Atlan Pte. Ltd. |
| 3 | + |
| 4 | + |
| 5 | +from __future__ import annotations |
| 6 | + |
| 7 | +from typing import ClassVar, List, Optional |
| 8 | + |
| 9 | +from pydantic.v1 import Field, validator |
| 10 | + |
| 11 | +from pyatlan.model.enums import FileType |
| 12 | +from pyatlan.model.fields.atlan_fields import KeywordField, RelationField, TextField |
| 13 | + |
| 14 | +from .agentic import Agentic |
| 15 | + |
| 16 | + |
| 17 | +class Artifact(Agentic): |
| 18 | + """Description""" |
| 19 | + |
| 20 | + type_name: str = Field(default="Artifact", allow_mutation=False) |
| 21 | + |
| 22 | + @validator("type_name") |
| 23 | + def validate_type_name(cls, v): |
| 24 | + if v != "Artifact": |
| 25 | + raise ValueError("must be Artifact") |
| 26 | + return v |
| 27 | + |
| 28 | + def __setattr__(self, name, value): |
| 29 | + if name in Artifact._convenience_properties: |
| 30 | + return object.__setattr__(self, name, value) |
| 31 | + super().__setattr__(name, value) |
| 32 | + |
| 33 | + ARTIFACT_VERSION: ClassVar[KeywordField] = KeywordField( |
| 34 | + "artifactVersion", "artifactVersion" |
| 35 | + ) |
| 36 | + """ |
| 37 | + Version identifier for this artifact. |
| 38 | + """ |
| 39 | + FILE_TYPE: ClassVar[KeywordField] = KeywordField("fileType", "fileType") |
| 40 | + """ |
| 41 | + Type (extension) of the file. |
| 42 | + """ |
| 43 | + FILE_PATH: ClassVar[TextField] = TextField("filePath", "filePath") |
| 44 | + """ |
| 45 | + URL giving the online location where the file can be accessed. |
| 46 | + """ |
| 47 | + |
| 48 | + FILE_ASSETS: ClassVar[RelationField] = RelationField("fileAssets") |
| 49 | + """ |
| 50 | + TBC |
| 51 | + """ |
| 52 | + |
| 53 | + _convenience_properties: ClassVar[List[str]] = [ |
| 54 | + "artifact_version", |
| 55 | + "file_type", |
| 56 | + "file_path", |
| 57 | + "file_assets", |
| 58 | + ] |
| 59 | + |
| 60 | + @property |
| 61 | + def artifact_version(self) -> Optional[str]: |
| 62 | + return None if self.attributes is None else self.attributes.artifact_version |
| 63 | + |
| 64 | + @artifact_version.setter |
| 65 | + def artifact_version(self, artifact_version: Optional[str]): |
| 66 | + if self.attributes is None: |
| 67 | + self.attributes = self.Attributes() |
| 68 | + self.attributes.artifact_version = artifact_version |
| 69 | + |
| 70 | + @property |
| 71 | + def file_type(self) -> Optional[FileType]: |
| 72 | + return None if self.attributes is None else self.attributes.file_type |
| 73 | + |
| 74 | + @file_type.setter |
| 75 | + def file_type(self, file_type: Optional[FileType]): |
| 76 | + if self.attributes is None: |
| 77 | + self.attributes = self.Attributes() |
| 78 | + self.attributes.file_type = file_type |
| 79 | + |
| 80 | + @property |
| 81 | + def file_path(self) -> Optional[str]: |
| 82 | + return None if self.attributes is None else self.attributes.file_path |
| 83 | + |
| 84 | + @file_path.setter |
| 85 | + def file_path(self, file_path: Optional[str]): |
| 86 | + if self.attributes is None: |
| 87 | + self.attributes = self.Attributes() |
| 88 | + self.attributes.file_path = file_path |
| 89 | + |
| 90 | + @property |
| 91 | + def file_assets(self) -> Optional[Asset]: |
| 92 | + return None if self.attributes is None else self.attributes.file_assets |
| 93 | + |
| 94 | + @file_assets.setter |
| 95 | + def file_assets(self, file_assets: Optional[Asset]): |
| 96 | + if self.attributes is None: |
| 97 | + self.attributes = self.Attributes() |
| 98 | + self.attributes.file_assets = file_assets |
| 99 | + |
| 100 | + class Attributes(Agentic.Attributes): |
| 101 | + artifact_version: Optional[str] = Field(default=None, description="") |
| 102 | + file_type: Optional[FileType] = Field(default=None, description="") |
| 103 | + file_path: Optional[str] = Field(default=None, description="") |
| 104 | + file_assets: Optional[Asset] = Field( |
| 105 | + default=None, description="" |
| 106 | + ) # relationship |
| 107 | + |
| 108 | + attributes: Artifact.Attributes = Field( |
| 109 | + default_factory=lambda: Artifact.Attributes(), |
| 110 | + description=( |
| 111 | + "Map of attributes in the instance and their values. " |
| 112 | + "The specific keys of this map will vary by type, " |
| 113 | + "so are described in the sub-types of this schema." |
| 114 | + ), |
| 115 | + ) |
| 116 | + |
| 117 | + |
| 118 | +from .asset import Asset # noqa: E402, F401 |
0 commit comments