mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Added sleep and ping API on DispatcherSv1
This commit is contained in:
committed by
Dan Christian Bogos
parent
3cb7081792
commit
8917043055
@@ -265,3 +265,11 @@ func (dSv1 DispatcherSv1) GetProfilesForEvent(ctx *context.Context, ev *utils.CG
|
||||
func (dS *DispatcherSv1) RemoteStatus(args *utils.TenantWithAPIOpts, reply *map[string]interface{}) (err error) {
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -245,3 +245,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])); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
return dS.Dispatch(context.Background(), &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(context.Background(), args, utils.MetaCore, utils.CoreSv1Ping, args, reply)
|
||||
}
|
||||
|
||||
@@ -1425,6 +1425,8 @@ const (
|
||||
DispatcherSv1GetProfilesForEvent = "DispatcherSv1.GetProfilesForEvent"
|
||||
DispatcherServicePing = "DispatcherService.Ping"
|
||||
DispatcherSv1RemoteStatus = "DispatcherSv1.RemoteStatus"
|
||||
DispatcherSv1RemoteSleep = "DispatcherSv1.RemoteSleep"
|
||||
DispatcherSv1RemotePing = "DispatcherSv1.RemotePing"
|
||||
)
|
||||
|
||||
// RegistrarS APIs
|
||||
|
||||
Reference in New Issue
Block a user