github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python/docs/ExternalApi.md (about)

     1  # lakefs_sdk.ExternalApi
     2  
     3  All URIs are relative to */api/v1*
     4  
     5  Method | HTTP request | Description
     6  ------------- | ------------- | -------------
     7  [**create_user_external_principal**](ExternalApi.md#create_user_external_principal) | **POST** /auth/users/{userId}/external/principals | attach external principal to user
     8  [**delete_user_external_principal**](ExternalApi.md#delete_user_external_principal) | **DELETE** /auth/users/{userId}/external/principals | delete external principal from user
     9  [**external_principal_login**](ExternalApi.md#external_principal_login) | **POST** /auth/external/principal/login | perform a login using an external authenticator
    10  [**get_external_principal**](ExternalApi.md#get_external_principal) | **GET** /auth/external/principals | describe external principal by id
    11  [**list_user_external_principals**](ExternalApi.md#list_user_external_principals) | **GET** /auth/users/{userId}/external/principals/ls | list user external policies attached to a user
    12  
    13  
    14  # **create_user_external_principal**
    15  > create_user_external_principal(user_id, principal_id, external_principal_creation=external_principal_creation)
    16  
    17  attach external principal to user
    18  
    19  ### Example
    20  
    21  * Basic Authentication (basic_auth):
    22  * Api Key Authentication (cookie_auth):
    23  * Api Key Authentication (oidc_auth):
    24  * Api Key Authentication (saml_auth):
    25  * Bearer (JWT) Authentication (jwt_token):
    26  
    27  ```python
    28  import time
    29  import os
    30  import lakefs_sdk
    31  from lakefs_sdk.models.external_principal_creation import ExternalPrincipalCreation
    32  from lakefs_sdk.rest import ApiException
    33  from pprint import pprint
    34  
    35  # Defining the host is optional and defaults to /api/v1
    36  # See configuration.py for a list of all supported configuration parameters.
    37  configuration = lakefs_sdk.Configuration(
    38      host = "/api/v1"
    39  )
    40  
    41  # The client must configure the authentication and authorization parameters
    42  # in accordance with the API server security policy.
    43  # Examples for each auth method are provided below, use the example that
    44  # satisfies your auth use case.
    45  
    46  # Configure HTTP basic authorization: basic_auth
    47  configuration = lakefs_sdk.Configuration(
    48      username = os.environ["USERNAME"],
    49      password = os.environ["PASSWORD"]
    50  )
    51  
    52  # Configure API key authorization: cookie_auth
    53  configuration.api_key['cookie_auth'] = os.environ["API_KEY"]
    54  
    55  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    56  # configuration.api_key_prefix['cookie_auth'] = 'Bearer'
    57  
    58  # Configure API key authorization: oidc_auth
    59  configuration.api_key['oidc_auth'] = os.environ["API_KEY"]
    60  
    61  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    62  # configuration.api_key_prefix['oidc_auth'] = 'Bearer'
    63  
    64  # Configure API key authorization: saml_auth
    65  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
    66  
    67  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    68  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
    69  
    70  # Configure Bearer authorization (JWT): jwt_token
    71  configuration = lakefs_sdk.Configuration(
    72      access_token = os.environ["BEARER_TOKEN"]
    73  )
    74  
    75  # Enter a context with an instance of the API client
    76  with lakefs_sdk.ApiClient(configuration) as api_client:
    77      # Create an instance of the API class
    78      api_instance = lakefs_sdk.ExternalApi(api_client)
    79      user_id = 'user_id_example' # str | 
    80      principal_id = 'principal_id_example' # str | 
    81      external_principal_creation = lakefs_sdk.ExternalPrincipalCreation() # ExternalPrincipalCreation |  (optional)
    82  
    83      try:
    84          # attach external principal to user
    85          api_instance.create_user_external_principal(user_id, principal_id, external_principal_creation=external_principal_creation)
    86      except Exception as e:
    87          print("Exception when calling ExternalApi->create_user_external_principal: %s\n" % e)
    88  ```
    89  
    90  
    91  
    92  ### Parameters
    93  
    94  
    95  Name | Type | Description  | Notes
    96  ------------- | ------------- | ------------- | -------------
    97   **user_id** | **str**|  | 
    98   **principal_id** | **str**|  | 
    99   **external_principal_creation** | [**ExternalPrincipalCreation**](ExternalPrincipalCreation.md)|  | [optional] 
   100  
   101  ### Return type
   102  
   103  void (empty response body)
   104  
   105  ### Authorization
   106  
   107  [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token)
   108  
   109  ### HTTP request headers
   110  
   111   - **Content-Type**: application/json
   112   - **Accept**: application/json
   113  
   114  ### HTTP response details
   115  
   116  | Status code | Description | Response headers |
   117  |-------------|-------------|------------------|
   118  **201** | external principal attached successfully |  -  |
   119  **401** | Unauthorized |  -  |
   120  **404** | Resource Not Found |  -  |
   121  **409** | Resource Conflicts With Target |  -  |
   122  **420** | too many requests |  -  |
   123  **0** | Internal Server Error |  -  |
   124  
   125  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   126  
   127  # **delete_user_external_principal**
   128  > delete_user_external_principal(user_id, principal_id)
   129  
   130  delete external principal from user
   131  
   132  ### Example
   133  
   134  * Basic Authentication (basic_auth):
   135  * Api Key Authentication (cookie_auth):
   136  * Api Key Authentication (oidc_auth):
   137  * Api Key Authentication (saml_auth):
   138  * Bearer (JWT) Authentication (jwt_token):
   139  
   140  ```python
   141  import time
   142  import os
   143  import lakefs_sdk
   144  from lakefs_sdk.rest import ApiException
   145  from pprint import pprint
   146  
   147  # Defining the host is optional and defaults to /api/v1
   148  # See configuration.py for a list of all supported configuration parameters.
   149  configuration = lakefs_sdk.Configuration(
   150      host = "/api/v1"
   151  )
   152  
   153  # The client must configure the authentication and authorization parameters
   154  # in accordance with the API server security policy.
   155  # Examples for each auth method are provided below, use the example that
   156  # satisfies your auth use case.
   157  
   158  # Configure HTTP basic authorization: basic_auth
   159  configuration = lakefs_sdk.Configuration(
   160      username = os.environ["USERNAME"],
   161      password = os.environ["PASSWORD"]
   162  )
   163  
   164  # Configure API key authorization: cookie_auth
   165  configuration.api_key['cookie_auth'] = os.environ["API_KEY"]
   166  
   167  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   168  # configuration.api_key_prefix['cookie_auth'] = 'Bearer'
   169  
   170  # Configure API key authorization: oidc_auth
   171  configuration.api_key['oidc_auth'] = os.environ["API_KEY"]
   172  
   173  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   174  # configuration.api_key_prefix['oidc_auth'] = 'Bearer'
   175  
   176  # Configure API key authorization: saml_auth
   177  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
   178  
   179  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   180  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
   181  
   182  # Configure Bearer authorization (JWT): jwt_token
   183  configuration = lakefs_sdk.Configuration(
   184      access_token = os.environ["BEARER_TOKEN"]
   185  )
   186  
   187  # Enter a context with an instance of the API client
   188  with lakefs_sdk.ApiClient(configuration) as api_client:
   189      # Create an instance of the API class
   190      api_instance = lakefs_sdk.ExternalApi(api_client)
   191      user_id = 'user_id_example' # str | 
   192      principal_id = 'principal_id_example' # str | 
   193  
   194      try:
   195          # delete external principal from user
   196          api_instance.delete_user_external_principal(user_id, principal_id)
   197      except Exception as e:
   198          print("Exception when calling ExternalApi->delete_user_external_principal: %s\n" % e)
   199  ```
   200  
   201  
   202  
   203  ### Parameters
   204  
   205  
   206  Name | Type | Description  | Notes
   207  ------------- | ------------- | ------------- | -------------
   208   **user_id** | **str**|  | 
   209   **principal_id** | **str**|  | 
   210  
   211  ### Return type
   212  
   213  void (empty response body)
   214  
   215  ### Authorization
   216  
   217  [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token)
   218  
   219  ### HTTP request headers
   220  
   221   - **Content-Type**: Not defined
   222   - **Accept**: application/json
   223  
   224  ### HTTP response details
   225  
   226  | Status code | Description | Response headers |
   227  |-------------|-------------|------------------|
   228  **204** | external principal detached successfully |  -  |
   229  **401** | Unauthorized |  -  |
   230  **404** | Resource Not Found |  -  |
   231  **420** | too many requests |  -  |
   232  **0** | Internal Server Error |  -  |
   233  
   234  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   235  
   236  # **external_principal_login**
   237  > AuthenticationToken external_principal_login(external_login_information=external_login_information)
   238  
   239  perform a login using an external authenticator
   240  
   241  ### Example
   242  
   243  
   244  ```python
   245  import time
   246  import os
   247  import lakefs_sdk
   248  from lakefs_sdk.models.authentication_token import AuthenticationToken
   249  from lakefs_sdk.models.external_login_information import ExternalLoginInformation
   250  from lakefs_sdk.rest import ApiException
   251  from pprint import pprint
   252  
   253  # Defining the host is optional and defaults to /api/v1
   254  # See configuration.py for a list of all supported configuration parameters.
   255  configuration = lakefs_sdk.Configuration(
   256      host = "/api/v1"
   257  )
   258  
   259  
   260  # Enter a context with an instance of the API client
   261  with lakefs_sdk.ApiClient(configuration) as api_client:
   262      # Create an instance of the API class
   263      api_instance = lakefs_sdk.ExternalApi(api_client)
   264      external_login_information = lakefs_sdk.ExternalLoginInformation() # ExternalLoginInformation |  (optional)
   265  
   266      try:
   267          # perform a login using an external authenticator
   268          api_response = api_instance.external_principal_login(external_login_information=external_login_information)
   269          print("The response of ExternalApi->external_principal_login:\n")
   270          pprint(api_response)
   271      except Exception as e:
   272          print("Exception when calling ExternalApi->external_principal_login: %s\n" % e)
   273  ```
   274  
   275  
   276  
   277  ### Parameters
   278  
   279  
   280  Name | Type | Description  | Notes
   281  ------------- | ------------- | ------------- | -------------
   282   **external_login_information** | [**ExternalLoginInformation**](ExternalLoginInformation.md)|  | [optional] 
   283  
   284  ### Return type
   285  
   286  [**AuthenticationToken**](AuthenticationToken.md)
   287  
   288  ### Authorization
   289  
   290  No authorization required
   291  
   292  ### HTTP request headers
   293  
   294   - **Content-Type**: application/json
   295   - **Accept**: application/json
   296  
   297  ### HTTP response details
   298  
   299  | Status code | Description | Response headers |
   300  |-------------|-------------|------------------|
   301  **200** | successful external login |  -  |
   302  **400** | Bad Request |  -  |
   303  **401** | Unauthorized |  -  |
   304  **403** | Forbidden |  -  |
   305  **404** | Resource Not Found |  -  |
   306  **420** | too many requests |  -  |
   307  **0** | Internal Server Error |  -  |
   308  
   309  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   310  
   311  # **get_external_principal**
   312  > ExternalPrincipal get_external_principal(principal_id)
   313  
   314  describe external principal by id
   315  
   316  ### Example
   317  
   318  * Basic Authentication (basic_auth):
   319  * Api Key Authentication (cookie_auth):
   320  * Api Key Authentication (oidc_auth):
   321  * Api Key Authentication (saml_auth):
   322  * Bearer (JWT) Authentication (jwt_token):
   323  
   324  ```python
   325  import time
   326  import os
   327  import lakefs_sdk
   328  from lakefs_sdk.models.external_principal import ExternalPrincipal
   329  from lakefs_sdk.rest import ApiException
   330  from pprint import pprint
   331  
   332  # Defining the host is optional and defaults to /api/v1
   333  # See configuration.py for a list of all supported configuration parameters.
   334  configuration = lakefs_sdk.Configuration(
   335      host = "/api/v1"
   336  )
   337  
   338  # The client must configure the authentication and authorization parameters
   339  # in accordance with the API server security policy.
   340  # Examples for each auth method are provided below, use the example that
   341  # satisfies your auth use case.
   342  
   343  # Configure HTTP basic authorization: basic_auth
   344  configuration = lakefs_sdk.Configuration(
   345      username = os.environ["USERNAME"],
   346      password = os.environ["PASSWORD"]
   347  )
   348  
   349  # Configure API key authorization: cookie_auth
   350  configuration.api_key['cookie_auth'] = os.environ["API_KEY"]
   351  
   352  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   353  # configuration.api_key_prefix['cookie_auth'] = 'Bearer'
   354  
   355  # Configure API key authorization: oidc_auth
   356  configuration.api_key['oidc_auth'] = os.environ["API_KEY"]
   357  
   358  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   359  # configuration.api_key_prefix['oidc_auth'] = 'Bearer'
   360  
   361  # Configure API key authorization: saml_auth
   362  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
   363  
   364  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   365  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
   366  
   367  # Configure Bearer authorization (JWT): jwt_token
   368  configuration = lakefs_sdk.Configuration(
   369      access_token = os.environ["BEARER_TOKEN"]
   370  )
   371  
   372  # Enter a context with an instance of the API client
   373  with lakefs_sdk.ApiClient(configuration) as api_client:
   374      # Create an instance of the API class
   375      api_instance = lakefs_sdk.ExternalApi(api_client)
   376      principal_id = 'principal_id_example' # str | 
   377  
   378      try:
   379          # describe external principal by id
   380          api_response = api_instance.get_external_principal(principal_id)
   381          print("The response of ExternalApi->get_external_principal:\n")
   382          pprint(api_response)
   383      except Exception as e:
   384          print("Exception when calling ExternalApi->get_external_principal: %s\n" % e)
   385  ```
   386  
   387  
   388  
   389  ### Parameters
   390  
   391  
   392  Name | Type | Description  | Notes
   393  ------------- | ------------- | ------------- | -------------
   394   **principal_id** | **str**|  | 
   395  
   396  ### Return type
   397  
   398  [**ExternalPrincipal**](ExternalPrincipal.md)
   399  
   400  ### Authorization
   401  
   402  [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token)
   403  
   404  ### HTTP request headers
   405  
   406   - **Content-Type**: Not defined
   407   - **Accept**: application/json
   408  
   409  ### HTTP response details
   410  
   411  | Status code | Description | Response headers |
   412  |-------------|-------------|------------------|
   413  **200** | external principal |  -  |
   414  **401** | Unauthorized |  -  |
   415  **404** | Resource Not Found |  -  |
   416  **420** | too many requests |  -  |
   417  **0** | Internal Server Error |  -  |
   418  
   419  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   420  
   421  # **list_user_external_principals**
   422  > ExternalPrincipalList list_user_external_principals(user_id, prefix=prefix, after=after, amount=amount)
   423  
   424  list user external policies attached to a user
   425  
   426  ### Example
   427  
   428  * Basic Authentication (basic_auth):
   429  * Api Key Authentication (cookie_auth):
   430  * Api Key Authentication (oidc_auth):
   431  * Api Key Authentication (saml_auth):
   432  * Bearer (JWT) Authentication (jwt_token):
   433  
   434  ```python
   435  import time
   436  import os
   437  import lakefs_sdk
   438  from lakefs_sdk.models.external_principal_list import ExternalPrincipalList
   439  from lakefs_sdk.rest import ApiException
   440  from pprint import pprint
   441  
   442  # Defining the host is optional and defaults to /api/v1
   443  # See configuration.py for a list of all supported configuration parameters.
   444  configuration = lakefs_sdk.Configuration(
   445      host = "/api/v1"
   446  )
   447  
   448  # The client must configure the authentication and authorization parameters
   449  # in accordance with the API server security policy.
   450  # Examples for each auth method are provided below, use the example that
   451  # satisfies your auth use case.
   452  
   453  # Configure HTTP basic authorization: basic_auth
   454  configuration = lakefs_sdk.Configuration(
   455      username = os.environ["USERNAME"],
   456      password = os.environ["PASSWORD"]
   457  )
   458  
   459  # Configure API key authorization: cookie_auth
   460  configuration.api_key['cookie_auth'] = os.environ["API_KEY"]
   461  
   462  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   463  # configuration.api_key_prefix['cookie_auth'] = 'Bearer'
   464  
   465  # Configure API key authorization: oidc_auth
   466  configuration.api_key['oidc_auth'] = os.environ["API_KEY"]
   467  
   468  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   469  # configuration.api_key_prefix['oidc_auth'] = 'Bearer'
   470  
   471  # Configure API key authorization: saml_auth
   472  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
   473  
   474  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   475  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
   476  
   477  # Configure Bearer authorization (JWT): jwt_token
   478  configuration = lakefs_sdk.Configuration(
   479      access_token = os.environ["BEARER_TOKEN"]
   480  )
   481  
   482  # Enter a context with an instance of the API client
   483  with lakefs_sdk.ApiClient(configuration) as api_client:
   484      # Create an instance of the API class
   485      api_instance = lakefs_sdk.ExternalApi(api_client)
   486      user_id = 'user_id_example' # str | 
   487      prefix = 'prefix_example' # str | return items prefixed with this value (optional)
   488      after = 'after_example' # str | return items after this value (optional)
   489      amount = 100 # int | how many items to return (optional) (default to 100)
   490  
   491      try:
   492          # list user external policies attached to a user
   493          api_response = api_instance.list_user_external_principals(user_id, prefix=prefix, after=after, amount=amount)
   494          print("The response of ExternalApi->list_user_external_principals:\n")
   495          pprint(api_response)
   496      except Exception as e:
   497          print("Exception when calling ExternalApi->list_user_external_principals: %s\n" % e)
   498  ```
   499  
   500  
   501  
   502  ### Parameters
   503  
   504  
   505  Name | Type | Description  | Notes
   506  ------------- | ------------- | ------------- | -------------
   507   **user_id** | **str**|  | 
   508   **prefix** | **str**| return items prefixed with this value | [optional] 
   509   **after** | **str**| return items after this value | [optional] 
   510   **amount** | **int**| how many items to return | [optional] [default to 100]
   511  
   512  ### Return type
   513  
   514  [**ExternalPrincipalList**](ExternalPrincipalList.md)
   515  
   516  ### Authorization
   517  
   518  [basic_auth](../README.md#basic_auth), [cookie_auth](../README.md#cookie_auth), [oidc_auth](../README.md#oidc_auth), [saml_auth](../README.md#saml_auth), [jwt_token](../README.md#jwt_token)
   519  
   520  ### HTTP request headers
   521  
   522   - **Content-Type**: Not defined
   523   - **Accept**: application/json
   524  
   525  ### HTTP response details
   526  
   527  | Status code | Description | Response headers |
   528  |-------------|-------------|------------------|
   529  **200** | external principals list |  -  |
   530  **401** | Unauthorized |  -  |
   531  **404** | Resource Not Found |  -  |
   532  **420** | too many requests |  -  |
   533  **0** | Internal Server Error |  -  |
   534  
   535  [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
   536