github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/object_stats.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, Optional
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, validator
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictInt, StrictStr, validator
    27  
    28  class ObjectStats(BaseModel):
    29      """
    30      ObjectStats
    31      """
    32      path: StrictStr = Field(...)
    33      path_type: StrictStr = Field(...)
    34      physical_address: StrictStr = Field(..., description="The location of the object on the underlying object store. Formatted as a native URI with the object store type as scheme (\"s3://...\", \"gs://...\", etc.) Or, in the case of presign=true, will be an HTTP URL to be consumed via regular HTTP GET ")
    35      physical_address_expiry: Optional[StrictInt] = Field(None, description="If present and nonzero, physical_address is a pre-signed URL and will expire at this Unix Epoch time.  This will be shorter than the pre-signed URL lifetime if an authentication token is about to expire.  This field is *optional*. ")
    36      checksum: StrictStr = Field(...)
    37      size_bytes: Optional[StrictInt] = None
    38      mtime: StrictInt = Field(..., description="Unix Epoch in seconds")
    39      metadata: Optional[Dict[str, StrictStr]] = None
    40      content_type: Optional[StrictStr] = Field(None, description="Object media type")
    41      __properties = ["path", "path_type", "physical_address", "physical_address_expiry", "checksum", "size_bytes", "mtime", "metadata", "content_type"]
    42  
    43      @validator('path_type')
    44      def path_type_validate_enum(cls, value):
    45          """Validates the enum"""
    46          if value not in ('common_prefix', 'object'):
    47              raise ValueError("must be one of enum values ('common_prefix', 'object')")
    48          return value
    49  
    50      class Config:
    51          """Pydantic configuration"""
    52          allow_population_by_field_name = True
    53          validate_assignment = True
    54  
    55      def to_str(self) -> str:
    56          """Returns the string representation of the model using alias"""
    57          return pprint.pformat(self.dict(by_alias=True))
    58  
    59      def to_json(self) -> str:
    60          """Returns the JSON representation of the model using alias"""
    61          return json.dumps(self.to_dict())
    62  
    63      @classmethod
    64      def from_json(cls, json_str: str) -> ObjectStats:
    65          """Create an instance of ObjectStats from a JSON string"""
    66          return cls.from_dict(json.loads(json_str))
    67  
    68      def to_dict(self):
    69          """Returns the dictionary representation of the model using alias"""
    70          _dict = self.dict(by_alias=True,
    71                            exclude={
    72                            },
    73                            exclude_none=True)
    74          return _dict
    75  
    76      @classmethod
    77      def from_dict(cls, obj: dict) -> ObjectStats:
    78          """Create an instance of ObjectStats from a dict"""
    79          if obj is None:
    80              return None
    81  
    82          if not isinstance(obj, dict):
    83              return ObjectStats.parse_obj(obj)
    84  
    85          _obj = ObjectStats.parse_obj({
    86              "path": obj.get("path"),
    87              "path_type": obj.get("path_type"),
    88              "physical_address": obj.get("physical_address"),
    89              "physical_address_expiry": obj.get("physical_address_expiry"),
    90              "checksum": obj.get("checksum"),
    91              "size_bytes": obj.get("size_bytes"),
    92              "mtime": obj.get("mtime"),
    93              "metadata": obj.get("metadata"),
    94              "content_type": obj.get("content_type")
    95          })
    96          return _obj
    97  
    98