2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
2022-04-07 20:49:58 +03:00
/* Copyright 2002-2022, 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"
2019-12-10 13:45:15 +03:00
# include "ClusterPool.h"
# include "DatastorePool.h"
# include "DocumentPool.h"
# include "HookPool.h"
# include "HostPool.h"
# include "ImagePool.h"
# include "MarketPlacePool.h"
# include "MarketPlaceAppPool.h"
# include "SecurityGroupPool.h"
# include "VdcPool.h"
# include "VirtualMachinePool.h"
# include "VirtualNetworkPool.h"
# include "VirtualRouterPool.h"
# include "VMGroupPool.h"
# include "VMTemplatePool.h"
# include "VNTemplatePool.h"
# include "ZonePool.h"
2011-05-25 21:26:52 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerInfo : public Request
{
protected :
2020-07-02 23:42:10 +03:00
RequestManagerInfo ( const std : : string & method_name ,
const std : : string & help )
2012-06-13 19:41:54 +04:00
: 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 ;
2021-04-20 14:40:44 +03:00
zone_disabled = true ;
2011-05-26 02:59:50 +04:00
} ;
2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) override ;
2011-06-10 21:43:30 +04:00
/* -------------------------------------------------------------------- */
2014-09-11 19:00:27 +04:00
virtual void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
2020-07-02 23:42:10 +03:00
std : : string & str )
2011-06-10 21:43:30 +04:00
{
object - > to_xml ( str ) ;
} ;
2020-03-04 18:05:57 +03:00
virtual void load_monitoring ( PoolObjectSQL * obj ) const
{
}
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
} ;
2011-06-25 03:29:44 +04:00
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2019-09-09 14:13:52 +03:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
2020-07-02 23:42:10 +03:00
std : : string & str ) override
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
} ;
2020-03-04 18:05:57 +03:00
void load_monitoring ( PoolObjectSQL * obj ) const override
{
static_cast < VirtualMachine * > ( obj ) - > load_monitoring ( ) ;
}
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
} ;
2015-07-21 17:24:43 +03:00
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2015-07-21 17:24:43 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
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
} ;
2011-06-10 21:43:30 +04:00
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2020-07-02 23:42:10 +03:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
std : : string & str ) override ;
2011-05-25 21:26:52 +04:00
} ;
2018-11-20 19:24:59 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualNetworkTemplateInfo : public RequestManagerInfo
{
public :
VirtualNetworkTemplateInfo ( ) :
RequestManagerInfo ( " one.vntemplate.info " ,
" Returns virtual network template information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vntpool ( ) ;
auth_object = PoolObjectSQL : : VNTEMPLATE ;
} ;
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2018-11-20 19:24:59 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2018-11-20 19:24:59 +03:00
} ;
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
} ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
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
} ;
2020-03-04 18:05:57 +03:00
protected :
void load_monitoring ( PoolObjectSQL * obj ) const override
{
static_cast < Host * > ( obj ) - > load_monitoring ( ) ;
}
2011-05-25 21:26:52 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
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
} ;
2013-02-28 17:53:34 +04:00
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2020-07-02 23:42:10 +03:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
std : : string & str ) override
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
} ;
2013-02-28 17:53:34 +04:00
/* -------------------------------------------------------------------- */
2020-03-04 18:05:57 +03:00
protected :
2020-07-02 23:42:10 +03:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
std : : string & str ) override
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
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 ;
} ;
} ;
2019-09-09 15:43:51 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class HookInfo : public RequestManagerInfo
{
public :
HookInfo ( ) :
RequestManagerInfo ( " one.hook.info " ,
" Returns hook information " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_hkpool ( ) ;
auth_object = PoolObjectSQL : : HOOK ;
} ;
~ HookInfo ( ) { } ;
2020-03-04 18:05:57 +03:00
protected :
2019-09-09 15:43:51 +03:00
void to_xml ( RequestAttributes & att , PoolObjectSQL * object ,
2020-07-02 23:42:10 +03:00
std : : string & str )
2019-09-09 15:43:51 +03:00
{
( static_cast < Hook * > ( object ) ) - > to_xml_extended ( str ) ;
} ;
} ;
2011-05-25 21:26:52 +04:00
# endif