mirror of
https://github.com/versity/versitygw.git
synced 2026-01-08 12:41:10 +00:00
feat: Refactoring admin APIs: changes i/o data transfer encoding to xml, implements traditional aws-like error handling, adds admin role checker middleware. Refactoring admin CLI actions to handle aws-like error responses
This commit is contained in:
@@ -143,6 +143,13 @@ const (
|
||||
ErrDirectoryObjectContainsData
|
||||
ErrQuotaExceeded
|
||||
ErrVersioningNotConfigured
|
||||
|
||||
// Admin api errors
|
||||
ErrAdminAccessDenied
|
||||
ErrAdminUserNotFound
|
||||
ErrAdminUserExists
|
||||
ErrAdminInvalidUserRole
|
||||
ErrAdminMissingUserAcess
|
||||
)
|
||||
|
||||
var errorCodeResponse = map[ErrorCode]APIError{
|
||||
@@ -578,6 +585,33 @@ var errorCodeResponse = map[ErrorCode]APIError{
|
||||
Description: "Versioning has not been configured for the gateway.",
|
||||
HTTPStatusCode: http.StatusNotImplemented,
|
||||
},
|
||||
|
||||
// Admin api errors
|
||||
ErrAdminAccessDenied: {
|
||||
Code: "XAdminAccessDenied",
|
||||
Description: "Only admin users have access to this resource.",
|
||||
HTTPStatusCode: http.StatusForbidden,
|
||||
},
|
||||
ErrAdminUserNotFound: {
|
||||
Code: "XAdminUserNotFound",
|
||||
Description: "No user exists with the provided access key ID.",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
},
|
||||
ErrAdminUserExists: {
|
||||
Code: "XAdminUserExists",
|
||||
Description: "A user with the provided access key ID already exists.",
|
||||
HTTPStatusCode: http.StatusConflict,
|
||||
},
|
||||
ErrAdminInvalidUserRole: {
|
||||
Code: "XAdminInvalidArgument",
|
||||
Description: "User role has to be one of the following: 'user', 'admin', 'userplus'.",
|
||||
HTTPStatusCode: http.StatusBadRequest,
|
||||
},
|
||||
ErrAdminMissingUserAcess: {
|
||||
Code: "XAdminInvalidArgument",
|
||||
Description: "User access key ID is missing.",
|
||||
HTTPStatusCode: http.StatusNotFound,
|
||||
},
|
||||
}
|
||||
|
||||
// GetAPIError provides API Error for input API error code.
|
||||
|
||||
Reference in New Issue
Block a user