github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/reset_creation.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, Field, StrictBool, StrictStr, validator 25 except ImportError: 26 from pydantic import BaseModel, Field, StrictBool, StrictStr, validator 27 28 class ResetCreation(BaseModel): 29 """ 30 ResetCreation 31 """ 32 type: StrictStr = Field(..., description="What to reset according to path.") 33 path: Optional[StrictStr] = None 34 force: Optional[StrictBool] = False 35 __properties = ["type", "path", "force"] 36 37 @validator('type') 38 def type_validate_enum(cls, value): 39 """Validates the enum""" 40 if value not in ('object', 'common_prefix', 'reset'): 41 raise ValueError("must be one of enum values ('object', 'common_prefix', 'reset')") 42 return value 43 44 class Config: 45 """Pydantic configuration""" 46 allow_population_by_field_name = True 47 validate_assignment = True 48 49 def to_str(self) -> str: 50 """Returns the string representation of the model using alias""" 51 return pprint.pformat(self.dict(by_alias=True)) 52 53 def to_json(self) -> str: 54 """Returns the JSON representation of the model using alias""" 55 return json.dumps(self.to_dict()) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> ResetCreation: 59 """Create an instance of ResetCreation from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self): 63 """Returns the dictionary representation of the model using alias""" 64 _dict = self.dict(by_alias=True, 65 exclude={ 66 }, 67 exclude_none=True) 68 return _dict 69 70 @classmethod 71 def from_dict(cls, obj: dict) -> ResetCreation: 72 """Create an instance of ResetCreation from a dict""" 73 if obj is None: 74 return None 75 76 if not isinstance(obj, dict): 77 return ResetCreation.parse_obj(obj) 78 79 _obj = ResetCreation.parse_obj({ 80 "type": obj.get("type"), 81 "path": obj.get("path"), 82 "force": obj.get("force") if obj.get("force") is not None else False 83 }) 84 return _obj 85 86