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