]> git.proxmox.com Git - ceph.git/blame - ceph/src/rgw/rgw_http_errors.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / rgw / rgw_http_errors.h
CommitLineData
7c673cae 1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
9f95a23c 2// vim: ts=8 sw=2 smarttab ft=cpp
7c673cae
FG
3
4#ifndef RGW_HTTP_ERRORS_H_
5#define RGW_HTTP_ERRORS_H_
6
7#include "rgw_common.h"
8
31f18b77 9typedef const std::map<int,const std::pair<int, const char*>> rgw_http_errors;
7c673cae 10
31f18b77 11extern rgw_http_errors rgw_http_s3_errors;
7c673cae 12
31f18b77 13extern rgw_http_errors rgw_http_swift_errors;
7c673cae 14
11fdf7f2
TL
15extern rgw_http_errors rgw_http_sts_errors;
16
92f5a8d4
TL
17extern rgw_http_errors rgw_http_iam_errors;
18
7c673cae
FG
19static 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;
11fdf7f2
TL
36 case 503:
37 return -EBUSY;
7c673cae
FG
38 default:
39 return -EIO;
40 }
41
42 return 0; /* unreachable */
43}
44
45
46#endif