github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/api/refs_api.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.api_client import ApiClient, Endpoint as _Endpoint
    16  from lakefs_client.model_utils import (  # noqa: F401
    17      check_allowed_values,
    18      check_validations,
    19      date,
    20      datetime,
    21      file_type,
    22      none_type,
    23      validate_and_convert_types
    24  )
    25  from lakefs_client.model.commit_list import CommitList
    26  from lakefs_client.model.diff_list import DiffList
    27  from lakefs_client.model.error import Error
    28  from lakefs_client.model.find_merge_base_result import FindMergeBaseResult
    29  from lakefs_client.model.merge import Merge
    30  from lakefs_client.model.merge_result import MergeResult
    31  
    32  
    33  class RefsApi(object):
    34      """NOTE: This class is auto generated by OpenAPI Generator
    35      Ref: https://openapi-generator.tech
    36  
    37      Do not edit the class manually.
    38      """
    39  
    40      def __init__(self, api_client=None):
    41          if api_client is None:
    42              api_client = ApiClient()
    43          self.api_client = api_client
    44          self.diff_refs_endpoint = _Endpoint(
    45              settings={
    46                  'response_type': (DiffList,),
    47                  'auth': [
    48                      'basic_auth',
    49                      'cookie_auth',
    50                      'jwt_token',
    51                      'oidc_auth',
    52                      'saml_auth'
    53                  ],
    54                  'endpoint_path': '/repositories/{repository}/refs/{leftRef}/diff/{rightRef}',
    55                  'operation_id': 'diff_refs',
    56                  'http_method': 'GET',
    57                  'servers': None,
    58              },
    59              params_map={
    60                  'all': [
    61                      'repository',
    62                      'left_ref',
    63                      'right_ref',
    64                      'after',
    65                      'amount',
    66                      'prefix',
    67                      'delimiter',
    68                      'type',
    69                  ],
    70                  'required': [
    71                      'repository',
    72                      'left_ref',
    73                      'right_ref',
    74                  ],
    75                  'nullable': [
    76                  ],
    77                  'enum': [
    78                      'type',
    79                  ],
    80                  'validation': [
    81                      'amount',
    82                  ]
    83              },
    84              root_map={
    85                  'validations': {
    86                      ('amount',): {
    87  
    88                          'inclusive_maximum': 1000,
    89                          'inclusive_minimum': -1,
    90                      },
    91                  },
    92                  'allowed_values': {
    93                      ('type',): {
    94  
    95                          "TWO_DOT": "two_dot",
    96                          "THREE_DOT": "three_dot"
    97                      },
    98                  },
    99                  'openapi_types': {
   100                      'repository':
   101                          (str,),
   102                      'left_ref':
   103                          (str,),
   104                      'right_ref':
   105                          (str,),
   106                      'after':
   107                          (str,),
   108                      'amount':
   109                          (int,),
   110                      'prefix':
   111                          (str,),
   112                      'delimiter':
   113                          (str,),
   114                      'type':
   115                          (str,),
   116                  },
   117                  'attribute_map': {
   118                      'repository': 'repository',
   119                      'left_ref': 'leftRef',
   120                      'right_ref': 'rightRef',
   121                      'after': 'after',
   122                      'amount': 'amount',
   123                      'prefix': 'prefix',
   124                      'delimiter': 'delimiter',
   125                      'type': 'type',
   126                  },
   127                  'location_map': {
   128                      'repository': 'path',
   129                      'left_ref': 'path',
   130                      'right_ref': 'path',
   131                      'after': 'query',
   132                      'amount': 'query',
   133                      'prefix': 'query',
   134                      'delimiter': 'query',
   135                      'type': 'query',
   136                  },
   137                  'collection_format_map': {
   138                  }
   139              },
   140              headers_map={
   141                  'accept': [
   142                      'application/json'
   143                  ],
   144                  'content_type': [],
   145              },
   146              api_client=api_client
   147          )
   148          self.find_merge_base_endpoint = _Endpoint(
   149              settings={
   150                  'response_type': (FindMergeBaseResult,),
   151                  'auth': [
   152                      'basic_auth',
   153                      'cookie_auth',
   154                      'jwt_token',
   155                      'oidc_auth',
   156                      'saml_auth'
   157                  ],
   158                  'endpoint_path': '/repositories/{repository}/refs/{sourceRef}/merge/{destinationBranch}',
   159                  'operation_id': 'find_merge_base',
   160                  'http_method': 'GET',
   161                  'servers': None,
   162              },
   163              params_map={
   164                  'all': [
   165                      'repository',
   166                      'source_ref',
   167                      'destination_branch',
   168                  ],
   169                  'required': [
   170                      'repository',
   171                      'source_ref',
   172                      'destination_branch',
   173                  ],
   174                  'nullable': [
   175                  ],
   176                  'enum': [
   177                  ],
   178                  'validation': [
   179                  ]
   180              },
   181              root_map={
   182                  'validations': {
   183                  },
   184                  'allowed_values': {
   185                  },
   186                  'openapi_types': {
   187                      'repository':
   188                          (str,),
   189                      'source_ref':
   190                          (str,),
   191                      'destination_branch':
   192                          (str,),
   193                  },
   194                  'attribute_map': {
   195                      'repository': 'repository',
   196                      'source_ref': 'sourceRef',
   197                      'destination_branch': 'destinationBranch',
   198                  },
   199                  'location_map': {
   200                      'repository': 'path',
   201                      'source_ref': 'path',
   202                      'destination_branch': 'path',
   203                  },
   204                  'collection_format_map': {
   205                  }
   206              },
   207              headers_map={
   208                  'accept': [
   209                      'application/json'
   210                  ],
   211                  'content_type': [],
   212              },
   213              api_client=api_client
   214          )
   215          self.log_commits_endpoint = _Endpoint(
   216              settings={
   217                  'response_type': (CommitList,),
   218                  'auth': [
   219                      'basic_auth',
   220                      'cookie_auth',
   221                      'jwt_token',
   222                      'oidc_auth',
   223                      'saml_auth'
   224                  ],
   225                  'endpoint_path': '/repositories/{repository}/refs/{ref}/commits',
   226                  'operation_id': 'log_commits',
   227                  'http_method': 'GET',
   228                  'servers': None,
   229              },
   230              params_map={
   231                  'all': [
   232                      'repository',
   233                      'ref',
   234                      'after',
   235                      'amount',
   236                      'objects',
   237                      'prefixes',
   238                      'limit',
   239                      'first_parent',
   240                      'since',
   241                      'stop_at',
   242                  ],
   243                  'required': [
   244                      'repository',
   245                      'ref',
   246                  ],
   247                  'nullable': [
   248                  ],
   249                  'enum': [
   250                  ],
   251                  'validation': [
   252                      'amount',
   253                  ]
   254              },
   255              root_map={
   256                  'validations': {
   257                      ('amount',): {
   258  
   259                          'inclusive_maximum': 1000,
   260                          'inclusive_minimum': -1,
   261                      },
   262                  },
   263                  'allowed_values': {
   264                  },
   265                  'openapi_types': {
   266                      'repository':
   267                          (str,),
   268                      'ref':
   269                          (str,),
   270                      'after':
   271                          (str,),
   272                      'amount':
   273                          (int,),
   274                      'objects':
   275                          ([str],),
   276                      'prefixes':
   277                          ([str],),
   278                      'limit':
   279                          (bool,),
   280                      'first_parent':
   281                          (bool,),
   282                      'since':
   283                          (datetime,),
   284                      'stop_at':
   285                          (str,),
   286                  },
   287                  'attribute_map': {
   288                      'repository': 'repository',
   289                      'ref': 'ref',
   290                      'after': 'after',
   291                      'amount': 'amount',
   292                      'objects': 'objects',
   293                      'prefixes': 'prefixes',
   294                      'limit': 'limit',
   295                      'first_parent': 'first_parent',
   296                      'since': 'since',
   297                      'stop_at': 'stop_at',
   298                  },
   299                  'location_map': {
   300                      'repository': 'path',
   301                      'ref': 'path',
   302                      'after': 'query',
   303                      'amount': 'query',
   304                      'objects': 'query',
   305                      'prefixes': 'query',
   306                      'limit': 'query',
   307                      'first_parent': 'query',
   308                      'since': 'query',
   309                      'stop_at': 'query',
   310                  },
   311                  'collection_format_map': {
   312                      'objects': 'multi',
   313                      'prefixes': 'multi',
   314                  }
   315              },
   316              headers_map={
   317                  'accept': [
   318                      'application/json'
   319                  ],
   320                  'content_type': [],
   321              },
   322              api_client=api_client
   323          )
   324          self.merge_into_branch_endpoint = _Endpoint(
   325              settings={
   326                  'response_type': (MergeResult,),
   327                  'auth': [
   328                      'basic_auth',
   329                      'cookie_auth',
   330                      'jwt_token',
   331                      'oidc_auth',
   332                      'saml_auth'
   333                  ],
   334                  'endpoint_path': '/repositories/{repository}/refs/{sourceRef}/merge/{destinationBranch}',
   335                  'operation_id': 'merge_into_branch',
   336                  'http_method': 'POST',
   337                  'servers': None,
   338              },
   339              params_map={
   340                  'all': [
   341                      'repository',
   342                      'source_ref',
   343                      'destination_branch',
   344                      'merge',
   345                  ],
   346                  'required': [
   347                      'repository',
   348                      'source_ref',
   349                      'destination_branch',
   350                  ],
   351                  'nullable': [
   352                  ],
   353                  'enum': [
   354                  ],
   355                  'validation': [
   356                  ]
   357              },
   358              root_map={
   359                  'validations': {
   360                  },
   361                  'allowed_values': {
   362                  },
   363                  'openapi_types': {
   364                      'repository':
   365                          (str,),
   366                      'source_ref':
   367                          (str,),
   368                      'destination_branch':
   369                          (str,),
   370                      'merge':
   371                          (Merge,),
   372                  },
   373                  'attribute_map': {
   374                      'repository': 'repository',
   375                      'source_ref': 'sourceRef',
   376                      'destination_branch': 'destinationBranch',
   377                  },
   378                  'location_map': {
   379                      'repository': 'path',
   380                      'source_ref': 'path',
   381                      'destination_branch': 'path',
   382                      'merge': 'body',
   383                  },
   384                  'collection_format_map': {
   385                  }
   386              },
   387              headers_map={
   388                  'accept': [
   389                      'application/json'
   390                  ],
   391                  'content_type': [
   392                      'application/json'
   393                  ]
   394              },
   395              api_client=api_client
   396          )
   397  
   398      def diff_refs(
   399          self,
   400          repository,
   401          left_ref,
   402          right_ref,
   403          **kwargs
   404      ):
   405          """diff references  # noqa: E501
   406  
   407          This method makes a synchronous HTTP request by default. To make an
   408          asynchronous HTTP request, please pass async_req=True
   409  
   410          >>> thread = api.diff_refs(repository, left_ref, right_ref, async_req=True)
   411          >>> result = thread.get()
   412  
   413          Args:
   414              repository (str):
   415              left_ref (str): a reference (could be either a branch or a commit ID)
   416              right_ref (str): a reference (could be either a branch or a commit ID) to compare against
   417  
   418          Keyword Args:
   419              after (str): return items after this value. [optional]
   420              amount (int): how many items to return. [optional] if omitted the server will use the default value of 100
   421              prefix (str): return items prefixed with this value. [optional]
   422              delimiter (str): delimiter used to group common prefixes by. [optional]
   423              type (str): [optional] if omitted the server will use the default value of "three_dot"
   424              _return_http_data_only (bool): response data without head status
   425                  code and headers. Default is True.
   426              _preload_content (bool): if False, the urllib3.HTTPResponse object
   427                  will be returned without reading/decoding response data.
   428                  Default is True.
   429              _request_timeout (int/float/tuple): timeout setting for this request. If
   430                  one number provided, it will be total request timeout. It can also
   431                  be a pair (tuple) of (connection, read) timeouts.
   432                  Default is None.
   433              _check_input_type (bool): specifies if type checking
   434                  should be done one the data sent to the server.
   435                  Default is True.
   436              _check_return_type (bool): specifies if type checking
   437                  should be done one the data received from the server.
   438                  Default is True.
   439              _host_index (int/None): specifies the index of the server
   440                  that we want to use.
   441                  Default is read from the configuration.
   442              async_req (bool): execute request asynchronously
   443  
   444          Returns:
   445              DiffList
   446                  If the method is called asynchronously, returns the request
   447                  thread.
   448          """
   449          kwargs['async_req'] = kwargs.get(
   450              'async_req', False
   451          )
   452          kwargs['_return_http_data_only'] = kwargs.get(
   453              '_return_http_data_only', True
   454          )
   455          kwargs['_preload_content'] = kwargs.get(
   456              '_preload_content', True
   457          )
   458          kwargs['_request_timeout'] = kwargs.get(
   459              '_request_timeout', None
   460          )
   461          kwargs['_check_input_type'] = kwargs.get(
   462              '_check_input_type', True
   463          )
   464          kwargs['_check_return_type'] = kwargs.get(
   465              '_check_return_type', True
   466          )
   467          kwargs['_host_index'] = kwargs.get('_host_index')
   468          kwargs['repository'] = \
   469              repository
   470          kwargs['left_ref'] = \
   471              left_ref
   472          kwargs['right_ref'] = \
   473              right_ref
   474          return self.diff_refs_endpoint.call_with_http_info(**kwargs)
   475  
   476      def find_merge_base(
   477          self,
   478          repository,
   479          source_ref,
   480          destination_branch,
   481          **kwargs
   482      ):
   483          """find the merge base for 2 references  # noqa: E501
   484  
   485          This method makes a synchronous HTTP request by default. To make an
   486          asynchronous HTTP request, please pass async_req=True
   487  
   488          >>> thread = api.find_merge_base(repository, source_ref, destination_branch, async_req=True)
   489          >>> result = thread.get()
   490  
   491          Args:
   492              repository (str):
   493              source_ref (str): source ref
   494              destination_branch (str): destination branch name
   495  
   496          Keyword Args:
   497              _return_http_data_only (bool): response data without head status
   498                  code and headers. Default is True.
   499              _preload_content (bool): if False, the urllib3.HTTPResponse object
   500                  will be returned without reading/decoding response data.
   501                  Default is True.
   502              _request_timeout (int/float/tuple): timeout setting for this request. If
   503                  one number provided, it will be total request timeout. It can also
   504                  be a pair (tuple) of (connection, read) timeouts.
   505                  Default is None.
   506              _check_input_type (bool): specifies if type checking
   507                  should be done one the data sent to the server.
   508                  Default is True.
   509              _check_return_type (bool): specifies if type checking
   510                  should be done one the data received from the server.
   511                  Default is True.
   512              _host_index (int/None): specifies the index of the server
   513                  that we want to use.
   514                  Default is read from the configuration.
   515              async_req (bool): execute request asynchronously
   516  
   517          Returns:
   518              FindMergeBaseResult
   519                  If the method is called asynchronously, returns the request
   520                  thread.
   521          """
   522          kwargs['async_req'] = kwargs.get(
   523              'async_req', False
   524          )
   525          kwargs['_return_http_data_only'] = kwargs.get(
   526              '_return_http_data_only', True
   527          )
   528          kwargs['_preload_content'] = kwargs.get(
   529              '_preload_content', True
   530          )
   531          kwargs['_request_timeout'] = kwargs.get(
   532              '_request_timeout', None
   533          )
   534          kwargs['_check_input_type'] = kwargs.get(
   535              '_check_input_type', True
   536          )
   537          kwargs['_check_return_type'] = kwargs.get(
   538              '_check_return_type', True
   539          )
   540          kwargs['_host_index'] = kwargs.get('_host_index')
   541          kwargs['repository'] = \
   542              repository
   543          kwargs['source_ref'] = \
   544              source_ref
   545          kwargs['destination_branch'] = \
   546              destination_branch
   547          return self.find_merge_base_endpoint.call_with_http_info(**kwargs)
   548  
   549      def log_commits(
   550          self,
   551          repository,
   552          ref,
   553          **kwargs
   554      ):
   555          """get commit log from ref. If both objects and prefixes are empty, return all commits.  # noqa: E501
   556  
   557          This method makes a synchronous HTTP request by default. To make an
   558          asynchronous HTTP request, please pass async_req=True
   559  
   560          >>> thread = api.log_commits(repository, ref, async_req=True)
   561          >>> result = thread.get()
   562  
   563          Args:
   564              repository (str):
   565              ref (str):
   566  
   567          Keyword Args:
   568              after (str): return items after this value. [optional]
   569              amount (int): how many items to return. [optional] if omitted the server will use the default value of 100
   570              objects ([str]): list of paths, each element is a path of a specific object. [optional]
   571              prefixes ([str]): list of paths, each element is a path of a prefix. [optional]
   572              limit (bool): limit the number of items in return to 'amount'. Without further indication on actual number of items.. [optional]
   573              first_parent (bool): if set to true, follow only the first parent upon reaching a merge commit. [optional]
   574              since (datetime): Show commits more recent than a specific date-time. In case used with stop_at parameter, will stop at the first commit that meets any of the conditions.. [optional]
   575              stop_at (str): A reference to stop at. In case used with since parameter, will stop at the first commit that meets any of the conditions.. [optional]
   576              _return_http_data_only (bool): response data without head status
   577                  code and headers. Default is True.
   578              _preload_content (bool): if False, the urllib3.HTTPResponse object
   579                  will be returned without reading/decoding response data.
   580                  Default is True.
   581              _request_timeout (int/float/tuple): timeout setting for this request. If
   582                  one number provided, it will be total request timeout. It can also
   583                  be a pair (tuple) of (connection, read) timeouts.
   584                  Default is None.
   585              _check_input_type (bool): specifies if type checking
   586                  should be done one the data sent to the server.
   587                  Default is True.
   588              _check_return_type (bool): specifies if type checking
   589                  should be done one the data received from the server.
   590                  Default is True.
   591              _host_index (int/None): specifies the index of the server
   592                  that we want to use.
   593                  Default is read from the configuration.
   594              async_req (bool): execute request asynchronously
   595  
   596          Returns:
   597              CommitList
   598                  If the method is called asynchronously, returns the request
   599                  thread.
   600          """
   601          kwargs['async_req'] = kwargs.get(
   602              'async_req', False
   603          )
   604          kwargs['_return_http_data_only'] = kwargs.get(
   605              '_return_http_data_only', True
   606          )
   607          kwargs['_preload_content'] = kwargs.get(
   608              '_preload_content', True
   609          )
   610          kwargs['_request_timeout'] = kwargs.get(
   611              '_request_timeout', None
   612          )
   613          kwargs['_check_input_type'] = kwargs.get(
   614              '_check_input_type', True
   615          )
   616          kwargs['_check_return_type'] = kwargs.get(
   617              '_check_return_type', True
   618          )
   619          kwargs['_host_index'] = kwargs.get('_host_index')
   620          kwargs['repository'] = \
   621              repository
   622          kwargs['ref'] = \
   623              ref
   624          return self.log_commits_endpoint.call_with_http_info(**kwargs)
   625  
   626      def merge_into_branch(
   627          self,
   628          repository,
   629          source_ref,
   630          destination_branch,
   631          **kwargs
   632      ):
   633          """merge references  # noqa: E501
   634  
   635          This method makes a synchronous HTTP request by default. To make an
   636          asynchronous HTTP request, please pass async_req=True
   637  
   638          >>> thread = api.merge_into_branch(repository, source_ref, destination_branch, async_req=True)
   639          >>> result = thread.get()
   640  
   641          Args:
   642              repository (str):
   643              source_ref (str): source ref
   644              destination_branch (str): destination branch name
   645  
   646          Keyword Args:
   647              merge (Merge): [optional]
   648              _return_http_data_only (bool): response data without head status
   649                  code and headers. Default is True.
   650              _preload_content (bool): if False, the urllib3.HTTPResponse object
   651                  will be returned without reading/decoding response data.
   652                  Default is True.
   653              _request_timeout (int/float/tuple): timeout setting for this request. If
   654                  one number provided, it will be total request timeout. It can also
   655                  be a pair (tuple) of (connection, read) timeouts.
   656                  Default is None.
   657              _check_input_type (bool): specifies if type checking
   658                  should be done one the data sent to the server.
   659                  Default is True.
   660              _check_return_type (bool): specifies if type checking
   661                  should be done one the data received from the server.
   662                  Default is True.
   663              _host_index (int/None): specifies the index of the server
   664                  that we want to use.
   665                  Default is read from the configuration.
   666              async_req (bool): execute request asynchronously
   667  
   668          Returns:
   669              MergeResult
   670                  If the method is called asynchronously, returns the request
   671                  thread.
   672          """
   673          kwargs['async_req'] = kwargs.get(
   674              'async_req', False
   675          )
   676          kwargs['_return_http_data_only'] = kwargs.get(
   677              '_return_http_data_only', True
   678          )
   679          kwargs['_preload_content'] = kwargs.get(
   680              '_preload_content', True
   681          )
   682          kwargs['_request_timeout'] = kwargs.get(
   683              '_request_timeout', None
   684          )
   685          kwargs['_check_input_type'] = kwargs.get(
   686              '_check_input_type', True
   687          )
   688          kwargs['_check_return_type'] = kwargs.get(
   689              '_check_return_type', True
   690          )
   691          kwargs['_host_index'] = kwargs.get('_host_index')
   692          kwargs['repository'] = \
   693              repository
   694          kwargs['source_ref'] = \
   695              source_ref
   696          kwargs['destination_branch'] = \
   697              destination_branch
   698          return self.merge_into_branch_endpoint.call_with_http_info(**kwargs)
   699