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

     1  # lakefs_sdk.CommitsApi
     2  
     3  All URIs are relative to */api/v1*
     4  
     5  Method | HTTP request | Description
     6  ------------- | ------------- | -------------
     7  [**commit**](CommitsApi.md#commit) | **POST** /repositories/{repository}/branches/{branch}/commits | create commit
     8  [**get_commit**](CommitsApi.md#get_commit) | **GET** /repositories/{repository}/commits/{commitId} | get commit
     9  
    10  
    11  # **commit**
    12  > Commit commit(repository, branch, commit_creation, source_metarange=source_metarange)
    13  
    14  create commit
    15  
    16  ### Example
    17  
    18  * Basic Authentication (basic_auth):
    19  * Api Key Authentication (cookie_auth):
    20  * Api Key Authentication (oidc_auth):
    21  * Api Key Authentication (saml_auth):
    22  * Bearer (JWT) Authentication (jwt_token):
    23  
    24  ```python
    25  import time
    26  import os
    27  import lakefs_sdk
    28  from lakefs_sdk.models.commit import Commit
    29  from lakefs_sdk.models.commit_creation import CommitCreation
    30  from lakefs_sdk.rest import ApiException
    31  from pprint import pprint
    32  
    33  # Defining the host is optional and defaults to /api/v1
    34  # See configuration.py for a list of all supported configuration parameters.
    35  configuration = lakefs_sdk.Configuration(
    36      host = "/api/v1"
    37  )
    38  
    39  # The client must configure the authentication and authorization parameters
    40  # in accordance with the API server security policy.
    41  # Examples for each auth method are provided below, use the example that
    42  # satisfies your auth use case.
    43  
    44  # Configure HTTP basic authorization: basic_auth
    45  configuration = lakefs_sdk.Configuration(
    46      username = os.environ["USERNAME"],
    47      password = os.environ["PASSWORD"]
    48  )
    49  
    50  # Configure API key authorization: cookie_auth
    51  configuration.api_key['cookie_auth'] = os.environ["API_KEY"]
    52  
    53  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    54  # configuration.api_key_prefix['cookie_auth'] = 'Bearer'
    55  
    56  # Configure API key authorization: oidc_auth
    57  configuration.api_key['oidc_auth'] = os.environ["API_KEY"]
    58  
    59  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    60  # configuration.api_key_prefix['oidc_auth'] = 'Bearer'
    61  
    62  # Configure API key authorization: saml_auth
    63  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
    64  
    65  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
    66  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
    67  
    68  # Configure Bearer authorization (JWT): jwt_token
    69  configuration = lakefs_sdk.Configuration(
    70      access_token = os.environ["BEARER_TOKEN"]
    71  )
    72  
    73  # Enter a context with an instance of the API client
    74  with lakefs_sdk.ApiClient(configuration) as api_client:
    75      # Create an instance of the API class
    76      api_instance = lakefs_sdk.CommitsApi(api_client)
    77      repository = 'repository_example' # str | 
    78      branch = 'branch_example' # str | 
    79      commit_creation = lakefs_sdk.CommitCreation() # CommitCreation | 
    80      source_metarange = 'source_metarange_example' # str | The source metarange to commit. Branch must not have uncommitted changes. (optional)
    81  
    82      try:
    83          # create commit
    84          api_response = api_instance.commit(repository, branch, commit_creation, source_metarange=source_metarange)
    85          print("The response of CommitsApi->commit:\n")
    86          pprint(api_response)
    87      except Exception as e:
    88          print("Exception when calling CommitsApi->commit: %s\n" % e)
    89  ```
    90  
    91  
    92  
    93  ### Parameters
    94  
    95  
    96  Name | Type | Description  | Notes
    97  ------------- | ------------- | ------------- | -------------
    98   **repository** | **str**|  | 
    99   **branch** | **str**|  | 
   100   **commit_creation** | [**CommitCreation**](CommitCreation.md)|  | 
   101   **source_metarange** | **str**| The source metarange to commit. Branch must not have uncommitted changes. | [optional] 
   102  
   103  ### Return type
   104  
   105  [**Commit**](Commit.md)
   106  
   107  ### Authorization
   108  
   109  [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)
   110  
   111  ### HTTP request headers
   112  
   113   - **Content-Type**: application/json
   114   - **Accept**: application/json
   115  
   116  ### HTTP response details
   117  
   118  | Status code | Description | Response headers |
   119  |-------------|-------------|------------------|
   120  **201** | commit |  -  |
   121  **400** | Validation Error |  -  |
   122  **401** | Unauthorized |  -  |
   123  **403** | Forbidden |  -  |
   124  **404** | Resource Not Found |  -  |
   125  **409** | Resource Conflicts With Target |  -  |
   126  **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) |  -  |
   127  **420** | too many requests |  -  |
   128  **0** | Internal Server Error |  -  |
   129  
   130  [[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)
   131  
   132  # **get_commit**
   133  > Commit get_commit(repository, commit_id)
   134  
   135  get commit
   136  
   137  ### Example
   138  
   139  * Basic Authentication (basic_auth):
   140  * Api Key Authentication (cookie_auth):
   141  * Api Key Authentication (oidc_auth):
   142  * Api Key Authentication (saml_auth):
   143  * Bearer (JWT) Authentication (jwt_token):
   144  
   145  ```python
   146  import time
   147  import os
   148  import lakefs_sdk
   149  from lakefs_sdk.models.commit import Commit
   150  from lakefs_sdk.rest import ApiException
   151  from pprint import pprint
   152  
   153  # Defining the host is optional and defaults to /api/v1
   154  # See configuration.py for a list of all supported configuration parameters.
   155  configuration = lakefs_sdk.Configuration(
   156      host = "/api/v1"
   157  )
   158  
   159  # The client must configure the authentication and authorization parameters
   160  # in accordance with the API server security policy.
   161  # Examples for each auth method are provided below, use the example that
   162  # satisfies your auth use case.
   163  
   164  # Configure HTTP basic authorization: basic_auth
   165  configuration = lakefs_sdk.Configuration(
   166      username = os.environ["USERNAME"],
   167      password = os.environ["PASSWORD"]
   168  )
   169  
   170  # Configure API key authorization: cookie_auth
   171  configuration.api_key['cookie_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['cookie_auth'] = 'Bearer'
   175  
   176  # Configure API key authorization: oidc_auth
   177  configuration.api_key['oidc_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['oidc_auth'] = 'Bearer'
   181  
   182  # Configure API key authorization: saml_auth
   183  configuration.api_key['saml_auth'] = os.environ["API_KEY"]
   184  
   185  # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
   186  # configuration.api_key_prefix['saml_auth'] = 'Bearer'
   187  
   188  # Configure Bearer authorization (JWT): jwt_token
   189  configuration = lakefs_sdk.Configuration(
   190      access_token = os.environ["BEARER_TOKEN"]
   191  )
   192  
   193  # Enter a context with an instance of the API client
   194  with lakefs_sdk.ApiClient(configuration) as api_client:
   195      # Create an instance of the API class
   196      api_instance = lakefs_sdk.CommitsApi(api_client)
   197      repository = 'repository_example' # str | 
   198      commit_id = 'commit_id_example' # str | 
   199  
   200      try:
   201          # get commit
   202          api_response = api_instance.get_commit(repository, commit_id)
   203          print("The response of CommitsApi->get_commit:\n")
   204          pprint(api_response)
   205      except Exception as e:
   206          print("Exception when calling CommitsApi->get_commit: %s\n" % e)
   207  ```
   208  
   209  
   210  
   211  ### Parameters
   212  
   213  
   214  Name | Type | Description  | Notes
   215  ------------- | ------------- | ------------- | -------------
   216   **repository** | **str**|  | 
   217   **commit_id** | **str**|  | 
   218  
   219  ### Return type
   220  
   221  [**Commit**](Commit.md)
   222  
   223  ### Authorization
   224  
   225  [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)
   226  
   227  ### HTTP request headers
   228  
   229   - **Content-Type**: Not defined
   230   - **Accept**: application/json
   231  
   232  ### HTTP response details
   233  
   234  | Status code | Description | Response headers |
   235  |-------------|-------------|------------------|
   236  **200** | commit |  -  |
   237  **401** | Unauthorized |  -  |
   238  **404** | Resource Not Found |  -  |
   239  **420** | too many requests |  -  |
   240  **0** | Internal Server Error |  -  |
   241  
   242  [[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)
   243