2011-05-26 00:59:50 +02:00
/* -------------------------------------------------------------------------- */
2023-01-09 12:23:19 +01:00
/* Copyright 2002-2023, OpenNebula Project, OpenNebula Systems */
2011-05-26 00:59:50 +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_DELETE_H_
# define REQUEST_MANAGER_DELETE_H_
# include "Request.h"
2019-12-10 11:45:15 +01:00
# include "ClusterPool.h"
2020-07-02 22:42:10 +02:00
# include "Datastore.h"
2019-12-10 11:45:15 +01:00
# include "Host.h"
# include "VirtualNetwork.h"
class AclManager ;
2011-05-26 00:59:50 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerDelete : public Request
{
protected :
2020-07-02 22:42:10 +02:00
RequestManagerDelete ( const std : : string & method_name ,
const std : : string & params ,
const std : : string & help ) ;
2016-02-08 16:40:38 +01:00
2020-07-02 22:42:10 +02:00
RequestManagerDelete ( const std : : string & method_name ,
const std : : string & help ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ RequestManagerDelete ( ) = default ;
2011-05-26 00:59:50 +02:00
2016-02-08 16:40:38 +01:00
void request_execute ( xmlrpc_c : : paramList const & paramList ,
2019-07-05 17:23:21 +02:00
RequestAttributes & att ) override ;
2011-06-10 18:22:48 +02:00
2019-09-09 13:13:52 +02:00
ErrorCode delete_object ( int oid , bool recursive , RequestAttributes & att ) ;
2013-10-25 17:52:56 +02:00
2011-06-10 18:22:48 +02:00
/* -------------------------------------------------------------------- */
2020-09-10 09:08:29 +02:00
virtual int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) ;
2011-06-10 18:22:48 +02:00
2020-07-05 22:01:32 +02:00
virtual std : : set < int > get_cluster_ids ( PoolObjectSQL * object ) const
2012-02-29 17:00:33 +01:00
{
2020-07-02 22:42:10 +02:00
std : : set < int > empty ;
2016-03-10 16:28:33 +01:00
return empty ;
2012-02-29 17:00:33 +01:00
} ;
2011-06-10 18:22:48 +02:00
2020-07-02 22:42:10 +02:00
virtual int del_from_cluster ( Cluster * cluster , int id , std : : string & error_msg )
2012-02-29 17:00:33 +01:00
{
return - 1 ;
2011-06-10 18:22:48 +02:00
} ;
2016-04-21 16:08:28 +02:00
/* -------------------------------------------------------------------- */
ClusterPool * clpool ;
AclManager * aclm ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 12:20:56 +02:00
class TemplateDelete : public RequestManagerDelete
2011-05-26 00:59:50 +02:00
{
public :
2019-12-10 11:45:15 +01:00
TemplateDelete ( ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ TemplateDelete ( ) = default ;
2016-02-08 16:40:38 +01:00
2016-04-21 16:08:28 +02:00
ErrorCode request_execute ( int oid , bool recursive , RequestAttributes & att )
{
2019-09-09 13:13:52 +02:00
return delete_object ( oid , recursive , att ) ;
2016-04-21 16:08:28 +02:00
}
protected :
2016-04-11 12:25:02 +02:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2018-11-20 17:24:59 +01:00
class VirtualNetworkTemplateDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
VirtualNetworkTemplateDelete ( ) ;
2018-11-20 17:24:59 +01:00
2019-12-10 11:45:15 +01:00
~ VirtualNetworkTemplateDelete ( ) = default ;
2018-11-20 17:24:59 +01:00
ErrorCode request_execute ( int oid , bool recursive , RequestAttributes & att )
{
2019-09-09 13:13:52 +02:00
return delete_object ( oid , false , att ) ;
2018-11-20 17:24:59 +01:00
}
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 12:20:56 +02:00
class VirtualNetworkDelete : public RequestManagerDelete
2011-05-26 00:59:50 +02:00
{
public :
2019-12-10 11:45:15 +01:00
VirtualNetworkDelete ( ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ VirtualNetworkDelete ( ) = default ;
2012-02-29 18:09:47 +01:00
2016-04-21 16:08:28 +02:00
protected :
2012-02-29 18:09:47 +01:00
2020-07-05 22:01:32 +02:00
std : : set < int > get_cluster_ids ( PoolObjectSQL * object ) const override
2012-02-29 18:09:47 +01:00
{
2016-03-10 16:28:33 +01:00
return static_cast < VirtualNetwork * > ( object ) - > get_cluster_ids ( ) ;
2012-02-29 18:09:47 +01:00
} ;
2020-07-02 22:42:10 +02:00
int del_from_cluster ( Cluster * cluster , int id , std : : string & error_msg ) override
2012-02-29 18:09:47 +01:00
{
2019-02-13 17:44:02 +01:00
return clpool - > del_from_cluster ( PoolObjectSQL : : NET , cluster , id , error_msg ) ;
2012-02-29 18:09:47 +01:00
} ;
2014-03-19 17:09:52 +01:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
2011-05-26 12:20:56 +02:00
class ImageDelete : public RequestManagerDelete
2011-05-26 00:59:50 +02:00
{
public :
2019-12-10 11:45:15 +01:00
ImageDelete ( ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ ImageDelete ( ) = default ;
2011-06-10 18:22:48 +02:00
2016-04-21 16:08:28 +02:00
ErrorCode request_execute ( int oid , RequestAttributes & att )
{
2019-09-09 13:13:52 +02:00
return delete_object ( oid , false , att ) ;
2016-04-21 16:08:28 +02:00
} ;
2019-01-10 10:04:43 +01:00
void request_execute ( xmlrpc_c : : paramList const & paramList ,
2019-07-05 17:23:21 +02:00
RequestAttributes & att ) override ;
2019-01-10 10:04:43 +01:00
2016-04-21 16:08:28 +02:00
protected :
2016-02-08 16:40:38 +01:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class HostDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
HostDelete ( ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ HostDelete ( ) = default ;
2012-02-28 17:25:02 +01:00
2016-04-21 16:08:28 +02:00
protected :
2012-02-28 17:25:02 +01:00
2020-07-05 22:01:32 +02:00
std : : set < int > get_cluster_ids ( PoolObjectSQL * object ) const override
2012-02-29 17:00:33 +01:00
{
2020-07-02 22:42:10 +02:00
std : : set < int > ids ;
2016-03-15 16:37:36 +01:00
ids . insert ( static_cast < Host * > ( object ) - > get_cluster_id ( ) ) ;
return ids ;
2012-02-29 17:00:33 +01:00
} ;
2020-07-02 22:42:10 +02:00
int del_from_cluster ( Cluster * cluster , int id , std : : string & error_msg ) override
2012-02-29 17:00:33 +01:00
{
2019-02-13 17:44:02 +01:00
return clpool - > del_from_cluster ( PoolObjectSQL : : HOST , cluster , id , error_msg ) ;
2012-02-29 17:00:33 +01:00
} ;
2013-10-25 17:52:56 +02:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class GroupDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
GroupDelete ( ) ;
2012-04-11 14:45:46 +02:00
2019-12-10 11:45:15 +01:00
~ GroupDelete ( ) = default ;
2012-04-11 14:45:46 +02:00
2016-04-21 16:08:28 +02:00
protected :
2012-04-11 14:45:46 +02:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class UserDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
UserDelete ( ) ;
2011-05-26 00:59:50 +02:00
2019-12-10 11:45:15 +01:00
~ UserDelete ( ) = default ;
2011-07-21 02:57:04 -07:00
2016-04-21 16:08:28 +02:00
protected :
2011-07-21 02:57:04 -07:00
2012-04-11 14:45:46 +02:00
GroupPool * gpool ;
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2011-05-26 00:59:50 +02:00
} ;
2012-02-09 17:56:47 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DatastoreDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
DatastoreDelete ( ) ;
2012-02-09 17:56:47 +01:00
2019-12-10 11:45:15 +01:00
~ DatastoreDelete ( ) = default ;
2012-02-29 17:00:33 +01:00
/* -------------------------------------------------------------------- */
2020-07-05 22:01:32 +02:00
std : : set < int > get_cluster_ids ( PoolObjectSQL * object ) const override
2012-02-29 17:00:33 +01:00
{
2016-03-10 16:28:33 +01:00
return static_cast < Datastore * > ( object ) - > get_cluster_ids ( ) ;
2012-02-29 17:00:33 +01:00
} ;
2020-07-02 22:42:10 +02:00
int del_from_cluster ( Cluster * cluster , int id , std : : string & error_msg ) override
2012-02-29 17:00:33 +01:00
{
2019-02-13 17:44:02 +01:00
return clpool - > del_from_cluster ( PoolObjectSQL : : DATASTORE , cluster , id , error_msg ) ;
2012-02-29 17:00:33 +01:00
} ;
2019-07-05 17:23:21 +02:00
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2012-02-09 17:56:47 +01:00
} ;
2012-02-24 15:53:53 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ClusterDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
ClusterDelete ( ) ;
2019-09-09 13:13:52 +02:00
2019-12-10 11:45:15 +01:00
~ ClusterDelete ( ) = default ;
2013-01-23 16:46:14 +01:00
2016-04-21 16:08:28 +02:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2012-02-24 15:53:53 +01:00
} ;
2012-06-08 16:00:16 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class DocumentDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
DocumentDelete ( ) ;
2012-06-08 16:00:16 +02:00
2019-12-10 11:45:15 +01:00
~ DocumentDelete ( ) = default ;
2012-06-08 16:00:16 +02:00
} ;
2013-12-12 19:08:59 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ZoneDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
ZoneDelete ( ) ;
2013-12-12 19:08:59 +01:00
2019-12-10 11:45:15 +01:00
~ ZoneDelete ( ) = default ;
2014-02-21 15:23:24 +01:00
2016-04-21 16:08:28 +02:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2013-12-12 19:08:59 +01:00
} ;
2014-09-08 11:50:25 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class SecurityGroupDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
SecurityGroupDelete ( ) ;
2014-09-08 11:50:25 +02:00
2019-12-10 11:45:15 +01:00
~ SecurityGroupDelete ( ) = default ;
2014-09-09 18:13:52 +02:00
2016-04-21 16:08:28 +02:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2014-09-08 11:50:25 +02:00
} ;
2014-12-19 17:30:00 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VdcDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
VdcDelete ( ) ;
2014-12-19 17:30:00 +01:00
2019-12-10 11:45:15 +01:00
~ VdcDelete ( ) = default ;
2014-12-19 17:30:00 +01:00
} ;
2015-11-30 16:50:23 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualRouterDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
VirtualRouterDelete ( ) ;
2015-11-30 16:50:23 +01:00
2019-12-10 11:45:15 +01:00
~ VirtualRouterDelete ( ) = default ;
2017-02-07 17:26:23 +01:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2015-11-30 16:50:23 +01:00
} ;
2015-12-05 23:52:28 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
MarketPlaceDelete ( ) ;
2015-12-05 23:52:28 +01:00
2019-12-10 11:45:15 +01:00
~ MarketPlaceDelete ( ) = default ;
2016-02-29 18:19:52 +01:00
2016-04-21 16:08:28 +02:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2015-12-05 23:52:28 +01:00
} ;
2015-12-11 15:53:19 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class MarketPlaceAppDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
MarketPlaceAppDelete ( ) ;
2015-12-11 15:53:19 +01:00
2019-12-10 11:45:15 +01:00
~ MarketPlaceAppDelete ( ) = default ;
2015-12-21 13:23:22 +01:00
2016-04-21 16:08:28 +02:00
protected :
2020-09-10 09:08:29 +02:00
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
2015-12-11 15:53:19 +01:00
} ;
2017-01-03 01:22:10 +01:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VMGroupDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
VMGroupDelete ( ) ;
2017-01-03 01:22:10 +01:00
2019-12-10 11:45:15 +01:00
~ VMGroupDelete ( ) = default ;
2017-01-03 01:22:10 +01:00
} ;
2011-05-26 00:59:50 +02:00
2019-09-09 14:43:51 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class HookDelete : public RequestManagerDelete
{
public :
2019-12-10 11:45:15 +01:00
HookDelete ( ) ;
2019-09-09 14:43:51 +02:00
2019-12-10 11:45:15 +01:00
~ HookDelete ( ) = default ;
2019-09-09 14:43:51 +02:00
} ;
2023-07-03 18:15:52 +02:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class BackupJobDelete : public RequestManagerDelete
{
public :
BackupJobDelete ( ) ;
protected :
int drop ( std : : unique_ptr < PoolObjectSQL > obj ,
bool recursive ,
RequestAttributes & att ) override ;
} ;
2011-05-26 00:59:50 +02:00
# endif
2017-01-03 01:22:10 +01:00