http_api.hrl 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2017-2022 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. %% Bad Request
  17. -define(BAD_REQUEST, 'BAD_REQUEST').
  18. -define(ALREADY_EXISTS, 'ALREADY_EXISTS').
  19. -define(BAD_CONFIG_SCHEMA, 'BAD_CONFIG_SCHEMA').
  20. -define(BAD_LISTENER_ID, 'BAD_LISTENER_ID').
  21. -define(BAD_NODE_NAME, 'BAD_NODE_NAME').
  22. -define(BAD_RPC, 'BAD_RPC').
  23. -define(BAD_TOPIC, 'BAD_TOPIC').
  24. -define(EXCEED_LIMIT, 'EXCEED_LIMIT').
  25. -define(INVALID_PARAMETER, 'INVALID_PARAMETER').
  26. -define(CONFLICT, 'CONFLICT').
  27. -define(NO_DEFAULT_VALUE, 'NO_DEFAULT_VALUE').
  28. -define(DEPENDENCY_EXISTS, 'DEPENDENCY_EXISTS').
  29. -define(MESSAGE_ID_SCHEMA_ERROR, 'MESSAGE_ID_SCHEMA_ERROR').
  30. %% Resource Not Found
  31. -define(NOT_FOUND, 'NOT_FOUND').
  32. -define(CLIENTID_NOT_FOUND, 'CLIENTID_NOT_FOUND').
  33. -define(CLIENT_NOT_FOUND, 'CLIENT_NOT_FOUND').
  34. -define(MESSAGE_ID_NOT_FOUND, 'MESSAGE_ID_NOT_FOUND').
  35. -define(RESOURCE_NOT_FOUND, 'RESOURCE_NOT_FOUND').
  36. -define(TOPIC_NOT_FOUND, 'TOPIC_NOT_FOUND').
  37. -define(USER_NOT_FOUND, 'USER_NOT_FOUND').
  38. %% Internal error
  39. -define(INTERNAL_ERROR, 'INTERNAL_ERROR').
  40. -define(SOURCE_ERROR, 'SOURCE_ERROR').
  41. -define(UPDATE_FAILED, 'UPDATE_FAILED').
  42. -define(REST_FAILED, 'REST_FAILED').
  43. -define(CLIENT_NOT_RESPONSE, 'CLIENT_NOT_RESPONSE').
  44. %% All codes
  45. -define(ERROR_CODES,
  46. [ {'BAD_REQUEST', <<"Request parameters are not legal">>}
  47. , {'ALREADY_EXISTS', <<"Resource already existed">>}
  48. , {'BAD_CONFIG_SCHEMA', <<"Configuration data is not legal">>}
  49. , {'BAD_LISTENER_ID', <<"Bad listener ID">>}
  50. , {'BAD_NODE_NAME', <<"Bad Node Name">>}
  51. , {'BAD_RPC', <<"RPC Failed. Check the cluster status and the requested node status">>}
  52. , {'BAD_TOPIC', <<"Topic syntax error, Topic needs to comply with the MQTT protocol standard">>}
  53. , {'EXCEED_LIMIT', <<"Create resources that exceed the maximum limit or minimum limit">>}
  54. , {'INVALID_PARAMETER', <<"Request parameters is not legal and exceeds the boundary value">>}
  55. , {'CONFLICT', <<"Conflicting request resources">>}
  56. , {'NO_DEFAULT_VALUE', <<"Request parameters do not use default values">>}
  57. , {'DEPENDENCY_EXISTS', <<"Resource is dependent by another resource">>}
  58. , {'MESSAGE_ID_SCHEMA_ERROR', <<"Message ID parsing error">>}
  59. , {'MESSAGE_ID_NOT_FOUND', <<"Message ID does not exist">>}
  60. , {'NOT_FOUND', <<"Resource was not found or does not exist">>}
  61. , {'CLIENTID_NOT_FOUND', <<"Client ID was not found or does not exist">>}
  62. , {'CLIENT_NOT_FOUND', <<"Client was not found or does not exist(usually not a MQTT client)">>}
  63. , {'RESOURCE_NOT_FOUND', <<"Resource not found">>}
  64. , {'TOPIC_NOT_FOUND', <<"Topic not found">>}
  65. , {'USER_NOT_FOUND', <<"User not found">>}
  66. , {'INTERNAL_ERROR', <<"Server inter error">>}
  67. , {'SOURCE_ERROR', <<"Source error">>}
  68. , {'UPDATE_FAILED', <<"Update failed">>}
  69. , {'REST_FAILED', <<"Reset source or config failed">>}
  70. , {'CLIENT_NOT_RESPONSE', <<"Client not responding">>}
  71. ]).