2011-06-02 00:55:43 +02:00
/* -------------------------------------------------------------------------- */
2019-01-16 11:27:59 +01:00
/* Copyright 2002-2019, OpenNebula Project, OpenNebula Systems */
2011-06-02 00:55:43 +02: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_UPDATE_TEMPLATE_H
# define REQUEST_MANAGER_UPDATE_TEMPLATE_H
# include "Request.h"
# include "Nebula.h"
using namespace std ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerUpdateTemplate : public Request
{
protected :
RequestManagerUpdateTemplate ( const string & method_name ,
2012-06-13 17:41:54 +02:00
const string & help )
: Request ( method_name , " A:sis " , help )
2011-06-02 00:55:43 +02:00
{
auth_op = AuthRequest : : MANAGE ;
} ;
~ RequestManagerUpdateTemplate ( ) { } ;
/* -------------------------------------------------------------------- */
2011-07-07 12:45:13 +02:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) ;
2013-03-12 15:19:00 +01:00
virtual int replace_template ( PoolObjectSQL * object , const string & tmpl ,
const RequestAttributes & att , string & error_str ) ;
2013-06-28 18:00:26 +02:00
virtual int append_template ( PoolObjectSQL * object , const string & tmpl ,
const RequestAttributes & att , string & error_str ) ;
2011-06-02 00:55:43 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class TemplateUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
2012-06-08 11:43:55 +02:00
TemplateUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.template.update " ,
2011-06-02 00:55:43 +02:00
" Updates a virtual machine template " )
2013-01-04 00:04:01 +01:00
{
2011-06-02 00:55:43 +02:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_tpool ( ) ;
2012-01-03 02:58:23 +01:00
auth_object = PoolObjectSQL : : TEMPLATE ;
2011-06-02 00:55:43 +02:00
} ;
~ TemplateUpdateTemplate ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2018-11-20 17:24:59 +01:00
class VirtualNetworkTemplateUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VirtualNetworkTemplateUpdateTemplate ( ) :
RequestManagerUpdateTemplate ( " one.vntemplate.update " ,
" Updates a virtual network template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vntpool ( ) ;
auth_object = PoolObjectSQL : : VNTEMPLATE ;
} ;
~ VirtualNetworkTemplateUpdateTemplate ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-06-02 00:55:43 +02:00
2013-01-04 00:04:01 +01:00
class VirtualMachineUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VirtualMachineUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.vm.update " ,
2013-01-04 00:04:01 +01:00
" Updates a virtual machine user template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmpool ( ) ;
auth_object = PoolObjectSQL : : VM ;
2017-01-30 13:46:05 +01:00
auth_op = nd . get_vm_auth_op ( History : : UPDATE_ACTION ) ;
2013-01-04 00:04:01 +01:00
} ;
~ VirtualMachineUpdateTemplate ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-06-02 00:55:43 +02:00
class ImageUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
ImageUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.image.update " ,
2011-06-02 00:55:43 +02:00
" Updates an image template " )
2013-01-04 00:04:01 +01:00
{
2011-06-02 00:55:43 +02:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_ipool ( ) ;
2012-01-03 02:58:23 +01:00
auth_object = PoolObjectSQL : : IMAGE ;
2011-06-02 00:55:43 +02:00
} ;
~ ImageUpdateTemplate ( ) { } ;
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class HostUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
HostUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.host.update " ,
2011-06-02 00:55:43 +02:00
" Updates a host template " )
2013-01-04 00:04:01 +01:00
{
2011-06-02 00:55:43 +02:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_hpool ( ) ;
2012-01-03 02:58:23 +01:00
auth_object = PoolObjectSQL : : HOST ;
2013-01-17 15:52:02 +01:00
auth_op = AuthRequest : : ADMIN ;
2011-06-02 00:55:43 +02:00
} ;
~ HostUpdateTemplate ( ) { } ;
} ;
2011-10-10 23:06:13 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualNetworkUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VirtualNetworkUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.vn.update " ,
2011-10-10 23:06:13 +02:00
" Updates a vnet template " )
2013-01-04 00:04:01 +01:00
{
2011-10-10 23:06:13 +02:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vnpool ( ) ;
2012-01-03 02:58:23 +01:00
auth_object = PoolObjectSQL : : NET ;
2014-09-03 15:31:00 +02:00
auth_op = AuthRequest : : MANAGE ;
2011-10-10 23:06:13 +02:00
} ;
~ VirtualNetworkUpdateTemplate ( ) { } ;
} ;
2011-10-11 00:20:50 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
UserUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.user.update " ,
2011-10-11 00:20:50 +02:00
" Updates a user template " )
2013-01-04 00:04:01 +01:00
{
2011-10-11 00:20:50 +02:00
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_upool ( ) ;
2012-01-03 02:58:23 +01:00
auth_object = PoolObjectSQL : : USER ;
2011-10-11 00:20:50 +02:00
} ;
~ UserUpdateTemplate ( ) { } ;
} ;
2012-03-02 17:25:42 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DatastoreUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
DatastoreUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.datastore.update " ,
2012-03-02 17:25:42 +01:00
" Updates a datastore template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_dspool ( ) ;
auth_object = PoolObjectSQL : : DATASTORE ;
} ;
~ DatastoreUpdateTemplate ( ) { } ;
} ;
2012-06-08 16:00:16 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DocumentUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
DocumentUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.document.update " ,
2012-06-13 17:41:54 +02:00
" Updates a document template " )
2012-06-08 16:00:16 +02:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_docpool ( ) ;
auth_object = PoolObjectSQL : : DOCUMENT ;
} ;
~ DocumentUpdateTemplate ( ) { } ;
} ;
2012-06-28 17:51:21 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ClusterUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
ClusterUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.cluster.update " ,
2012-06-28 17:51:21 +02:00
" Updates a cluster template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_clpool ( ) ;
auth_object = PoolObjectSQL : : CLUSTER ;
} ;
~ ClusterUpdateTemplate ( ) { } ;
} ;
2014-01-13 18:26:21 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ZoneUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
ZoneUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.zone.update " ,
2014-01-13 18:26:21 +01:00
" Updates a zone template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_zonepool ( ) ;
auth_object = PoolObjectSQL : : ZONE ;
} ;
~ ZoneUpdateTemplate ( ) { } ;
} ;
2014-02-26 12:59:03 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
GroupUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.group.update " ,
2014-02-26 12:59:03 +01:00
" Updates a Group template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_gpool ( ) ;
auth_object = PoolObjectSQL : : GROUP ;
} ;
~ GroupUpdateTemplate ( ) { } ;
} ;
2014-09-08 11:50:25 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SecurityGroupUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
SecurityGroupUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.secgroup.update " ,
2014-09-08 11:50:25 +02:00
" Updates a security group template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_secgrouppool ( ) ;
auth_object = PoolObjectSQL : : SECGROUP ;
} ;
~ SecurityGroupUpdateTemplate ( ) { } ;
} ;
2014-12-19 17:30:00 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VdcUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.vdc.update " ,
2014-12-19 17:30:00 +01:00
" Updates a VDC template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vdcpool ( ) ;
auth_object = PoolObjectSQL : : VDC ;
} ;
~ VdcUpdateTemplate ( ) { } ;
} ;
2015-11-30 16:50:23 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualRouterUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VirtualRouterUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.vrouter.update " ,
2015-11-30 16:50:23 +01:00
" Updates a virtual router template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vrouterpool ( ) ;
auth_object = PoolObjectSQL : : VROUTER ;
} ;
~ VirtualRouterUpdateTemplate ( ) { } ;
} ;
2015-12-05 23:52:28 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
MarketPlaceUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.market.update " ,
2015-12-11 15:53:19 +01:00
" Updates a marketplace template " )
2015-12-05 23:52:28 +01:00
{
Nebula & nd = Nebula : : instance ( ) ;
2015-12-11 15:53:19 +01:00
pool = nd . get_marketpool ( ) ;
2015-12-05 23:52:28 +01:00
auth_object = PoolObjectSQL : : MARKETPLACE ;
} ;
~ MarketPlaceUpdateTemplate ( ) { } ;
} ;
2015-12-11 15:53:19 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAppUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
MarketPlaceAppUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.marketapp.update " ,
2015-12-11 15:53:19 +01:00
" Updates a marketplace app template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_apppool ( ) ;
auth_object = PoolObjectSQL : : MARKETPLACEAPP ;
} ;
~ MarketPlaceAppUpdateTemplate ( ) { } ;
} ;
2011-06-02 00:55:43 +02:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-01-03 21:12:27 +01:00
class VMGroupUpdateTemplate : public RequestManagerUpdateTemplate
{
public :
VMGroupUpdateTemplate ( ) :
2017-05-07 21:52:34 +02:00
RequestManagerUpdateTemplate ( " one.vmgroup.update " ,
2017-01-03 21:12:27 +01:00
" Updates a vm group template " )
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_vmgrouppool ( ) ;
auth_object = PoolObjectSQL : : VMGROUP ;
} ;
~ VMGroupUpdateTemplate ( ) { } ;
} ;
2011-06-02 00:55:43 +02:00
# endif