2017-04-11 22:34:38 +03:00
/* -------------------------------------------------------------------------- */
2024-07-29 15:25:20 +03:00
/* Copyright 2002-2024, OpenNebula Project, OpenNebula Systems */
2017-04-11 22:34:38 +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_ZONE_H
# define REQUEST_MANAGER_ZONE_H
# include "Request.h"
# include "Nebula.h"
2019-12-10 13:45:15 +03:00
# include "ZonePool.h"
2017-04-11 22:34:38 +03:00
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class RequestManagerZone : public Request
{
protected :
2020-07-02 23:42:10 +03:00
RequestManagerZone ( const std : : string & method_name ,
const std : : string & help ,
const std : : string & params )
2024-06-03 12:40:24 +03:00
: Request ( method_name , params , help )
2017-04-11 22:34:38 +03:00
{
Nebula & nd = Nebula : : instance ( ) ;
pool = nd . get_zonepool ( ) ;
auth_object = PoolObjectSQL : : ZONE ;
auth_op = AuthRequest : : ADMIN ;
} ;
2024-06-03 12:40:24 +03:00
~ RequestManagerZone ( ) { } ;
2017-04-11 22:34:38 +03:00
} ;
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ZoneAddServer : public RequestManagerZone
{
public :
ZoneAddServer ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerZone ( " one.zone.addserver " , " Add a server to zone " ,
2024-06-03 12:40:24 +03:00
" A:sis " ) { } ;
2017-04-11 22:34:38 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneAddServer ( ) { } ;
2017-04-11 22:34:38 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-04-11 22:34:38 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-04-13 19:31:14 +03:00
class ZoneDeleteServer : public RequestManagerZone
{
public :
ZoneDeleteServer ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerZone ( " one.zone.delserver " , " Delete a server from zone " ,
2024-06-03 12:40:24 +03:00
" A:sii " ) { } ;
2017-04-13 19:31:14 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneDeleteServer ( ) { } ;
2017-04-13 19:31:14 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-04-13 19:31:14 +03:00
} ;
2017-04-27 13:42:09 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2018-06-20 18:58:19 +03:00
2018-06-26 14:14:04 +03:00
class ZoneResetServer : public RequestManagerZone
2018-06-20 18:58:19 +03:00
{
public :
2018-06-26 14:14:04 +03:00
ZoneResetServer ( ) :
RequestManagerZone ( " one.zone.resetserver " , " Reset server log index " ,
2024-06-03 12:40:24 +03:00
" A:sis " ) { } ;
2018-06-20 18:58:19 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneResetServer ( ) { } ;
2018-06-20 18:58:19 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2018-06-20 18:58:19 +03:00
} ;
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
2017-04-27 13:42:09 +03:00
class ZoneReplicateLog : public RequestManagerZone
{
public :
ZoneReplicateLog ( ) :
2017-05-07 22:52:34 +03:00
RequestManagerZone ( " one.zone.replicate " , " Replicate a log record " ,
2024-06-03 12:40:24 +03:00
" A:siiiiiiis " )
2017-05-07 22:52:34 +03:00
{
log_method_call = false ;
2017-05-08 11:47:42 +03:00
leader_only = false ;
2021-04-20 14:40:44 +03:00
zone_disabled = true ;
2017-05-07 22:52:34 +03:00
} ;
2017-04-27 13:42:09 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneReplicateLog ( ) { } ;
2017-04-27 13:42:09 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-04-27 13:42:09 +03:00
} ;
2017-05-03 00:43:18 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class ZoneVoteRequest : public RequestManagerZone
{
public :
2017-05-08 11:47:42 +03:00
ZoneVoteRequest ( ) : RequestManagerZone ( " one.zone.voterequest " ,
2024-06-03 12:40:24 +03:00
" Request vote from a candidate " , " A:siiii " )
2017-05-08 11:47:42 +03:00
{
leader_only = false ;
2021-04-20 14:40:44 +03:00
zone_disabled = true ;
2017-05-08 11:47:42 +03:00
} ;
2017-05-03 00:43:18 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneVoteRequest ( ) { } ;
2017-05-03 00:43:18 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-05-03 00:43:18 +03:00
} ;
2017-05-06 01:17:27 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class ZoneRaftStatus : public RequestManagerZone
{
public :
2017-05-08 11:47:42 +03:00
ZoneRaftStatus ( ) : RequestManagerZone ( " one.zone.raftstatus " ,
2024-06-03 12:40:24 +03:00
" Returns Raft status " , " A:s " )
2017-05-08 11:47:42 +03:00
{
leader_only = false ;
2021-04-20 14:40:44 +03:00
zone_disabled = true ;
2017-05-08 11:47:42 +03:00
} ;
2017-05-06 01:17:27 +03:00
2024-06-03 12:40:24 +03:00
~ ZoneRaftStatus ( ) { } ;
2017-05-06 01:17:27 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-05-06 01:17:27 +03:00
} ;
2017-05-19 21:08:45 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class ZoneReplicateFedLog : public RequestManagerZone
{
public :
ZoneReplicateFedLog ( ) :
RequestManagerZone ( " one.zone.fedreplicate " , " Replicate a fed log record " ,
2024-06-03 12:40:24 +03:00
" A:sis " )
2017-05-19 21:08:45 +03:00
{
log_method_call = false ;
2021-04-20 14:40:44 +03:00
zone_disabled = true ;
2017-05-19 21:08:45 +03:00
} ;
2024-06-03 12:40:24 +03:00
~ ZoneReplicateFedLog ( ) { } ;
2017-05-19 21:08:45 +03:00
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
2019-07-05 18:23:21 +03:00
RequestAttributes & att ) override ;
2017-05-19 21:08:45 +03:00
} ;
2021-04-20 14:40:44 +03:00
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
class ZoneEnable : public RequestManagerZone
{
public :
ZoneEnable ( ) :
RequestManagerZone ( " one.zone.enable " , " Enable or disable zone " ,
2024-06-03 12:40:24 +03:00
" A:sii " )
2021-04-20 14:40:44 +03:00
{
log_method_call = true ;
zone_disabled = true ;
}
void request_execute ( xmlrpc_c : : paramList const & _paramList ,
RequestAttributes & att ) override ;
} ;
2017-04-11 22:34:38 +03:00
# endif