From a6af546afecee07ac0b4f72bad5d7c7ee399d745 Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Thu, 16 Feb 2023 18:34:32 +0200 Subject: [PATCH 1/4] Branch protection status code should be 403 --- api/swagger.yml | 12 +++++++ clients/java/api/openapi.yaml | 36 +++++++++++++++++++ clients/java/docs/BranchesApi.md | 1 + clients/java/docs/CommitsApi.md | 1 + clients/java/docs/ObjectsApi.md | 3 ++ clients/java/docs/RefsApi.md | 1 + .../io/lakefs/clients/api/BranchesApi.java | 4 +++ .../io/lakefs/clients/api/CommitsApi.java | 4 +++ .../io/lakefs/clients/api/ObjectsApi.java | 12 +++++++ .../java/io/lakefs/clients/api/RefsApi.java | 4 +++ clients/python/docs/BranchesApi.md | 1 + clients/python/docs/CommitsApi.md | 1 + clients/python/docs/ObjectsApi.md | 3 ++ clients/python/docs/RefsApi.md | 1 + docs/assets/js/swagger.yml | 12 +++++++ pkg/api/controller.go | 3 ++ 16 files changed, 99 insertions(+) diff --git a/api/swagger.yml b/api/swagger.yml index 4a41cf1e8c6..acccfb9433f 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -2605,6 +2605,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -2656,6 +2658,8 @@ paths: description: branch deleted successfully 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -2762,6 +2766,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" 409: @@ -3297,6 +3303,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" 412: @@ -3313,6 +3321,8 @@ paths: description: object deleted successfully 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -3350,6 +3360,8 @@ paths: $ref: "#/components/schemas/ObjectErrorList" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: diff --git a/clients/java/api/openapi.yaml b/clients/java/api/openapi.yaml index 80ca0943739..56be5ed110a 100644 --- a/clients/java/api/openapi.yaml +++ b/clients/java/api/openapi.yaml @@ -2467,6 +2467,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: @@ -2517,6 +2523,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: @@ -2741,6 +2753,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: @@ -3525,6 +3543,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: @@ -3614,6 +3638,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: @@ -3741,6 +3771,12 @@ paths: schema: $ref: '#/components/schemas/Error' description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Internal Server Error "404": content: application/json: diff --git a/clients/java/docs/BranchesApi.md b/clients/java/docs/BranchesApi.md index 0bd87ed340b..b009f9c6dfd 100644 --- a/clients/java/docs/BranchesApi.md +++ b/clients/java/docs/BranchesApi.md @@ -185,6 +185,7 @@ null (empty response body) |-------------|-------------|------------------| **204** | branch deleted successfully | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/CommitsApi.md b/clients/java/docs/CommitsApi.md index 8ad44b04737..0340884d1ec 100644 --- a/clients/java/docs/CommitsApi.md +++ b/clients/java/docs/CommitsApi.md @@ -98,6 +98,7 @@ Name | Type | Description | Notes **201** | commit | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/ObjectsApi.md b/clients/java/docs/ObjectsApi.md index 75dcafebfde..987ab0fb33c 100644 --- a/clients/java/docs/ObjectsApi.md +++ b/clients/java/docs/ObjectsApi.md @@ -193,6 +193,7 @@ null (empty response body) |-------------|-------------|------------------| **204** | object deleted successfully | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -282,6 +283,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | Delete objects response | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -942,6 +944,7 @@ Name | Type | Description | Notes **201** | object metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **412** | Precondition Failed | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/RefsApi.md b/clients/java/docs/RefsApi.md index 98111788cd4..d42e954f315 100644 --- a/clients/java/docs/RefsApi.md +++ b/clients/java/docs/RefsApi.md @@ -382,6 +382,7 @@ Name | Type | Description | Notes **200** | merge completed | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **409** | Conflict Deprecated: content schema will return Error format and not an empty MergeResult | - | **412** | precondition failed (e.g. a pre-merge hook returned a failure) | - | diff --git a/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java b/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java index 71dfbeadae5..427d1e7a789 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java @@ -213,6 +213,7 @@ public okhttp3.Call createBranchAsync(String repository, BranchCreation branchCr Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -279,6 +280,7 @@ private okhttp3.Call deleteBranchValidateBeforeCall(String repository, String br Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -299,6 +301,7 @@ public void deleteBranch(String repository, String branch) throws ApiException { Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -321,6 +324,7 @@ public ApiResponse deleteBranchWithHttpInfo(String repository, String bran Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java index 6a2d152686f..69910b3aa1f 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java @@ -72,6 +72,7 @@ public void setApiClient(ApiClient apiClient) { 201 commit - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -152,6 +153,7 @@ private okhttp3.Call commitValidateBeforeCall(String repository, String branch, 201 commit - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -177,6 +179,7 @@ public Commit commit(String repository, String branch, CommitCreation commitCrea 201 commit - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -204,6 +207,7 @@ public ApiResponse commitWithHttpInfo(String repository, String branch, 201 commit - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java index 67317d5d1d4..c29667ee1e3 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java @@ -235,6 +235,7 @@ public okhttp3.Call copyObjectAsync(String repository, String branch, String des Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -311,6 +312,7 @@ private okhttp3.Call deleteObjectValidateBeforeCall(String repository, String br Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -332,6 +334,7 @@ public void deleteObject(String repository, String branch, String path) throws A Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -355,6 +358,7 @@ public ApiResponse deleteObjectWithHttpInfo(String repository, String bran Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -378,6 +382,7 @@ public okhttp3.Call deleteObjectAsync(String repository, String branch, String p Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -451,6 +456,7 @@ private okhttp3.Call deleteObjectsValidateBeforeCall(String repository, String b Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -473,6 +479,7 @@ public ObjectErrorList deleteObjects(String repository, String branch, PathList Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -497,6 +504,7 @@ public ApiResponse deleteObjectsWithHttpInfo(String repository, Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 0 Internal Server Error - @@ -1523,6 +1531,7 @@ public okhttp3.Call statObjectAsync(String repository, String ref, String path, 201 object metadata - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1617,6 +1626,7 @@ private okhttp3.Call uploadObjectValidateBeforeCall(String repository, String br 201 object metadata - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1644,6 +1654,7 @@ public ObjectStats uploadObject(String repository, String branch, String path, S 201 object metadata - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1673,6 +1684,7 @@ public ApiResponse uploadObjectWithHttpInfo(String repository, Stri 201 object metadata - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java index d3ada7bf987..bac8d8fce92 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java @@ -560,6 +560,7 @@ public okhttp3.Call logCommitsAsync(String repository, String ref, String after, 200 merge completed - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -638,6 +639,7 @@ private okhttp3.Call mergeIntoBranchValidateBeforeCall(String repository, String 200 merge completed - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -664,6 +666,7 @@ public MergeResult mergeIntoBranch(String repository, String sourceRef, String d 200 merge completed - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -692,6 +695,7 @@ public ApiResponse mergeIntoBranchWithHttpInfo(String repository, S 200 merge completed - 400 Validation Error - 401 Unauthorized - + 403 Internal Server Error - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - diff --git a/clients/python/docs/BranchesApi.md b/clients/python/docs/BranchesApi.md index 9b5b6ea5df3..7679797b689 100644 --- a/clients/python/docs/BranchesApi.md +++ b/clients/python/docs/BranchesApi.md @@ -215,6 +215,7 @@ void (empty response body) |-------------|-------------|------------------| **204** | branch deleted successfully | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/CommitsApi.md b/clients/python/docs/CommitsApi.md index 288e5f70dd9..9e228dda622 100644 --- a/clients/python/docs/CommitsApi.md +++ b/clients/python/docs/CommitsApi.md @@ -127,6 +127,7 @@ Name | Type | Description | Notes **201** | commit | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/ObjectsApi.md b/clients/python/docs/ObjectsApi.md index 55b425a4090..6df6f981769 100644 --- a/clients/python/docs/ObjectsApi.md +++ b/clients/python/docs/ObjectsApi.md @@ -224,6 +224,7 @@ void (empty response body) |-------------|-------------|------------------| **204** | object deleted successfully | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -333,6 +334,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | Delete objects response | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -1147,6 +1149,7 @@ Name | Type | Description | Notes **201** | object metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **412** | Precondition Failed | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/RefsApi.md b/clients/python/docs/RefsApi.md index ca3bc589202..e8ab95f3b89 100644 --- a/clients/python/docs/RefsApi.md +++ b/clients/python/docs/RefsApi.md @@ -478,6 +478,7 @@ Name | Type | Description | Notes **200** | merge completed | - | **400** | Validation Error | - | **401** | Unauthorized | - | +**403** | Internal Server Error | - | **404** | Resource Not Found | - | **409** | Conflict Deprecated: content schema will return Error format and not an empty MergeResult | - | **412** | precondition failed (e.g. a pre-merge hook returned a failure) | - | diff --git a/docs/assets/js/swagger.yml b/docs/assets/js/swagger.yml index 4a41cf1e8c6..acccfb9433f 100644 --- a/docs/assets/js/swagger.yml +++ b/docs/assets/js/swagger.yml @@ -2605,6 +2605,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -2656,6 +2658,8 @@ paths: description: branch deleted successfully 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -2762,6 +2766,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" 409: @@ -3297,6 +3303,8 @@ paths: $ref: "#/components/responses/ValidationError" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" 412: @@ -3313,6 +3321,8 @@ paths: description: object deleted successfully 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: @@ -3350,6 +3360,8 @@ paths: $ref: "#/components/schemas/ObjectErrorList" 401: $ref: "#/components/responses/Unauthorized" + 403: + $ref: "#/components/responses/ServerError" 404: $ref: "#/components/responses/NotFound" default: diff --git a/pkg/api/controller.go b/pkg/api/controller.go index d0d21be843b..6bbec3c3210 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -1849,6 +1849,9 @@ func (c *Controller) handleAPIErrorCallback(ctx context.Context, w http.Response errors.Is(err, kv.ErrNotFound): cb(w, r, http.StatusNotFound, err) + case errors.Is(err, graveler.ErrWriteToProtectedBranch): + cb(w, r, http.StatusForbidden, err) + case errors.Is(err, graveler.ErrDirtyBranch), errors.Is(err, graveler.ErrCommitMetaRangeDirtyBranch), errors.Is(err, graveler.ErrInvalidValue), From 2bb26412c6a247deee4049c31c3d22110474ce40 Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Mon, 20 Feb 2023 09:21:43 +0200 Subject: [PATCH 2/4] apply code review changes --- api/swagger.yml | 18 +++++++++----- clients/java/api/openapi.yaml | 18 +++++++++----- clients/java/docs/BranchesApi.md | 2 +- clients/java/docs/CommitsApi.md | 2 +- clients/java/docs/ObjectsApi.md | 6 ++--- clients/java/docs/RefsApi.md | 2 +- .../io/lakefs/clients/api/BranchesApi.java | 8 +++---- .../io/lakefs/clients/api/CommitsApi.java | 8 +++---- .../io/lakefs/clients/api/ObjectsApi.java | 24 +++++++++---------- .../java/io/lakefs/clients/api/RefsApi.java | 8 +++---- clients/python/docs/BranchesApi.md | 2 +- clients/python/docs/CommitsApi.md | 2 +- clients/python/docs/ObjectsApi.md | 6 ++--- clients/python/docs/RefsApi.md | 2 +- docs/assets/js/swagger.yml | 18 +++++++++----- pkg/api/controller.go | 5 ++-- pkg/api/controller_test.go | 23 ++++++++++++++---- pkg/graveler/errors.go | 5 ++-- 18 files changed, 96 insertions(+), 63 deletions(-) diff --git a/api/swagger.yml b/api/swagger.yml index acccfb9433f..148dc869a9c 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -96,6 +96,12 @@ components: application/json: schema: $ref: "#/components/schemas/Error" + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/Error" ValidationError: description: Validation Error content: @@ -2606,7 +2612,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -2659,7 +2665,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -2767,7 +2773,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" 409: @@ -3304,7 +3310,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" 412: @@ -3322,7 +3328,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -3361,7 +3367,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: diff --git a/clients/java/api/openapi.yaml b/clients/java/api/openapi.yaml index 56be5ed110a..200cfa8a2a5 100644 --- a/clients/java/api/openapi.yaml +++ b/clients/java/api/openapi.yaml @@ -2472,7 +2472,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -2528,7 +2528,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -2758,7 +2758,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -3548,7 +3548,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -3643,7 +3643,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -3776,7 +3776,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Internal Server Error + description: Forbidden "404": content: application/json: @@ -5080,6 +5080,12 @@ components: schema: $ref: '#/components/schemas/Error' description: Precondition Failed + Forbidden: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: Forbidden ValidationError: content: application/json: diff --git a/clients/java/docs/BranchesApi.md b/clients/java/docs/BranchesApi.md index b009f9c6dfd..76e9cbd84dc 100644 --- a/clients/java/docs/BranchesApi.md +++ b/clients/java/docs/BranchesApi.md @@ -185,7 +185,7 @@ null (empty response body) |-------------|-------------|------------------| **204** | branch deleted successfully | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/CommitsApi.md b/clients/java/docs/CommitsApi.md index 0340884d1ec..35fead4916c 100644 --- a/clients/java/docs/CommitsApi.md +++ b/clients/java/docs/CommitsApi.md @@ -98,7 +98,7 @@ Name | Type | Description | Notes **201** | commit | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/ObjectsApi.md b/clients/java/docs/ObjectsApi.md index 987ab0fb33c..d364be13fe9 100644 --- a/clients/java/docs/ObjectsApi.md +++ b/clients/java/docs/ObjectsApi.md @@ -193,7 +193,7 @@ null (empty response body) |-------------|-------------|------------------| **204** | object deleted successfully | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -283,7 +283,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | Delete objects response | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -944,7 +944,7 @@ Name | Type | Description | Notes **201** | object metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **412** | Precondition Failed | - | **0** | Internal Server Error | - | diff --git a/clients/java/docs/RefsApi.md b/clients/java/docs/RefsApi.md index d42e954f315..a410ae9ae38 100644 --- a/clients/java/docs/RefsApi.md +++ b/clients/java/docs/RefsApi.md @@ -382,7 +382,7 @@ Name | Type | Description | Notes **200** | merge completed | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **409** | Conflict Deprecated: content schema will return Error format and not an empty MergeResult | - | **412** | precondition failed (e.g. a pre-merge hook returned a failure) | - | diff --git a/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java b/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java index 427d1e7a789..6a6b01c2187 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/BranchesApi.java @@ -213,7 +213,7 @@ public okhttp3.Call createBranchAsync(String repository, BranchCreation branchCr Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -280,7 +280,7 @@ private okhttp3.Call deleteBranchValidateBeforeCall(String repository, String br Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -301,7 +301,7 @@ public void deleteBranch(String repository, String branch) throws ApiException { Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -324,7 +324,7 @@ public ApiResponse deleteBranchWithHttpInfo(String repository, String bran Status Code Description Response Headers 204 branch deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java index 69910b3aa1f..d136b34fa85 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/CommitsApi.java @@ -72,7 +72,7 @@ public void setApiClient(ApiClient apiClient) { 201 commit - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -153,7 +153,7 @@ private okhttp3.Call commitValidateBeforeCall(String repository, String branch, 201 commit - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -179,7 +179,7 @@ public Commit commit(String repository, String branch, CommitCreation commitCrea 201 commit - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - @@ -207,7 +207,7 @@ public ApiResponse commitWithHttpInfo(String repository, String branch, 201 commit - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed (e.g. a pre-commit hook returned a failure) - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java index c29667ee1e3..000c3dbb2be 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/ObjectsApi.java @@ -235,7 +235,7 @@ public okhttp3.Call copyObjectAsync(String repository, String branch, String des Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -312,7 +312,7 @@ private okhttp3.Call deleteObjectValidateBeforeCall(String repository, String br Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -334,7 +334,7 @@ public void deleteObject(String repository, String branch, String path) throws A Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -358,7 +358,7 @@ public ApiResponse deleteObjectWithHttpInfo(String repository, String bran Status Code Description Response Headers 204 object deleted successfully - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -382,7 +382,7 @@ public okhttp3.Call deleteObjectAsync(String repository, String branch, String p Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -456,7 +456,7 @@ private okhttp3.Call deleteObjectsValidateBeforeCall(String repository, String b Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -479,7 +479,7 @@ public ObjectErrorList deleteObjects(String repository, String branch, PathList Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -504,7 +504,7 @@ public ApiResponse deleteObjectsWithHttpInfo(String repository, Status Code Description Response Headers 200 Delete objects response - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -1531,7 +1531,7 @@ public okhttp3.Call statObjectAsync(String repository, String ref, String path, 201 object metadata - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1626,7 +1626,7 @@ private okhttp3.Call uploadObjectValidateBeforeCall(String repository, String br 201 object metadata - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1654,7 +1654,7 @@ public ObjectStats uploadObject(String repository, String branch, String path, S 201 object metadata - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - @@ -1684,7 +1684,7 @@ public ApiResponse uploadObjectWithHttpInfo(String repository, Stri 201 object metadata - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 412 Precondition Failed - 0 Internal Server Error - diff --git a/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java b/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java index bac8d8fce92..7b8e4230566 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/RefsApi.java @@ -560,7 +560,7 @@ public okhttp3.Call logCommitsAsync(String repository, String ref, String after, 200 merge completed - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -639,7 +639,7 @@ private okhttp3.Call mergeIntoBranchValidateBeforeCall(String repository, String 200 merge completed - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -666,7 +666,7 @@ public MergeResult mergeIntoBranch(String repository, String sourceRef, String d 200 merge completed - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - @@ -695,7 +695,7 @@ public ApiResponse mergeIntoBranchWithHttpInfo(String repository, S 200 merge completed - 400 Validation Error - 401 Unauthorized - - 403 Internal Server Error - + 403 Forbidden - 404 Resource Not Found - 409 Conflict Deprecated: content schema will return Error format and not an empty MergeResult - 412 precondition failed (e.g. a pre-merge hook returned a failure) - diff --git a/clients/python/docs/BranchesApi.md b/clients/python/docs/BranchesApi.md index 7679797b689..9eadc05c3a1 100644 --- a/clients/python/docs/BranchesApi.md +++ b/clients/python/docs/BranchesApi.md @@ -215,7 +215,7 @@ void (empty response body) |-------------|-------------|------------------| **204** | branch deleted successfully | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/CommitsApi.md b/clients/python/docs/CommitsApi.md index 9e228dda622..2cab7e1843a 100644 --- a/clients/python/docs/CommitsApi.md +++ b/clients/python/docs/CommitsApi.md @@ -127,7 +127,7 @@ Name | Type | Description | Notes **201** | commit | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **412** | Precondition Failed (e.g. a pre-commit hook returned a failure) | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/ObjectsApi.md b/clients/python/docs/ObjectsApi.md index 6df6f981769..e19b36d99a4 100644 --- a/clients/python/docs/ObjectsApi.md +++ b/clients/python/docs/ObjectsApi.md @@ -224,7 +224,7 @@ void (empty response body) |-------------|-------------|------------------| **204** | object deleted successfully | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -334,7 +334,7 @@ Name | Type | Description | Notes |-------------|-------------|------------------| **200** | Delete objects response | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | @@ -1149,7 +1149,7 @@ Name | Type | Description | Notes **201** | object metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **412** | Precondition Failed | - | **0** | Internal Server Error | - | diff --git a/clients/python/docs/RefsApi.md b/clients/python/docs/RefsApi.md index e8ab95f3b89..080cd298528 100644 --- a/clients/python/docs/RefsApi.md +++ b/clients/python/docs/RefsApi.md @@ -478,7 +478,7 @@ Name | Type | Description | Notes **200** | merge completed | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Internal Server Error | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **409** | Conflict Deprecated: content schema will return Error format and not an empty MergeResult | - | **412** | precondition failed (e.g. a pre-merge hook returned a failure) | - | diff --git a/docs/assets/js/swagger.yml b/docs/assets/js/swagger.yml index acccfb9433f..148dc869a9c 100644 --- a/docs/assets/js/swagger.yml +++ b/docs/assets/js/swagger.yml @@ -96,6 +96,12 @@ components: application/json: schema: $ref: "#/components/schemas/Error" + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: "#/components/schemas/Error" ValidationError: description: Validation Error content: @@ -2606,7 +2612,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -2659,7 +2665,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -2767,7 +2773,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" 409: @@ -3304,7 +3310,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" 412: @@ -3322,7 +3328,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: @@ -3361,7 +3367,7 @@ paths: 401: $ref: "#/components/responses/Unauthorized" 403: - $ref: "#/components/responses/ServerError" + $ref: "#/components/responses/Forbidden" 404: $ref: "#/components/responses/NotFound" default: diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 6bbec3c3210..19c649f0bee 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -19,8 +19,6 @@ import ( "strings" "time" - tablediff "github.com/treeverse/lakefs/pkg/plugins/diff" - "github.com/aws/aws-sdk-go/aws" "github.com/davecgh/go-spew/spew" "github.com/go-openapi/swag" @@ -40,6 +38,7 @@ import ( "github.com/treeverse/lakefs/pkg/kv" "github.com/treeverse/lakefs/pkg/logging" "github.com/treeverse/lakefs/pkg/permissions" + tablediff "github.com/treeverse/lakefs/pkg/plugins/diff" "github.com/treeverse/lakefs/pkg/stats" "github.com/treeverse/lakefs/pkg/templater" "github.com/treeverse/lakefs/pkg/upload" @@ -1849,7 +1848,7 @@ func (c *Controller) handleAPIErrorCallback(ctx context.Context, w http.Response errors.Is(err, kv.ErrNotFound): cb(w, r, http.StatusNotFound, err) - case errors.Is(err, graveler.ErrWriteToProtectedBranch): + case errors.Is(err, graveler.ErrProtectedBranch): cb(w, r, http.StatusForbidden, err) case errors.Is(err, graveler.ErrDirtyBranch), diff --git a/pkg/api/controller_test.go b/pkg/api/controller_test.go index 7e42581c98e..9c93f4a8fc3 100644 --- a/pkg/api/controller_test.go +++ b/pkg/api/controller_test.go @@ -22,11 +22,8 @@ import ( "text/template" "time" - "github.com/deepmap/oapi-codegen/pkg/securityprovider" - - tablediff "github.com/treeverse/lakefs/pkg/plugins/diff" - "github.com/davecgh/go-spew/spew" + "github.com/deepmap/oapi-codegen/pkg/securityprovider" "github.com/go-openapi/swag" "github.com/go-test/deep" "github.com/hashicorp/go-multierror" @@ -42,6 +39,7 @@ import ( "github.com/treeverse/lakefs/pkg/graveler" "github.com/treeverse/lakefs/pkg/httputil" "github.com/treeverse/lakefs/pkg/ingest/store" + tablediff "github.com/treeverse/lakefs/pkg/plugins/diff" "github.com/treeverse/lakefs/pkg/stats" "github.com/treeverse/lakefs/pkg/testutil" "github.com/treeverse/lakefs/pkg/upload" @@ -868,6 +866,23 @@ func TestController_CommitHandler(t *testing.T) { t.Errorf("creation date expected %d, got: %d", date, resp.JSON201.CreationDate) } }) + + t.Run("protected branch", func(t *testing.T) { + repo := testUniqueRepoName() + _, err := deps.catalog.CreateRepository(ctx, repo, onBlock(deps, repo), "main") + testutil.MustDo(t, "create repository", err) + err = deps.catalog.CreateBranchProtectionRule(ctx, repo, "main", []graveler.BranchProtectionBlockedAction{graveler.BranchProtectionBlockedAction_COMMIT}) + testutil.MustDo(t, "protection rule", err) + err = deps.catalog.CreateEntry(ctx, repo, "main", catalog.DBEntry{Path: "foo/bar", PhysicalAddress: "pa", CreationDate: time.Now(), Size: 666, Checksum: "cs", Metadata: nil}) + testutil.MustDo(t, "commit to protected branch", err) + resp, err := clt.CommitWithResponse(ctx, repo, "main", &api.CommitParams{}, api.CommitJSONRequestBody{ + Message: "committed to protected branch", + }) + testutil.Must(t, err) + if resp.JSON403 == nil { + t.Fatalf("Commit to protected branch should be forbidden (403), got %s", resp.Status()) + } + }) } func TestController_CreateRepositoryHandler(t *testing.T) { diff --git a/pkg/graveler/errors.go b/pkg/graveler/errors.go index 9656a4e87c4..71bbc9abddf 100644 --- a/pkg/graveler/errors.go +++ b/pkg/graveler/errors.go @@ -17,9 +17,10 @@ var ( ErrNotFound = wrapError(kv.ErrNotFound, "not found") ErrNotUnique = wrapError(ErrUserVisible, "not unique") ErrPreconditionFailed = errors.New("precondition failed") - ErrWriteToProtectedBranch = wrapError(ErrUserVisible, "cannot write to protected branch") + ErrProtectedBranch = errors.New("protected branch") + ErrWriteToProtectedBranch = wrapError(ErrProtectedBranch, "cannot write to protected branch") ErrReadingFromStore = errors.New("cannot read from store") - ErrCommitToProtectedBranch = wrapError(ErrUserVisible, "cannot commit to protected branch") + ErrCommitToProtectedBranch = wrapError(ErrProtectedBranch, "cannot commit to protected branch") ErrInvalidValue = fmt.Errorf("invalid value: %w", ErrInvalid) ErrInvalidMergeBase = fmt.Errorf("only 2 commits allowed in FindMergeBase: %w", ErrInvalidValue) ErrNoCommitGeneration = errors.New("no commit generation") From 780f6e36e0bee9e12375eec3fac2a07b95d00796 Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Wed, 22 Feb 2023 17:06:50 +0200 Subject: [PATCH 3/4] fix indent --- pkg/api/controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 411902a1025..f1ac821bf82 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -1830,7 +1830,7 @@ func (c *Controller) handleAPIErrorCallback(ctx context.Context, w http.Response case errors.Is(err, store.ErrForbidden), errors.Is(err, local.ErrForbidden), errors.Is(err, graveler.ErrProtectedBranch): - cb(w, r, http.StatusForbidden, err) + cb(w, r, http.StatusForbidden, err) case errors.Is(err, graveler.ErrDirtyBranch), errors.Is(err, graveler.ErrCommitMetaRangeDirtyBranch), From 1eac381e5e416de8696fb8d8d07821e3a6c8661a Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Wed, 22 Feb 2023 17:21:05 +0200 Subject: [PATCH 4/4] fix dup Forbidden message type --- api/swagger.yml | 6 ------ clients/java/api/openapi.yaml | 8 +------- clients/java/docs/ImportApi.md | 2 +- .../src/main/java/io/lakefs/clients/api/ImportApi.java | 8 ++++---- clients/python/docs/ImportApi.md | 2 +- docs/assets/js/swagger.yml | 6 ------ 6 files changed, 7 insertions(+), 25 deletions(-) diff --git a/api/swagger.yml b/api/swagger.yml index 8a6947b4992..870d1380870 100644 --- a/api/swagger.yml +++ b/api/swagger.yml @@ -79,12 +79,6 @@ components: application/json: schema: $ref: "#/components/schemas/Error" - Forbidden: - description: Access is forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" NotFound: description: Resource Not Found content: diff --git a/clients/java/api/openapi.yaml b/clients/java/api/openapi.yaml index f075e0241e0..7f153e25415 100644 --- a/clients/java/api/openapi.yaml +++ b/clients/java/api/openapi.yaml @@ -3423,7 +3423,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - description: Access is forbidden + description: Forbidden "404": content: application/json: @@ -5048,12 +5048,6 @@ components: schema: $ref: '#/components/schemas/Error' description: Internal Server Error - Forbidden: - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - description: Access is forbidden NotFound: content: application/json: diff --git a/clients/java/docs/ImportApi.md b/clients/java/docs/ImportApi.md index bc80ba388de..cc46f2d80b0 100644 --- a/clients/java/docs/ImportApi.md +++ b/clients/java/docs/ImportApi.md @@ -93,7 +93,7 @@ Name | Type | Description | Notes **201** | metarange metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Access is forbidden | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/clients/java/src/main/java/io/lakefs/clients/api/ImportApi.java b/clients/java/src/main/java/io/lakefs/clients/api/ImportApi.java index d4bb2a24b8b..e254367fd44 100644 --- a/clients/java/src/main/java/io/lakefs/clients/api/ImportApi.java +++ b/clients/java/src/main/java/io/lakefs/clients/api/ImportApi.java @@ -71,7 +71,7 @@ public void setApiClient(ApiClient apiClient) { 201 metarange metadata - 400 Validation Error - 401 Unauthorized - - 403 Access is forbidden - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -139,7 +139,7 @@ private okhttp3.Call createMetaRangeValidateBeforeCall(String repository, MetaRa 201 metarange metadata - 400 Validation Error - 401 Unauthorized - - 403 Access is forbidden - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -162,7 +162,7 @@ public MetaRangeCreationResponse createMetaRange(String repository, MetaRangeCre 201 metarange metadata - 400 Validation Error - 401 Unauthorized - - 403 Access is forbidden - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - @@ -187,7 +187,7 @@ public ApiResponse createMetaRangeWithHttpInfo(String 201 metarange metadata - 400 Validation Error - 401 Unauthorized - - 403 Access is forbidden - + 403 Forbidden - 404 Resource Not Found - 0 Internal Server Error - diff --git a/clients/python/docs/ImportApi.md b/clients/python/docs/ImportApi.md index f69c0c82224..cfdb16f6fa0 100644 --- a/clients/python/docs/ImportApi.md +++ b/clients/python/docs/ImportApi.md @@ -117,7 +117,7 @@ Name | Type | Description | Notes **201** | metarange metadata | - | **400** | Validation Error | - | **401** | Unauthorized | - | -**403** | Access is forbidden | - | +**403** | Forbidden | - | **404** | Resource Not Found | - | **0** | Internal Server Error | - | diff --git a/docs/assets/js/swagger.yml b/docs/assets/js/swagger.yml index 8a6947b4992..870d1380870 100644 --- a/docs/assets/js/swagger.yml +++ b/docs/assets/js/swagger.yml @@ -79,12 +79,6 @@ components: application/json: schema: $ref: "#/components/schemas/Error" - Forbidden: - description: Access is forbidden - content: - application/json: - schema: - $ref: "#/components/schemas/Error" NotFound: description: Resource Not Found content: