2011-05-28 06:03:09 +04:00
/* -------------------------------------------------------------------------- */
2020-04-30 16:00:02 +03:00
/* Copyright 2002-2020, OpenNebula Project, OpenNebula Systems */
2011-05-28 06:03:09 +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_ALLOCATE_H_
# define REQUEST_MANAGER_ALLOCATE_H_
# include "Request.h"
# include "Nebula.h"
# include "VirtualNetworkTemplate.h"
# include "ImageTemplate.h"
# include "VirtualMachineTemplate.h"
2012-02-16 22:37:08 +04:00
# include "DatastoreTemplate.h"
2019-12-10 13:45:15 +03:00
# include "MarketPlaceTemplate.h"
# include "ClusterPool.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-28 06:03:09 +04:00
using namespace std ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerAllocate : public Request
{
protected :
RequestManagerAllocate ( const string & method_name ,
const string & help ,
const string & xml_args ,
2013-12-12 22:08:59 +04:00
bool _do_template )
: Request ( method_name , xml_args , help ) , do_template ( _do_template )
2011-05-28 06:03:09 +04:00
{
auth_op = AuthRequest : : CREATE ;
2012-02-29 19:06:29 +04:00
2012-03-01 20:14:52 +04:00
Nebula & nd = Nebula : : instance ( ) ;
clpool = nd . get_clpool ( ) ;
2011-05-28 06:03:09 +04:00
} ;
~ RequestManagerAllocate ( ) { } ;
/* -------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) override ;
2011-05-28 06:03:09 +04:00
2016-09-29 13:22:07 +03:00
virtual bool allocate_authorization ( xmlrpc_c : : paramList const & _paramList ,
Template * obj_template , RequestAttributes & att ,
PoolObjectAuth * cluster_perms ) ;
2011-05-28 06:03:09 +04:00
/* -------------------------------------------------------------------- */
virtual Template * get_object_template ( ) { return 0 ; } ;
2016-09-23 14:27:45 +03:00
virtual Request : : ErrorCode pool_allocate (
xmlrpc_c : : paramList const & _paramList ,
2011-05-28 06:03:09 +04:00
Template * tmpl ,
2014-05-27 14:58:46 +04:00
int & id ,
RequestAttributes & att )
2012-02-15 19:47:52 +04:00
{
2016-09-23 14:27:45 +03:00
return Request : : INTERNAL ;
2012-02-15 19:47:52 +04:00
} ;
2016-09-23 14:27:45 +03:00
virtual Request : : ErrorCode pool_allocate (
xmlrpc_c : : paramList const & _paramList ,
2012-02-29 19:06:29 +04:00
Template * tmpl ,
int & id ,
RequestAttributes & att ,
2016-03-15 18:37:36 +03:00
int cluster_id ,
const string & cluster_name )
2012-02-29 19:06:29 +04:00
{
2016-01-30 15:55:13 +03:00
return pool_allocate ( _paramList , tmpl , id , att ) ;
2012-02-29 19:06:29 +04:00
} ;
2016-03-20 01:13:10 +03:00
virtual int get_cluster_id ( xmlrpc_c : : paramList const & paramList )
2012-02-29 19:06:29 +04:00
{
2012-03-01 20:14:52 +04:00
return ClusterPool : : NONE_CLUSTER_ID ;
2012-02-29 19:06:29 +04:00
} ;
2012-12-17 19:54:17 +04:00
virtual int add_to_cluster (
Cluster * cluster ,
int id ,
string & error_msg )
2012-02-29 19:06:29 +04:00
{
return - 1 ;
} ;
2012-12-17 19:54:17 +04:00
virtual Datastore : : DatastoreType get_ds_type ( int oid )
{
return Datastore : : FILE_DS ;
} ;
2012-02-29 19:06:29 +04:00
protected :
ClusterPool * clpool ;
2016-03-20 01:13:10 +03:00
int get_cluster_id ( xmlrpc_c : : paramList const & paramList , int cluster_pos )
{
int cid = xmlrpc_c : : value_int ( paramList . getInt ( cluster_pos ) ) ;
if ( cid = = - 1 )
{
cid = ClusterPool : : DEFAULT_CLUSTER_ID ;
}
return cid ;
} ;
2011-05-28 06:03:09 +04:00
private :
bool do_template ;
} ;
2011-06-01 14:37:39 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineAllocate : public RequestManagerAllocate
{
public :
VirtualMachineAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.vm.allocate " ,
2011-06-01 14:37:39 +04:00
" Allocates a new virtual machine " ,
2012-12-20 20:45:27 +04:00
" A:ssb " ,
2011-06-01 14:37:39 +04:00
true )
2014-05-27 14:58:46 +04:00
{
2011-06-01 14:37:39 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : VM ;
2011-06-01 14:37:39 +04:00
} ;
~ VirtualMachineAllocate ( ) { } ;
2012-02-29 19:06:29 +04:00
2011-06-01 14:37:39 +04:00
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2014-05-27 14:58:46 +04:00
{
return new VirtualMachineTemplate ;
2011-06-01 14:37:39 +04:00
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-06-01 14:37:39 +04:00
2016-09-29 13:22:07 +03:00
bool allocate_authorization ( xmlrpc_c : : paramList const & paramList ,
Template * obj_template , RequestAttributes & att ,
2019-07-05 18:23:21 +03:00
PoolObjectAuth * cluster_perms ) override ;
2011-06-01 14:37:39 +04:00
} ;
2011-05-28 06:03:09 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualNetworkAllocate : public RequestManagerAllocate
{
public :
VirtualNetworkAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.vn.allocate " ,
2011-05-28 06:03:09 +04:00
" Allocates a new virtual network " ,
2012-03-09 18:49:45 +04:00
" A:ssi " ,
2011-05-28 06:03:09 +04:00
true )
2014-05-27 14:58:46 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vnpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : NET ;
2011-05-28 06:03:09 +04:00
} ;
~ VirtualNetworkAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2014-05-27 14:58:46 +04:00
{
return new VirtualNetworkTemplate ;
2011-05-28 06:03:09 +04:00
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
2011-05-28 06:03:09 +04:00
Template * tmpl ,
2012-02-29 21:09:47 +04:00
int & id ,
RequestAttributes & att ,
2016-03-15 18:37:36 +03:00
int cluster_id ,
2019-07-05 18:23:21 +03:00
const string & cluster_name ) override ;
2012-03-09 18:49:45 +04:00
2019-07-05 18:23:21 +03:00
int get_cluster_id ( xmlrpc_c : : paramList const & paramList ) override
2012-03-09 18:49:45 +04:00
{
2016-03-20 01:13:10 +03:00
return RequestManagerAllocate : : get_cluster_id ( paramList , 2 ) ;
2012-03-09 18:49:45 +04:00
} ;
2012-12-17 19:54:17 +04:00
int add_to_cluster (
Cluster * cluster ,
int id ,
2019-07-05 18:23:21 +03:00
string & error_msg ) override
2012-03-09 18:49:45 +04:00
{
2019-02-13 19:44:02 +03:00
return clpool - > add_to_cluster ( PoolObjectSQL : : NET , cluster , id , error_msg ) ;
2012-03-09 18:49:45 +04:00
} ;
2011-05-28 06:03:09 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ImageAllocate : public RequestManagerAllocate
{
public :
ImageAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.image.allocate " ,
2011-05-28 06:03:09 +04:00
" Allocates a new image " ,
2018-06-25 17:36:52 +03:00
" A:ssib " ,
2011-05-28 06:03:09 +04:00
true )
2012-02-15 19:47:52 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_ipool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : IMAGE ;
2011-05-28 06:03:09 +04:00
} ;
~ ImageAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2012-02-15 19:47:52 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2011-05-28 06:03:09 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class TemplateAllocate : public RequestManagerAllocate
{
public :
2012-06-08 13:43:55 +04:00
TemplateAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.template.allocate " ,
2011-05-28 06:03:09 +04:00
" Allocates a new virtual machine template " ,
" A:ss " ,
true )
2014-05-27 14:58:46 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_tpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : TEMPLATE ;
2011-05-28 06:03:09 +04:00
} ;
~ TemplateAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2014-05-27 14:58:46 +04:00
{
return new VirtualMachineTemplate ;
2011-05-28 06:03:09 +04:00
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-03-06 19:35:10 +03:00
2016-09-29 13:22:07 +03:00
bool allocate_authorization ( xmlrpc_c : : paramList const & paramList ,
Template * obj_template , RequestAttributes & att ,
2019-07-05 18:23:21 +03:00
PoolObjectAuth * cluster_perms ) override ;
2011-05-28 06:03:09 +04:00
} ;
2018-11-20 19:24:59 +03:00
class VirtualNetworkTemplateAllocate : public RequestManagerAllocate
{
public :
VirtualNetworkTemplateAllocate ( ) :
RequestManagerAllocate ( " one.vntemplate.allocate " ,
" Allocates a new virtual network template " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vntpool ( ) ;
auth_object = PoolObjectSQL : : VNTEMPLATE ;
} ;
~ VirtualNetworkTemplateAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2018-11-20 19:24:59 +03:00
{
return new VirtualMachineTemplate ;
} ;
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2018-11-20 19:24:59 +03:00
bool allocate_authorization ( xmlrpc_c : : paramList const & paramList ,
Template * obj_template , RequestAttributes & att ,
2019-07-05 18:23:21 +03:00
PoolObjectAuth * cluster_perms ) override ;
2018-11-20 19:24:59 +03:00
} ;
2011-05-28 06:03:09 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class HostAllocate : public RequestManagerAllocate
{
public :
HostAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.host.allocate " ,
2011-05-28 06:03:09 +04:00
" Allocates a new host " ,
2016-04-07 13:49:48 +03:00
" A:ssssi " ,
2012-03-01 20:14:52 +04:00
false )
2014-05-27 14:58:46 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_hpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : HOST ;
2011-05-28 06:03:09 +04:00
} ;
~ HostAllocate ( ) { } ;
2012-02-28 20:30:07 +04:00
/* --------------------------------------------------------------------- */
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
2012-02-29 19:06:29 +04:00
Template * tmpl ,
int & id ,
RequestAttributes & att ,
2016-03-15 18:37:36 +03:00
int cluster_id ,
2019-07-05 18:23:21 +03:00
const string & cluster_name ) override ;
2012-02-29 19:06:29 +04:00
2019-07-05 18:23:21 +03:00
int get_cluster_id ( xmlrpc_c : : paramList const & paramList ) override
2012-03-01 20:14:52 +04:00
{
2016-04-07 13:49:48 +03:00
return RequestManagerAllocate : : get_cluster_id ( paramList , 4 ) ;
2012-03-01 20:14:52 +04:00
} ;
2012-02-29 19:06:29 +04:00
2012-12-17 19:54:17 +04:00
int add_to_cluster (
Cluster * cluster ,
int id ,
2019-07-05 18:23:21 +03:00
string & error_msg ) override
2012-03-01 20:14:52 +04:00
{
2019-02-13 19:44:02 +03:00
return clpool - > add_to_cluster ( PoolObjectSQL : : HOST , cluster , id , error_msg ) ; ;
2012-03-01 20:14:52 +04:00
} ;
2011-05-28 06:03:09 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserAllocate : public RequestManagerAllocate
{
public :
UserAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.user.allocate " ,
2011-05-28 06:03:09 +04:00
" Returns user information " ,
2016-09-23 14:27:45 +03:00
" A:ssssA " ,
2011-05-28 06:03:09 +04:00
false )
2014-05-27 14:58:46 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_upool ( ) ;
2016-09-23 14:27:45 +03:00
gpool = nd . get_gpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : USER ;
2014-10-28 18:23:09 +03:00
hidden_params . insert ( 2 ) ; // password argument
2011-05-28 06:03:09 +04:00
} ;
~ UserAllocate ( ) { } ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2016-09-29 13:22:07 +03:00
bool allocate_authorization ( xmlrpc_c : : paramList const & paramList ,
Template * obj_template , RequestAttributes & att ,
2019-07-05 18:23:21 +03:00
PoolObjectAuth * cluster_perms ) override ;
2016-09-23 14:27:45 +03:00
private :
GroupPool * gpool ;
2011-05-28 06:03:09 +04:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupAllocate : public RequestManagerAllocate
{
public :
GroupAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.group.allocate " ,
2011-05-28 06:03:09 +04:00
" Allocates a new group " ,
" A:ss " ,
false )
2014-05-27 14:58:46 +04:00
{
2011-05-28 06:03:09 +04:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_gpool ( ) ;
2012-01-03 05:58:23 +04:00
auth_object = PoolObjectSQL : : GROUP ;
2015-01-26 18:36:54 +03:00
vdcpool = nd . get_vdcpool ( ) ;
2011-05-28 06:03:09 +04:00
} ;
~ GroupAllocate ( ) { } ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-01-26 18:36:54 +03:00
private :
VdcPool * vdcpool ;
2011-05-28 06:03:09 +04:00
} ;
2012-02-09 20:56:47 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DatastoreAllocate : public RequestManagerAllocate
{
public :
DatastoreAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.datastore.allocate " ,
2012-02-09 20:56:47 +04:00
" Allocates a new Datastore " ,
2012-02-29 19:30:52 +04:00
" A:ssi " ,
2012-02-16 22:37:08 +04:00
true )
2012-02-09 20:56:47 +04:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_dspool ( ) ;
auth_object = PoolObjectSQL : : DATASTORE ;
} ;
~ DatastoreAllocate ( ) { } ;
2012-02-16 22:37:08 +04:00
/* -------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2012-02-16 22:37:08 +04:00
{
return new DatastoreTemplate ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
2012-02-09 20:56:47 +04:00
Template * tmpl ,
int & id ,
2012-02-29 19:30:52 +04:00
RequestAttributes & att ,
2016-03-15 18:37:36 +03:00
int cluster_id ,
2019-07-05 18:23:21 +03:00
const string & cluster_name ) override ;
2012-02-29 19:30:52 +04:00
2019-07-05 18:23:21 +03:00
int get_cluster_id ( xmlrpc_c : : paramList const & paramList ) override
2012-03-01 20:14:52 +04:00
{
2016-03-20 01:13:10 +03:00
return RequestManagerAllocate : : get_cluster_id ( paramList , 2 ) ;
2012-03-01 20:14:52 +04:00
} ;
2012-02-29 19:30:52 +04:00
2012-12-17 19:54:17 +04:00
int add_to_cluster (
Cluster * cluster ,
int id ,
2019-07-05 18:23:21 +03:00
string & error_msg ) override
2012-03-01 20:14:52 +04:00
{
2019-02-13 19:44:02 +03:00
return clpool - > add_to_cluster ( PoolObjectSQL : : DATASTORE , cluster , id , error_msg ) ;
2012-03-01 20:14:52 +04:00
} ;
2012-02-09 20:56:47 +04:00
} ;
2012-02-24 18:53:53 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ClusterAllocate : public RequestManagerAllocate
{
public :
ClusterAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.cluster.allocate " ,
2012-02-24 18:53:53 +04:00
" Allocates a new cluster " ,
" A:ss " ,
false )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_clpool ( ) ;
auth_object = PoolObjectSQL : : CLUSTER ;
} ;
~ ClusterAllocate ( ) { } ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2012-02-24 18:53:53 +04:00
} ;
2012-06-08 18:00:16 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DocumentAllocate : public RequestManagerAllocate
{
public :
DocumentAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.document.allocate " ,
2012-06-08 18:00:16 +04:00
" Allocates a new generic document " ,
" A:ssi " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_docpool ( ) ;
auth_object = PoolObjectSQL : : DOCUMENT ;
} ;
~ DocumentAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2012-06-08 18:00:16 +04:00
{
return new Template ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2012-06-08 18:00:16 +04:00
} ;
2013-12-12 22:08:59 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ZoneAllocate : public RequestManagerAllocate
{
public :
ZoneAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.zone.allocate " ,
2013-12-12 22:08:59 +04:00
" Allocates a new zone " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_zonepool ( ) ;
auth_object = PoolObjectSQL : : ZONE ;
} ;
~ ZoneAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2014-02-12 22:27:38 +04:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2014-02-12 22:27:38 +04:00
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2013-12-12 22:08:59 +04:00
{
return new Template ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2013-12-12 22:08:59 +04:00
} ;
2014-09-08 13:50:25 +04:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SecurityGroupAllocate : public RequestManagerAllocate
{
public :
SecurityGroupAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.secgroup.allocate " ,
2014-09-08 13:50:25 +04:00
" Allocates a new security group " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_secgrouppool ( ) ;
auth_object = PoolObjectSQL : : SECGROUP ;
} ;
~ SecurityGroupAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2014-09-08 13:50:25 +04:00
{
return new Template ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
RequestAttributes & att ) ;
2014-09-08 13:50:25 +04:00
} ;
2014-12-19 19:30:00 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcAllocate : public RequestManagerAllocate
{
public :
VdcAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.vdc.allocate " ,
2014-12-19 19:30:00 +03:00
" Allocates a new VDC " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vdcpool ( ) ;
auth_object = PoolObjectSQL : : VDC ;
} ;
~ VdcAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2014-12-19 19:30:00 +03:00
{
return new Template ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2014-12-19 19:30:00 +03:00
} ;
2015-11-30 18:50:23 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualRouterAllocate : public RequestManagerAllocate
{
public :
VirtualRouterAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.vrouter.allocate " ,
2015-11-30 18:50:23 +03:00
" Allocates a new virtual router " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vrouterpool ( ) ;
auth_object = PoolObjectSQL : : VROUTER ;
} ;
~ VirtualRouterAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2015-11-30 18:50:23 +03:00
{
return new Template ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2016-02-01 19:07:04 +03:00
2016-09-29 13:22:07 +03:00
bool allocate_authorization ( xmlrpc_c : : paramList const & paramList ,
Template * obj_template , RequestAttributes & att ,
2019-07-05 18:23:21 +03:00
PoolObjectAuth * cluster_perms ) override ;
2015-11-30 18:50:23 +03:00
} ;
2015-12-06 01:52:28 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAllocate : public RequestManagerAllocate
{
public :
MarketPlaceAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.market.allocate " ,
2015-12-06 01:52:28 +03:00
" Allocates a new marketplace " ,
" A:ss " ,
true )
{
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 ;
} ;
~ MarketPlaceAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2015-12-06 01:52:28 +03:00
{
return new MarketPlaceTemplate ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
2015-12-06 01:52:28 +03:00
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-12-06 01:52:28 +03:00
} ;
2015-12-11 17:53:19 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAppAllocate : public RequestManagerAllocate
{
public :
MarketPlaceAppAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.marketapp.allocate " ,
2015-12-11 17:53:19 +03:00
" Allocates a new marketplace app " ,
" A:ssi " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_apppool ( ) ;
mppool = nd . get_marketpool ( ) ;
auth_object = PoolObjectSQL : : MARKETPLACEAPP ;
} ;
~ MarketPlaceAppAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2015-12-11 17:53:19 +03:00
{
return new MarketPlaceAppTemplate ;
} ;
2016-09-23 14:27:45 +03:00
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
2015-12-11 17:53:19 +03:00
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2015-12-11 17:53:19 +03:00
private :
MarketPlacePool * mppool ;
} ;
2011-05-28 06:03:09 +04:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-01-03 03:22:10 +03:00
class VMGroupAllocate : public RequestManagerAllocate
{
public :
VMGroupAllocate ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerAllocate ( " one.vmgroup.allocate " ,
2017-01-03 03:22:10 +03:00
" Allocates a new vm group " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmgrouppool ( ) ;
auth_object = PoolObjectSQL : : VMGROUP ;
} ;
~ VMGroupAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
2019-07-05 18:23:21 +03:00
Template * get_object_template ( ) override
2017-01-03 03:22:10 +03:00
{
return new Template ;
} ;
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & paramList ,
Template * tmpl ,
int & id ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-01-03 03:22:10 +03:00
} ;
2019-09-09 15:43:51 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class HookAllocate : public RequestManagerAllocate
{
public :
HookAllocate ( ) :
RequestManagerAllocate ( " one.hook.allocate " ,
" Allocates a new hook " ,
" A:ss " ,
true )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_hkpool ( ) ;
auth_object = PoolObjectSQL : : HOOK ;
} ;
~ HookAllocate ( ) { } ;
/* --------------------------------------------------------------------- */
Template * get_object_template ( )
{
return new Template ;
} ;
Request : : ErrorCode pool_allocate ( xmlrpc_c : : paramList const & _paramList ,
Template * tmpl ,
int & id ,
RequestAttributes & att ) ;
} ;
2011-05-28 06:03:09 +04:00
# endif