github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/api/metadata_api.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  import re  # noqa: F401
    17  import io
    18  import warnings
    19  
    20  try:
    21      from pydantic.v1 import validate_arguments, ValidationError
    22  except ImportError:
    23      from pydantic import validate_arguments, ValidationError
    24  from typing_extensions import Annotated
    25  
    26  try:
    27      from pydantic.v1 import StrictStr
    28  except ImportError:
    29      from pydantic import StrictStr
    30  
    31  from lakefs_sdk.models.storage_uri import StorageURI
    32  
    33  from lakefs_sdk.api_client import ApiClient
    34  from lakefs_sdk.api_response import ApiResponse
    35  from lakefs_sdk.exceptions import (  # noqa: F401
    36      ApiTypeError,
    37      ApiValueError
    38  )
    39  
    40  
    41  class MetadataApi(object):
    42      """NOTE: This class is auto generated by OpenAPI Generator
    43      Ref: https://openapi-generator.tech
    44  
    45      Do not edit the class manually.
    46      """
    47  
    48      def __init__(self, api_client=None):
    49          if api_client is None:
    50              api_client = ApiClient.get_default()
    51          self.api_client = api_client
    52  
    53      @validate_arguments
    54      def get_meta_range(self, repository : StrictStr, meta_range : StrictStr, **kwargs) -> StorageURI:  # noqa: E501
    55          """return URI to a meta-range file  # noqa: E501
    56  
    57          This method makes a synchronous HTTP request by default. To make an
    58          asynchronous HTTP request, please pass async_req=True
    59  
    60          >>> thread = api.get_meta_range(repository, meta_range, async_req=True)
    61          >>> result = thread.get()
    62  
    63          :param repository: (required)
    64          :type repository: str
    65          :param meta_range: (required)
    66          :type meta_range: str
    67          :param async_req: Whether to execute the request asynchronously.
    68          :type async_req: bool, optional
    69          :param _request_timeout: timeout setting for this request. If one
    70                                   number provided, it will be total request
    71                                   timeout. It can also be a pair (tuple) of
    72                                   (connection, read) timeouts.
    73          :return: Returns the result object.
    74                   If the method is called asynchronously,
    75                   returns the request thread.
    76          :rtype: StorageURI
    77          """
    78          kwargs['_return_http_data_only'] = True
    79          if '_preload_content' in kwargs:
    80              raise ValueError("Error! Please call the get_meta_range_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
    81          return self.get_meta_range_with_http_info(repository, meta_range, **kwargs)  # noqa: E501
    82  
    83      @validate_arguments
    84      def get_meta_range_with_http_info(self, repository : StrictStr, meta_range : StrictStr, **kwargs) -> ApiResponse:  # noqa: E501
    85          """return URI to a meta-range file  # noqa: E501
    86  
    87          This method makes a synchronous HTTP request by default. To make an
    88          asynchronous HTTP request, please pass async_req=True
    89  
    90          >>> thread = api.get_meta_range_with_http_info(repository, meta_range, async_req=True)
    91          >>> result = thread.get()
    92  
    93          :param repository: (required)
    94          :type repository: str
    95          :param meta_range: (required)
    96          :type meta_range: str
    97          :param async_req: Whether to execute the request asynchronously.
    98          :type async_req: bool, optional
    99          :param _preload_content: if False, the ApiResponse.data will
   100                                   be set to none and raw_data will store the 
   101                                   HTTP response body without reading/decoding.
   102                                   Default is True.
   103          :type _preload_content: bool, optional
   104          :param _return_http_data_only: response data instead of ApiResponse
   105                                         object with status code, headers, etc
   106          :type _return_http_data_only: bool, optional
   107          :param _request_timeout: timeout setting for this request. If one
   108                                   number provided, it will be total request
   109                                   timeout. It can also be a pair (tuple) of
   110                                   (connection, read) timeouts.
   111          :param _request_auth: set to override the auth_settings for an a single
   112                                request; this effectively ignores the authentication
   113                                in the spec for a single request.
   114          :type _request_auth: dict, optional
   115          :type _content_type: string, optional: force content-type for the request
   116          :return: Returns the result object.
   117                   If the method is called asynchronously,
   118                   returns the request thread.
   119          :rtype: tuple(StorageURI, status_code(int), headers(HTTPHeaderDict))
   120          """
   121  
   122          _params = locals()
   123  
   124          _all_params = [
   125              'repository',
   126              'meta_range'
   127          ]
   128          _all_params.extend(
   129              [
   130                  'async_req',
   131                  '_return_http_data_only',
   132                  '_preload_content',
   133                  '_request_timeout',
   134                  '_request_auth',
   135                  '_content_type',
   136                  '_headers'
   137              ]
   138          )
   139  
   140          # validate the arguments
   141          for _key, _val in _params['kwargs'].items():
   142              if _key not in _all_params:
   143                  raise ApiTypeError(
   144                      "Got an unexpected keyword argument '%s'"
   145                      " to method get_meta_range" % _key
   146                  )
   147              _params[_key] = _val
   148          del _params['kwargs']
   149  
   150          _collection_formats = {}
   151  
   152          # process the path parameters
   153          _path_params = {}
   154          if _params['repository']:
   155              _path_params['repository'] = _params['repository']
   156  
   157          if _params['meta_range']:
   158              _path_params['meta_range'] = _params['meta_range']
   159  
   160  
   161          # process the query parameters
   162          _query_params = []
   163          # process the header parameters
   164          _header_params = dict(_params.get('_headers', {}))
   165          # process the form parameters
   166          _form_params = []
   167          _files = {}
   168          # process the body parameter
   169          _body_params = None
   170          # set the HTTP header `Accept`
   171          _header_params['Accept'] = self.api_client.select_header_accept(
   172              ['application/json'])  # noqa: E501
   173  
   174          # authentication setting
   175          _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token']  # noqa: E501
   176  
   177          _response_types_map = {
   178              '200': "StorageURI",
   179              '401': "Error",
   180              '404': "Error",
   181              '420': None,
   182          }
   183  
   184          return self.api_client.call_api(
   185              '/repositories/{repository}/metadata/meta_range/{meta_range}', 'GET',
   186              _path_params,
   187              _query_params,
   188              _header_params,
   189              body=_body_params,
   190              post_params=_form_params,
   191              files=_files,
   192              response_types_map=_response_types_map,
   193              auth_settings=_auth_settings,
   194              async_req=_params.get('async_req'),
   195              _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
   196              _preload_content=_params.get('_preload_content', True),
   197              _request_timeout=_params.get('_request_timeout'),
   198              collection_formats=_collection_formats,
   199              _request_auth=_params.get('_request_auth'))
   200  
   201      @validate_arguments
   202      def get_range(self, repository : StrictStr, range : StrictStr, **kwargs) -> StorageURI:  # noqa: E501
   203          """return URI to a range file  # noqa: E501
   204  
   205          This method makes a synchronous HTTP request by default. To make an
   206          asynchronous HTTP request, please pass async_req=True
   207  
   208          >>> thread = api.get_range(repository, range, async_req=True)
   209          >>> result = thread.get()
   210  
   211          :param repository: (required)
   212          :type repository: str
   213          :param range: (required)
   214          :type range: str
   215          :param async_req: Whether to execute the request asynchronously.
   216          :type async_req: bool, optional
   217          :param _request_timeout: timeout setting for this request. If one
   218                                   number provided, it will be total request
   219                                   timeout. It can also be a pair (tuple) of
   220                                   (connection, read) timeouts.
   221          :return: Returns the result object.
   222                   If the method is called asynchronously,
   223                   returns the request thread.
   224          :rtype: StorageURI
   225          """
   226          kwargs['_return_http_data_only'] = True
   227          if '_preload_content' in kwargs:
   228              raise ValueError("Error! Please call the get_range_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
   229          return self.get_range_with_http_info(repository, range, **kwargs)  # noqa: E501
   230  
   231      @validate_arguments
   232      def get_range_with_http_info(self, repository : StrictStr, range : StrictStr, **kwargs) -> ApiResponse:  # noqa: E501
   233          """return URI to a range file  # noqa: E501
   234  
   235          This method makes a synchronous HTTP request by default. To make an
   236          asynchronous HTTP request, please pass async_req=True
   237  
   238          >>> thread = api.get_range_with_http_info(repository, range, async_req=True)
   239          >>> result = thread.get()
   240  
   241          :param repository: (required)
   242          :type repository: str
   243          :param range: (required)
   244          :type range: str
   245          :param async_req: Whether to execute the request asynchronously.
   246          :type async_req: bool, optional
   247          :param _preload_content: if False, the ApiResponse.data will
   248                                   be set to none and raw_data will store the 
   249                                   HTTP response body without reading/decoding.
   250                                   Default is True.
   251          :type _preload_content: bool, optional
   252          :param _return_http_data_only: response data instead of ApiResponse
   253                                         object with status code, headers, etc
   254          :type _return_http_data_only: bool, optional
   255          :param _request_timeout: timeout setting for this request. If one
   256                                   number provided, it will be total request
   257                                   timeout. It can also be a pair (tuple) of
   258                                   (connection, read) timeouts.
   259          :param _request_auth: set to override the auth_settings for an a single
   260                                request; this effectively ignores the authentication
   261                                in the spec for a single request.
   262          :type _request_auth: dict, optional
   263          :type _content_type: string, optional: force content-type for the request
   264          :return: Returns the result object.
   265                   If the method is called asynchronously,
   266                   returns the request thread.
   267          :rtype: tuple(StorageURI, status_code(int), headers(HTTPHeaderDict))
   268          """
   269  
   270          _params = locals()
   271  
   272          _all_params = [
   273              'repository',
   274              'range'
   275          ]
   276          _all_params.extend(
   277              [
   278                  'async_req',
   279                  '_return_http_data_only',
   280                  '_preload_content',
   281                  '_request_timeout',
   282                  '_request_auth',
   283                  '_content_type',
   284                  '_headers'
   285              ]
   286          )
   287  
   288          # validate the arguments
   289          for _key, _val in _params['kwargs'].items():
   290              if _key not in _all_params:
   291                  raise ApiTypeError(
   292                      "Got an unexpected keyword argument '%s'"
   293                      " to method get_range" % _key
   294                  )
   295              _params[_key] = _val
   296          del _params['kwargs']
   297  
   298          _collection_formats = {}
   299  
   300          # process the path parameters
   301          _path_params = {}
   302          if _params['repository']:
   303              _path_params['repository'] = _params['repository']
   304  
   305          if _params['range']:
   306              _path_params['range'] = _params['range']
   307  
   308  
   309          # process the query parameters
   310          _query_params = []
   311          # process the header parameters
   312          _header_params = dict(_params.get('_headers', {}))
   313          # process the form parameters
   314          _form_params = []
   315          _files = {}
   316          # process the body parameter
   317          _body_params = None
   318          # set the HTTP header `Accept`
   319          _header_params['Accept'] = self.api_client.select_header_accept(
   320              ['application/json'])  # noqa: E501
   321  
   322          # authentication setting
   323          _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token']  # noqa: E501
   324  
   325          _response_types_map = {
   326              '200': "StorageURI",
   327              '401': "Error",
   328              '404': "Error",
   329              '420': None,
   330          }
   331  
   332          return self.api_client.call_api(
   333              '/repositories/{repository}/metadata/range/{range}', 'GET',
   334              _path_params,
   335              _query_params,
   336              _header_params,
   337              body=_body_params,
   338              post_params=_form_params,
   339              files=_files,
   340              response_types_map=_response_types_map,
   341              auth_settings=_auth_settings,
   342              async_req=_params.get('async_req'),
   343              _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
   344              _preload_content=_params.get('_preload_content', True),
   345              _request_timeout=_params.get('_request_timeout'),
   346              collection_formats=_collection_formats,
   347              _request_auth=_params.get('_request_auth'))