]> git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_http_errors.h
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / rgw / rgw_http_errors.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #ifndef RGW_HTTP_ERRORS_H_
5 #define RGW_HTTP_ERRORS_H_
6
7 #include "rgw_common.h"
8
9 typedef const std::map<int,const std::pair<int, const char*>> rgw_http_errors;
10
11 extern rgw_http_errors rgw_http_s3_errors;
12
13 extern rgw_http_errors rgw_http_swift_errors;
14
15 extern rgw_http_errors rgw_http_sts_errors;
16
17 extern rgw_http_errors rgw_http_iam_errors;
18
19 static inline int rgw_http_error_to_errno(int http_err)
20 {
21 if (http_err >= 200 && http_err <= 299)
22 return 0;
23 switch (http_err) {
24 case 304:
25 return -ERR_NOT_MODIFIED;
26 case 400:
27 return -EINVAL;
28 case 401:
29 return -EPERM;
30 case 403:
31 return -EACCES;
32 case 404:
33 return -ENOENT;
34 case 409:
35 return -ENOTEMPTY;
36 case 503:
37 return -EBUSY;
38 default:
39 return -EIO;
40 }
41
42 return 0; /* unreachable */
43 }
44
45
46 #endif