mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
feature #662: moved error codes to Request.h class
This commit is contained in:
parent
c3e29e7f83
commit
04977725a0
@ -24,7 +24,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
* The Request Class represents the basic abstraction for the OpenNebula
|
||||
* XML-RPC API. This interface must be implemented by any XML-RPC API call
|
||||
*/
|
||||
class Request: public xmlrpc_c::method
|
||||
{
|
||||
public:
|
||||
@ -38,6 +41,16 @@ public:
|
||||
xmlrpc_c::paramList const& _paramList,
|
||||
xmlrpc_c::value * const _retval);
|
||||
|
||||
/**
|
||||
* Error codes for the XML-RPC API
|
||||
*/
|
||||
enum ErrorCode {
|
||||
AUTHENTICATION = 0x0100,
|
||||
AUTHORIZATION = 0x0200,
|
||||
GET = 0x0400,
|
||||
ACTION = 0x0800
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
Request(const string& mn,
|
||||
@ -82,7 +95,7 @@ protected:
|
||||
* @param ec error code for this call
|
||||
* @param val string representation of the error
|
||||
*/
|
||||
void failure_response(RequestManager::ErrorCode ec, const string& val);
|
||||
void failure_response(ErrorCode ec, const string& val);
|
||||
|
||||
/**
|
||||
* Logs authorization errors
|
||||
|
@ -38,8 +38,7 @@ void Request::execute(
|
||||
|
||||
if ( upool->authenticate(session, uid, gid) == false )
|
||||
{
|
||||
failure_response(RequestManager::AUTHENTICATION,
|
||||
authenticate_error());
|
||||
failure_response(AUTHENTICATION, authenticate_error());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -50,8 +49,7 @@ void Request::execute(
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void Request::failure_response(RequestManager::ErrorCode ec,
|
||||
const string& str_val)
|
||||
void Request::failure_response(ErrorCode ec, const string& str_val)
|
||||
{
|
||||
vector<xmlrpc_c::value> arrayData;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user