From c7ac907daf49479cbf0aab75f6bf500d56657626 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Wed, 12 Oct 2022 18:08:13 +0300 Subject: [PATCH] Add the missing dispatcher functions --- .../scripts/generate_dispatchers/generator.go | 4 ++ dispatchers/efs.go | 62 +++++++++++++++++++ dispatchers/tpes.go | 54 ++++++++++++++++ utils/consts.go | 1 + 4 files changed, 121 insertions(+) create mode 100644 dispatchers/efs.go create mode 100644 dispatchers/tpes.go diff --git a/data/scripts/generate_dispatchers/generator.go b/data/scripts/generate_dispatchers/generator.go index cd9fed03f..dfcff1ac0 100644 --- a/data/scripts/generate_dispatchers/generator.go +++ b/data/scripts/generate_dispatchers/generator.go @@ -40,11 +40,13 @@ import ( "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/cores" "github.com/cgrates/cgrates/ees" + "github.com/cgrates/cgrates/efs" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/guardian" "github.com/cgrates/cgrates/loaders" "github.com/cgrates/cgrates/rates" "github.com/cgrates/cgrates/sessions" + "github.com/cgrates/cgrates/tpes" "github.com/cgrates/cgrates/utils" ) @@ -77,6 +79,8 @@ func main() { {"admins.go", "MetaAdminS", new(apis.AdminSv1), utils.EmptyString}, {"cores.go", "MetaCore", new(cores.CoreS), utils.EmptyString}, {"guardian.go", "MetaGuardian", guardian.Guardian, utils.GuardianS}, + {"efs.go", "MetaEFs", new(efs.EfS), utils.EmptyString}, + {"tpes.go", "MetaTpes", new(tpes.TPeS), utils.EmptyString}, // {"servicemanager.go", "MetaServiceManager", new(servmanager.ServiceManager), utils.EmptyString}, } { if err := createFile(file.path, file.subsystem, file.customName, file.obj); err != nil { diff --git a/dispatchers/efs.go b/dispatchers/efs.go new file mode 100644 index 000000000..53c1cefb7 --- /dev/null +++ b/dispatchers/efs.go @@ -0,0 +1,62 @@ +/* +Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +// do not modify this code because it's generated +package dispatchers + +import ( + "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/utils" +) + +func (dS *DispatcherService) EfSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) { + tnt := dS.cfg.GeneralCfg().DefaultTenant + if args != nil && len(args.Tenant) != 0 { + tnt = args.Tenant + } + ev := make(map[string]interface{}) + if args != nil { + ev = args.Event + } + opts := make(map[string]interface{}) + if args != nil { + opts = args.APIOpts + } + return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaEFs, utils.EfSv1Ping, args, reply) +} +func (dS *DispatcherService) EfSv1ProcessEvent(ctx *context.Context, args *utils.ArgsFailedPosts, reply *string) (err error) { + tnt := dS.cfg.GeneralCfg().DefaultTenant + if args != nil && len(args.Tenant) != 0 { + tnt = args.Tenant + } + ev := make(map[string]interface{}) + opts := make(map[string]interface{}) + if args != nil { + opts = args.APIOpts + } + return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaEFs, utils.EfSv1ProcessEvent, args, reply) +} +func (dS *DispatcherService) EfSv1ReplayEvents(ctx *context.Context, args *utils.ArgsReplayFailedPosts, reply *string) (err error) { + tnt := dS.cfg.GeneralCfg().DefaultTenant + if args != nil && len(args.Tenant) != 0 { + tnt = args.Tenant + } + ev := make(map[string]interface{}) + opts := make(map[string]interface{}) + return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaEFs, utils.EfSv1ReplayEvents, args, reply) +} diff --git a/dispatchers/tpes.go b/dispatchers/tpes.go new file mode 100644 index 000000000..9b66eff02 --- /dev/null +++ b/dispatchers/tpes.go @@ -0,0 +1,54 @@ +/* +Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments +Copyright (C) ITsysCOM GmbH + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +// do not modify this code because it's generated +package dispatchers + +import ( + "github.com/cgrates/birpc/context" + "github.com/cgrates/cgrates/tpes" + "github.com/cgrates/cgrates/utils" +) + +func (dS *DispatcherService) TPeSv1ExportTariffPlan(ctx *context.Context, args *tpes.ArgsExportTP, reply *[]uint8) (err error) { + tnt := dS.cfg.GeneralCfg().DefaultTenant + if args != nil && len(args.Tenant) != 0 { + tnt = args.Tenant + } + ev := make(map[string]interface{}) + opts := make(map[string]interface{}) + if args != nil { + opts = args.APIOpts + } + return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaTpes, utils.TPeSv1ExportTariffPlan, args, reply) +} +func (dS *DispatcherService) TPeSv1Ping(ctx *context.Context, args *utils.CGREvent, reply *string) (err error) { + tnt := dS.cfg.GeneralCfg().DefaultTenant + if args != nil && len(args.Tenant) != 0 { + tnt = args.Tenant + } + ev := make(map[string]interface{}) + if args != nil { + ev = args.Event + } + opts := make(map[string]interface{}) + if args != nil { + opts = args.APIOpts + } + return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaTpes, utils.TPeSv1Ping, args, reply) +} diff --git a/utils/consts.go b/utils/consts.go index 41565ee62..1d11f6015 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -1276,6 +1276,7 @@ const ( // EfSv1 APIs const ( EfSv1 = "EfSv1" + EfSv1Ping = "EfSv1.Ping" EfSv1ProcessEvent = "EfSv1.ProcessEvent" EfSv1ReplayEvents = "EfSv1.ReplayEvents" )