Generate dispatchers after adding new filters API

This commit is contained in:
ionutboangiu
2022-04-05 17:35:31 +03:00
committed by Dan Christian Bogos
parent fb97533deb
commit e200668cb4
4 changed files with 34 additions and 9 deletions

View File

@@ -128,6 +128,7 @@
// "listen": {
// "rpc_json": "127.0.0.1:2012", // RPC JSON listening address
// "rpc_gob": "127.0.0.1:2013", // RPC GOB listening address
@@ -516,6 +517,7 @@
// // "connIDs": [], // connections for connManager to this exporter
// // "rpcConnTimeout" : "1s", // connection unsuccesfull on timeout
// // "rpcReplyTimeout":"2s", // connection down at replies if taking longer that this value
// // "rpcAPIOpts": {}, // opts that will be passed within APIOpts
// }, // extra options for exporter
// "timezone": "", // timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
// "filters": [], // limit parsing based on the filters
@@ -1755,5 +1757,9 @@
// }
// },
// "tpes": {
// "enabled": false,
// },
}

View File

@@ -60,6 +60,26 @@ func (dS *DispatcherService) AdminSv1ComputeFilterIndexes(ctx *context.Context,
}
return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaAdminS, utils.AdminSv1ComputeFilterIndexes, args, reply)
}
func (dS *DispatcherService) AdminSv1FiltersMatch(ctx *context.Context, args *engine.ArgsFiltersMatch, reply *bool) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && (args.CGREvent != nil && len(args.CGREvent.Tenant) != 0) {
tnt = args.CGREvent.Tenant
}
ev := make(map[string]interface{})
if args != nil && args.CGREvent != nil {
ev = args.CGREvent.Event
}
opts := make(map[string]interface{})
if args != nil && args.CGREvent != nil {
opts = args.CGREvent.APIOpts
}
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(ctx, utils.AdminSv1FiltersMatch, tnt, utils.IfaceAsString(opts[utils.OptsAPIKey])); err != nil {
return
}
}
return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.MetaAdminS, utils.AdminSv1FiltersMatch, args, reply)
}
func (dS *DispatcherService) AdminSv1GetAccount(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *utils.Account) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && (args.TenantID != nil && len(args.TenantID.Tenant) != 0) {

View File

@@ -20,11 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package dispatchers
import (
"time"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/ltcache"
"time"
)
func (dS *DispatcherService) CacheSv1Clear(ctx *context.Context, args *utils.AttrCacheIDsWithAPIOpts, reply *string) (err error) {

View File

@@ -64,18 +64,18 @@ func (dS *DispatcherService) RateSv1Ping(ctx *context.Context, args *utils.CGREv
}
return dS.Dispatch(ctx, &utils.CGREvent{Tenant: tnt, Event: ev, APIOpts: opts}, utils.RateS, utils.RateSv1Ping, args, reply)
}
func (dS *DispatcherService) RateSv1RateProfileRatesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error) {
func (dS *DispatcherService) RateSv1RateProfileRatesForEvent(ctx *context.Context, args *utils.CGREventWithRateProfile, reply *[]string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && len(args.Tenant) != 0 {
tnt = args.Tenant
if args != nil && (args.CGREvent != nil && len(args.CGREvent.Tenant) != 0) {
tnt = args.CGREvent.Tenant
}
ev := make(map[string]interface{})
if args != nil {
ev = args.Event
if args != nil && args.CGREvent != nil {
ev = args.CGREvent.Event
}
opts := make(map[string]interface{})
if args != nil {
opts = args.APIOpts
if args != nil && args.CGREvent != nil {
opts = args.CGREvent.APIOpts
}
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(ctx, utils.RateSv1RateProfileRatesForEvent, tnt, utils.IfaceAsString(opts[utils.OptsAPIKey])); err != nil {