diff --git a/api/swagger.yml b/api/swagger.yml index bda8a0d83b8..1b60b1b5b2d 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -3606,43 +3606,6 @@ paths: default: $ref: "#/components/responses/ServerError" - /repositories/{repository}/branches/{branch}/update_token: - parameters: - - in: path - name: repository - required: true - schema: - type: string - - in: path - name: branch - required: true - schema: - type: string - put: - tags: - - internal - operationId: updateBranchToken - summary: modify branch staging token - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateToken" - responses: - 204: - description: branch updated successfully - 400: - $ref: "#/components/responses/ValidationError" - 401: - $ref: "#/components/responses/Unauthorized" - 403: - $ref: "#/components/responses/Forbidden" - 404: - $ref: "#/components/responses/NotFound" - default: - $ref: "#/components/responses/ServerError" - /repositories/{repository}/branches/{branch}/objects/stage_allowed: parameters: - in: path diff --git a/clients/java/README.md b/clients/java/README.md index 9b9f76b05c0..f1c90855d47 100644 --- a/clients/java/README.md +++ b/clients/java/README.md @@ -200,7 +200,6 @@ Class | Method | HTTP request | Description *InternalApi* | [**setGarbageCollectionRulesPreflight**](docs/InternalApi.md#setGarbageCollectionRulesPreflight) | **GET** /repositories/{repository}/gc/rules/set_allowed | *InternalApi* | [**setup**](docs/InternalApi.md#setup) | **POST** /setup_lakefs | setup lakeFS and create a first user *InternalApi* | [**setupCommPrefs**](docs/InternalApi.md#setupCommPrefs) | **POST** /setup_comm_prefs | setup communications preferences -*InternalApi* | [**updateBranchToken**](docs/InternalApi.md#updateBranchToken) | **PUT** /repositories/{repository}/branches/{branch}/update_token | modify branch staging token *InternalApi* | [**uploadObjectPreflight**](docs/InternalApi.md#uploadObjectPreflight) | **GET** /repositories/{repository}/branches/{branch}/objects/stage_allowed | *MetadataApi* | [**createSymlinkFile**](docs/MetadataApi.md#createSymlinkFile) | **POST** /repositories/{repository}/refs/{branch}/symlink | creates symlink files corresponding to the given directory *MetadataApi* | [**getMetaRange**](docs/MetadataApi.md#getMetaRange) | **GET** /repositories/{repository}/metadata/meta_range/{meta_range} | return URI to a meta-range file diff --git a/clients/java/api/openapi.yaml b/clients/java/api/openapi.yaml index ad6bd5ebed9..547b5b11b74 100644 --- a/clients/java/api/openapi.yaml +++ b/clients/java/api/openapi.yaml @@ -3882,68 +3882,6 @@ paths: - import x-contentType: application/json x-accepts: application/json - /repositories/{repository}/branches/{branch}/update_token: - put: - operationId: updateBranchToken - parameters: - - explode: false - in: path - name: repository - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: branch - required: true - schema: - type: string - style: simple - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/UpdateToken' - required: true - responses: - "204": - description: branch updated successfully - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Validation Error - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Forbidden - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Resource Not Found - default: - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Internal Server Error - summary: modify branch staging token - tags: - - internal - x-contentType: application/json - x-accepts: application/json /repositories/{repository}/branches/{branch}/objects/stage_allowed: get: operationId: uploadObjectPreflight @@ -7541,8 +7479,6 @@ components: type: string type: object UpdateToken: - example: - staging_token: staging_token properties: staging_token: type: string diff --git a/clients/java/docs/InternalApi.md b/clients/java/docs/InternalApi.md index ba761086508..9471c000d80 100644 --- a/clients/java/docs/InternalApi.md +++ b/clients/java/docs/InternalApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description [**setGarbageCollectionRulesPreflight**](InternalApi.md#setGarbageCollectionRulesPreflight) | **GET** /repositories/{repository}/gc/rules/set_allowed | [**setup**](InternalApi.md#setup) | **POST** /setup_lakefs | setup lakeFS and create a first user [**setupCommPrefs**](InternalApi.md#setupCommPrefs) | **POST** /setup_comm_prefs | setup communications preferences -[**updateBranchToken**](InternalApi.md#updateBranchToken) | **PUT** /repositories/{repository}/branches/{branch}/update_token | modify branch staging token [**uploadObjectPreflight**](InternalApi.md#uploadObjectPreflight) | **GET** /repositories/{repository}/branches/{branch}/objects/stage_allowed | @@ -525,102 +524,6 @@ No authorization required **412** | wrong setup state for this operation | - | **0** | Internal Server Error | - | - -# **updateBranchToken** -> updateBranchToken(repository, branch, updateToken) - -modify branch staging token - -### Example -```java -// Import classes: -import io.lakefs.clients.api.ApiClient; -import io.lakefs.clients.api.ApiException; -import io.lakefs.clients.api.Configuration; -import io.lakefs.clients.api.auth.*; -import io.lakefs.clients.api.models.*; -import io.lakefs.clients.api.InternalApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://localhost/api/v1"); - - // Configure HTTP basic authorization: basic_auth - HttpBasicAuth basic_auth = (HttpBasicAuth) defaultClient.getAuthentication("basic_auth"); - basic_auth.setUsername("YOUR USERNAME"); - basic_auth.setPassword("YOUR PASSWORD"); - - // Configure API key authorization: cookie_auth - ApiKeyAuth cookie_auth = (ApiKeyAuth) defaultClient.getAuthentication("cookie_auth"); - cookie_auth.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //cookie_auth.setApiKeyPrefix("Token"); - - // Configure HTTP bearer authorization: jwt_token - HttpBearerAuth jwt_token = (HttpBearerAuth) defaultClient.getAuthentication("jwt_token"); - jwt_token.setBearerToken("BEARER TOKEN"); - - // Configure API key authorization: oidc_auth - ApiKeyAuth oidc_auth = (ApiKeyAuth) defaultClient.getAuthentication("oidc_auth"); - oidc_auth.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //oidc_auth.setApiKeyPrefix("Token"); - - // Configure API key authorization: saml_auth - ApiKeyAuth saml_auth = (ApiKeyAuth) defaultClient.getAuthentication("saml_auth"); - saml_auth.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //saml_auth.setApiKeyPrefix("Token"); - - InternalApi apiInstance = new InternalApi(defaultClient); - String repository = "repository_example"; // String | - String branch = "branch_example"; // String | - UpdateToken updateToken = new UpdateToken(); // UpdateToken | - try { - apiInstance.updateBranchToken(repository, branch, updateToken); - } catch (ApiException e) { - System.err.println("Exception when calling InternalApi#updateBranchToken"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **repository** | **String**| | - **branch** | **String**| | - **updateToken** | [**UpdateToken**](UpdateToken.md)| | - -### Return type - -null (empty response body) - -### Authorization - -[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) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | branch updated successfully | - | -**400** | Validation Error | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Resource Not Found | - | -**0** | Internal Server Error | - | - # **uploadObjectPreflight** > uploadObjectPreflight(repository, branch, path) diff --git a/clients/java/src/main/java/io/lakefs/clients/api/InternalApi.java b/clients/java/src/main/java/io/lakefs/clients/api/InternalApi.java index 1c0fc48eb98..554c1b6479a 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/InternalApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/InternalApi.java @@ -34,7 +34,6 @@ import io.lakefs.clients.api.model.Setup; import io.lakefs.clients.api.model.SetupState; import io.lakefs.clients.api.model.StatsEventsList; -import io.lakefs.clients.api.model.UpdateToken; import java.lang.reflect.Type; import java.util.ArrayList; @@ -878,153 +877,6 @@ public okhttp3.Call setupCommPrefsAsync(CommPrefsInput commPrefsInput, final Api localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } - /** - * Build call for updateBranchToken - * @param repository (required) - * @param branch (required) - * @param updateToken (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - - - -
Status Code Description Response Headers
204 branch updated successfully -
400 Validation Error -
401 Unauthorized -
403 Forbidden -
404 Resource Not Found -
0 Internal Server Error -
- */ - public okhttp3.Call updateBranchTokenCall(String repository, String branch, UpdateToken updateToken, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = updateToken; - - // create path and map variables - String localVarPath = "/repositories/{repository}/branches/{branch}/update_token" - .replaceAll("\\{" + "repository" + "\\}", localVarApiClient.escapeString(repository.toString())) - .replaceAll("\\{" + "branch" + "\\}", localVarApiClient.escapeString(branch.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - String[] localVarAuthNames = new String[] { "basic_auth", "cookie_auth", "jwt_token", "oidc_auth", "saml_auth" }; - return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call updateBranchTokenValidateBeforeCall(String repository, String branch, UpdateToken updateToken, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'repository' is set - if (repository == null) { - throw new ApiException("Missing the required parameter 'repository' when calling updateBranchToken(Async)"); - } - - // verify the required parameter 'branch' is set - if (branch == null) { - throw new ApiException("Missing the required parameter 'branch' when calling updateBranchToken(Async)"); - } - - // verify the required parameter 'updateToken' is set - if (updateToken == null) { - throw new ApiException("Missing the required parameter 'updateToken' when calling updateBranchToken(Async)"); - } - - - okhttp3.Call localVarCall = updateBranchTokenCall(repository, branch, updateToken, _callback); - return localVarCall; - - } - - /** - * modify branch staging token - * - * @param repository (required) - * @param branch (required) - * @param updateToken (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - -
Status Code Description Response Headers
204 branch updated successfully -
400 Validation Error -
401 Unauthorized -
403 Forbidden -
404 Resource Not Found -
0 Internal Server Error -
- */ - public void updateBranchToken(String repository, String branch, UpdateToken updateToken) throws ApiException { - updateBranchTokenWithHttpInfo(repository, branch, updateToken); - } - - /** - * modify branch staging token - * - * @param repository (required) - * @param branch (required) - * @param updateToken (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - - - -
Status Code Description Response Headers
204 branch updated successfully -
400 Validation Error -
401 Unauthorized -
403 Forbidden -
404 Resource Not Found -
0 Internal Server Error -
- */ - public ApiResponse updateBranchTokenWithHttpInfo(String repository, String branch, UpdateToken updateToken) throws ApiException { - okhttp3.Call localVarCall = updateBranchTokenValidateBeforeCall(repository, branch, updateToken, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * modify branch staging token (asynchronously) - * - * @param repository (required) - * @param branch (required) - * @param updateToken (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - - - -
Status Code Description Response Headers
204 branch updated successfully -
400 Validation Error -
401 Unauthorized -
403 Forbidden -
404 Resource Not Found -
0 Internal Server Error -
- */ - public okhttp3.Call updateBranchTokenAsync(String repository, String branch, UpdateToken updateToken, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateBranchTokenValidateBeforeCall(repository, branch, updateToken, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } /** * Build call for uploadObjectPreflight * @param repository (required) diff --git a/clients/java/src/test/java/io/lakefs/clients/api/InternalApiTest.java b/clients/java/src/test/java/io/lakefs/clients/api/InternalApiTest.java index d27a16781ec..44dff9228e2 100644 --- a/clients/java/src/test/java/io/lakefs/clients/api/InternalApiTest.java +++ b/clients/java/src/test/java/io/lakefs/clients/api/InternalApiTest.java @@ -21,7 +21,6 @@ import io.lakefs.clients.api.model.Setup; import io.lakefs.clients.api.model.SetupState; import io.lakefs.clients.api.model.StatsEventsList; -import io.lakefs.clients.api.model.UpdateToken; import org.junit.Test; import org.junit.Ignore; @@ -142,23 +141,6 @@ public void setupCommPrefsTest() throws ApiException { // TODO: test validations } - /** - * modify branch staging token - * - * - * - * @throws ApiException - * if the Api call fails - */ - @Test - public void updateBranchTokenTest() throws ApiException { - String repository = null; - String branch = null; - UpdateToken updateToken = null; - api.updateBranchToken(repository, branch, updateToken); - // TODO: test validations - } - /** * * diff --git a/clients/python/README.md b/clients/python/README.md index c673f9a91ed..9a50fa5f4bb 100644 --- a/clients/python/README.md +++ b/clients/python/README.md @@ -181,7 +181,6 @@ Class | Method | HTTP request | Description *InternalApi* | [**set_garbage_collection_rules_preflight**](docs/InternalApi.md#set_garbage_collection_rules_preflight) | **GET** /repositories/{repository}/gc/rules/set_allowed | *InternalApi* | [**setup**](docs/InternalApi.md#setup) | **POST** /setup_lakefs | setup lakeFS and create a first user *InternalApi* | [**setup_comm_prefs**](docs/InternalApi.md#setup_comm_prefs) | **POST** /setup_comm_prefs | setup communications preferences -*InternalApi* | [**update_branch_token**](docs/InternalApi.md#update_branch_token) | **PUT** /repositories/{repository}/branches/{branch}/update_token | modify branch staging token *InternalApi* | [**upload_object_preflight**](docs/InternalApi.md#upload_object_preflight) | **GET** /repositories/{repository}/branches/{branch}/objects/stage_allowed | *MetadataApi* | [**create_symlink_file**](docs/MetadataApi.md#create_symlink_file) | **POST** /repositories/{repository}/refs/{branch}/symlink | creates symlink files corresponding to the given directory *MetadataApi* | [**get_meta_range**](docs/MetadataApi.md#get_meta_range) | **GET** /repositories/{repository}/metadata/meta_range/{meta_range} | return URI to a meta-range file diff --git a/clients/python/docs/InternalApi.md b/clients/python/docs/InternalApi.md index 42fe236887a..fd40783290c 100644 --- a/clients/python/docs/InternalApi.md +++ b/clients/python/docs/InternalApi.md @@ -11,7 +11,6 @@ Method | HTTP request | Description [**set_garbage_collection_rules_preflight**](InternalApi.md#set_garbage_collection_rules_preflight) | **GET** /repositories/{repository}/gc/rules/set_allowed | [**setup**](InternalApi.md#setup) | **POST** /setup_lakefs | setup lakeFS and create a first user [**setup_comm_prefs**](InternalApi.md#setup_comm_prefs) | **POST** /setup_comm_prefs | setup communications preferences -[**update_branch_token**](InternalApi.md#update_branch_token) | **PUT** /repositories/{repository}/branches/{branch}/update_token | modify branch staging token [**upload_object_preflight**](InternalApi.md#upload_object_preflight) | **GET** /repositories/{repository}/branches/{branch}/objects/stage_allowed | @@ -612,120 +611,6 @@ No authorization required [[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) -# **update_branch_token** -> update_branch_token(repository, branch, update_token) - -modify branch staging token - -### Example - -* Basic Authentication (basic_auth): -* Api Key Authentication (cookie_auth): -* Bearer (JWT) Authentication (jwt_token): -* Api Key Authentication (oidc_auth): -* Api Key Authentication (saml_auth): - -```python -import time -import lakefs_client -from lakefs_client.api import internal_api -from lakefs_client.model.update_token import UpdateToken -from lakefs_client.model.error import Error -from pprint import pprint -# Defining the host is optional and defaults to http://localhost/api/v1 -# See configuration.py for a list of all supported configuration parameters. -configuration = lakefs_client.Configuration( - host = "http://localhost/api/v1" -) - -# The client must configure the authentication and authorization parameters -# in accordance with the API server security policy. -# Examples for each auth method are provided below, use the example that -# satisfies your auth use case. - -# Configure HTTP basic authorization: basic_auth -configuration = lakefs_client.Configuration( - username = 'YOUR_USERNAME', - password = 'YOUR_PASSWORD' -) - -# Configure API key authorization: cookie_auth -configuration.api_key['cookie_auth'] = 'YOUR_API_KEY' - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['cookie_auth'] = 'Bearer' - -# Configure Bearer authorization (JWT): jwt_token -configuration = lakefs_client.Configuration( - access_token = 'YOUR_BEARER_TOKEN' -) - -# Configure API key authorization: oidc_auth -configuration.api_key['oidc_auth'] = 'YOUR_API_KEY' - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['oidc_auth'] = 'Bearer' - -# Configure API key authorization: saml_auth -configuration.api_key['saml_auth'] = 'YOUR_API_KEY' - -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['saml_auth'] = 'Bearer' - -# Enter a context with an instance of the API client -with lakefs_client.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = internal_api.InternalApi(api_client) - repository = "repository_example" # str | - branch = "branch_example" # str | - update_token = UpdateToken( - staging_token="staging_token_example", - ) # UpdateToken | - - # example passing only required values which don't have defaults set - try: - # modify branch staging token - api_instance.update_branch_token(repository, branch, update_token) - except lakefs_client.ApiException as e: - print("Exception when calling InternalApi->update_branch_token: %s\n" % e) -``` - - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **repository** | **str**| | - **branch** | **str**| | - **update_token** | [**UpdateToken**](UpdateToken.md)| | - -### Return type - -void (empty response body) - -### Authorization - -[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) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**204** | branch updated successfully | - | -**400** | Validation Error | - | -**401** | Unauthorized | - | -**403** | Forbidden | - | -**404** | Resource Not Found | - | -**0** | Internal Server Error | - | - -[[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) - # **upload_object_preflight** > upload_object_preflight(repository, branch, path) diff --git a/clients/python/lakefs_client/api/internal_api.py b/clients/python/lakefs_client/api/internal_api.py index 68b1538ae9b..6f4238cd944 100644 --- a/clients/python/lakefs_client/api/internal_api.py +++ b/clients/python/lakefs_client/api/internal_api.py @@ -29,7 +29,6 @@ from lakefs_client.model.setup import Setup from lakefs_client.model.setup_state import SetupState from lakefs_client.model.stats_events_list import StatsEventsList -from lakefs_client.model.update_token import UpdateToken class InternalApi(object): @@ -393,74 +392,6 @@ def __init__(self, api_client=None): }, api_client=api_client ) - self.update_branch_token_endpoint = _Endpoint( - settings={ - 'response_type': None, - 'auth': [ - 'basic_auth', - 'cookie_auth', - 'jwt_token', - 'oidc_auth', - 'saml_auth' - ], - 'endpoint_path': '/repositories/{repository}/branches/{branch}/update_token', - 'operation_id': 'update_branch_token', - 'http_method': 'PUT', - 'servers': None, - }, - params_map={ - 'all': [ - 'repository', - 'branch', - 'update_token', - ], - 'required': [ - 'repository', - 'branch', - 'update_token', - ], - 'nullable': [ - ], - 'enum': [ - ], - 'validation': [ - ] - }, - root_map={ - 'validations': { - }, - 'allowed_values': { - }, - 'openapi_types': { - 'repository': - (str,), - 'branch': - (str,), - 'update_token': - (UpdateToken,), - }, - 'attribute_map': { - 'repository': 'repository', - 'branch': 'branch', - }, - 'location_map': { - 'repository': 'path', - 'branch': 'path', - 'update_token': 'body', - }, - 'collection_format_map': { - } - }, - headers_map={ - 'accept': [ - 'application/json' - ], - 'content_type': [ - 'application/json' - ] - }, - api_client=api_client - ) self.upload_object_preflight_endpoint = _Endpoint( settings={ 'response_type': None, @@ -974,79 +905,6 @@ def setup_comm_prefs( comm_prefs_input return self.setup_comm_prefs_endpoint.call_with_http_info(**kwargs) - def update_branch_token( - self, - repository, - branch, - update_token, - **kwargs - ): - """modify branch staging token # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_branch_token(repository, branch, update_token, async_req=True) - >>> result = thread.get() - - Args: - repository (str): - branch (str): - update_token (UpdateToken): - - Keyword Args: - _return_http_data_only (bool): response data without head status - code and headers. Default is True. - _preload_content (bool): if False, the urllib3.HTTPResponse object - will be returned without reading/decoding response data. - Default is True. - _request_timeout (int/float/tuple): timeout setting for this request. If - one number provided, it will be total request timeout. It can also - be a pair (tuple) of (connection, read) timeouts. - Default is None. - _check_input_type (bool): specifies if type checking - should be done one the data sent to the server. - Default is True. - _check_return_type (bool): specifies if type checking - should be done one the data received from the server. - Default is True. - _host_index (int/None): specifies the index of the server - that we want to use. - Default is read from the configuration. - async_req (bool): execute request asynchronously - - Returns: - None - If the method is called asynchronously, returns the request - thread. - """ - kwargs['async_req'] = kwargs.get( - 'async_req', False - ) - kwargs['_return_http_data_only'] = kwargs.get( - '_return_http_data_only', True - ) - kwargs['_preload_content'] = kwargs.get( - '_preload_content', True - ) - kwargs['_request_timeout'] = kwargs.get( - '_request_timeout', None - ) - kwargs['_check_input_type'] = kwargs.get( - '_check_input_type', True - ) - kwargs['_check_return_type'] = kwargs.get( - '_check_return_type', True - ) - kwargs['_host_index'] = kwargs.get('_host_index') - kwargs['repository'] = \ - repository - kwargs['branch'] = \ - branch - kwargs['update_token'] = \ - update_token - return self.update_branch_token_endpoint.call_with_http_info(**kwargs) - def upload_object_preflight( self, repository, diff --git a/clients/python/test/test_internal_api.py b/clients/python/test/test_internal_api.py index 5ccb8f17450..96637ea841f 100644 --- a/clients/python/test/test_internal_api.py +++ b/clients/python/test/test_internal_api.py @@ -71,13 +71,6 @@ def test_setup_comm_prefs(self): """ pass - def test_update_branch_token(self): - """Test case for update_branch_token - - modify branch staging token # noqa: E501 - """ - pass - def test_upload_object_preflight(self): """Test case for upload_object_preflight diff --git a/docs/assets/js/swagger.yml b/docs/assets/js/swagger.yml index bda8a0d83b8..1b60b1b5b2d 100644 --- a/docs/assets/js/swagger.yml +++ b/docs/assets/js/swagger.yml @@ -3606,43 +3606,6 @@ paths: default: $ref: "#/components/responses/ServerError" - /repositories/{repository}/branches/{branch}/update_token: - parameters: - - in: path - name: repository - required: true - schema: - type: string - - in: path - name: branch - required: true - schema: - type: string - put: - tags: - - internal - operationId: updateBranchToken - summary: modify branch staging token - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/UpdateToken" - responses: - 204: - description: branch updated successfully - 400: - $ref: "#/components/responses/ValidationError" - 401: - $ref: "#/components/responses/Unauthorized" - 403: - $ref: "#/components/responses/Forbidden" - 404: - $ref: "#/components/responses/NotFound" - default: - $ref: "#/components/responses/ServerError" - /repositories/{repository}/branches/{branch}/objects/stage_allowed: parameters: - in: path diff --git a/esti/import_test.go b/esti/import_test.go index af9e3c09601..dac9b3b2ead 100644 --- a/esti/import_test.go +++ b/esti/import_test.go @@ -221,10 +221,6 @@ func testImport(t testing.TB, ctx context.Context, repoName, importPath, importB require.Equal(t, http.StatusCreated, commitResp.StatusCode(), "failed to commit") if stagingToken != "" { - stageResp, err := client.UpdateBranchTokenWithResponse(ctx, repoName, importBranch, apigen.UpdateBranchTokenJSONRequestBody{StagingToken: stagingToken}) - require.NoError(t, err, "failed to change branch token") - require.Equal(t, http.StatusNoContent, stageResp.StatusCode(), "failed to change branch token") - commitResp, err = client.CommitWithResponse(ctx, repoName, importBranch, &apigen.CommitParams{}, apigen.CommitJSONRequestBody{ Message: "created by import on skipped objects", Metadata: &apigen.CommitCreation_Metadata{ diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 909894123b0..d5d9924dad6 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -2407,25 +2407,6 @@ func (c *Controller) CreateMetaRange(w http.ResponseWriter, r *http.Request, bod }) } -func (c *Controller) UpdateBranchToken(w http.ResponseWriter, r *http.Request, body apigen.UpdateBranchTokenJSONRequestBody, repository, branch string) { - if !c.authorize(w, r, permissions.Node{ - Permission: permissions.Permission{ - Action: permissions.WriteObjectAction, - // This API writes an entire staging area to a branch and therefore requires permission to write to the entire repository space - Resource: permissions.ObjectArn(repository, "*"), - }, - }) { - return - } - ctx := r.Context() - c.LogAction(ctx, "update_branch_token", r, repository, branch, "") - err := c.Catalog.UpdateBranchToken(ctx, repository, branch, body.StagingToken) - if c.handleAPIError(ctx, w, r, err) { - return - } - writeResponse(w, r, http.StatusNoContent, nil) -} - func (c *Controller) Commit(w http.ResponseWriter, r *http.Request, body apigen.CommitJSONRequestBody, repository, branch string, params apigen.CommitParams) { if !c.authorize(w, r, permissions.Node{ Permission: permissions.Permission{ diff --git a/pkg/catalog/catalog.go b/pkg/catalog/catalog.go index 655832941c6..0c5dc2e7b77 100644 --- a/pkg/catalog/catalog.go +++ b/pkg/catalog/catalog.go @@ -2063,14 +2063,6 @@ func (c *Catalog) WriteMetaRange(ctx context.Context, repositoryID string, range return c.Store.WriteMetaRange(ctx, repository, ranges) } -func (c *Catalog) UpdateBranchToken(ctx context.Context, repositoryID, branchID, stagingToken string) error { - repository, err := c.getRepository(ctx, repositoryID) - if err != nil { - return err - } - return c.Store.UpdateBranchToken(ctx, repository, branchID, stagingToken) -} - func (c *Catalog) GetGarbageCollectionRules(ctx context.Context, repositoryID string) (*graveler.GarbageCollectionRules, error) { repository, err := c.getRepository(ctx, repositoryID) if err != nil { diff --git a/pkg/catalog/fake_graveler_test.go b/pkg/catalog/fake_graveler_test.go index f7b6c737fe4..37d08fdf464 100644 --- a/pkg/catalog/fake_graveler_test.go +++ b/pkg/catalog/fake_graveler_test.go @@ -23,12 +23,7 @@ type FakeGraveler struct { } func (g *FakeGraveler) StageObject(ctx context.Context, stagingToken string, object graveler.ValueRecord) error { - //TODO implement me - panic("implement me") -} - -func (g *FakeGraveler) UpdateBranchToken(_ context.Context, _ *graveler.RepositoryRecord, _, _ string) error { - //TODO implement me + // TODO implement me panic("implement me") } diff --git a/pkg/catalog/interface.go b/pkg/catalog/interface.go index 9d14456cec8..31e81a26e60 100644 --- a/pkg/catalog/interface.go +++ b/pkg/catalog/interface.go @@ -154,7 +154,6 @@ type Interface interface { CancelImport(ctx context.Context, repositoryID, importID string) error WriteRange(ctx context.Context, repositoryID string, params WriteRangeRequest) (*graveler.RangeInfo, *Mark, error) WriteMetaRange(ctx context.Context, repositoryID string, ranges []*graveler.RangeInfo) (*graveler.MetaRangeInfo, error) - UpdateBranchToken(ctx context.Context, repositoryID, branchID, stagingToken string) error GetGarbageCollectionRules(ctx context.Context, repositoryID string) (*graveler.GarbageCollectionRules, error) SetGarbageCollectionRules(ctx context.Context, repositoryID string, rules *graveler.GarbageCollectionRules) error diff --git a/pkg/graveler/graveler.go b/pkg/graveler/graveler.go index dcb95ed2608..a7473f04ed1 100644 --- a/pkg/graveler/graveler.go +++ b/pkg/graveler/graveler.go @@ -656,8 +656,6 @@ type Plumbing interface { WriteMetaRange(ctx context.Context, repository *RepositoryRecord, ranges []*RangeInfo) (*MetaRangeInfo, error) // StageObject stages given object to stagingToken. StageObject(ctx context.Context, stagingToken string, object ValueRecord) error - // UpdateBranchToken updates the given branch stagingToken - UpdateBranchToken(ctx context.Context, repository *RepositoryRecord, branchID, stagingToken string) error } type Dumper interface { @@ -1104,25 +1102,6 @@ func (g *Graveler) StageObject(ctx context.Context, stagingToken string, object return g.StagingManager.Set(ctx, StagingToken(stagingToken), object.Key, object.Value, false) } -func (g *Graveler) UpdateBranchToken(ctx context.Context, repository *RepositoryRecord, branchID, stagingToken string) error { - err := g.RefManager.BranchUpdate(ctx, repository, BranchID(branchID), func(branch *Branch) (*Branch, error) { - isEmpty, err := g.isStagingEmpty(ctx, repository, branch) - if err != nil { - return nil, err - } - if !isEmpty { - return nil, fmt.Errorf("branch staging is not empty: %w", ErrDirtyBranch) - } - tokensToDrop := []StagingToken{branch.StagingToken} - tokensToDrop = append(tokensToDrop, branch.SealedTokens...) - g.dropTokens(ctx, tokensToDrop...) - branch.StagingToken = StagingToken(stagingToken) - branch.SealedTokens = make([]StagingToken, 0) - return branch, nil - }) - return err -} - func (g *Graveler) WriteMetaRangeByIterator(ctx context.Context, repository *RepositoryRecord, it ValueIterator) (*MetaRangeID, error) { return g.CommittedManager.WriteMetaRangeByIterator(ctx, repository.StorageNamespace, it, nil) } diff --git a/pkg/graveler/mock/graveler.go b/pkg/graveler/mock/graveler.go index b3a6ebf62c3..aa973854438 100644 --- a/pkg/graveler/mock/graveler.go +++ b/pkg/graveler/mock/graveler.go @@ -986,20 +986,6 @@ func (mr *MockPlumbingMockRecorder) StageObject(ctx, stagingToken, object interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StageObject", reflect.TypeOf((*MockPlumbing)(nil).StageObject), ctx, stagingToken, object) } -// UpdateBranchToken mocks base method. -func (m *MockPlumbing) UpdateBranchToken(ctx context.Context, repository *graveler.RepositoryRecord, branchID, stagingToken string) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UpdateBranchToken", ctx, repository, branchID, stagingToken) - ret0, _ := ret[0].(error) - return ret0 -} - -// UpdateBranchToken indicates an expected call of UpdateBranchToken. -func (mr *MockPlumbingMockRecorder) UpdateBranchToken(ctx, repository, branchID, stagingToken interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateBranchToken", reflect.TypeOf((*MockPlumbing)(nil).UpdateBranchToken), ctx, repository, branchID, stagingToken) -} - // WriteMetaRange mocks base method. func (m *MockPlumbing) WriteMetaRange(ctx context.Context, repository *graveler.RepositoryRecord, ranges []*graveler.RangeInfo) (*graveler.MetaRangeInfo, error) { m.ctrl.T.Helper()