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