github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/underlying_object_properties.py (about) 1 # coding: utf-8 2 3 """ 4 lakeFS API 5 6 lakeFS HTTP API 7 8 The version of the OpenAPI document: 1.0.0 9 Contact: services@treeverse.io 10 Generated by OpenAPI Generator (https://openapi-generator.tech) 11 12 Do not edit the class manually. 13 """ # noqa: E501 14 15 16 from __future__ import annotations 17 import pprint 18 import re # noqa: F401 19 import json 20 21 22 from typing import Optional 23 try: 24 from pydantic.v1 import BaseModel, StrictStr 25 except ImportError: 26 from pydantic import BaseModel, StrictStr 27 28 class UnderlyingObjectProperties(BaseModel): 29 """ 30 UnderlyingObjectProperties 31 """ 32 storage_class: Optional[StrictStr] = None 33 __properties = ["storage_class"] 34 35 class Config: 36 """Pydantic configuration""" 37 allow_population_by_field_name = True 38 validate_assignment = True 39 40 def to_str(self) -> str: 41 """Returns the string representation of the model using alias""" 42 return pprint.pformat(self.dict(by_alias=True)) 43 44 def to_json(self) -> str: 45 """Returns the JSON representation of the model using alias""" 46 return json.dumps(self.to_dict()) 47 48 @classmethod 49 def from_json(cls, json_str: str) -> UnderlyingObjectProperties: 50 """Create an instance of UnderlyingObjectProperties from a JSON string""" 51 return cls.from_dict(json.loads(json_str)) 52 53 def to_dict(self): 54 """Returns the dictionary representation of the model using alias""" 55 _dict = self.dict(by_alias=True, 56 exclude={ 57 }, 58 exclude_none=True) 59 # set to None if storage_class (nullable) is None 60 # and __fields_set__ contains the field 61 if self.storage_class is None and "storage_class" in self.__fields_set__: 62 _dict['storage_class'] = None 63 64 return _dict 65 66 @classmethod 67 def from_dict(cls, obj: dict) -> UnderlyingObjectProperties: 68 """Create an instance of UnderlyingObjectProperties from a dict""" 69 if obj is None: 70 return None 71 72 if not isinstance(obj, dict): 73 return UnderlyingObjectProperties.parse_obj(obj) 74 75 _obj = UnderlyingObjectProperties.parse_obj({ 76 "storage_class": obj.get("storage_class") 77 }) 78 return _obj 79 80