github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/models/storage_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, StrictBool, StrictStr
    25  except ImportError:
    26      from pydantic import BaseModel, Field, StrictBool, StrictStr
    27  
    28  class StorageConfig(BaseModel):
    29      """
    30      StorageConfig
    31      """
    32      blockstore_type: StrictStr = Field(...)
    33      blockstore_namespace_example: StrictStr = Field(...)
    34      blockstore_namespace_validity_regex: StrictStr = Field(..., alias="blockstore_namespace_ValidityRegex")
    35      default_namespace_prefix: Optional[StrictStr] = None
    36      pre_sign_support: StrictBool = Field(...)
    37      pre_sign_support_ui: StrictBool = Field(...)
    38      import_support: StrictBool = Field(...)
    39      import_validity_regex: StrictStr = Field(...)
    40      pre_sign_multipart_upload: Optional[StrictBool] = None
    41      __properties = ["blockstore_type", "blockstore_namespace_example", "blockstore_namespace_ValidityRegex", "default_namespace_prefix", "pre_sign_support", "pre_sign_support_ui", "import_support", "import_validity_regex", "pre_sign_multipart_upload"]
    42  
    43      class Config:
    44          """Pydantic configuration"""
    45          allow_population_by_field_name = True
    46          validate_assignment = True
    47  
    48      def to_str(self) -> str:
    49          """Returns the string representation of the model using alias"""
    50          return pprint.pformat(self.dict(by_alias=True))
    51  
    52      def to_json(self) -> str:
    53          """Returns the JSON representation of the model using alias"""
    54          return json.dumps(self.to_dict())
    55  
    56      @classmethod
    57      def from_json(cls, json_str: str) -> StorageConfig:
    58          """Create an instance of StorageConfig from a JSON string"""
    59          return cls.from_dict(json.loads(json_str))
    60  
    61      def to_dict(self):
    62          """Returns the dictionary representation of the model using alias"""
    63          _dict = self.dict(by_alias=True,
    64                            exclude={
    65                            },
    66                            exclude_none=True)
    67          return _dict
    68  
    69      @classmethod
    70      def from_dict(cls, obj: dict) -> StorageConfig:
    71          """Create an instance of StorageConfig from a dict"""
    72          if obj is None:
    73              return None
    74  
    75          if not isinstance(obj, dict):
    76              return StorageConfig.parse_obj(obj)
    77  
    78          _obj = StorageConfig.parse_obj({
    79              "blockstore_type": obj.get("blockstore_type"),
    80              "blockstore_namespace_example": obj.get("blockstore_namespace_example"),
    81              "blockstore_namespace_validity_regex": obj.get("blockstore_namespace_ValidityRegex"),
    82              "default_namespace_prefix": obj.get("default_namespace_prefix"),
    83              "pre_sign_support": obj.get("pre_sign_support"),
    84              "pre_sign_support_ui": obj.get("pre_sign_support_ui"),
    85              "import_support": obj.get("import_support"),
    86              "import_validity_regex": obj.get("import_validity_regex"),
    87              "pre_sign_multipart_upload": obj.get("pre_sign_multipart_upload")
    88          })
    89          return _obj
    90  
    91