[#187] Add handling quota limit reached error #190

Open
r.loginov wants to merge 1 commit from r.loginov/frostfs-http-gw:feature/187-add_handling_quota_reached_error into master
Member

close #187

Before:

$ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/roma
HTTP/1.1 400 Bad Request
Date: Thu, 26 Dec 2024 05:48:39 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 186

could not store file in frostfs: save object via connection pool: access denied: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached

$ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/2Pv71oaMBwcNEx9D2saCvP3aj35pDfvPbqrTsqroxJCd
HTTP/1.1 400 Bad Request
Date: Thu, 26 Dec 2024 05:48:44 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 186

could not store file in frostfs: save object via connection pool: access denied: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached
root@rloginov-node1[rloginov]:/home/service#

Now:

$ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/roma
HTTP/1.1 409 Conflict
Date: Thu, 26 Dec 2024 05:45:45 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 192

could not store file in frostfs: save object via connection pool: quota limit reached: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached

$ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/2Pv71oaMBwcNEx9D2saCvP3aj35pDfvPbqrTsqroxJCd
HTTP/1.1 409 Conflict
Date: Thu, 26 Dec 2024 05:45:54 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 192

could not store file in frostfs: save object via connection pool: quota limit reached: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached
close #187 Before: ``` $ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/roma HTTP/1.1 400 Bad Request Date: Thu, 26 Dec 2024 05:48:39 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 186 could not store file in frostfs: save object via connection pool: access denied: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached $ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/2Pv71oaMBwcNEx9D2saCvP3aj35pDfvPbqrTsqroxJCd HTTP/1.1 400 Bad Request Date: Thu, 26 Dec 2024 05:48:44 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 186 could not store file in frostfs: save object via connection pool: access denied: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached root@rloginov-node1[rloginov]:/home/service# ``` Now: ``` $ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/roma HTTP/1.1 409 Conflict Date: Thu, 26 Dec 2024 05:45:45 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 192 could not store file in frostfs: save object via connection pool: quota limit reached: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached $ curl -i -F "file=@./wallet.json" http://localhost:8888/upload/2Pv71oaMBwcNEx9D2saCvP3aj35pDfvPbqrTsqroxJCd HTTP/1.1 409 Conflict Date: Thu, 26 Dec 2024 05:45:54 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 192 could not store file in frostfs: save object via connection pool: quota limit reached: ape denied request: access to operation PutObject is denied by access policy engine: Quota limit reached ```
r.loginov self-assigned this 2024-12-26 07:43:02 +00:00
r.loginov added 1 commit 2024-12-26 07:43:03 +00:00
[#187] Add handling quota limit reached error
All checks were successful
/ DCO (pull_request) Successful in 2m39s
/ Vulncheck (pull_request) Successful in 2m55s
/ Builds (pull_request) Successful in 4m18s
/ Lint (pull_request) Successful in 4m24s
/ Tests (pull_request) Successful in 3m59s
7f94699ec6
The Access Denied status may be received
from APE due to exceeding the quota. In
this situation, you need to return the
appropriate status code.

Signed-off-by: Roman Loginov <r.loginov@yadro.com>
Author
Member

If you don't like the idea of porting the FrostFS interface, I can transfer the error handling function from the response package to the handler package.

If you don't like the idea of porting the [FrostFS interface](https://git.frostfs.info/TrueCloudLab/frostfs-http-gw/src/commit/7f94699ec680266c49436fdbd26e3708fcd04572/internal/layer/frostfs.go#L123), I can transfer the [error handling function](https://git.frostfs.info/TrueCloudLab/frostfs-http-gw/src/commit/7f94699ec680266c49436fdbd26e3708fcd04572/response/utils.go#L18) from the response package to the handler package.
r.loginov changed title from WIP: [#187] Add handling quota limit reached error to [#187] Add handling quota limit reached error 2024-12-26 07:54:55 +00:00
r.loginov requested review from storage-services-developers 2024-12-26 07:54:55 +00:00
r.loginov requested review from storage-services-committers 2024-12-26 07:54:55 +00:00
dkirillov reviewed 2025-01-09 08:23:36 +00:00
@ -143,4 +40,0 @@
)
// FrostFS represents virtual connection to FrostFS network.
type FrostFS interface {
Member

Let's try to keep the interface in this handler package

Let's try to keep the interface in this `handler` package
dkirillov marked this conversation as resolved
dkirillov reviewed 2025-01-09 08:24:23 +00:00
docs/api.md Outdated
@ -92,6 +92,7 @@ The `filename` field from the multipart form will be set as `FileName` attribute
|--------|----------------------------------------------|
| 200 | Object created successfully. |
| 400 | Some error occurred during object uploading. |
| 409 | The quota was exceeded. |
Member

Probably we also should update CHANGELOG.md

Probably we also should update CHANGELOG.md
dkirillov marked this conversation as resolved
r.loginov force-pushed feature/187-add_handling_quota_reached_error from 7f94699ec6 to ce66b900fe 2025-01-09 13:04:11 +00:00 Compare
dkirillov approved these changes 2025-01-09 14:40:41 +00:00
mbiryukova approved these changes 2025-01-10 03:06:55 +00:00
All checks were successful
/ DCO (pull_request) Successful in 39s
Required
Details
/ Vulncheck (pull_request) Successful in 41s
Required
Details
/ Builds (pull_request) Successful in 50s
Required
Details
/ Lint (pull_request) Successful in 1m50s
Required
Details
/ Tests (pull_request) Successful in 51s
Required
Details
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/187-add_handling_quota_reached_error:r.loginov-feature/187-add_handling_quota_reached_error
git checkout r.loginov-feature/187-add_handling_quota_reached_error
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#190
No description provided.