github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/complete_presign_multipart_upload.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, StrictStr, conlist 25 except ImportError: 26 from pydantic import BaseModel, Field, StrictStr, conlist 27 from lakefs_sdk.models.upload_part import UploadPart 28 29 class CompletePresignMultipartUpload(BaseModel): 30 """ 31 CompletePresignMultipartUpload 32 """ 33 physical_address: StrictStr = Field(...) 34 parts: conlist(UploadPart) = Field(..., description="List of uploaded parts, should be ordered by ascending part number") 35 user_metadata: Optional[Dict[str, StrictStr]] = None 36 content_type: Optional[StrictStr] = Field(None, description="Object media type") 37 __properties = ["physical_address", "parts", "user_metadata", "content_type"] 38 39 class Config: 40 """Pydantic configuration""" 41 allow_population_by_field_name = True 42 validate_assignment = True 43 44 def to_str(self) -> str: 45 """Returns the string representation of the model using alias""" 46 return pprint.pformat(self.dict(by_alias=True)) 47 48 def to_json(self) -> str: 49 """Returns the JSON representation of the model using alias""" 50 return json.dumps(self.to_dict()) 51 52 @classmethod 53 def from_json(cls, json_str: str) -> CompletePresignMultipartUpload: 54 """Create an instance of CompletePresignMultipartUpload from a JSON string""" 55 return cls.from_dict(json.loads(json_str)) 56 57 def to_dict(self): 58 """Returns the dictionary representation of the model using alias""" 59 _dict = self.dict(by_alias=True, 60 exclude={ 61 }, 62 exclude_none=True) 63 # override the default output from pydantic by calling `to_dict()` of each item in parts (list) 64 _items = [] 65 if self.parts: 66 for _item in self.parts: 67 if _item: 68 _items.append(_item.to_dict()) 69 _dict['parts'] = _items 70 return _dict 71 72 @classmethod 73 def from_dict(cls, obj: dict) -> CompletePresignMultipartUpload: 74 """Create an instance of CompletePresignMultipartUpload from a dict""" 75 if obj is None: 76 return None 77 78 if not isinstance(obj, dict): 79 return CompletePresignMultipartUpload.parse_obj(obj) 80 81 _obj = CompletePresignMultipartUpload.parse_obj({ 82 "physical_address": obj.get("physical_address"), 83 "parts": [UploadPart.from_dict(_item) for _item in obj.get("parts")] if obj.get("parts") is not None else None, 84 "user_metadata": obj.get("user_metadata"), 85 "content_type": obj.get("content_type") 86 }) 87 return _obj 88 89