2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
2013-01-24 19:18:30 +04:00
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
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 ( ) { } ;
/* -------------------------------------------------------------------- */
2011-07-07 14:45:13 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
2011-06-10 21:43:30 +04:00
/* -------------------------------------------------------------------- */
virtual void to_xml ( PoolObjectSQL * object , string & str )
{
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 " )
{
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
/* -------------------------------------------------------------------- */
void to_xml ( PoolObjectSQL * object , string & str )
{
VirtualMachine * vm = static_cast < VirtualMachine * > ( object ) ;
vm - > to_xml_extended ( str ) ;
} ;
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 " )
{
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 ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
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 " )
{
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
/* -------------------------------------------------------------------- */
void to_xml ( PoolObjectSQL * object , string & str )
{
VirtualNetwork * vn = static_cast < VirtualNetwork * > ( object ) ;
vn - > to_xml_extended ( 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 " )
{
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 " )
{
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
/* -------------------------------------------------------------------- */
void to_xml ( PoolObjectSQL * object , string & str )
{
Group * group = static_cast < Group * > ( object ) ;
group - > to_xml_extended ( str ) ;
} ;
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
/* -------------------------------------------------------------------- */
void to_xml ( PoolObjectSQL * object , string & str )
{
User * user = static_cast < User * > ( object ) ;
user - > to_xml_extended ( str ) ;
} ;
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 ( ) { } ;
} ;
2011-05-25 21:26:52 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
# endif