2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
2018-01-02 20:27:37 +03:00
/* Copyright 2002-2018, 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
{
2018-01-24 17:33:12 +03:00
auth_op = AuthRequest : : USE_NO_LCK ;
2017-05-08 11:47:42 +03:00
leader_only = false ;
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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.vm.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.template.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.vn.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.image.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.host.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.group.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.user.info " ,
2011-05-25 21:26:52 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.datastore.info " ,
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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.cluster.info " ,
2012-02-24 18:53:53 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.document.info " ,
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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.zone.info " ,
2013-12-12 22:08:59 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.secgroup.info " ,
2014-09-08 13:50:25 +04:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.vdc.info " ,
2014-12-19 19:30:00 +03:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.vrouter.info " ,
2015-11-30 18:50:23 +03:00
" 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 ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.market.info " ,
2015-12-11 17:53:19 +03:00
" Returns marketplace information " )
2015-12-06 01:52:28 +03:00
{
Nebula & nd = Nebula : : instance ( ) ;
2015-12-11 17:53:19 +03:00
pool = nd . get_marketpool ( ) ;
2015-12-06 01:52:28 +03:00
auth_object = PoolObjectSQL : : MARKETPLACE ;
} ;
~ MarketPlaceInfo ( ) { } ;
} ;
2015-12-11 17:53:19 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAppInfo : public RequestManagerInfo
{
public :
MarketPlaceAppInfo ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.marketapp.info " ,
2015-12-11 17:53:19 +03:00
" Returns marketplace app information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_apppool ( ) ;
auth_object = PoolObjectSQL : : MARKETPLACEAPP ;
} ;
~ MarketPlaceAppInfo ( ) { } ;
} ;
2017-01-03 03:22:10 +03:00
2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-01-03 03:22:10 +03:00
class VMGroupInfo : public RequestManagerInfo
{
public :
VMGroupInfo ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerInfo ( " one.vmgroup.info " ,
2017-01-03 03:22:10 +03:00
" Returns vm group information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmgrouppool ( ) ;
auth_object = PoolObjectSQL : : VMGROUP ;
} ;
~ VMGroupInfo ( ) { } ;
} ;
2011-05-25 21:26:52 +04:00
# endif