mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added sleep and ping API on DispatcherSv1
This commit is contained in:
committed by
Dan Christian Bogos
parent
f237785164
commit
a734718421
@@ -758,6 +758,14 @@ func (dS *DispatcherSv1) RemoteStatus(args *utils.TenantWithAPIOpts, reply *map[
|
||||
return dS.dS.DispatcherSv1RemoteStatus(args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherSv1) RemotePing(args *utils.CGREvent, reply *string) (err error) {
|
||||
return dS.dS.DispatcherSv1RemotePing(args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherSv1) RemoteSleep(args *utils.DurationArgs, reply *string) (err error) {
|
||||
return dS.dS.DispatcherSv1RemoteSleep(args, reply)
|
||||
}
|
||||
|
||||
/*
|
||||
func (dSv1 DispatcherSv1) Apier(args *utils.MethodParameters, reply *interface{}) (err error) {
|
||||
return dSv1.dS.V1Apier(new(APIerSv1), args, reply)
|
||||
|
||||
@@ -379,3 +379,34 @@ func (dS *DispatcherService) DispatcherSv1RemoteStatus(args *utils.TenantWithAPI
|
||||
APIOpts: args.APIOpts,
|
||||
}, utils.MetaCore, utils.CoreSv1Status, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) DispatcherSv1RemoteSleep(args *utils.DurationArgs, reply *string) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.Tenant != utils.EmptyString {
|
||||
tnt = args.Tenant
|
||||
}
|
||||
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
|
||||
if err = dS.authorize(utils.CoreSv1Sleep, tnt,
|
||||
utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(&utils.CGREvent{
|
||||
Tenant: tnt,
|
||||
APIOpts: args.APIOpts,
|
||||
}, utils.MetaCore, utils.CoreSv1Sleep, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) DispatcherSv1RemotePing(args *utils.CGREvent, reply *string) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args != nil && args.Tenant != utils.EmptyString {
|
||||
tnt = args.Tenant
|
||||
}
|
||||
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
|
||||
if err = dS.authorize(utils.CoreSv1Ping, tnt,
|
||||
utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.Time); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(args, utils.MetaCore, utils.CoreSv1Ping, args, reply)
|
||||
}
|
||||
|
||||
@@ -1661,6 +1661,8 @@ const (
|
||||
DispatcherSv1Apier = "DispatcherSv1.Apier"
|
||||
DispatcherServicePing = "DispatcherService.Ping"
|
||||
DispatcherSv1RemoteStatus = "DispatcherSv1.RemoteStatus"
|
||||
DispatcherSv1RemoteSleep = "DispatcherSv1.RemoteSleep"
|
||||
DispatcherSv1RemotePing = "DispatcherSv1.RemotePing"
|
||||
)
|
||||
|
||||
// RegistrarS APIs
|
||||
|
||||
Reference in New Issue
Block a user