2014-12-23 18:32:06 +03:00
/* -------------------------------------------------------------------------- */
2016-05-04 13:33:23 +03:00
/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */
2014-12-23 18:32:06 +03: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_VDC_H
# define REQUEST_MANAGER_VDC_H
# include "Request.h"
# include "Nebula.h"
using namespace std ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcEditGroup : public Request
{
public :
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
protected :
VdcEditGroup ( const string & method_name ,
const string & help ,
const string & params ,
bool _check_obj_exist )
: Request ( method_name , params , help ) ,
check_obj_exist ( _check_obj_exist )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vdcpool ( ) ;
aclm = nd . get_aclm ( ) ;
gpool = nd . get_gpool ( ) ;
auth_object = PoolObjectSQL : : VDC ;
auth_op = AuthRequest : : ADMIN ;
} ;
GroupPool * gpool ;
AclManager * aclm ;
bool check_obj_exist ;
virtual int edit_group (
Vdc * vdc , int group_id , string & error_msg ) = 0 ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAddGroup : public VdcEditGroup
{
public :
2017-05-07 22:52:34 +03:00
VdcAddGroup ( ) : VdcEditGroup ( " one.vdc.addgroup " , " Adds a group to the VDC " ,
" A:sii " , true ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcAddGroup ( ) { } ;
int edit_group (
Vdc * vdc , int group_id , string & error_msg ) ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelGroup : public VdcEditGroup
{
public :
2017-05-07 22:52:34 +03:00
VdcDelGroup ( ) : VdcEditGroup ( " one.vdc.delgroup " , " Deletes a group from the VDC " ,
" A:sii " , false ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcDelGroup ( ) { } ;
int edit_group (
Vdc * vdc , int group_id , string & error_msg ) ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcEditResource : public Request
{
public :
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
protected :
VdcEditResource ( const string & method_name ,
const string & help ,
const string & params ,
bool _check_obj_exist ,
PoolSQL * respool ,
PoolObjectSQL : : ObjectType res_obj_type )
: Request ( method_name , params , help ) ,
check_obj_exist ( _check_obj_exist ) ,
respool ( respool ) ,
res_obj_type ( res_obj_type )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vdcpool ( ) ;
zonepool = nd . get_zonepool ( ) ;
local_zone_id = nd . get_zone_id ( ) ;
auth_object = PoolObjectSQL : : VDC ;
auth_op = AuthRequest : : ADMIN ;
} ;
bool check_obj_exist ;
int local_zone_id ;
ZonePool * zonepool ;
PoolSQL * respool ;
PoolObjectSQL : : ObjectType res_obj_type ;
2017-05-07 22:52:34 +03:00
virtual int edit_resource ( Vdc * vdc , int zone_id , int res_id ,
string & error_msg ) = 0 ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAddCluster : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcAddCluster ( ) : VdcEditResource ( " one.vdc.addcluster " ,
" Adds a cluster to the VDC " , " A:siii " , true ,
Nebula : : instance ( ) . get_clpool ( ) , PoolObjectSQL : : CLUSTER ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcAddCluster ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelCluster : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcDelCluster ( ) : VdcEditResource ( " one.vdc.delcluster " ,
" Deletes a cluster from the VDC " , " A:siii " , false ,
Nebula : : instance ( ) . get_clpool ( ) , PoolObjectSQL : : CLUSTER ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcDelCluster ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAddHost : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcAddHost ( ) : VdcEditResource ( " one.vdc.addhost " , " Adds a host to the VDC " ,
" A:siii " , true , Nebula : : instance ( ) . get_hpool ( ) , PoolObjectSQL : : HOST ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcAddHost ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelHost : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcDelHost ( ) : VdcEditResource ( " one.vdc.delhost " , " Deletes a host from the VDC " ,
" A:siii " , false , Nebula : : instance ( ) . get_hpool ( ) , PoolObjectSQL : : HOST ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcDelHost ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAddDatastore : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcAddDatastore ( ) : VdcEditResource ( " one.vdc.adddatastore " ,
" Adds a datastore to the VDC " , " A:siii " , true ,
Nebula : : instance ( ) . get_dspool ( ) , PoolObjectSQL : : DATASTORE ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcAddDatastore ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelDatastore : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcDelDatastore ( ) : VdcEditResource ( " one.vdc.deldatastore " ,
" Deletes a datastore from the VDC " , " A:siii " , false ,
Nebula : : instance ( ) . get_dspool ( ) , PoolObjectSQL : : DATASTORE ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcDelDatastore ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAddVNet : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcAddVNet ( ) : VdcEditResource ( " one.vdc.addvnet " ,
" Adds a virtual network to the VDC " , " A:siii " , true ,
Nebula : : instance ( ) . get_vnpool ( ) , PoolObjectSQL : : NET ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcAddVNet ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelVNet : public VdcEditResource
{
public :
2017-05-07 22:52:34 +03:00
VdcDelVNet ( ) : VdcEditResource ( " one.vdc.delvnet " ,
" Deletes a virtual network from the VDC " , " A:siii " , false ,
Nebula : : instance ( ) . get_vnpool ( ) , PoolObjectSQL : : NET ) { } ;
2014-12-23 18:32:06 +03:00
~ VdcDelVNet ( ) { } ;
2017-05-07 22:52:34 +03:00
int edit_resource ( Vdc * vdc , int zone_id , int res_id , string & error_msg ) ;
2014-12-23 18:32:06 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
# endif