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

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