github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/api/import_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 Field, StrictStr 28 except ImportError: 29 from pydantic import Field, StrictStr 30 31 from lakefs_sdk.models.import_creation import ImportCreation 32 from lakefs_sdk.models.import_creation_response import ImportCreationResponse 33 from lakefs_sdk.models.import_status import ImportStatus 34 35 from lakefs_sdk.api_client import ApiClient 36 from lakefs_sdk.api_response import ApiResponse 37 from lakefs_sdk.exceptions import ( # noqa: F401 38 ApiTypeError, 39 ApiValueError 40 ) 41 42 43 class ImportApi(object): 44 """NOTE: This class is auto generated by OpenAPI Generator 45 Ref: https://openapi-generator.tech 46 47 Do not edit the class manually. 48 """ 49 50 def __init__(self, api_client=None): 51 if api_client is None: 52 api_client = ApiClient.get_default() 53 self.api_client = api_client 54 55 @validate_arguments 56 def import_cancel(self, repository : StrictStr, branch : StrictStr, id : Annotated[StrictStr, Field(..., description="Unique identifier of the import process")], **kwargs) -> None: # noqa: E501 57 """cancel ongoing import # noqa: E501 58 59 This method makes a synchronous HTTP request by default. To make an 60 asynchronous HTTP request, please pass async_req=True 61 62 >>> thread = api.import_cancel(repository, branch, id, async_req=True) 63 >>> result = thread.get() 64 65 :param repository: (required) 66 :type repository: str 67 :param branch: (required) 68 :type branch: str 69 :param id: Unique identifier of the import process (required) 70 :type id: str 71 :param async_req: Whether to execute the request asynchronously. 72 :type async_req: bool, optional 73 :param _request_timeout: timeout setting for this request. If one 74 number provided, it will be total request 75 timeout. It can also be a pair (tuple) of 76 (connection, read) timeouts. 77 :return: Returns the result object. 78 If the method is called asynchronously, 79 returns the request thread. 80 :rtype: None 81 """ 82 kwargs['_return_http_data_only'] = True 83 if '_preload_content' in kwargs: 84 raise ValueError("Error! Please call the import_cancel_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 85 return self.import_cancel_with_http_info(repository, branch, id, **kwargs) # noqa: E501 86 87 @validate_arguments 88 def import_cancel_with_http_info(self, repository : StrictStr, branch : StrictStr, id : Annotated[StrictStr, Field(..., description="Unique identifier of the import process")], **kwargs) -> ApiResponse: # noqa: E501 89 """cancel ongoing import # noqa: E501 90 91 This method makes a synchronous HTTP request by default. To make an 92 asynchronous HTTP request, please pass async_req=True 93 94 >>> thread = api.import_cancel_with_http_info(repository, branch, id, async_req=True) 95 >>> result = thread.get() 96 97 :param repository: (required) 98 :type repository: str 99 :param branch: (required) 100 :type branch: str 101 :param id: Unique identifier of the import process (required) 102 :type id: str 103 :param async_req: Whether to execute the request asynchronously. 104 :type async_req: bool, optional 105 :param _preload_content: if False, the ApiResponse.data will 106 be set to none and raw_data will store the 107 HTTP response body without reading/decoding. 108 Default is True. 109 :type _preload_content: bool, optional 110 :param _return_http_data_only: response data instead of ApiResponse 111 object with status code, headers, etc 112 :type _return_http_data_only: bool, optional 113 :param _request_timeout: timeout setting for this request. If one 114 number provided, it will be total request 115 timeout. It can also be a pair (tuple) of 116 (connection, read) timeouts. 117 :param _request_auth: set to override the auth_settings for an a single 118 request; this effectively ignores the authentication 119 in the spec for a single request. 120 :type _request_auth: dict, optional 121 :type _content_type: string, optional: force content-type for the request 122 :return: Returns the result object. 123 If the method is called asynchronously, 124 returns the request thread. 125 :rtype: None 126 """ 127 128 _params = locals() 129 130 _all_params = [ 131 'repository', 132 'branch', 133 'id' 134 ] 135 _all_params.extend( 136 [ 137 'async_req', 138 '_return_http_data_only', 139 '_preload_content', 140 '_request_timeout', 141 '_request_auth', 142 '_content_type', 143 '_headers' 144 ] 145 ) 146 147 # validate the arguments 148 for _key, _val in _params['kwargs'].items(): 149 if _key not in _all_params: 150 raise ApiTypeError( 151 "Got an unexpected keyword argument '%s'" 152 " to method import_cancel" % _key 153 ) 154 _params[_key] = _val 155 del _params['kwargs'] 156 157 _collection_formats = {} 158 159 # process the path parameters 160 _path_params = {} 161 if _params['repository']: 162 _path_params['repository'] = _params['repository'] 163 164 if _params['branch']: 165 _path_params['branch'] = _params['branch'] 166 167 168 # process the query parameters 169 _query_params = [] 170 if _params.get('id') is not None: # noqa: E501 171 _query_params.append(('id', _params['id'])) 172 173 # process the header parameters 174 _header_params = dict(_params.get('_headers', {})) 175 # process the form parameters 176 _form_params = [] 177 _files = {} 178 # process the body parameter 179 _body_params = None 180 # set the HTTP header `Accept` 181 _header_params['Accept'] = self.api_client.select_header_accept( 182 ['application/json']) # noqa: E501 183 184 # authentication setting 185 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 186 187 _response_types_map = {} 188 189 return self.api_client.call_api( 190 '/repositories/{repository}/branches/{branch}/import', 'DELETE', 191 _path_params, 192 _query_params, 193 _header_params, 194 body=_body_params, 195 post_params=_form_params, 196 files=_files, 197 response_types_map=_response_types_map, 198 auth_settings=_auth_settings, 199 async_req=_params.get('async_req'), 200 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 201 _preload_content=_params.get('_preload_content', True), 202 _request_timeout=_params.get('_request_timeout'), 203 collection_formats=_collection_formats, 204 _request_auth=_params.get('_request_auth')) 205 206 @validate_arguments 207 def import_start(self, repository : StrictStr, branch : StrictStr, import_creation : ImportCreation, **kwargs) -> ImportCreationResponse: # noqa: E501 208 """import data from object store # noqa: E501 209 210 This method makes a synchronous HTTP request by default. To make an 211 asynchronous HTTP request, please pass async_req=True 212 213 >>> thread = api.import_start(repository, branch, import_creation, async_req=True) 214 >>> result = thread.get() 215 216 :param repository: (required) 217 :type repository: str 218 :param branch: (required) 219 :type branch: str 220 :param import_creation: (required) 221 :type import_creation: ImportCreation 222 :param async_req: Whether to execute the request asynchronously. 223 :type async_req: bool, optional 224 :param _request_timeout: timeout setting for this request. If one 225 number provided, it will be total request 226 timeout. It can also be a pair (tuple) of 227 (connection, read) timeouts. 228 :return: Returns the result object. 229 If the method is called asynchronously, 230 returns the request thread. 231 :rtype: ImportCreationResponse 232 """ 233 kwargs['_return_http_data_only'] = True 234 if '_preload_content' in kwargs: 235 raise ValueError("Error! Please call the import_start_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 236 return self.import_start_with_http_info(repository, branch, import_creation, **kwargs) # noqa: E501 237 238 @validate_arguments 239 def import_start_with_http_info(self, repository : StrictStr, branch : StrictStr, import_creation : ImportCreation, **kwargs) -> ApiResponse: # noqa: E501 240 """import data from object store # noqa: E501 241 242 This method makes a synchronous HTTP request by default. To make an 243 asynchronous HTTP request, please pass async_req=True 244 245 >>> thread = api.import_start_with_http_info(repository, branch, import_creation, async_req=True) 246 >>> result = thread.get() 247 248 :param repository: (required) 249 :type repository: str 250 :param branch: (required) 251 :type branch: str 252 :param import_creation: (required) 253 :type import_creation: ImportCreation 254 :param async_req: Whether to execute the request asynchronously. 255 :type async_req: bool, optional 256 :param _preload_content: if False, the ApiResponse.data will 257 be set to none and raw_data will store the 258 HTTP response body without reading/decoding. 259 Default is True. 260 :type _preload_content: bool, optional 261 :param _return_http_data_only: response data instead of ApiResponse 262 object with status code, headers, etc 263 :type _return_http_data_only: bool, optional 264 :param _request_timeout: timeout setting for this request. If one 265 number provided, it will be total request 266 timeout. It can also be a pair (tuple) of 267 (connection, read) timeouts. 268 :param _request_auth: set to override the auth_settings for an a single 269 request; this effectively ignores the authentication 270 in the spec for a single request. 271 :type _request_auth: dict, optional 272 :type _content_type: string, optional: force content-type for the request 273 :return: Returns the result object. 274 If the method is called asynchronously, 275 returns the request thread. 276 :rtype: tuple(ImportCreationResponse, status_code(int), headers(HTTPHeaderDict)) 277 """ 278 279 _params = locals() 280 281 _all_params = [ 282 'repository', 283 'branch', 284 'import_creation' 285 ] 286 _all_params.extend( 287 [ 288 'async_req', 289 '_return_http_data_only', 290 '_preload_content', 291 '_request_timeout', 292 '_request_auth', 293 '_content_type', 294 '_headers' 295 ] 296 ) 297 298 # validate the arguments 299 for _key, _val in _params['kwargs'].items(): 300 if _key not in _all_params: 301 raise ApiTypeError( 302 "Got an unexpected keyword argument '%s'" 303 " to method import_start" % _key 304 ) 305 _params[_key] = _val 306 del _params['kwargs'] 307 308 _collection_formats = {} 309 310 # process the path parameters 311 _path_params = {} 312 if _params['repository']: 313 _path_params['repository'] = _params['repository'] 314 315 if _params['branch']: 316 _path_params['branch'] = _params['branch'] 317 318 319 # process the query parameters 320 _query_params = [] 321 # process the header parameters 322 _header_params = dict(_params.get('_headers', {})) 323 # process the form parameters 324 _form_params = [] 325 _files = {} 326 # process the body parameter 327 _body_params = None 328 if _params['import_creation'] is not None: 329 _body_params = _params['import_creation'] 330 331 # set the HTTP header `Accept` 332 _header_params['Accept'] = self.api_client.select_header_accept( 333 ['application/json']) # noqa: E501 334 335 # set the HTTP header `Content-Type` 336 _content_types_list = _params.get('_content_type', 337 self.api_client.select_header_content_type( 338 ['application/json'])) 339 if _content_types_list: 340 _header_params['Content-Type'] = _content_types_list 341 342 # authentication setting 343 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 344 345 _response_types_map = { 346 '202': "ImportCreationResponse", 347 '400': "Error", 348 '401': "Error", 349 '403': "Error", 350 '404': "Error", 351 '420': None, 352 } 353 354 return self.api_client.call_api( 355 '/repositories/{repository}/branches/{branch}/import', 'POST', 356 _path_params, 357 _query_params, 358 _header_params, 359 body=_body_params, 360 post_params=_form_params, 361 files=_files, 362 response_types_map=_response_types_map, 363 auth_settings=_auth_settings, 364 async_req=_params.get('async_req'), 365 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 366 _preload_content=_params.get('_preload_content', True), 367 _request_timeout=_params.get('_request_timeout'), 368 collection_formats=_collection_formats, 369 _request_auth=_params.get('_request_auth')) 370 371 @validate_arguments 372 def import_status(self, repository : StrictStr, branch : StrictStr, id : Annotated[StrictStr, Field(..., description="Unique identifier of the import process")], **kwargs) -> ImportStatus: # noqa: E501 373 """get import status # noqa: E501 374 375 This method makes a synchronous HTTP request by default. To make an 376 asynchronous HTTP request, please pass async_req=True 377 378 >>> thread = api.import_status(repository, branch, id, async_req=True) 379 >>> result = thread.get() 380 381 :param repository: (required) 382 :type repository: str 383 :param branch: (required) 384 :type branch: str 385 :param id: Unique identifier of the import process (required) 386 :type id: str 387 :param async_req: Whether to execute the request asynchronously. 388 :type async_req: bool, optional 389 :param _request_timeout: timeout setting for this request. If one 390 number provided, it will be total request 391 timeout. It can also be a pair (tuple) of 392 (connection, read) timeouts. 393 :return: Returns the result object. 394 If the method is called asynchronously, 395 returns the request thread. 396 :rtype: ImportStatus 397 """ 398 kwargs['_return_http_data_only'] = True 399 if '_preload_content' in kwargs: 400 raise ValueError("Error! Please call the import_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 401 return self.import_status_with_http_info(repository, branch, id, **kwargs) # noqa: E501 402 403 @validate_arguments 404 def import_status_with_http_info(self, repository : StrictStr, branch : StrictStr, id : Annotated[StrictStr, Field(..., description="Unique identifier of the import process")], **kwargs) -> ApiResponse: # noqa: E501 405 """get import status # 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.import_status_with_http_info(repository, branch, id, async_req=True) 411 >>> result = thread.get() 412 413 :param repository: (required) 414 :type repository: str 415 :param branch: (required) 416 :type branch: str 417 :param id: Unique identifier of the import process (required) 418 :type id: str 419 :param async_req: Whether to execute the request asynchronously. 420 :type async_req: bool, optional 421 :param _preload_content: if False, the ApiResponse.data will 422 be set to none and raw_data will store the 423 HTTP response body without reading/decoding. 424 Default is True. 425 :type _preload_content: bool, optional 426 :param _return_http_data_only: response data instead of ApiResponse 427 object with status code, headers, etc 428 :type _return_http_data_only: bool, optional 429 :param _request_timeout: timeout setting for this request. If one 430 number provided, it will be total request 431 timeout. It can also be a pair (tuple) of 432 (connection, read) timeouts. 433 :param _request_auth: set to override the auth_settings for an a single 434 request; this effectively ignores the authentication 435 in the spec for a single request. 436 :type _request_auth: dict, optional 437 :type _content_type: string, optional: force content-type for the request 438 :return: Returns the result object. 439 If the method is called asynchronously, 440 returns the request thread. 441 :rtype: tuple(ImportStatus, status_code(int), headers(HTTPHeaderDict)) 442 """ 443 444 _params = locals() 445 446 _all_params = [ 447 'repository', 448 'branch', 449 'id' 450 ] 451 _all_params.extend( 452 [ 453 'async_req', 454 '_return_http_data_only', 455 '_preload_content', 456 '_request_timeout', 457 '_request_auth', 458 '_content_type', 459 '_headers' 460 ] 461 ) 462 463 # validate the arguments 464 for _key, _val in _params['kwargs'].items(): 465 if _key not in _all_params: 466 raise ApiTypeError( 467 "Got an unexpected keyword argument '%s'" 468 " to method import_status" % _key 469 ) 470 _params[_key] = _val 471 del _params['kwargs'] 472 473 _collection_formats = {} 474 475 # process the path parameters 476 _path_params = {} 477 if _params['repository']: 478 _path_params['repository'] = _params['repository'] 479 480 if _params['branch']: 481 _path_params['branch'] = _params['branch'] 482 483 484 # process the query parameters 485 _query_params = [] 486 if _params.get('id') is not None: # noqa: E501 487 _query_params.append(('id', _params['id'])) 488 489 # process the header parameters 490 _header_params = dict(_params.get('_headers', {})) 491 # process the form parameters 492 _form_params = [] 493 _files = {} 494 # process the body parameter 495 _body_params = None 496 # set the HTTP header `Accept` 497 _header_params['Accept'] = self.api_client.select_header_accept( 498 ['application/json']) # noqa: E501 499 500 # authentication setting 501 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 502 503 _response_types_map = { 504 '200': "ImportStatus", 505 '401': "Error", 506 '404': "Error", 507 '420': None, 508 } 509 510 return self.api_client.call_api( 511 '/repositories/{repository}/branches/{branch}/import', 'GET', 512 _path_params, 513 _query_params, 514 _header_params, 515 body=_body_params, 516 post_params=_form_params, 517 files=_files, 518 response_types_map=_response_types_map, 519 auth_settings=_auth_settings, 520 async_req=_params.get('async_req'), 521 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 522 _preload_content=_params.get('_preload_content', True), 523 _request_timeout=_params.get('_request_timeout'), 524 collection_formats=_collection_formats, 525 _request_auth=_params.get('_request_auth'))