github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/garbage_collection_config.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, StrictInt 25 except ImportError: 26 from pydantic import BaseModel, Field, StrictInt 27 28 class GarbageCollectionConfig(BaseModel): 29 """ 30 GarbageCollectionConfig 31 """ 32 grace_period: Optional[StrictInt] = Field(None, description="Duration in seconds. Objects created in the recent grace_period will not be collected.") 33 __properties = ["grace_period"] 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) -> GarbageCollectionConfig: 50 """Create an instance of GarbageCollectionConfig 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 return _dict 60 61 @classmethod 62 def from_dict(cls, obj: dict) -> GarbageCollectionConfig: 63 """Create an instance of GarbageCollectionConfig from a dict""" 64 if obj is None: 65 return None 66 67 if not isinstance(obj, dict): 68 return GarbageCollectionConfig.parse_obj(obj) 69 70 _obj = GarbageCollectionConfig.parse_obj({ 71 "grace_period": obj.get("grace_period") 72 }) 73 return _obj 74 75