github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/commit_record_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 Dict, List, Optional 23 try: 24 from pydantic.v1 import BaseModel, Field, StrictBool, StrictInt, StrictStr, conint, conlist 25 except ImportError: 26 from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conint, conlist 27 28 class CommitRecordCreation(BaseModel): 29 """ 30 CommitRecordCreation 31 """ 32 commit_id: StrictStr = Field(..., description="id of the commit record") 33 version: conint(strict=True, le=1, ge=0) = Field(..., description="version of the commit record") 34 committer: StrictStr = Field(..., description="committer of the commit record") 35 message: StrictStr = Field(..., description="message of the commit record") 36 metarange_id: StrictStr = Field(..., description="metarange_id of the commit record") 37 creation_date: StrictInt = Field(..., description="Unix Epoch in seconds") 38 parents: conlist(StrictStr) = Field(..., description="parents of the commit record") 39 metadata: Optional[Dict[str, StrictStr]] = Field(None, description="metadata of the commit record") 40 generation: StrictInt = Field(..., description="generation of the commit record") 41 force: Optional[StrictBool] = False 42 __properties = ["commit_id", "version", "committer", "message", "metarange_id", "creation_date", "parents", "metadata", "generation", "force"] 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) -> CommitRecordCreation: 59 """Create an instance of CommitRecordCreation 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) -> CommitRecordCreation: 72 """Create an instance of CommitRecordCreation from a dict""" 73 if obj is None: 74 return None 75 76 if not isinstance(obj, dict): 77 return CommitRecordCreation.parse_obj(obj) 78 79 _obj = CommitRecordCreation.parse_obj({ 80 "commit_id": obj.get("commit_id"), 81 "version": obj.get("version"), 82 "committer": obj.get("committer"), 83 "message": obj.get("message"), 84 "metarange_id": obj.get("metarange_id"), 85 "creation_date": obj.get("creation_date"), 86 "parents": obj.get("parents"), 87 "metadata": obj.get("metadata"), 88 "generation": obj.get("generation"), 89 "force": obj.get("force") if obj.get("force") is not None else False 90 }) 91 return _obj 92 93