|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# Copyright 2022 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.fields.atlan_fields import BooleanField, KeywordField, RelationField |
| 12 | + |
| 13 | +from .dataverse import Dataverse |
| 14 | + |
| 15 | + |
| 16 | +class DataverseAttribute(Dataverse): |
| 17 | + """Description""" |
| 18 | + |
| 19 | + type_name: str = Field(default="DataverseAttribute", allow_mutation=False) |
| 20 | + |
| 21 | + @validator("type_name") |
| 22 | + def validate_type_name(cls, v): |
| 23 | + if v != "DataverseAttribute": |
| 24 | + raise ValueError("must be DataverseAttribute") |
| 25 | + return v |
| 26 | + |
| 27 | + def __setattr__(self, name, value): |
| 28 | + if name in DataverseAttribute._convenience_properties: |
| 29 | + return object.__setattr__(self, name, value) |
| 30 | + super().__setattr__(name, value) |
| 31 | + |
| 32 | + DATAVERSE_ENTITY_QUALIFIED_NAME: ClassVar[KeywordField] = KeywordField( |
| 33 | + "dataverseEntityQualifiedName", "dataverseEntityQualifiedName" |
| 34 | + ) |
| 35 | + """ |
| 36 | + Entity Qualified Name of the DataverseAttribute. |
| 37 | + """ |
| 38 | + DATAVERSE_ATTRIBUTE_SCHEMA_NAME: ClassVar[KeywordField] = KeywordField( |
| 39 | + "dataverseAttributeSchemaName", "dataverseAttributeSchemaName" |
| 40 | + ) |
| 41 | + """ |
| 42 | + Schema Name of the DataverseAttribute. |
| 43 | + """ |
| 44 | + DATAVERSE_ATTRIBUTE_TYPE: ClassVar[KeywordField] = KeywordField( |
| 45 | + "dataverseAttributeType", "dataverseAttributeType" |
| 46 | + ) |
| 47 | + """ |
| 48 | + Type of the DataverseAttribute. |
| 49 | + """ |
| 50 | + DATAVERSE_ATTRIBUTE_IS_PRIMARY_ID: ClassVar[BooleanField] = BooleanField( |
| 51 | + "dataverseAttributeIsPrimaryId", "dataverseAttributeIsPrimaryId" |
| 52 | + ) |
| 53 | + """ |
| 54 | + Indicator if DataverseAttribute is the primary key. |
| 55 | + """ |
| 56 | + DATAVERSE_ATTRIBUTE_IS_SEARCHABLE: ClassVar[BooleanField] = BooleanField( |
| 57 | + "dataverseAttributeIsSearchable", "dataverseAttributeIsSearchable" |
| 58 | + ) |
| 59 | + """ |
| 60 | + Indicator if DataverseAttribute is searchable. |
| 61 | + """ |
| 62 | + |
| 63 | + DATAVERSE_ENTITY: ClassVar[RelationField] = RelationField("dataverseEntity") |
| 64 | + """ |
| 65 | + TBC |
| 66 | + """ |
| 67 | + |
| 68 | + _convenience_properties: ClassVar[List[str]] = [ |
| 69 | + "dataverse_entity_qualified_name", |
| 70 | + "dataverse_attribute_schema_name", |
| 71 | + "dataverse_attribute_type", |
| 72 | + "dataverse_attribute_is_primary_id", |
| 73 | + "dataverse_attribute_is_searchable", |
| 74 | + "dataverse_entity", |
| 75 | + ] |
| 76 | + |
| 77 | + @property |
| 78 | + def dataverse_entity_qualified_name(self) -> Optional[str]: |
| 79 | + return ( |
| 80 | + None |
| 81 | + if self.attributes is None |
| 82 | + else self.attributes.dataverse_entity_qualified_name |
| 83 | + ) |
| 84 | + |
| 85 | + @dataverse_entity_qualified_name.setter |
| 86 | + def dataverse_entity_qualified_name( |
| 87 | + self, dataverse_entity_qualified_name: Optional[str] |
| 88 | + ): |
| 89 | + if self.attributes is None: |
| 90 | + self.attributes = self.Attributes() |
| 91 | + self.attributes.dataverse_entity_qualified_name = ( |
| 92 | + dataverse_entity_qualified_name |
| 93 | + ) |
| 94 | + |
| 95 | + @property |
| 96 | + def dataverse_attribute_schema_name(self) -> Optional[str]: |
| 97 | + return ( |
| 98 | + None |
| 99 | + if self.attributes is None |
| 100 | + else self.attributes.dataverse_attribute_schema_name |
| 101 | + ) |
| 102 | + |
| 103 | + @dataverse_attribute_schema_name.setter |
| 104 | + def dataverse_attribute_schema_name( |
| 105 | + self, dataverse_attribute_schema_name: Optional[str] |
| 106 | + ): |
| 107 | + if self.attributes is None: |
| 108 | + self.attributes = self.Attributes() |
| 109 | + self.attributes.dataverse_attribute_schema_name = ( |
| 110 | + dataverse_attribute_schema_name |
| 111 | + ) |
| 112 | + |
| 113 | + @property |
| 114 | + def dataverse_attribute_type(self) -> Optional[str]: |
| 115 | + return ( |
| 116 | + None |
| 117 | + if self.attributes is None |
| 118 | + else self.attributes.dataverse_attribute_type |
| 119 | + ) |
| 120 | + |
| 121 | + @dataverse_attribute_type.setter |
| 122 | + def dataverse_attribute_type(self, dataverse_attribute_type: Optional[str]): |
| 123 | + if self.attributes is None: |
| 124 | + self.attributes = self.Attributes() |
| 125 | + self.attributes.dataverse_attribute_type = dataverse_attribute_type |
| 126 | + |
| 127 | + @property |
| 128 | + def dataverse_attribute_is_primary_id(self) -> Optional[bool]: |
| 129 | + return ( |
| 130 | + None |
| 131 | + if self.attributes is None |
| 132 | + else self.attributes.dataverse_attribute_is_primary_id |
| 133 | + ) |
| 134 | + |
| 135 | + @dataverse_attribute_is_primary_id.setter |
| 136 | + def dataverse_attribute_is_primary_id( |
| 137 | + self, dataverse_attribute_is_primary_id: Optional[bool] |
| 138 | + ): |
| 139 | + if self.attributes is None: |
| 140 | + self.attributes = self.Attributes() |
| 141 | + self.attributes.dataverse_attribute_is_primary_id = ( |
| 142 | + dataverse_attribute_is_primary_id |
| 143 | + ) |
| 144 | + |
| 145 | + @property |
| 146 | + def dataverse_attribute_is_searchable(self) -> Optional[bool]: |
| 147 | + return ( |
| 148 | + None |
| 149 | + if self.attributes is None |
| 150 | + else self.attributes.dataverse_attribute_is_searchable |
| 151 | + ) |
| 152 | + |
| 153 | + @dataverse_attribute_is_searchable.setter |
| 154 | + def dataverse_attribute_is_searchable( |
| 155 | + self, dataverse_attribute_is_searchable: Optional[bool] |
| 156 | + ): |
| 157 | + if self.attributes is None: |
| 158 | + self.attributes = self.Attributes() |
| 159 | + self.attributes.dataverse_attribute_is_searchable = ( |
| 160 | + dataverse_attribute_is_searchable |
| 161 | + ) |
| 162 | + |
| 163 | + @property |
| 164 | + def dataverse_entity(self) -> Optional[DataverseEntity]: |
| 165 | + return None if self.attributes is None else self.attributes.dataverse_entity |
| 166 | + |
| 167 | + @dataverse_entity.setter |
| 168 | + def dataverse_entity(self, dataverse_entity: Optional[DataverseEntity]): |
| 169 | + if self.attributes is None: |
| 170 | + self.attributes = self.Attributes() |
| 171 | + self.attributes.dataverse_entity = dataverse_entity |
| 172 | + |
| 173 | + class Attributes(Dataverse.Attributes): |
| 174 | + dataverse_entity_qualified_name: Optional[str] = Field( |
| 175 | + default=None, description="" |
| 176 | + ) |
| 177 | + dataverse_attribute_schema_name: Optional[str] = Field( |
| 178 | + default=None, description="" |
| 179 | + ) |
| 180 | + dataverse_attribute_type: Optional[str] = Field(default=None, description="") |
| 181 | + dataverse_attribute_is_primary_id: Optional[bool] = Field( |
| 182 | + default=None, description="" |
| 183 | + ) |
| 184 | + dataverse_attribute_is_searchable: Optional[bool] = Field( |
| 185 | + default=None, description="" |
| 186 | + ) |
| 187 | + dataverse_entity: Optional[DataverseEntity] = Field( |
| 188 | + default=None, description="" |
| 189 | + ) # relationship |
| 190 | + |
| 191 | + attributes: DataverseAttribute.Attributes = Field( |
| 192 | + default_factory=lambda: DataverseAttribute.Attributes(), |
| 193 | + description=( |
| 194 | + "Map of attributes in the instance and their values. " |
| 195 | + "The specific keys of this map will vary by type, " |
| 196 | + "so are described in the sub-types of this schema." |
| 197 | + ), |
| 198 | + ) |
| 199 | + |
| 200 | + |
| 201 | +from .dataverse_entity import DataverseEntity # noqa |
| 202 | + |
| 203 | +DataverseAttribute.Attributes.update_forward_refs() |
0 commit comments