http_api.hrl 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2017-2023 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. %% HTTP API Auth
  17. -define(BAD_USERNAME_OR_PWD, 'BAD_USERNAME_OR_PWD').
  18. -define(BAD_API_KEY_OR_SECRET, 'BAD_API_KEY_OR_SECRET').
  19. %% Bad Request
  20. -define(BAD_REQUEST, 'BAD_REQUEST').
  21. -define(NOT_MATCH, 'NOT_MATCH').
  22. -define(ALREADY_EXISTS, 'ALREADY_EXISTS').
  23. -define(BAD_CONFIG_SCHEMA, 'BAD_CONFIG_SCHEMA').
  24. -define(BAD_LISTENER_ID, 'BAD_LISTENER_ID').
  25. -define(BAD_NODE_NAME, 'BAD_NODE_NAME').
  26. -define(BAD_RPC, 'BAD_RPC').
  27. -define(BAD_TOPIC, 'BAD_TOPIC').
  28. -define(EXCEED_LIMIT, 'EXCEED_LIMIT').
  29. -define(INVALID_PARAMETER, 'INVALID_PARAMETER').
  30. -define(CONFLICT, 'CONFLICT').
  31. -define(NO_DEFAULT_VALUE, 'NO_DEFAULT_VALUE').
  32. -define(DEPENDENCY_EXISTS, 'DEPENDENCY_EXISTS').
  33. -define(MESSAGE_ID_SCHEMA_ERROR, 'MESSAGE_ID_SCHEMA_ERROR').
  34. -define(INVALID_ID, 'INVALID_ID').
  35. %% Resource Not Found
  36. -define(NOT_FOUND, 'NOT_FOUND').
  37. -define(CLIENTID_NOT_FOUND, 'CLIENTID_NOT_FOUND').
  38. -define(CLIENT_NOT_FOUND, 'CLIENT_NOT_FOUND').
  39. -define(MESSAGE_ID_NOT_FOUND, 'MESSAGE_ID_NOT_FOUND').
  40. -define(RESOURCE_NOT_FOUND, 'RESOURCE_NOT_FOUND').
  41. -define(TOPIC_NOT_FOUND, 'TOPIC_NOT_FOUND').
  42. -define(USER_NOT_FOUND, 'USER_NOT_FOUND').
  43. %% Internal error
  44. -define(INTERNAL_ERROR, 'INTERNAL_ERROR').
  45. -define(SERVICE_UNAVAILABLE, 'SERVICE_UNAVAILABLE').
  46. -define(SOURCE_ERROR, 'SOURCE_ERROR').
  47. -define(UPDATE_FAILED, 'UPDATE_FAILED').
  48. -define(REST_FAILED, 'REST_FAILED').
  49. -define(CLIENT_NOT_RESPONSE, 'CLIENT_NOT_RESPONSE').
  50. %% All codes
  51. -define(ERROR_CODES, [
  52. {?BAD_USERNAME_OR_PWD, <<"Bad username or password">>},
  53. {?BAD_API_KEY_OR_SECRET, <<"Bad API key or secret">>},
  54. {'BAD_REQUEST', <<"Request parameters are invalid">>},
  55. {'NOT_MATCH', <<"Conditions are not matched">>},
  56. {'ALREADY_EXISTS', <<"Resource already existed">>},
  57. {'BAD_CONFIG_SCHEMA', <<"Configuration data is invalid">>},
  58. {'BAD_LISTENER_ID', <<"Bad listener ID">>},
  59. {'BAD_NODE_NAME', <<"Bad Node Name">>},
  60. {'BAD_RPC', <<"RPC Failed. Check the cluster status and the requested node status">>},
  61. {'BAD_TOPIC', <<"Topic syntax error, Topic needs to comply with the MQTT protocol standard">>},
  62. {'EXCEED_LIMIT', <<"Create resources that exceed the maximum limit or minimum limit">>},
  63. {'INVALID_PARAMETER', <<"Request parameters is invalid and exceeds the boundary value">>},
  64. {'CONFLICT', <<"Conflicting request resources">>},
  65. {'NO_DEFAULT_VALUE', <<"Request parameters do not use default values">>},
  66. {'DEPENDENCY_EXISTS', <<"Resource is dependent by another resource">>},
  67. {'MESSAGE_ID_SCHEMA_ERROR', <<"Message ID parsing error">>},
  68. {'INVALID_ID', <<"Bad ID schema">>},
  69. {'MESSAGE_ID_NOT_FOUND', <<"Message ID does not exist">>},
  70. {'NOT_FOUND', <<"Resource was not found or does not exist">>},
  71. {'CLIENTID_NOT_FOUND', <<"Client ID was not found or does not exist">>},
  72. {'CLIENT_NOT_FOUND', <<"Client was not found or does not exist(usually not a MQTT client)">>},
  73. {'RESOURCE_NOT_FOUND', <<"Resource not found">>},
  74. {'TOPIC_NOT_FOUND', <<"Topic not found">>},
  75. {'USER_NOT_FOUND', <<"User not found">>},
  76. {'INTERNAL_ERROR', <<"Server inter error">>},
  77. {'SERVICE_UNAVAILABLE', <<"Service unavailable">>},
  78. {'SOURCE_ERROR', <<"Source error">>},
  79. {'UPDATE_FAILED', <<"Update failed">>},
  80. {'REST_FAILED', <<"Reset source or config failed">>},
  81. {'CLIENT_NOT_RESPONSE', <<"Client not responding">>}
  82. ]).