Source code for sdk.lusid.models.address_definition

# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from datetime import datetime
from typing import Any, Dict, Optional
from pydantic.v1 import BaseModel, Field, StrictStr, validator

[docs] class AddressDefinition(BaseModel): """ AddressDefinition """ display_name: Optional[StrictStr] = Field(None, alias="displayName", description="The display name of the address key.") type: Optional[StrictStr] = Field(None, description="The available values are: String, Int, Decimal, DateTime, Boolean, ResultValue, Result0D, Json") description: Optional[StrictStr] = Field(None, description="The description for this result.") life_cycle_status: Optional[StrictStr] = Field(None, alias="lifeCycleStatus", description="What is the status of the address path. If it is not Production then it might be removed at some point in the future. See the removal date for the likely timing of that if any.") removal_date: Optional[datetime] = Field(None, alias="removalDate", description="If the life-cycle status of the address is Deprecated then this is the date at which support of the address will be suspended. After that date it will be removed at the earliest possible point subject to any specific contractual support and development constraints.") documentation_link: Optional[StrictStr] = Field(None, alias="documentationLink", description="Contains a link to the documentation for this AddressDefinition in KnowledgeBase.") __properties = ["displayName", "type", "description", "lifeCycleStatus", "removalDate", "documentationLink"]
[docs] @validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value if value not in ('String', 'Int', 'Decimal', 'DateTime', 'Boolean', 'ResultValue', 'Result0D', 'Json'): raise ValueError("must be one of enum values ('String', 'Int', 'Decimal', 'DateTime', 'Boolean', 'ResultValue', 'Result0D', 'Json')") return value
[docs] class Config: """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.dict(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> AddressDefinition: """Create an instance of AddressDefinition from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self): """Returns the dictionary representation of the model using alias""" _dict = self.dict(by_alias=True, exclude={ }, exclude_none=True) # set to None if display_name (nullable) is None # and __fields_set__ contains the field if self.display_name is None and "display_name" in self.__fields_set__: _dict['displayName'] = None # set to None if description (nullable) is None # and __fields_set__ contains the field if self.description is None and "description" in self.__fields_set__: _dict['description'] = None # set to None if life_cycle_status (nullable) is None # and __fields_set__ contains the field if self.life_cycle_status is None and "life_cycle_status" in self.__fields_set__: _dict['lifeCycleStatus'] = None # set to None if removal_date (nullable) is None # and __fields_set__ contains the field if self.removal_date is None and "removal_date" in self.__fields_set__: _dict['removalDate'] = None # set to None if documentation_link (nullable) is None # and __fields_set__ contains the field if self.documentation_link is None and "documentation_link" in self.__fields_set__: _dict['documentationLink'] = None return _dict
[docs] @classmethod def from_dict(cls, obj: dict) -> AddressDefinition: """Create an instance of AddressDefinition from a dict""" if obj is None: return None if not isinstance(obj, dict): return AddressDefinition.parse_obj(obj) _obj = AddressDefinition.parse_obj({ "display_name": obj.get("displayName"), "type": obj.get("type"), "description": obj.get("description"), "life_cycle_status": obj.get("lifeCycleStatus"), "removal_date": obj.get("removalDate"), "documentation_link": obj.get("documentationLink") }) return _obj