Source code for pydelfini.delfini_core.models.cdes_update_cdeset_body

from typing import Any
from typing import Dict
from typing import Type
from typing import TypeVar
from typing import Union

from attrs import define as _attrs_define

from ..models.cdeset_state import CdesetState
from ..types import UNSET
from ..types import Unset


T = TypeVar("T", bound="CdesUpdateCdesetBody")


[docs] @_attrs_define class CdesUpdateCdesetBody: """CdesUpdateCdesetBody model Attributes: description (Union[Unset, str]): display_name (Union[Unset, str]): is_default (Union[Unset, bool]): state (Union[Unset, CdesetState]): Lifecycle state of a CDE set: - `active`: listed everywhere and recommended for use (the default) - `deprecated`: still usable, but no longer recommended - `system`: hidden from the public CDE listing, but still available as a data element source (e.g. for metadata fields) """ description: Union[Unset, str] = UNSET display_name: Union[Unset, str] = UNSET is_default: Union[Unset, bool] = UNSET state: Union[Unset, CdesetState] = UNSET
[docs] def to_dict(self) -> Dict[str, Any]: """Convert to a dict""" description = self.description display_name = self.display_name is_default = self.is_default state: Union[Unset, str] = UNSET if not isinstance(self.state, Unset): state = self.state.value field_dict: Dict[str, Any] = {} field_dict.update({}) if description is not UNSET: field_dict["description"] = description if display_name is not UNSET: field_dict["display_name"] = display_name if is_default is not UNSET: field_dict["is_default"] = is_default if state is not UNSET: field_dict["state"] = state return field_dict
[docs] @classmethod def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: """Create an instance of :py:class:`CdesUpdateCdesetBody` from a dict""" d = src_dict.copy() description = d.pop("description", UNSET) display_name = d.pop("display_name", UNSET) is_default = d.pop("is_default", UNSET) _state = d.pop("state", UNSET) state: Union[Unset, CdesetState] if isinstance(_state, Unset): state = UNSET else: state = CdesetState(_state) cdes_update_cdeset_body = cls( description=description, display_name=display_name, is_default=is_default, state=state, ) return cdes_update_cdeset_body