github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/import_location.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  
    23  try:
    24      from pydantic.v1 import BaseModel, Field, StrictStr, validator
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictStr, validator
    27  
    28  class ImportLocation(BaseModel):
    29      """
    30      ImportLocation
    31      """
    32      type: StrictStr = Field(..., description="Path type, can either be 'common_prefix' or 'object'")
    33      path: StrictStr = Field(..., description="A source location to a 'common_prefix' or to a single object. Must match the lakeFS installation blockstore type.")
    34      destination: StrictStr = Field(..., description="Destination for the imported objects on the branch. Must be a relative path to the branch. If the type is an 'object', the destination is the exact object name under the branch. If the type is a 'common_prefix', the destination is the prefix under the branch. ")
    35      __properties = ["type", "path", "destination"]
    36  
    37      @validator('type')
    38      def type_validate_enum(cls, value):
    39          """Validates the enum"""
    40          if value not in ('common_prefix', 'object'):
    41              raise ValueError("must be one of enum values ('common_prefix', 'object')")
    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) -> ImportLocation:
    59          """Create an instance of ImportLocation 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) -> ImportLocation:
    72          """Create an instance of ImportLocation from a dict"""
    73          if obj is None:
    74              return None
    75  
    76          if not isinstance(obj, dict):
    77              return ImportLocation.parse_obj(obj)
    78  
    79          _obj = ImportLocation.parse_obj({
    80              "type": obj.get("type"),
    81              "path": obj.get("path"),
    82              "destination": obj.get("destination")
    83          })
    84          return _obj
    85  
    86