github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/lakefs_sdk/api/actions_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, conint 28 except ImportError: 29 from pydantic import Field, StrictStr, conint 30 31 from typing import Optional, Union 32 33 from lakefs_sdk.models.action_run import ActionRun 34 from lakefs_sdk.models.action_run_list import ActionRunList 35 from lakefs_sdk.models.hook_run_list import HookRunList 36 37 from lakefs_sdk.api_client import ApiClient 38 from lakefs_sdk.api_response import ApiResponse 39 from lakefs_sdk.exceptions import ( # noqa: F401 40 ApiTypeError, 41 ApiValueError 42 ) 43 44 45 class ActionsApi(object): 46 """NOTE: This class is auto generated by OpenAPI Generator 47 Ref: https://openapi-generator.tech 48 49 Do not edit the class manually. 50 """ 51 52 def __init__(self, api_client=None): 53 if api_client is None: 54 api_client = ApiClient.get_default() 55 self.api_client = api_client 56 57 @validate_arguments 58 def get_run(self, repository : StrictStr, run_id : StrictStr, **kwargs) -> ActionRun: # noqa: E501 59 """get a run # noqa: E501 60 61 This method makes a synchronous HTTP request by default. To make an 62 asynchronous HTTP request, please pass async_req=True 63 64 >>> thread = api.get_run(repository, run_id, async_req=True) 65 >>> result = thread.get() 66 67 :param repository: (required) 68 :type repository: str 69 :param run_id: (required) 70 :type run_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: ActionRun 81 """ 82 kwargs['_return_http_data_only'] = True 83 if '_preload_content' in kwargs: 84 raise ValueError("Error! Please call the get_run_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 85 return self.get_run_with_http_info(repository, run_id, **kwargs) # noqa: E501 86 87 @validate_arguments 88 def get_run_with_http_info(self, repository : StrictStr, run_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 89 """get a run # 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.get_run_with_http_info(repository, run_id, async_req=True) 95 >>> result = thread.get() 96 97 :param repository: (required) 98 :type repository: str 99 :param run_id: (required) 100 :type run_id: str 101 :param async_req: Whether to execute the request asynchronously. 102 :type async_req: bool, optional 103 :param _preload_content: if False, the ApiResponse.data will 104 be set to none and raw_data will store the 105 HTTP response body without reading/decoding. 106 Default is True. 107 :type _preload_content: bool, optional 108 :param _return_http_data_only: response data instead of ApiResponse 109 object with status code, headers, etc 110 :type _return_http_data_only: bool, optional 111 :param _request_timeout: timeout setting for this request. If one 112 number provided, it will be total request 113 timeout. It can also be a pair (tuple) of 114 (connection, read) timeouts. 115 :param _request_auth: set to override the auth_settings for an a single 116 request; this effectively ignores the authentication 117 in the spec for a single request. 118 :type _request_auth: dict, optional 119 :type _content_type: string, optional: force content-type for the request 120 :return: Returns the result object. 121 If the method is called asynchronously, 122 returns the request thread. 123 :rtype: tuple(ActionRun, status_code(int), headers(HTTPHeaderDict)) 124 """ 125 126 _params = locals() 127 128 _all_params = [ 129 'repository', 130 'run_id' 131 ] 132 _all_params.extend( 133 [ 134 'async_req', 135 '_return_http_data_only', 136 '_preload_content', 137 '_request_timeout', 138 '_request_auth', 139 '_content_type', 140 '_headers' 141 ] 142 ) 143 144 # validate the arguments 145 for _key, _val in _params['kwargs'].items(): 146 if _key not in _all_params: 147 raise ApiTypeError( 148 "Got an unexpected keyword argument '%s'" 149 " to method get_run" % _key 150 ) 151 _params[_key] = _val 152 del _params['kwargs'] 153 154 _collection_formats = {} 155 156 # process the path parameters 157 _path_params = {} 158 if _params['repository']: 159 _path_params['repository'] = _params['repository'] 160 161 if _params['run_id']: 162 _path_params['run_id'] = _params['run_id'] 163 164 165 # process the query parameters 166 _query_params = [] 167 # process the header parameters 168 _header_params = dict(_params.get('_headers', {})) 169 # process the form parameters 170 _form_params = [] 171 _files = {} 172 # process the body parameter 173 _body_params = None 174 # set the HTTP header `Accept` 175 _header_params['Accept'] = self.api_client.select_header_accept( 176 ['application/json']) # noqa: E501 177 178 # authentication setting 179 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 180 181 _response_types_map = { 182 '200': "ActionRun", 183 '401': "Error", 184 '404': "Error", 185 '420': None, 186 } 187 188 return self.api_client.call_api( 189 '/repositories/{repository}/actions/runs/{run_id}', 'GET', 190 _path_params, 191 _query_params, 192 _header_params, 193 body=_body_params, 194 post_params=_form_params, 195 files=_files, 196 response_types_map=_response_types_map, 197 auth_settings=_auth_settings, 198 async_req=_params.get('async_req'), 199 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 200 _preload_content=_params.get('_preload_content', True), 201 _request_timeout=_params.get('_request_timeout'), 202 collection_formats=_collection_formats, 203 _request_auth=_params.get('_request_auth')) 204 205 @validate_arguments 206 def get_run_hook_output(self, repository : StrictStr, run_id : StrictStr, hook_run_id : StrictStr, **kwargs) -> bytearray: # noqa: E501 207 """get run hook output # noqa: E501 208 209 This method makes a synchronous HTTP request by default. To make an 210 asynchronous HTTP request, please pass async_req=True 211 212 >>> thread = api.get_run_hook_output(repository, run_id, hook_run_id, async_req=True) 213 >>> result = thread.get() 214 215 :param repository: (required) 216 :type repository: str 217 :param run_id: (required) 218 :type run_id: str 219 :param hook_run_id: (required) 220 :type hook_run_id: str 221 :param async_req: Whether to execute the request asynchronously. 222 :type async_req: bool, optional 223 :param _request_timeout: timeout setting for this request. If one 224 number provided, it will be total request 225 timeout. It can also be a pair (tuple) of 226 (connection, read) timeouts. 227 :return: Returns the result object. 228 If the method is called asynchronously, 229 returns the request thread. 230 :rtype: bytearray 231 """ 232 kwargs['_return_http_data_only'] = True 233 if '_preload_content' in kwargs: 234 raise ValueError("Error! Please call the get_run_hook_output_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 235 return self.get_run_hook_output_with_http_info(repository, run_id, hook_run_id, **kwargs) # noqa: E501 236 237 @validate_arguments 238 def get_run_hook_output_with_http_info(self, repository : StrictStr, run_id : StrictStr, hook_run_id : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 239 """get run hook output # noqa: E501 240 241 This method makes a synchronous HTTP request by default. To make an 242 asynchronous HTTP request, please pass async_req=True 243 244 >>> thread = api.get_run_hook_output_with_http_info(repository, run_id, hook_run_id, async_req=True) 245 >>> result = thread.get() 246 247 :param repository: (required) 248 :type repository: str 249 :param run_id: (required) 250 :type run_id: str 251 :param hook_run_id: (required) 252 :type hook_run_id: str 253 :param async_req: Whether to execute the request asynchronously. 254 :type async_req: bool, optional 255 :param _preload_content: if False, the ApiResponse.data will 256 be set to none and raw_data will store the 257 HTTP response body without reading/decoding. 258 Default is True. 259 :type _preload_content: bool, optional 260 :param _return_http_data_only: response data instead of ApiResponse 261 object with status code, headers, etc 262 :type _return_http_data_only: bool, optional 263 :param _request_timeout: timeout setting for this request. If one 264 number provided, it will be total request 265 timeout. It can also be a pair (tuple) of 266 (connection, read) timeouts. 267 :param _request_auth: set to override the auth_settings for an a single 268 request; this effectively ignores the authentication 269 in the spec for a single request. 270 :type _request_auth: dict, optional 271 :type _content_type: string, optional: force content-type for the request 272 :return: Returns the result object. 273 If the method is called asynchronously, 274 returns the request thread. 275 :rtype: tuple(bytearray, status_code(int), headers(HTTPHeaderDict)) 276 """ 277 278 _params = locals() 279 280 _all_params = [ 281 'repository', 282 'run_id', 283 'hook_run_id' 284 ] 285 _all_params.extend( 286 [ 287 'async_req', 288 '_return_http_data_only', 289 '_preload_content', 290 '_request_timeout', 291 '_request_auth', 292 '_content_type', 293 '_headers' 294 ] 295 ) 296 297 # validate the arguments 298 for _key, _val in _params['kwargs'].items(): 299 if _key not in _all_params: 300 raise ApiTypeError( 301 "Got an unexpected keyword argument '%s'" 302 " to method get_run_hook_output" % _key 303 ) 304 _params[_key] = _val 305 del _params['kwargs'] 306 307 _collection_formats = {} 308 309 # process the path parameters 310 _path_params = {} 311 if _params['repository']: 312 _path_params['repository'] = _params['repository'] 313 314 if _params['run_id']: 315 _path_params['run_id'] = _params['run_id'] 316 317 if _params['hook_run_id']: 318 _path_params['hook_run_id'] = _params['hook_run_id'] 319 320 321 # process the query parameters 322 _query_params = [] 323 # process the header parameters 324 _header_params = dict(_params.get('_headers', {})) 325 # process the form parameters 326 _form_params = [] 327 _files = {} 328 # process the body parameter 329 _body_params = None 330 # set the HTTP header `Accept` 331 _header_params['Accept'] = self.api_client.select_header_accept( 332 ['application/octet-stream', 'application/json']) # noqa: E501 333 334 # authentication setting 335 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 336 337 _response_types_map = { 338 '200': "bytearray", 339 '401': "Error", 340 '404': "Error", 341 '420': None, 342 } 343 344 return self.api_client.call_api( 345 '/repositories/{repository}/actions/runs/{run_id}/hooks/{hook_run_id}/output', 'GET', 346 _path_params, 347 _query_params, 348 _header_params, 349 body=_body_params, 350 post_params=_form_params, 351 files=_files, 352 response_types_map=_response_types_map, 353 auth_settings=_auth_settings, 354 async_req=_params.get('async_req'), 355 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 356 _preload_content=_params.get('_preload_content', True), 357 _request_timeout=_params.get('_request_timeout'), 358 collection_formats=_collection_formats, 359 _request_auth=_params.get('_request_auth')) 360 361 @validate_arguments 362 def list_repository_runs(self, repository : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, branch : Optional[StrictStr] = None, commit : Optional[StrictStr] = None, **kwargs) -> ActionRunList: # noqa: E501 363 """list runs # noqa: E501 364 365 This method makes a synchronous HTTP request by default. To make an 366 asynchronous HTTP request, please pass async_req=True 367 368 >>> thread = api.list_repository_runs(repository, after, amount, branch, commit, async_req=True) 369 >>> result = thread.get() 370 371 :param repository: (required) 372 :type repository: str 373 :param after: return items after this value 374 :type after: str 375 :param amount: how many items to return 376 :type amount: int 377 :param branch: 378 :type branch: str 379 :param commit: 380 :type commit: str 381 :param async_req: Whether to execute the request asynchronously. 382 :type async_req: bool, optional 383 :param _request_timeout: timeout setting for this request. If one 384 number provided, it will be total request 385 timeout. It can also be a pair (tuple) of 386 (connection, read) timeouts. 387 :return: Returns the result object. 388 If the method is called asynchronously, 389 returns the request thread. 390 :rtype: ActionRunList 391 """ 392 kwargs['_return_http_data_only'] = True 393 if '_preload_content' in kwargs: 394 raise ValueError("Error! Please call the list_repository_runs_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 395 return self.list_repository_runs_with_http_info(repository, after, amount, branch, commit, **kwargs) # noqa: E501 396 397 @validate_arguments 398 def list_repository_runs_with_http_info(self, repository : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, branch : Optional[StrictStr] = None, commit : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 399 """list runs # noqa: E501 400 401 This method makes a synchronous HTTP request by default. To make an 402 asynchronous HTTP request, please pass async_req=True 403 404 >>> thread = api.list_repository_runs_with_http_info(repository, after, amount, branch, commit, async_req=True) 405 >>> result = thread.get() 406 407 :param repository: (required) 408 :type repository: str 409 :param after: return items after this value 410 :type after: str 411 :param amount: how many items to return 412 :type amount: int 413 :param branch: 414 :type branch: str 415 :param commit: 416 :type commit: str 417 :param async_req: Whether to execute the request asynchronously. 418 :type async_req: bool, optional 419 :param _preload_content: if False, the ApiResponse.data will 420 be set to none and raw_data will store the 421 HTTP response body without reading/decoding. 422 Default is True. 423 :type _preload_content: bool, optional 424 :param _return_http_data_only: response data instead of ApiResponse 425 object with status code, headers, etc 426 :type _return_http_data_only: bool, optional 427 :param _request_timeout: timeout setting for this request. If one 428 number provided, it will be total request 429 timeout. It can also be a pair (tuple) of 430 (connection, read) timeouts. 431 :param _request_auth: set to override the auth_settings for an a single 432 request; this effectively ignores the authentication 433 in the spec for a single request. 434 :type _request_auth: dict, optional 435 :type _content_type: string, optional: force content-type for the request 436 :return: Returns the result object. 437 If the method is called asynchronously, 438 returns the request thread. 439 :rtype: tuple(ActionRunList, status_code(int), headers(HTTPHeaderDict)) 440 """ 441 442 _params = locals() 443 444 _all_params = [ 445 'repository', 446 'after', 447 'amount', 448 'branch', 449 'commit' 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 list_repository_runs" % _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 481 # process the query parameters 482 _query_params = [] 483 if _params.get('after') is not None: # noqa: E501 484 _query_params.append(('after', _params['after'])) 485 486 if _params.get('amount') is not None: # noqa: E501 487 _query_params.append(('amount', _params['amount'])) 488 489 if _params.get('branch') is not None: # noqa: E501 490 _query_params.append(('branch', _params['branch'])) 491 492 if _params.get('commit') is not None: # noqa: E501 493 _query_params.append(('commit', _params['commit'])) 494 495 # process the header parameters 496 _header_params = dict(_params.get('_headers', {})) 497 # process the form parameters 498 _form_params = [] 499 _files = {} 500 # process the body parameter 501 _body_params = None 502 # set the HTTP header `Accept` 503 _header_params['Accept'] = self.api_client.select_header_accept( 504 ['application/json']) # noqa: E501 505 506 # authentication setting 507 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 508 509 _response_types_map = { 510 '200': "ActionRunList", 511 '401': "Error", 512 '404': "Error", 513 '420': None, 514 } 515 516 return self.api_client.call_api( 517 '/repositories/{repository}/actions/runs', 'GET', 518 _path_params, 519 _query_params, 520 _header_params, 521 body=_body_params, 522 post_params=_form_params, 523 files=_files, 524 response_types_map=_response_types_map, 525 auth_settings=_auth_settings, 526 async_req=_params.get('async_req'), 527 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 528 _preload_content=_params.get('_preload_content', True), 529 _request_timeout=_params.get('_request_timeout'), 530 collection_formats=_collection_formats, 531 _request_auth=_params.get('_request_auth')) 532 533 @validate_arguments 534 def list_run_hooks(self, repository : StrictStr, run_id : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> HookRunList: # noqa: E501 535 """list run hooks # noqa: E501 536 537 This method makes a synchronous HTTP request by default. To make an 538 asynchronous HTTP request, please pass async_req=True 539 540 >>> thread = api.list_run_hooks(repository, run_id, after, amount, async_req=True) 541 >>> result = thread.get() 542 543 :param repository: (required) 544 :type repository: str 545 :param run_id: (required) 546 :type run_id: str 547 :param after: return items after this value 548 :type after: str 549 :param amount: how many items to return 550 :type amount: int 551 :param async_req: Whether to execute the request asynchronously. 552 :type async_req: bool, optional 553 :param _request_timeout: timeout setting for this request. If one 554 number provided, it will be total request 555 timeout. It can also be a pair (tuple) of 556 (connection, read) timeouts. 557 :return: Returns the result object. 558 If the method is called asynchronously, 559 returns the request thread. 560 :rtype: HookRunList 561 """ 562 kwargs['_return_http_data_only'] = True 563 if '_preload_content' in kwargs: 564 raise ValueError("Error! Please call the list_run_hooks_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") 565 return self.list_run_hooks_with_http_info(repository, run_id, after, amount, **kwargs) # noqa: E501 566 567 @validate_arguments 568 def list_run_hooks_with_http_info(self, repository : StrictStr, run_id : StrictStr, after : Annotated[Optional[StrictStr], Field(description="return items after this value")] = None, amount : Annotated[Optional[conint(strict=True, le=1000, ge=-1)], Field(description="how many items to return")] = None, **kwargs) -> ApiResponse: # noqa: E501 569 """list run hooks # noqa: E501 570 571 This method makes a synchronous HTTP request by default. To make an 572 asynchronous HTTP request, please pass async_req=True 573 574 >>> thread = api.list_run_hooks_with_http_info(repository, run_id, after, amount, async_req=True) 575 >>> result = thread.get() 576 577 :param repository: (required) 578 :type repository: str 579 :param run_id: (required) 580 :type run_id: str 581 :param after: return items after this value 582 :type after: str 583 :param amount: how many items to return 584 :type amount: int 585 :param async_req: Whether to execute the request asynchronously. 586 :type async_req: bool, optional 587 :param _preload_content: if False, the ApiResponse.data will 588 be set to none and raw_data will store the 589 HTTP response body without reading/decoding. 590 Default is True. 591 :type _preload_content: bool, optional 592 :param _return_http_data_only: response data instead of ApiResponse 593 object with status code, headers, etc 594 :type _return_http_data_only: bool, optional 595 :param _request_timeout: timeout setting for this request. If one 596 number provided, it will be total request 597 timeout. It can also be a pair (tuple) of 598 (connection, read) timeouts. 599 :param _request_auth: set to override the auth_settings for an a single 600 request; this effectively ignores the authentication 601 in the spec for a single request. 602 :type _request_auth: dict, optional 603 :type _content_type: string, optional: force content-type for the request 604 :return: Returns the result object. 605 If the method is called asynchronously, 606 returns the request thread. 607 :rtype: tuple(HookRunList, status_code(int), headers(HTTPHeaderDict)) 608 """ 609 610 _params = locals() 611 612 _all_params = [ 613 'repository', 614 'run_id', 615 'after', 616 'amount' 617 ] 618 _all_params.extend( 619 [ 620 'async_req', 621 '_return_http_data_only', 622 '_preload_content', 623 '_request_timeout', 624 '_request_auth', 625 '_content_type', 626 '_headers' 627 ] 628 ) 629 630 # validate the arguments 631 for _key, _val in _params['kwargs'].items(): 632 if _key not in _all_params: 633 raise ApiTypeError( 634 "Got an unexpected keyword argument '%s'" 635 " to method list_run_hooks" % _key 636 ) 637 _params[_key] = _val 638 del _params['kwargs'] 639 640 _collection_formats = {} 641 642 # process the path parameters 643 _path_params = {} 644 if _params['repository']: 645 _path_params['repository'] = _params['repository'] 646 647 if _params['run_id']: 648 _path_params['run_id'] = _params['run_id'] 649 650 651 # process the query parameters 652 _query_params = [] 653 if _params.get('after') is not None: # noqa: E501 654 _query_params.append(('after', _params['after'])) 655 656 if _params.get('amount') is not None: # noqa: E501 657 _query_params.append(('amount', _params['amount'])) 658 659 # process the header parameters 660 _header_params = dict(_params.get('_headers', {})) 661 # process the form parameters 662 _form_params = [] 663 _files = {} 664 # process the body parameter 665 _body_params = None 666 # set the HTTP header `Accept` 667 _header_params['Accept'] = self.api_client.select_header_accept( 668 ['application/json']) # noqa: E501 669 670 # authentication setting 671 _auth_settings = ['basic_auth', 'cookie_auth', 'oidc_auth', 'saml_auth', 'jwt_token'] # noqa: E501 672 673 _response_types_map = { 674 '200': "HookRunList", 675 '401': "Error", 676 '404': "Error", 677 '420': None, 678 } 679 680 return self.api_client.call_api( 681 '/repositories/{repository}/actions/runs/{run_id}/hooks', 'GET', 682 _path_params, 683 _query_params, 684 _header_params, 685 body=_body_params, 686 post_params=_form_params, 687 files=_files, 688 response_types_map=_response_types_map, 689 auth_settings=_auth_settings, 690 async_req=_params.get('async_req'), 691 _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 692 _preload_content=_params.get('_preload_content', True), 693 _request_timeout=_params.get('_request_timeout'), 694 collection_formats=_collection_formats, 695 _request_auth=_params.get('_request_auth'))