github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/model/policy.py (about)

     1  """
     2      lakeFS API
     3  
     4      lakeFS HTTP API  # noqa: E501
     5  
     6      The version of the OpenAPI document: 1.0.0
     7      Contact: services@treeverse.io
     8      Generated by: https://openapi-generator.tech
     9  """
    10  
    11  
    12  import re  # noqa: F401
    13  import sys  # noqa: F401
    14  
    15  from lakefs_client.model_utils import (  # noqa: F401
    16      ApiTypeError,
    17      ModelComposed,
    18      ModelNormal,
    19      ModelSimple,
    20      cached_property,
    21      change_keys_js_to_python,
    22      convert_js_args_to_python_args,
    23      date,
    24      datetime,
    25      file_type,
    26      none_type,
    27      validate_get_composed_info,
    28  )
    29  from ..model_utils import OpenApiModel
    30  from lakefs_client.exceptions import ApiAttributeError
    31  
    32  
    33  def lazy_import():
    34      from lakefs_client.model.statement import Statement
    35      globals()['Statement'] = Statement
    36  
    37  
    38  class Policy(ModelNormal):
    39      """NOTE: This class is auto generated by OpenAPI Generator.
    40      Ref: https://openapi-generator.tech
    41  
    42      Do not edit the class manually.
    43  
    44      Attributes:
    45        allowed_values (dict): The key is the tuple path to the attribute
    46            and the for var_name this is (var_name,). The value is a dict
    47            with a capitalized key describing the allowed value and an allowed
    48            value. These dicts store the allowed enum values.
    49        attribute_map (dict): The key is attribute name
    50            and the value is json key in definition.
    51        discriminator_value_class_map (dict): A dict to go from the discriminator
    52            variable value to the discriminator class name.
    53        validations (dict): The key is the tuple path to the attribute
    54            and the for var_name this is (var_name,). The value is a dict
    55            that stores validations for max_length, min_length, max_items,
    56            min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
    57            inclusive_minimum, and regex.
    58        additional_properties_type (tuple): A tuple of classes accepted
    59            as additional properties values.
    60      """
    61  
    62      allowed_values = {
    63      }
    64  
    65      validations = {
    66          ('statement',): {
    67              'min_items': 1,
    68          },
    69      }
    70  
    71      @cached_property
    72      def additional_properties_type():
    73          """
    74          This must be a method because a model may have properties that are
    75          of type self, this must run after the class is loaded
    76          """
    77          lazy_import()
    78          return (bool, date, datetime, dict, float, int, list, str, none_type,)  # noqa: E501
    79  
    80      _nullable = False
    81  
    82      @cached_property
    83      def openapi_types():
    84          """
    85          This must be a method because a model may have properties that are
    86          of type self, this must run after the class is loaded
    87  
    88          Returns
    89              openapi_types (dict): The key is attribute name
    90                  and the value is attribute type.
    91          """
    92          lazy_import()
    93          return {
    94              'id': (str,),  # noqa: E501
    95              'statement': ([Statement],),  # noqa: E501
    96              'creation_date': (int,),  # noqa: E501
    97          }
    98  
    99      @cached_property
   100      def discriminator():
   101          return None
   102  
   103  
   104      attribute_map = {
   105          'id': 'id',  # noqa: E501
   106          'statement': 'statement',  # noqa: E501
   107          'creation_date': 'creation_date',  # noqa: E501
   108      }
   109  
   110      read_only_vars = {
   111      }
   112  
   113      _composed_schemas = {}
   114  
   115      @classmethod
   116      @convert_js_args_to_python_args
   117      def _from_openapi_data(cls, id, statement, *args, **kwargs):  # noqa: E501
   118          """Policy - a model defined in OpenAPI
   119  
   120          Args:
   121              id (str):
   122              statement ([Statement]):
   123  
   124          Keyword Args:
   125              _check_type (bool): if True, values for parameters in openapi_types
   126                                  will be type checked and a TypeError will be
   127                                  raised if the wrong type is input.
   128                                  Defaults to True
   129              _path_to_item (tuple/list): This is a list of keys or values to
   130                                  drill down to the model in received_data
   131                                  when deserializing a response
   132              _spec_property_naming (bool): True if the variable names in the input data
   133                                  are serialized names, as specified in the OpenAPI document.
   134                                  False if the variable names in the input data
   135                                  are pythonic names, e.g. snake case (default)
   136              _configuration (Configuration): the instance to use when
   137                                  deserializing a file_type parameter.
   138                                  If passed, type conversion is attempted
   139                                  If omitted no type conversion is done.
   140              _visited_composed_classes (tuple): This stores a tuple of
   141                                  classes that we have traveled through so that
   142                                  if we see that class again we will not use its
   143                                  discriminator again.
   144                                  When traveling through a discriminator, the
   145                                  composed schema that is
   146                                  is traveled through is added to this set.
   147                                  For example if Animal has a discriminator
   148                                  petType and we pass in "Dog", and the class Dog
   149                                  allOf includes Animal, we move through Animal
   150                                  once using the discriminator, and pick Dog.
   151                                  Then in Dog, we will make an instance of the
   152                                  Animal class but this time we won't travel
   153                                  through its discriminator because we passed in
   154                                  _visited_composed_classes = (Animal,)
   155              creation_date (int): Unix Epoch in seconds. [optional]  # noqa: E501
   156          """
   157  
   158          _check_type = kwargs.pop('_check_type', True)
   159          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   160          _path_to_item = kwargs.pop('_path_to_item', ())
   161          _configuration = kwargs.pop('_configuration', None)
   162          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   163  
   164          self = super(OpenApiModel, cls).__new__(cls)
   165  
   166          if args:
   167              raise ApiTypeError(
   168                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   169                      args,
   170                      self.__class__.__name__,
   171                  ),
   172                  path_to_item=_path_to_item,
   173                  valid_classes=(self.__class__,),
   174              )
   175  
   176          self._data_store = {}
   177          self._check_type = _check_type
   178          self._spec_property_naming = _spec_property_naming
   179          self._path_to_item = _path_to_item
   180          self._configuration = _configuration
   181          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   182  
   183          self.id = id
   184          self.statement = statement
   185          for var_name, var_value in kwargs.items():
   186              if var_name not in self.attribute_map and \
   187                          self._configuration is not None and \
   188                          self._configuration.discard_unknown_keys and \
   189                          self.additional_properties_type is None:
   190                  # discard variable.
   191                  continue
   192              setattr(self, var_name, var_value)
   193          return self
   194  
   195      required_properties = set([
   196          '_data_store',
   197          '_check_type',
   198          '_spec_property_naming',
   199          '_path_to_item',
   200          '_configuration',
   201          '_visited_composed_classes',
   202      ])
   203  
   204      @convert_js_args_to_python_args
   205      def __init__(self, id, statement, *args, **kwargs):  # noqa: E501
   206          """Policy - a model defined in OpenAPI
   207  
   208          Args:
   209              id (str):
   210              statement ([Statement]):
   211  
   212          Keyword Args:
   213              _check_type (bool): if True, values for parameters in openapi_types
   214                                  will be type checked and a TypeError will be
   215                                  raised if the wrong type is input.
   216                                  Defaults to True
   217              _path_to_item (tuple/list): This is a list of keys or values to
   218                                  drill down to the model in received_data
   219                                  when deserializing a response
   220              _spec_property_naming (bool): True if the variable names in the input data
   221                                  are serialized names, as specified in the OpenAPI document.
   222                                  False if the variable names in the input data
   223                                  are pythonic names, e.g. snake case (default)
   224              _configuration (Configuration): the instance to use when
   225                                  deserializing a file_type parameter.
   226                                  If passed, type conversion is attempted
   227                                  If omitted no type conversion is done.
   228              _visited_composed_classes (tuple): This stores a tuple of
   229                                  classes that we have traveled through so that
   230                                  if we see that class again we will not use its
   231                                  discriminator again.
   232                                  When traveling through a discriminator, the
   233                                  composed schema that is
   234                                  is traveled through is added to this set.
   235                                  For example if Animal has a discriminator
   236                                  petType and we pass in "Dog", and the class Dog
   237                                  allOf includes Animal, we move through Animal
   238                                  once using the discriminator, and pick Dog.
   239                                  Then in Dog, we will make an instance of the
   240                                  Animal class but this time we won't travel
   241                                  through its discriminator because we passed in
   242                                  _visited_composed_classes = (Animal,)
   243              creation_date (int): Unix Epoch in seconds. [optional]  # noqa: E501
   244          """
   245  
   246          _check_type = kwargs.pop('_check_type', True)
   247          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   248          _path_to_item = kwargs.pop('_path_to_item', ())
   249          _configuration = kwargs.pop('_configuration', None)
   250          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   251  
   252          if args:
   253              raise ApiTypeError(
   254                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   255                      args,
   256                      self.__class__.__name__,
   257                  ),
   258                  path_to_item=_path_to_item,
   259                  valid_classes=(self.__class__,),
   260              )
   261  
   262          self._data_store = {}
   263          self._check_type = _check_type
   264          self._spec_property_naming = _spec_property_naming
   265          self._path_to_item = _path_to_item
   266          self._configuration = _configuration
   267          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   268  
   269          self.id = id
   270          self.statement = statement
   271          for var_name, var_value in kwargs.items():
   272              if var_name not in self.attribute_map and \
   273                          self._configuration is not None and \
   274                          self._configuration.discard_unknown_keys and \
   275                          self.additional_properties_type is None:
   276                  # discard variable.
   277                  continue
   278              setattr(self, var_name, var_value)
   279              if var_name in self.read_only_vars:
   280                  raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
   281                                       f"class with read only attributes.")