2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
2015-09-23 16:03:22 +03:00
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
2011-05-25 21:26:52 +04:00
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
# ifndef REQUEST_MANAGER_INFO_H_
# define REQUEST_MANAGER_INFO_H_
# include "Request.h"
# include "Nebula.h"
using namespace std ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerInfo : public Request
{
protected :
RequestManagerInfo ( const string & method_name ,
2012-06-13 19:41:54 +04:00
const string & help )
: Request ( method_name , " A:si " , help )
2011-05-26 02:59:50 +04:00
{
2011-12-28 20:51:10 +04:00
auth_op = AuthRequest : : USE ;
2011-05-26 02:59:50 +04:00
} ;
2011-05-25 21:26:52 +04:00
~ RequestManagerInfo ( ) { } ;
/* -------------------------------------------------------------------- */
2015-07-21 17:24:43 +03:00
virtual void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2011-07-07 14:45:13 +04:00
RequestAttributes & att ) ;
2011-06-10 21:43:30 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
virtual void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
string & str )
2011-06-10 21:43:30 +04:00
{
object - > to_xml ( str ) ;
} ;
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineInfo : public RequestManagerInfo
{
public :
VirtualMachineInfo ( ) :
RequestManagerInfo ( " VirtualMachineInfo " ,
" Returns virtual machine instance information " )
2014-09-11 19:00:27 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : VM ;
2011-05-25 21:26:52 +04:00
} ;
~ VirtualMachineInfo ( ) { } ;
2011-06-25 03:29:44 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object , string & str )
2011-06-25 03:29:44 +04:00
{
2014-09-11 19:00:27 +04:00
static_cast < VirtualMachine * > ( object ) - > to_xml_extended ( str ) ;
2011-06-25 03:29:44 +04:00
} ;
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 14:20:56 +04:00
class TemplateInfo : public RequestManagerInfo
2011-05-25 21:26:52 +04:00
{
public :
2012-06-08 13:43:55 +04:00
TemplateInfo ( ) :
2011-05-25 21:26:52 +04:00
RequestManagerInfo ( " TemplateInfo " ,
" Returns virtual machine template information " )
2014-09-11 19:00:27 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_tpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : TEMPLATE ;
2011-05-25 21:26:52 +04:00
} ;
~ TemplateInfo ( ) { } ;
2015-07-21 17:24:43 +03:00
/* -------------------------------------------------------------------- */
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 14:20:56 +04:00
class VirtualNetworkInfo : public RequestManagerInfo
2011-05-25 21:26:52 +04:00
{
public :
VirtualNetworkInfo ( ) :
RequestManagerInfo ( " VirtualNetworkInfo " ,
" Returns virtual network information " )
2014-09-11 19:00:27 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vnpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : NET ;
2011-05-25 21:26:52 +04:00
} ;
~ VirtualNetworkInfo ( ) { } ;
2011-06-10 21:43:30 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object , string & str ) ;
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 14:20:56 +04:00
class ImageInfo : public RequestManagerInfo
2011-05-25 21:26:52 +04:00
{
public :
ImageInfo ( ) :
RequestManagerInfo ( " ImageInfo " ,
" Returns image information " )
2014-09-11 19:00:27 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_ipool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : IMAGE ;
2011-05-25 21:26:52 +04:00
} ;
~ ImageInfo ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class HostInfo : public RequestManagerInfo
{
public :
HostInfo ( ) :
RequestManagerInfo ( " HostInfo " ,
" Returns host information " )
2014-09-11 19:00:27 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_hpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : HOST ;
2011-05-25 21:26:52 +04:00
} ;
~ HostInfo ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupInfo : public RequestManagerInfo
{
public :
GroupInfo ( ) :
RequestManagerInfo ( " GroupInfo " ,
" Returns group information " )
2013-02-28 17:53:34 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_gpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : GROUP ;
2011-05-25 21:26:52 +04:00
} ;
~ GroupInfo ( ) { } ;
2013-02-28 17:53:34 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object , string & str )
2013-02-28 17:53:34 +04:00
{
2014-09-11 19:00:27 +04:00
static_cast < Group * > ( object ) - > to_xml_extended ( str ) ;
2013-02-28 17:53:34 +04:00
} ;
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserInfo : public RequestManagerInfo
{
public :
UserInfo ( ) :
RequestManagerInfo ( " UserInfo " ,
" Returns user information " )
2013-02-28 17:53:34 +04:00
{
2011-05-25 21:26:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_upool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : USER ;
2011-05-25 21:26:52 +04:00
} ;
~ UserInfo ( ) { } ;
2013-02-28 17:53:34 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object , string & str )
2013-02-28 17:53:34 +04:00
{
2014-09-11 19:00:27 +04:00
static_cast < User * > ( object ) - > to_xml_extended ( str ) ;
2013-02-28 17:53:34 +04:00
} ;
2011-05-25 21:26:52 +04:00
} ;
2012-02-09 20:56:47 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DatastoreInfo : public RequestManagerInfo
{
public :
DatastoreInfo ( ) :
2012-02-10 03:51:26 +04:00
RequestManagerInfo ( " DatastoreInfo " ,
2012-02-09 20:56:47 +04:00
" Returns datastore information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_dspool ( ) ;
auth_object = PoolObjectSQL : : DATASTORE ;
} ;
~ DatastoreInfo ( ) { } ;
} ;
2012-02-24 18:53:53 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ClusterInfo : public RequestManagerInfo
{
public :
ClusterInfo ( ) :
RequestManagerInfo ( " ClusterInfo " ,
" Returns cluster information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_clpool ( ) ;
auth_object = PoolObjectSQL : : CLUSTER ;
} ;
~ ClusterInfo ( ) { } ;
} ;
2012-06-08 18:00:16 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DocumentInfo : public RequestManagerInfo
{
public :
DocumentInfo ( ) :
RequestManagerInfo ( " DocumentInfo " ,
2012-06-13 19:41:54 +04:00
" Returns generic document information " )
2012-06-08 18:00:16 +04:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_docpool ( ) ;
auth_object = PoolObjectSQL : : DOCUMENT ;
} ;
~ DocumentInfo ( ) { } ;
} ;
2013-12-12 22:08:59 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ZoneInfo : public RequestManagerInfo
{
public :
ZoneInfo ( ) :
RequestManagerInfo ( " ZoneInfo " ,
" Returns zone information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_zonepool ( ) ;
auth_object = PoolObjectSQL : : ZONE ;
} ;
~ ZoneInfo ( ) { } ;
} ;
2014-09-08 13:50:25 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SecurityGroupInfo : public RequestManagerInfo
{
public :
SecurityGroupInfo ( ) :
RequestManagerInfo ( " SecurityGroupInfo " ,
" Returns security group information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_secgrouppool ( ) ;
auth_object = PoolObjectSQL : : SECGROUP ;
} ;
~ SecurityGroupInfo ( ) { } ;
} ;
2014-12-19 19:30:00 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcInfo : public RequestManagerInfo
{
public :
VdcInfo ( ) :
RequestManagerInfo ( " VdcInfo " ,
" Returns VDC information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vdcpool ( ) ;
auth_object = PoolObjectSQL : : VDC ;
} ;
~ VdcInfo ( ) { } ;
} ;
2015-11-30 18:50:23 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualRouterInfo : public RequestManagerInfo
{
public :
VirtualRouterInfo ( ) :
RequestManagerInfo ( " VirtualRouterInfo " ,
" Returns virtual router information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vrouterpool ( ) ;
auth_object = PoolObjectSQL : : VROUTER ;
} ;
~ VirtualRouterInfo ( ) { } ;
} ;
2015-12-06 01:52:28 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceInfo : public RequestManagerInfo
{
public :
MarketPlaceInfo ( ) :
RequestManagerInfo ( " MarketPlaceInfo " ,
" Returns MarketPlace information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_mppool ( ) ;
auth_object = PoolObjectSQL : : MARKETPLACE ;
} ;
~ MarketPlaceInfo ( ) { } ;
} ;
2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
# endif