From 806c8295bef2a76b94be027565747173fa8a151a Mon Sep 17 00:00:00 2001 From: andronache Date: Mon, 22 Mar 2021 16:29:59 +0200 Subject: [PATCH] Finished changing Opts to APIOpts for structs used in api_interfaces --- agents/diam_it_test.go | 6 +- apier/v1/api_interfaces.go | 40 ++-- apier/v1/apier_it_test.go | 38 ++-- apier/v1/caches.go | 12 +- apier/v1/caches_it_test.go | 16 +- apier/v1/cdrs.go | 8 +- apier/v1/config.go | 4 +- apier/v1/config_it_test.go | 16 +- apier/v1/dispatcher.go | 40 ++-- apier/v1/dispatcher_it_test.go | 4 +- apier/v1/ees_it_test.go | 2 +- apier/v1/filter_indexes_it_test.go | 16 +- apier/v1/filterindexecache_it_test.go | 12 +- apier/v1/full_remote_it_test.go | 4 +- apier/v1/guardian.go | 4 +- apier/v1/guardian_it_test.go | 2 +- apier/v1/libapier.go | 4 +- apier/v1/libapier_test.go | 2 +- apier/v1/precache_it_test.go | 4 +- apier/v1/remote_it_test.go | 4 +- apier/v1/replicate_it_test.go | 4 +- apier/v1/replicator.go | 18 +- apier/v1/resourcesv1.go | 10 +- apier/v1/resourcesv1_it_test.go | 12 +- apier/v1/routes_it_test.go | 2 +- apier/v1/servicemanager.go | 6 +- apier/v1/sessions_process_event_it_test.go | 26 +-- apier/v1/sessionsv1_it_test.go | 16 +- apier/v1/stats.go | 10 +- apier/v1/stats_it_test.go | 26 +-- apier/v2/cdrs_it_test.go | 4 +- apier/v2/cdrs_offline_it_test.go | 4 +- config/config.go | 28 +-- config/config_it_test.go | 4 +- config/config_test.go | 190 +++++++++--------- console/active_sessions.go | 2 +- console/cache_clear.go | 6 +- console/cache_group_item_id.go | 6 +- console/cache_has_group.go | 6 +- console/cache_precache_status.go | 6 +- console/cache_remove_group.go | 6 +- console/cache_stats.go | 6 +- console/cdrs.go | 4 +- console/get_json_section.go | 6 +- console/passive_sessions.go | 2 +- console/reload_config.go | 2 +- console/resources_profile_set.go | 8 +- console/stats_profile_set.go | 8 +- dispatchers/caches.go | 32 +-- dispatchers/caches_it_test.go | 8 +- dispatchers/cdrs.go | 32 +-- dispatchers/cdrs_it_test.go | 42 ++-- dispatchers/config.go | 24 +-- dispatchers/config_it_test.go | 4 +- dispatchers/core.go | 4 +- dispatchers/core_it_test.go | 2 +- dispatchers/guardian.go | 12 +- dispatchers/guardian_it_test.go | 8 +- dispatchers/rals.go | 4 +- dispatchers/rals_it_test.go | 2 +- dispatchers/replicator.go | 24 +-- dispatchers/replicator_it_test.go | 12 +- dispatchers/scheduler.go | 8 +- dispatchers/servicemanager.go | 18 +- dispatchers/sessions.go | 36 ++-- dispatchers/sessions_it_test.go | 14 +- dispatchers/utils.go | 20 +- engine/caches.go | 18 +- engine/cdr.go | 8 +- engine/cdrs.go | 46 ++--- engine/datamanager.go | 24 +-- engine/libstats.go | 6 +- engine/resources.go | 6 +- engine/storage_utils.go | 2 +- engine/tpreader.go | 4 +- engine/z_actions_it_test.go | 6 +- ers/ers_reload_it_test.go | 2 +- ers/filecsv_it_test.go | 6 +- ers/filejson_it_test.go | 2 +- general_tests/attributes_it_test.go | 2 +- general_tests/broadcast_client_it_test.go | 2 +- general_tests/cdrs_it_test.go | 2 +- general_tests/cdrs_processevent_it_test.go | 14 +- general_tests/doubleremove_it_test.go | 2 +- general_tests/filtered_replication_it_test.go | 4 +- general_tests/filters_it_test.go | 8 +- general_tests/resourcesv1_it_test.go | 2 +- general_tests/route_it_test.go | 8 +- general_tests/rpccaching_it_test.go | 4 +- general_tests/tut_smgeneric_it_test.go | 2 +- loaders/loader.go | 8 +- sessions/libsessions.go | 4 +- sessions/sessions.go | 2 +- utils/apitpdata.go | 32 +-- utils/coreutils.go | 2 +- 95 files changed, 600 insertions(+), 600 deletions(-) diff --git a/agents/diam_it_test.go b/agents/diam_it_test.go index 53ce5cede..32b5a3868 100644 --- a/agents/diam_it_test.go +++ b/agents/diam_it_test.go @@ -912,7 +912,7 @@ func testDiamItCCRTerminate(t *testing.T) { } time.Sleep(time.Duration(*waitRater) * time.Millisecond) var cdrs []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}}} + args := utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}}} if err := apierRpc.Call(utils.CDRsV1GetCDRs, &args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -997,7 +997,7 @@ func testDiamItCCRSMS(t *testing.T) { diamClnt.ReceivedMessage(rplyTimeout) var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.MetaSMS}}} + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.MetaSMS}}} if err := apierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -1076,7 +1076,7 @@ func testDiamItCCRMMS(t *testing.T) { diamClnt.ReceivedMessage(rplyTimeout) var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.MetaMMS}}} + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaRaw}, ToRs: []string{utils.MetaMMS}}} if err := apierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { diff --git a/apier/v1/api_interfaces.go b/apier/v1/api_interfaces.go index 227b52b25..4dd1427d6 100644 --- a/apier/v1/api_interfaces.go +++ b/apier/v1/api_interfaces.go @@ -119,12 +119,12 @@ type CacheSv1Interface interface { GetItemExpiryTime(args *utils.ArgsGetCacheItemWithAPIOpts, reply *time.Time) error RemoveItem(args *utils.ArgsGetCacheItemWithAPIOpts, reply *string) error RemoveItems(args utils.AttrReloadCacheWithAPIOpts, reply *string) error - Clear(cacheIDs *utils.AttrCacheIDsWithOpts, reply *string) error - GetCacheStats(cacheIDs *utils.AttrCacheIDsWithOpts, rply *map[string]*ltcache.CacheStats) error - PrecacheStatus(cacheIDs *utils.AttrCacheIDsWithOpts, rply *map[string]string) error - HasGroup(args *utils.ArgsGetGroupWithOpts, rply *bool) error - GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, rply *[]string) error - RemoveGroup(args *utils.ArgsGetGroupWithOpts, rply *string) error + Clear(cacheIDs *utils.AttrCacheIDsWithAPIOpts, reply *string) error + GetCacheStats(cacheIDs *utils.AttrCacheIDsWithAPIOpts, rply *map[string]*ltcache.CacheStats) error + PrecacheStatus(cacheIDs *utils.AttrCacheIDsWithAPIOpts, rply *map[string]string) error + HasGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *bool) error + GetGroupItemIDs(args *utils.ArgsGetGroupWithAPIOpts, rply *[]string) error + RemoveGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *string) error ReloadCache(attrs *utils.AttrReloadCacheWithAPIOpts, reply *string) error LoadCache(args *utils.AttrReloadCacheWithAPIOpts, reply *string) error ReplicateSet(args *utils.ArgCacheReplicateSet, reply *string) (err error) @@ -133,8 +133,8 @@ type CacheSv1Interface interface { } type GuardianSv1Interface interface { - RemoteLock(attr *dispatchers.AttrRemoteLockWithOpts, reply *string) (err error) - RemoteUnlock(refID *dispatchers.AttrRemoteUnlockWithOpts, reply *[]string) (err error) + RemoteLock(attr *dispatchers.AttrRemoteLockWithAPIOpts, reply *string) (err error) + RemoteUnlock(refID *dispatchers.AttrRemoteUnlockWithAPIOpts, reply *[]string) (err error) Ping(ign *utils.CGREvent, reply *string) error } @@ -146,20 +146,20 @@ type SchedulerSv1Interface interface { } type CDRsV1Interface interface { - ProcessCDR(cdr *engine.CDRWithOpts, reply *string) error + ProcessCDR(cdr *engine.CDRWithAPIOpts, reply *string) error ProcessEvent(arg *engine.ArgV1ProcessEvent, reply *string) error - ProcessExternalCDR(cdr *engine.ExternalCDRWithOpts, reply *string) error + ProcessExternalCDR(cdr *engine.ExternalCDRWithAPIOpts, reply *string) error RateCDRs(arg *engine.ArgRateCDRs, reply *string) error StoreSessionCost(attr *engine.AttrCDRSStoreSMCost, reply *string) error - GetCDRsCount(args *utils.RPCCDRsFilterWithOpts, reply *int64) error - GetCDRs(args *utils.RPCCDRsFilterWithOpts, reply *[]*engine.CDR) error + GetCDRsCount(args *utils.RPCCDRsFilterWithAPIOpts, reply *int64) error + GetCDRs(args *utils.RPCCDRsFilterWithAPIOpts, reply *[]*engine.CDR) error Ping(ign *utils.CGREvent, reply *string) error } type ServiceManagerV1Interface interface { - StartService(args *dispatchers.ArgStartServiceWithOpts, reply *string) error - StopService(args *dispatchers.ArgStartServiceWithOpts, reply *string) error - ServiceStatus(args *dispatchers.ArgStartServiceWithOpts, reply *string) error + StartService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error + StopService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error + ServiceStatus(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error Ping(ign *utils.CGREvent, reply *string) error } @@ -169,11 +169,11 @@ type RALsV1Interface interface { } type ConfigSv1Interface interface { - GetConfig(section *config.SectionWithOpts, reply *map[string]interface{}) (err error) + GetConfig(section *config.SectionWithAPIOpts, reply *map[string]interface{}) (err error) ReloadConfig(section *config.ReloadArgs, reply *string) (err error) SetConfig(args *config.SetConfigArgs, reply *string) (err error) SetConfigFromJSON(args *config.SetConfigFromJSONArgs, reply *string) (err error) - GetConfigAsJSON(args *config.SectionWithOpts, reply *string) (err error) + GetConfigAsJSON(args *config.SectionWithAPIOpts, reply *string) (err error) } type CoreSv1Interface interface { @@ -226,11 +226,11 @@ type ReplicatorSv1Interface interface { SetReverseDestination(dst *engine.DestinationWithAPIOpts, reply *string) error SetStatQueue(ssq *engine.StatQueueWithAPIOpts, reply *string) error SetFilter(fltr *engine.FilterWithAPIOpts, reply *string) error - SetStatQueueProfile(sq *engine.StatQueueProfileWithOpts, reply *string) error + SetStatQueueProfile(sq *engine.StatQueueProfileWithAPIOpts, reply *string) error SetTiming(tm *utils.TPTimingWithAPIOpts, reply *string) error SetResource(rs *engine.ResourceWithAPIOpts, reply *string) error - SetResourceProfile(rs *engine.ResourceProfileWithOpts, reply *string) error - SetActionTriggers(args *engine.SetActionTriggersArgWithOpts, reply *string) error + SetResourceProfile(rs *engine.ResourceProfileWithAPIOpts, reply *string) error + SetActionTriggers(args *engine.SetActionTriggersArgWithAPIOpts, reply *string) error SetSharedGroup(shg *engine.SharedGroupWithAPIOpts, reply *string) error SetActions(args *engine.SetActionsArgsWithAPIOpts, reply *string) error SetRatingPlan(rp *engine.RatingPlanWithAPIOpts, reply *string) error diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go index 90036d4a8..492ae04f1 100644 --- a/apier/v1/apier_it_test.go +++ b/apier/v1/apier_it_test.go @@ -827,7 +827,7 @@ func testApierLoadAccountActions(t *testing.T) { var rcvStats map[string]*ltcache.CacheStats expectedStats := engine.GetDefaultEmptyCacheStats() // Make sure nothing in cache so far expectedStats[utils.CacheLoadIDs].Items = 4 // we loaded the ratingprofiles - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v,\n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -845,7 +845,7 @@ func testApierLoadAccountActions(t *testing.T) { expectedStats[utils.CacheActions].Items = 1 expectedStats[utils.CacheLoadIDs].Items = 8 expectedStats[utils.CacheRPCConnections].Items = 1 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v, \n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -882,7 +882,7 @@ func testApierSetRatingProfile(t *testing.T) { expectedStats[utils.CacheRatingProfiles].Items = 1 expectedStats[utils.CacheRPCConnections].Items = 1 expectedStats[utils.CacheLoadIDs].Items = 8 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v, received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -916,7 +916,7 @@ func testApierSetRatingProfile(t *testing.T) { } expectedStats[utils.CacheRatingPlans].Items = 1 expectedStats[utils.CacheReverseDestinations].Items = 10 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v, received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -1082,7 +1082,7 @@ func testApierReloadCache(t *testing.T) { expectedStats[utils.CacheReverseDestinations].Items = 10 expectedStats[utils.CacheLoadIDs].Items = 8 expectedStats[utils.CacheRPCConnections].Items = 1 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling CacheSv1.GetCacheStats expected: %+v,\n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) @@ -1568,7 +1568,7 @@ func testApierResetDataBeforeLoadFromFolder(t *testing.T) { testApierInitDataDb(t) var reply string // Simple test that command is executed without errors - if err := rater.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := rater.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error(err) @@ -1577,7 +1577,7 @@ func testApierResetDataBeforeLoadFromFolder(t *testing.T) { } var rcvStats map[string]*ltcache.CacheStats expectedStats := engine.GetDefaultEmptyCacheStats() - err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats) + err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats) if err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(rcvStats, expectedStats) { @@ -1631,7 +1631,7 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) { expStats[utils.CacheDestinations].Items = 3 expStats[utils.CacheLoadIDs].Items = 17 expStats[utils.CacheRPCConnections].Items = 2 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v,\n received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -1672,7 +1672,7 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) { expStats[utils.CacheReverseFilterIndexes].Items = 10 expStats[utils.CacheReverseFilterIndexes].Groups = 7 - if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error(err) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v, \n received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -1787,7 +1787,7 @@ func testApierITGetCdrs(t *testing.T) { func testApierITProcessCdr(t *testing.T) { var reply string - cdr := &engine.CDRWithOpts{ + cdr := &engine.CDRWithAPIOpts{ CDR: &engine.CDR{CGRID: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), OrderID: 123, ToR: utils.MetaVoice, OriginID: "dsafdsaf", OriginHost: "192.168.1.1", Source: "test", RequestType: utils.MetaRated, Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1002", @@ -1823,7 +1823,7 @@ func testApierGetCallCostLog(t *testing.T) { t.Error("APIerSv1.GetCallCostLog: should return NOT_FOUND, got:", err) } tm := time.Now().Truncate(time.Millisecond).UTC() - cdr := &engine.CDRWithOpts{ + cdr := &engine.CDRWithAPIOpts{ CDR: &engine.CDR{ CGRID: "Cdr1", OrderID: 123, @@ -1961,7 +1961,7 @@ func testApierInitStorDb2(t *testing.T) { func testApierReloadCache2(t *testing.T) { var reply string // Simple test that command is executed without errors - if err := rater.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := rater.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error("Got error on CacheSv1.ReloadCache: ", err.Error()) @@ -2005,7 +2005,7 @@ func testApierLoadTariffPlanFromStorDbDryRun(t *testing.T) { func testApierGetCacheStats2(t *testing.T) { var rcvStats map[string]*ltcache.CacheStats expectedStats := engine.GetDefaultEmptyCacheStats() - err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats) + err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats) if err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { @@ -2025,35 +2025,35 @@ func testApierLoadTariffPlanFromStorDb(t *testing.T) { func testApierStartStopServiceStatus(t *testing.T) { var reply string - if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, + if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, &reply); err != nil { t.Error(err) } else if reply != utils.RunningCaps { t.Errorf("Received: <%s>", reply) } - if err := rater.Call(utils.ServiceManagerV1StopService, dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: "INVALID"}}, + if err := rater.Call(utils.ServiceManagerV1StopService, dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: "INVALID"}}, &reply); err == nil || err.Error() != utils.UnsupportedServiceIDCaps { t.Error(err) } - if err := rater.Call(utils.ServiceManagerV1StopService, dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, + if err := rater.Call(utils.ServiceManagerV1StopService, dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: <%s>", reply) } - if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, + if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, &reply); err != nil { t.Error(err) } else if reply != utils.StoppedCaps { t.Errorf("Received: <%s>", reply) } - if err := rater.Call(utils.ServiceManagerV1StartService, &dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, + if err := rater.Call(utils.ServiceManagerV1StartService, &dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Errorf("Received: <%s>", reply) } - if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, + if err := rater.Call(utils.ServiceManagerV1ServiceStatus, dispatchers.ArgStartServiceWithAPIOpts{ArgStartService: servmanager.ArgStartService{ServiceID: utils.MetaScheduler}}, &reply); err != nil { t.Error(err) } else if reply != utils.RunningCaps { diff --git a/apier/v1/caches.go b/apier/v1/caches.go index a8c4981ad..822f1650c 100644 --- a/apier/v1/caches.go +++ b/apier/v1/caches.go @@ -66,36 +66,36 @@ func (chSv1 *CacheSv1) RemoveItems(args utils.AttrReloadCacheWithAPIOpts, } // Clear will clear partitions in the cache (nil fol all, empty slice for none) -func (chSv1 *CacheSv1) Clear(args *utils.AttrCacheIDsWithOpts, +func (chSv1 *CacheSv1) Clear(args *utils.AttrCacheIDsWithAPIOpts, reply *string) error { return chSv1.cacheS.V1Clear(args, reply) } // GetCacheStats returns CacheStats filtered by cacheIDs -func (chSv1 *CacheSv1) GetCacheStats(args *utils.AttrCacheIDsWithOpts, +func (chSv1 *CacheSv1) GetCacheStats(args *utils.AttrCacheIDsWithAPIOpts, rply *map[string]*ltcache.CacheStats) error { return chSv1.cacheS.V1GetCacheStats(args, rply) } // PrecacheStatus checks status of active precache processes -func (chSv1 *CacheSv1) PrecacheStatus(args *utils.AttrCacheIDsWithOpts, rply *map[string]string) error { +func (chSv1 *CacheSv1) PrecacheStatus(args *utils.AttrCacheIDsWithAPIOpts, rply *map[string]string) error { return chSv1.cacheS.V1PrecacheStatus(args, rply) } // HasGroup checks existence of a group in cache -func (chSv1 *CacheSv1) HasGroup(args *utils.ArgsGetGroupWithOpts, +func (chSv1 *CacheSv1) HasGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *bool) (err error) { return chSv1.cacheS.V1HasGroup(args, rply) } // GetGroupItemIDs returns a list of itemIDs in a cache group -func (chSv1 *CacheSv1) GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, +func (chSv1 *CacheSv1) GetGroupItemIDs(args *utils.ArgsGetGroupWithAPIOpts, rply *[]string) (err error) { return chSv1.cacheS.V1GetGroupItemIDs(args, rply) } // RemoveGroup will remove a group and all items belonging to it from cache -func (chSv1 *CacheSv1) RemoveGroup(args *utils.ArgsGetGroupWithOpts, +func (chSv1 *CacheSv1) RemoveGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *string) (err error) { return chSv1.cacheS.V1RemoveGroup(args, rply) } diff --git a/apier/v1/caches_it_test.go b/apier/v1/caches_it_test.go index 159014a88..e24beab90 100644 --- a/apier/v1/caches_it_test.go +++ b/apier/v1/caches_it_test.go @@ -135,7 +135,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) { expStats[utils.CacheDestinations].Items = 3 expStats[utils.CacheLoadIDs].Items = 17 expStats[utils.CacheRPCConnections].Items = 2 - if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v, \n received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -176,7 +176,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) { expStats[utils.CacheReverseFilterIndexes].Items = 10 expStats[utils.CacheReverseFilterIndexes].Groups = 7 - if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error(err) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v,\n received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -185,7 +185,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) { func testCacheSFlush(t *testing.T) { reply := "" - if err := chcRPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := chcRPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error("Got error on CacheSv1.ReloadCache: ", err.Error()) @@ -194,7 +194,7 @@ func testCacheSFlush(t *testing.T) { } var rcvStats map[string]*ltcache.CacheStats expStats := engine.GetDefaultEmptyCacheStats() - if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -244,7 +244,7 @@ func testCacheSReload(t *testing.T) { expStats[utils.CacheReverseFilterIndexes].Items = 10 expStats[utils.CacheReverseFilterIndexes].Groups = 7 - if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error(err) } rcvStats[utils.MetaAPIBan].Items = 0 @@ -423,14 +423,14 @@ func testCacheSRemoveItems(t *testing.T) { func testCacheSClear(t *testing.T) { reply := "" - if err := chcRPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{}, &reply); err != nil { + if err := chcRPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{}, &reply); err != nil { t.Error(err) } else if reply != utils.OK { t.Error("Calling CacheSv1.ReloadCache got reply: ", reply) } var rcvStats map[string]*ltcache.CacheStats expStats := engine.GetDefaultEmptyCacheStats() - if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expStats, rcvStats) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(expStats), utils.ToJSON(rcvStats)) @@ -443,7 +443,7 @@ func testCacheSPrecacheStatus(t *testing.T) { for k := range utils.CachePartitions { expected[k] = utils.MetaReady } - if err := chcRPC.Call(utils.CacheSv1PrecacheStatus, &utils.AttrCacheIDsWithOpts{}, &reply); err != nil { + if err := chcRPC.Call(utils.CacheSv1PrecacheStatus, &utils.AttrCacheIDsWithAPIOpts{}, &reply); err != nil { t.Fatal(err) } reply[utils.MetaAPIBan] = utils.MetaReady // do not check the status for this partition diff --git a/apier/v1/cdrs.go b/apier/v1/cdrs.go index 220e7e855..613b7c9e6 100644 --- a/apier/v1/cdrs.go +++ b/apier/v1/cdrs.go @@ -90,7 +90,7 @@ type CDRsV1 struct { } // ProcessCDR will process a CDR in CGRateS internal format -func (cdrSv1 *CDRsV1) ProcessCDR(cdr *engine.CDRWithOpts, reply *string) error { +func (cdrSv1 *CDRsV1) ProcessCDR(cdr *engine.CDRWithAPIOpts, reply *string) error { return cdrSv1.CDRs.V1ProcessCDR(cdr, reply) } @@ -100,7 +100,7 @@ func (cdrSv1 *CDRsV1) ProcessEvent(arg *engine.ArgV1ProcessEvent, reply *string) } // ProcessExternalCDR will process a CDR in external format -func (cdrSv1 *CDRsV1) ProcessExternalCDR(cdr *engine.ExternalCDRWithOpts, reply *string) error { +func (cdrSv1 *CDRsV1) ProcessExternalCDR(cdr *engine.ExternalCDRWithAPIOpts, reply *string) error { return cdrSv1.CDRs.V1ProcessExternalCDR(cdr, reply) } @@ -114,11 +114,11 @@ func (cdrSv1 *CDRsV1) StoreSessionCost(attr *engine.AttrCDRSStoreSMCost, reply * return cdrSv1.CDRs.V1StoreSessionCost(attr, reply) } -func (cdrSv1 *CDRsV1) GetCDRsCount(args *utils.RPCCDRsFilterWithOpts, reply *int64) error { +func (cdrSv1 *CDRsV1) GetCDRsCount(args *utils.RPCCDRsFilterWithAPIOpts, reply *int64) error { return cdrSv1.CDRs.V1CountCDRs(args, reply) } -func (cdrSv1 *CDRsV1) GetCDRs(args *utils.RPCCDRsFilterWithOpts, reply *[]*engine.CDR) error { +func (cdrSv1 *CDRsV1) GetCDRs(args *utils.RPCCDRsFilterWithAPIOpts, reply *[]*engine.CDR) error { return cdrSv1.CDRs.V1GetCDRs(*args, reply) } diff --git a/apier/v1/config.go b/apier/v1/config.go index 3c33b71f6..2db61e72f 100644 --- a/apier/v1/config.go +++ b/apier/v1/config.go @@ -34,7 +34,7 @@ type ConfigSv1 struct { } // GetConfig will retrieve from CGRConfig a section -func (cSv1 *ConfigSv1) GetConfig(section *config.SectionWithOpts, reply *map[string]interface{}) (err error) { +func (cSv1 *ConfigSv1) GetConfig(section *config.SectionWithAPIOpts, reply *map[string]interface{}) (err error) { return cSv1.cfg.V1GetConfig(section, reply) } @@ -54,7 +54,7 @@ func (cSv1 *ConfigSv1) SetConfigFromJSON(args *config.SetConfigFromJSONArgs, rep } // GetConfigAsJSON will retrieve from CGRConfig a section -func (cSv1 *ConfigSv1) GetConfigAsJSON(args *config.SectionWithOpts, reply *string) (err error) { +func (cSv1 *ConfigSv1) GetConfigAsJSON(args *config.SectionWithAPIOpts, reply *string) (err error) { return cSv1.cfg.V1GetConfigAsJSON(args, reply) } diff --git a/apier/v1/config_it_test.go b/apier/v1/config_it_test.go index 31e02396e..4a1ac0add 100644 --- a/apier/v1/config_it_test.go +++ b/apier/v1/config_it_test.go @@ -220,7 +220,7 @@ func testConfigSSetConfigSessionS(t *testing.T) { config.SessionSJson: exp, } var rpl map[string]interface{} - if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", Section: config.SessionSJson, }, &rpl); err != nil { @@ -311,7 +311,7 @@ func testConfigSv1GetJSONSectionWithoutTenant(t *testing.T) { config.SessionSJson: exp, } var rpl map[string]interface{} - if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Section: config.SessionSJson, }, &rpl); err != nil { t.Error(err) @@ -339,7 +339,7 @@ func testConfigSSetConfigEEsDryRun(t *testing.T) { } var rpl map[string]interface{} - if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Section: config.EEsJson, }, &rpl); err != nil { t.Error(err) @@ -396,7 +396,7 @@ func testConfigSSetConfigEEs(t *testing.T) { config.EEsJson: exp, } var rpl map[string]interface{} - if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Section: config.EEsJson, }, &rpl); err != nil { t.Error(err) @@ -480,7 +480,7 @@ func testConfigSSetConfigFromJSONCoreSDryRun(t *testing.T) { expCfg := "{\"cores\":{\"caps\":0,\"caps_stats_interval\":\"0\",\"caps_strategy\":\"*busy\",\"shutdown_timeout\":\"1s\"}}" var rpl string - if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", Section: config.CoreSCfgJson, }, &rpl); err != nil { @@ -503,7 +503,7 @@ func testConfigSSetConfigFromJSONCoreS(t *testing.T) { } var rpl string - if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", Section: config.CoreSCfgJson, }, &rpl); err != nil { @@ -528,7 +528,7 @@ func testConfigSReloadConfigCoreSDryRun(t *testing.T) { } var rpl string - if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", Section: config.CoreSCfgJson, }, &rpl); err != nil { @@ -552,7 +552,7 @@ func testConfigSReloadConfigCoreS(t *testing.T) { } var rpl string - if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithOpts{ + if err := configRPC.Call(utils.ConfigSv1GetConfigAsJSON, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", Section: config.CoreSCfgJson, }, &rpl); err != nil { diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go index e2351e91b..1696c8eb1 100755 --- a/apier/v1/dispatcher.go +++ b/apier/v1/dispatcher.go @@ -621,36 +621,36 @@ func (dS *DispatcherCacheSv1) RemoveItems(args utils.AttrReloadCacheWithAPIOpts, } // Clear will clear partitions in the cache (nil fol all, empty slice for none) -func (dS *DispatcherCacheSv1) Clear(args *utils.AttrCacheIDsWithOpts, +func (dS *DispatcherCacheSv1) Clear(args *utils.AttrCacheIDsWithAPIOpts, reply *string) error { return dS.dS.CacheSv1Clear(args, reply) } // GetCacheStats returns CacheStats filtered by cacheIDs -func (dS *DispatcherCacheSv1) GetCacheStats(args *utils.AttrCacheIDsWithOpts, +func (dS *DispatcherCacheSv1) GetCacheStats(args *utils.AttrCacheIDsWithAPIOpts, reply *map[string]*ltcache.CacheStats) error { return dS.dS.CacheSv1GetCacheStats(args, reply) } // PrecacheStatus checks status of active precache processes -func (dS *DispatcherCacheSv1) PrecacheStatus(args *utils.AttrCacheIDsWithOpts, reply *map[string]string) error { +func (dS *DispatcherCacheSv1) PrecacheStatus(args *utils.AttrCacheIDsWithAPIOpts, reply *map[string]string) error { return dS.dS.CacheSv1PrecacheStatus(args, reply) } // HasGroup checks existence of a group in cache -func (dS *DispatcherCacheSv1) HasGroup(args *utils.ArgsGetGroupWithOpts, +func (dS *DispatcherCacheSv1) HasGroup(args *utils.ArgsGetGroupWithAPIOpts, reply *bool) (err error) { return dS.dS.CacheSv1HasGroup(args, reply) } // GetGroupItemIDs returns a list of itemIDs in a cache group -func (dS *DispatcherCacheSv1) GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, +func (dS *DispatcherCacheSv1) GetGroupItemIDs(args *utils.ArgsGetGroupWithAPIOpts, reply *[]string) (err error) { return dS.dS.CacheSv1GetGroupItemIDs(args, reply) } // RemoveGroup will remove a group and all items belonging to it from cache -func (dS *DispatcherCacheSv1) RemoveGroup(args *utils.ArgsGetGroupWithOpts, +func (dS *DispatcherCacheSv1) RemoveGroup(args *utils.ArgsGetGroupWithAPIOpts, reply *string) (err error) { return dS.dS.CacheSv1RemoveGroup(args, reply) } @@ -690,12 +690,12 @@ type DispatcherGuardianSv1 struct { } // RemoteLock will lock a key from remote -func (dS *DispatcherGuardianSv1) RemoteLock(attr *dispatchers.AttrRemoteLockWithOpts, reply *string) (err error) { +func (dS *DispatcherGuardianSv1) RemoteLock(attr *dispatchers.AttrRemoteLockWithAPIOpts, reply *string) (err error) { return dS.dS.GuardianSv1RemoteLock(*attr, reply) } // RemoteUnlock will unlock a key from remote based on reference ID -func (dS *DispatcherGuardianSv1) RemoteUnlock(attr *dispatchers.AttrRemoteUnlockWithOpts, reply *[]string) (err error) { +func (dS *DispatcherGuardianSv1) RemoteUnlock(attr *dispatchers.AttrRemoteUnlockWithAPIOpts, reply *[]string) (err error) { return dS.dS.GuardianSv1RemoteUnlock(*attr, reply) } @@ -772,11 +772,11 @@ func (dS *DispatcherSCDRsV1) Ping(args *utils.CGREvent, reply *string) error { return dS.dS.CDRsV1Ping(args, reply) } -func (dS *DispatcherSCDRsV1) GetCDRs(args *utils.RPCCDRsFilterWithOpts, reply *[]*engine.CDR) error { +func (dS *DispatcherSCDRsV1) GetCDRs(args *utils.RPCCDRsFilterWithAPIOpts, reply *[]*engine.CDR) error { return dS.dS.CDRsV1GetCDRs(args, reply) } -func (dS *DispatcherSCDRsV1) GetCDRsCount(args *utils.RPCCDRsFilterWithOpts, reply *int64) error { +func (dS *DispatcherSCDRsV1) GetCDRsCount(args *utils.RPCCDRsFilterWithAPIOpts, reply *int64) error { return dS.dS.CDRsV1GetCDRsCount(args, reply) } @@ -788,7 +788,7 @@ func (dS *DispatcherSCDRsV1) RateCDRs(args *engine.ArgRateCDRs, reply *string) e return dS.dS.CDRsV1RateCDRs(args, reply) } -func (dS *DispatcherSCDRsV1) ProcessExternalCDR(args *engine.ExternalCDRWithOpts, reply *string) error { +func (dS *DispatcherSCDRsV1) ProcessExternalCDR(args *engine.ExternalCDRWithAPIOpts, reply *string) error { return dS.dS.CDRsV1ProcessExternalCDR(args, reply) } @@ -796,7 +796,7 @@ func (dS *DispatcherSCDRsV1) ProcessEvent(args *engine.ArgV1ProcessEvent, reply return dS.dS.CDRsV1ProcessEvent(args, reply) } -func (dS *DispatcherSCDRsV1) ProcessCDR(args *engine.CDRWithOpts, reply *string) error { +func (dS *DispatcherSCDRsV1) ProcessCDR(args *engine.CDRWithAPIOpts, reply *string) error { return dS.dS.CDRsV1ProcessCDR(args, reply) } @@ -813,13 +813,13 @@ type DispatcherSServiceManagerV1 struct { func (dS *DispatcherSServiceManagerV1) Ping(args *utils.CGREvent, reply *string) error { return dS.dS.ServiceManagerV1Ping(args, reply) } -func (dS *DispatcherSServiceManagerV1) StartService(args *dispatchers.ArgStartServiceWithOpts, reply *string) error { +func (dS *DispatcherSServiceManagerV1) StartService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error { return dS.dS.ServiceManagerV1StartService(*args, reply) } -func (dS *DispatcherSServiceManagerV1) StopService(args *dispatchers.ArgStartServiceWithOpts, reply *string) error { +func (dS *DispatcherSServiceManagerV1) StopService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error { return dS.dS.ServiceManagerV1StopService(*args, reply) } -func (dS *DispatcherSServiceManagerV1) ServiceStatus(args *dispatchers.ArgStartServiceWithOpts, reply *string) error { +func (dS *DispatcherSServiceManagerV1) ServiceStatus(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) error { return dS.dS.ServiceManagerV1ServiceStatus(*args, reply) } @@ -832,7 +832,7 @@ type DispatcherConfigSv1 struct { dS *dispatchers.DispatcherService } -func (dS *DispatcherConfigSv1) GetConfig(args *config.SectionWithOpts, reply *map[string]interface{}) (err error) { +func (dS *DispatcherConfigSv1) GetConfig(args *config.SectionWithAPIOpts, reply *map[string]interface{}) (err error) { return dS.dS.ConfigSv1GetConfig(args, reply) } @@ -847,7 +847,7 @@ func (dS *DispatcherConfigSv1) SetConfig(args *config.SetConfigArgs, reply *stri func (dS *DispatcherConfigSv1) SetConfigFromJSON(args *config.SetConfigFromJSONArgs, reply *string) (err error) { return dS.dS.ConfigSv1SetConfigFromJSON(args, reply) } -func (dS *DispatcherConfigSv1) GetConfigAsJSON(args *config.SectionWithOpts, reply *string) (err error) { +func (dS *DispatcherConfigSv1) GetConfigAsJSON(args *config.SectionWithAPIOpts, reply *string) (err error) { return dS.dS.ConfigSv1GetConfigAsJSON(args, reply) } @@ -1072,7 +1072,7 @@ func (dS *DispatcherReplicatorSv1) SetFilter(args *engine.FilterWithAPIOpts, rep } // SetStatQueueProfile -func (dS *DispatcherReplicatorSv1) SetStatQueueProfile(args *engine.StatQueueProfileWithOpts, reply *string) error { +func (dS *DispatcherReplicatorSv1) SetStatQueueProfile(args *engine.StatQueueProfileWithAPIOpts, reply *string) error { return dS.dS.ReplicatorSv1SetStatQueueProfile(args, reply) } @@ -1087,12 +1087,12 @@ func (dS *DispatcherReplicatorSv1) SetResource(args *engine.ResourceWithAPIOpts, } // SetResourceProfile -func (dS *DispatcherReplicatorSv1) SetResourceProfile(args *engine.ResourceProfileWithOpts, reply *string) error { +func (dS *DispatcherReplicatorSv1) SetResourceProfile(args *engine.ResourceProfileWithAPIOpts, reply *string) error { return dS.dS.ReplicatorSv1SetResourceProfile(args, reply) } // SetActionTriggers -func (dS *DispatcherReplicatorSv1) SetActionTriggers(args *engine.SetActionTriggersArgWithOpts, reply *string) error { +func (dS *DispatcherReplicatorSv1) SetActionTriggers(args *engine.SetActionTriggersArgWithAPIOpts, reply *string) error { return dS.dS.ReplicatorSv1SetActionTriggers(args, reply) } diff --git a/apier/v1/dispatcher_it_test.go b/apier/v1/dispatcher_it_test.go index 971d5b6a1..a634c20e6 100644 --- a/apier/v1/dispatcher_it_test.go +++ b/apier/v1/dispatcher_it_test.go @@ -223,7 +223,7 @@ func testDispatcherSGetDispatcherProfileCache(t *testing.T) { t.SkipNow() } var rcvStats map[string]*ltcache.CacheStats - if err := dispatcherRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := dispatcherRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error(err) } else if rcvStats[utils.CacheDispatcherProfiles].Items != 1 { t.Errorf("Expecting: 1 DispatcherProfiles, received: %+v", rcvStats[utils.CacheDispatcherProfiles]) @@ -337,7 +337,7 @@ func testDispatcherSGetDispatcherHostCache(t *testing.T) { t.SkipNow() } var rcvStats map[string]*ltcache.CacheStats - if err := dispatcherRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil { + if err := dispatcherRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithAPIOpts{}, &rcvStats); err != nil { t.Error(err) } else if rcvStats[utils.CacheDispatcherHosts].Items != 0 { t.Errorf("Expecting: 0 DispatcherProfiles, received: %+v", rcvStats[utils.CacheDispatcherHosts]) diff --git a/apier/v1/ees_it_test.go b/apier/v1/ees_it_test.go index 93b0a739e..94f57bcc2 100644 --- a/apier/v1/ees_it_test.go +++ b/apier/v1/ees_it_test.go @@ -171,7 +171,7 @@ func testEEsAddCDRs(t *testing.T) { } for _, cdr := range storedCdrs { var reply string - if err := eeSRPC.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithOpts{CDR: cdr}, &reply); err != nil { + if err := eeSRPC.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithAPIOpts{CDR: cdr}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) diff --git a/apier/v1/filter_indexes_it_test.go b/apier/v1/filter_indexes_it_test.go index 2729550c0..732094878 100644 --- a/apier/v1/filter_indexes_it_test.go +++ b/apier/v1/filter_indexes_it_test.go @@ -161,7 +161,7 @@ func testV1FIdxdxInitDataDb(t *testing.T) { func testV1IndexClearCache(t *testing.T) { var reply string - if err := tFIdxRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{}, &reply); err != nil { + if err := tFIdxRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{}, &reply); err != nil { t.Fatal(err) } } @@ -476,7 +476,7 @@ func testV1FIdxSetStatQueueProfileIndexes(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE1", @@ -579,7 +579,7 @@ func testV1FIdxSetSecondStatQueueProfileIndexes(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE2", @@ -724,7 +724,7 @@ func testV1FIdxSetResourceProfileIndexes(t *testing.T) { &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: tenant, ID: "RCFG1", @@ -817,7 +817,7 @@ func testV1FIdxSetSecondResourceProfileIndexes(t *testing.T) { &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: tenant, ID: "RCFG2", @@ -2877,7 +2877,7 @@ func testV1FIdxRemoveAttributeProfile(t *testing.T) { func testV1FIdxPopulateDatabase(t *testing.T) { var result string - resPrf := engine.ResourceProfileWithOpts{ + resPrf := engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: tenant, ID: "ResProfile1", @@ -2896,7 +2896,7 @@ func testV1FIdxPopulateDatabase(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - resPrf = engine.ResourceProfileWithOpts{ + resPrf = engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: tenant, ID: "ResProfile2", @@ -2915,7 +2915,7 @@ func testV1FIdxPopulateDatabase(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - resPrf = engine.ResourceProfileWithOpts{ + resPrf = engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: tenant, ID: "ResProfile3", diff --git a/apier/v1/filterindexecache_it_test.go b/apier/v1/filterindexecache_it_test.go index 4ef95634f..0598340d7 100644 --- a/apier/v1/filterindexecache_it_test.go +++ b/apier/v1/filterindexecache_it_test.go @@ -585,7 +585,7 @@ func testV1FIdxCaSetStatQueueProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -747,7 +747,7 @@ func testV1FIdxCaUpdateStatQueueProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -833,7 +833,7 @@ func testV1FIdxCaUpdateStatQueueProfileFromTP(t *testing.T) { reply.FilterIDs = []string{"FLTR_3"} reply.ActivationInterval = &utils.ActivationInterval{ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)} if err := tFIdxCaRpc.Call(utils.APIerSv1SetStatQueueProfile, - &engine.StatQueueProfileWithOpts{StatQueueProfile: &reply}, &result); err != nil { + &engine.StatQueueProfileWithAPIOpts{StatQueueProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -1330,7 +1330,7 @@ func testV1FIdxCaSetResourceProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RCFG1", @@ -1459,7 +1459,7 @@ func testV1FIdxCaUpdateResourceProfile(t *testing.T) { } else if result != utils.OK { t.Error("Unexpected reply returned", result) } - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RCFG1", @@ -1543,7 +1543,7 @@ func testV1FIdxCaUpdateResourceProfileFromTP(t *testing.T) { reply.FilterIDs = []string{"FLTR_RES_RCFG3"} reply.ActivationInterval = &utils.ActivationInterval{ActivationTime: time.Date(2014, 7, 14, 14, 25, 0, 0, time.UTC)} - if err := tFIdxCaRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithOpts{ResourceProfile: &reply}, &result); err != nil { + if err := tFIdxCaRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithAPIOpts{ResourceProfile: &reply}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/apier/v1/full_remote_it_test.go b/apier/v1/full_remote_it_test.go index 7ef13b393..914948742 100644 --- a/apier/v1/full_remote_it_test.go +++ b/apier/v1/full_remote_it_test.go @@ -192,7 +192,7 @@ func testFullRemoteITStatQueue(t *testing.T) { } var replySet string - stat := &engine.StatQueueProfileWithOpts{ + stat := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -317,7 +317,7 @@ func testFullRemoteITResource(t *testing.T) { } var replySet string - rlsPrf := &engine.ResourceProfileWithOpts{ + rlsPrf := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ResGroup1", diff --git a/apier/v1/guardian.go b/apier/v1/guardian.go index 420fe9e6f..4f8ea9fb6 100644 --- a/apier/v1/guardian.go +++ b/apier/v1/guardian.go @@ -31,13 +31,13 @@ func NewGuardianSv1() *GuardianSv1 { type GuardianSv1 struct{} // RemoteLock will lock a key from remote -func (self *GuardianSv1) RemoteLock(attr *dispatchers.AttrRemoteLockWithOpts, reply *string) (err error) { +func (self *GuardianSv1) RemoteLock(attr *dispatchers.AttrRemoteLockWithAPIOpts, reply *string) (err error) { *reply = guardian.Guardian.GuardIDs(attr.ReferenceID, attr.Timeout, attr.LockIDs...) return } // RemoteUnlock will unlock a key from remote based on reference ID -func (self *GuardianSv1) RemoteUnlock(refID *dispatchers.AttrRemoteUnlockWithOpts, reply *[]string) (err error) { +func (self *GuardianSv1) RemoteUnlock(refID *dispatchers.AttrRemoteUnlockWithAPIOpts, reply *[]string) (err error) { *reply = guardian.Guardian.UnguardIDs(refID.RefID) return } diff --git a/apier/v1/guardian_it_test.go b/apier/v1/guardian_it_test.go index d8888bb04..c672c1d78 100644 --- a/apier/v1/guardian_it_test.go +++ b/apier/v1/guardian_it_test.go @@ -83,7 +83,7 @@ func TestGuardianSIT(t *testing.T) { t.Error(err) } var unlockReply []string - if err = guardianRPC.Call(utils.GuardianSv1RemoteUnlock, &dispatchers.AttrRemoteUnlockWithOpts{RefID: reply}, &unlockReply); err != nil { + if err = guardianRPC.Call(utils.GuardianSv1RemoteUnlock, &dispatchers.AttrRemoteUnlockWithAPIOpts{RefID: reply}, &unlockReply); err != nil { t.Error(err) } if !reflect.DeepEqual(args.LockIDs, unlockReply) { diff --git a/apier/v1/libapier.go b/apier/v1/libapier.go index 1e757c108..a4811cfa9 100644 --- a/apier/v1/libapier.go +++ b/apier/v1/libapier.go @@ -57,7 +57,7 @@ func (apierSv1 *APIerSv1) CallCache(cacheopt string, tnt, cacheID, itemID string cacheIDs = append(cacheIDs, cIdx) } method = utils.CacheSv1Clear - args = &utils.AttrCacheIDsWithOpts{ + args = &utils.AttrCacheIDsWithAPIOpts{ Tenant: tnt, CacheIDs: cacheIDs, APIOpts: opts, @@ -175,7 +175,7 @@ func (apierSv1 *APIerSv1) callCacheMultiple(cacheopt, tnt, cacheID string, itemI } case utils.MetaClear: method = utils.CacheSv1Clear - args = &utils.AttrCacheIDsWithOpts{ + args = &utils.AttrCacheIDsWithAPIOpts{ Tenant: tnt, CacheIDs: []string{cacheID}, APIOpts: opts, diff --git a/apier/v1/libapier_test.go b/apier/v1/libapier_test.go index 6c55ca3fb..8450e4487 100644 --- a/apier/v1/libapier_test.go +++ b/apier/v1/libapier_test.go @@ -132,7 +132,7 @@ func TestCallCache(t *testing.T) { } exp := &rpcRequest{ Method: utils.CacheSv1Clear, - Params: &utils.AttrCacheIDsWithOpts{ + Params: &utils.AttrCacheIDsWithAPIOpts{ Tenant: "cgrates.org", CacheIDs: []string{utils.CacheStatQueueProfiles, utils.CacheStatFilterIndexes}, APIOpts: make(map[string]interface{}), diff --git a/apier/v1/precache_it_test.go b/apier/v1/precache_it_test.go index 9ef434387..41529f8dc 100644 --- a/apier/v1/precache_it_test.go +++ b/apier/v1/precache_it_test.go @@ -122,7 +122,7 @@ func testPrecacheGetItemIDs(t *testing.T) { func testPrecacheGetCacheStatsBeforeLoad(t *testing.T) { var reply *map[string]*ltcache.CacheStats - args := &utils.AttrCacheIDsWithOpts{ + args := &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: []string{}, } dfltStats := engine.GetDefaultEmptyCacheStats() @@ -157,7 +157,7 @@ func testPrecacheRestartEngine(t *testing.T) { func testPrecacheGetCacheStatsAfterRestart(t *testing.T) { var reply *map[string]*ltcache.CacheStats - args := &utils.AttrCacheIDsWithOpts{ + args := &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: []string{}, } expectedStats := &map[string]*ltcache.CacheStats{ diff --git a/apier/v1/remote_it_test.go b/apier/v1/remote_it_test.go index f768ec945..6bb37bd2b 100644 --- a/apier/v1/remote_it_test.go +++ b/apier/v1/remote_it_test.go @@ -321,7 +321,7 @@ func testInternalRemoteITGetResource(t *testing.T) { } func testInternalRemoteITGetResourceProfile(t *testing.T) { - rlsPrf := &engine.ResourceProfileWithOpts{ + rlsPrf := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ResGroup1", @@ -1088,7 +1088,7 @@ func testInternalSetAccount(t *testing.T) { func testInternalReplicateStats(t *testing.T) { var reply string - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatsToReplicate", diff --git a/apier/v1/replicate_it_test.go b/apier/v1/replicate_it_test.go index fcd30df76..2d53b458c 100644 --- a/apier/v1/replicate_it_test.go +++ b/apier/v1/replicate_it_test.go @@ -423,7 +423,7 @@ func testInternalReplicateITStatQueueProfile(t *testing.T) { t.Error(err) } // set - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: tenant, ID: "TEST_PROFILE1", @@ -761,7 +761,7 @@ func testInternalReplicateITResourceProfile(t *testing.T) { t.Error(err) } // set - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RES_GR_TEST", diff --git a/apier/v1/replicator.go b/apier/v1/replicator.go index 9a3a18268..f27247288 100644 --- a/apier/v1/replicator.go +++ b/apier/v1/replicator.go @@ -428,12 +428,12 @@ func (rplSv1 *ReplicatorSv1) SetThreshold(th *engine.ThresholdWithAPIOpts, reply } // SetStatQueueProfile is the replication method coresponding to the dataDb driver method -func (rplSv1 *ReplicatorSv1) SetStatQueueProfile(sq *engine.StatQueueProfileWithOpts, reply *string) (err error) { +func (rplSv1 *ReplicatorSv1) SetStatQueueProfile(sq *engine.StatQueueProfileWithAPIOpts, reply *string) (err error) { if err = rplSv1.dm.DataDB().SetStatQueueProfileDrv(sq.StatQueueProfile); err != nil { return } - if err = rplSv1.v1.CallCache(utils.IfaceAsString(sq.Opts[utils.CacheOpt]), - sq.Tenant, utils.CacheStatQueueProfiles, sq.TenantID(), &sq.FilterIDs, nil, sq.Opts); err != nil { + if err = rplSv1.v1.CallCache(utils.IfaceAsString(sq.APIOpts[utils.CacheOpt]), + sq.Tenant, utils.CacheStatQueueProfiles, sq.TenantID(), &sq.FilterIDs, nil, sq.APIOpts); err != nil { return } *reply = utils.OK @@ -480,12 +480,12 @@ func (rplSv1 *ReplicatorSv1) SetTiming(tm *utils.TPTimingWithAPIOpts, reply *str } // SetResourceProfile is the replication method coresponding to the dataDb driver method -func (rplSv1 *ReplicatorSv1) SetResourceProfile(rs *engine.ResourceProfileWithOpts, reply *string) (err error) { +func (rplSv1 *ReplicatorSv1) SetResourceProfile(rs *engine.ResourceProfileWithAPIOpts, reply *string) (err error) { if err = rplSv1.dm.DataDB().SetResourceProfileDrv(rs.ResourceProfile); err != nil { return } - if err = rplSv1.v1.CallCache(utils.IfaceAsString(rs.Opts[utils.CacheOpt]), - rs.Tenant, utils.CacheResourceProfiles, rs.TenantID(), &rs.FilterIDs, nil, rs.Opts); err != nil { + if err = rplSv1.v1.CallCache(utils.IfaceAsString(rs.APIOpts[utils.CacheOpt]), + rs.Tenant, utils.CacheResourceProfiles, rs.TenantID(), &rs.FilterIDs, nil, rs.APIOpts); err != nil { return } *reply = utils.OK @@ -506,12 +506,12 @@ func (rplSv1 *ReplicatorSv1) SetResource(rs *engine.ResourceWithAPIOpts, reply * } // SetActionTriggers is the replication method coresponding to the dataDb driver method -func (rplSv1 *ReplicatorSv1) SetActionTriggers(args *engine.SetActionTriggersArgWithOpts, reply *string) (err error) { +func (rplSv1 *ReplicatorSv1) SetActionTriggers(args *engine.SetActionTriggersArgWithAPIOpts, reply *string) (err error) { if err = rplSv1.dm.DataDB().SetActionTriggersDrv(args.Key, args.Attrs); err != nil { return } - if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.Opts[utils.CacheOpt]), - args.Tenant, utils.CacheActionTriggers, args.Key, nil, nil, args.Opts); err != nil { + if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), + args.Tenant, utils.CacheActionTriggers, args.Key, nil, nil, args.APIOpts); err != nil { return } *reply = utils.OK diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go index 7e1879fe6..b9abf6096 100644 --- a/apier/v1/resourcesv1.go +++ b/apier/v1/resourcesv1.go @@ -108,7 +108,7 @@ func (apierSv1 *APIerSv1) GetResourceProfileIDs(args *utils.PaginatorWithTenant, } //SetResourceProfile adds a new resource configuration -func (apierSv1 *APIerSv1) SetResourceProfile(arg *engine.ResourceProfileWithOpts, reply *string) (err error) { +func (apierSv1 *APIerSv1) SetResourceProfile(arg *engine.ResourceProfileWithAPIOpts, reply *string) (err error) { if missing := utils.MissingStructFields(arg.ResourceProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -127,8 +127,8 @@ func (apierSv1 *APIerSv1) SetResourceProfile(arg *engine.ResourceProfileWithOpts return utils.APIErrorHandler(err) } //handle caching for ResourceProfile - if err = apierSv1.CallCache(utils.IfaceAsString(arg.Opts[utils.CacheOpt]), arg.Tenant, utils.CacheResourceProfiles, - arg.TenantID(), &arg.FilterIDs, nil, arg.Opts); err != nil { + if err = apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheResourceProfiles, + arg.TenantID(), &arg.FilterIDs, nil, arg.APIOpts); err != nil { return utils.APIErrorHandler(err) } var ttl *time.Duration @@ -144,8 +144,8 @@ func (apierSv1 *APIerSv1) SetResourceProfile(arg *engine.ResourceProfileWithOpts return } //handle caching for Resource - if err = apierSv1.CallCache(utils.IfaceAsString(arg.Opts[utils.CacheOpt]), arg.Tenant, utils.CacheResources, - arg.TenantID(), nil, nil, arg.Opts); err != nil { + if err = apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheResources, + arg.TenantID(), nil, nil, arg.APIOpts); err != nil { return utils.APIErrorHandler(err) } diff --git a/apier/v1/resourcesv1_it_test.go b/apier/v1/resourcesv1_it_test.go index 58c524df9..3de1753d4 100644 --- a/apier/v1/resourcesv1_it_test.go +++ b/apier/v1/resourcesv1_it_test.go @@ -37,7 +37,7 @@ var ( rlsV1Cfg *config.CGRConfig rlsV1Rpc *rpc.Client rlsV1ConfDIR string //run tests for specific configuration - rlsConfig *engine.ResourceProfileWithOpts + rlsConfig *engine.ResourceProfileWithAPIOpts sTestsRLSV1 = []func(t *testing.T){ testV1RsLoadConfig, @@ -664,7 +664,7 @@ func testV1RsGetResourceProfileBeforeSet(t *testing.T) { } func testV1RsSetResourceProfile(t *testing.T) { - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RES_GR_TEST", @@ -780,7 +780,7 @@ func testV1RsResourcePing(t *testing.T) { } func testV1RsMatchNotFound(t *testing.T) { - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "Res_NotFound", @@ -821,7 +821,7 @@ func testV1RsMatchNotFound(t *testing.T) { } func testV1RsAllocateUnlimited(t *testing.T) { - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RES_ULTIMITED", @@ -891,7 +891,7 @@ func testV1RsStopEngine(t *testing.T) { } func testV1RsGetResourceProfileWithoutTenant(t *testing.T) { - rlsConfig = &engine.ResourceProfileWithOpts{ + rlsConfig = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ ID: "RES_ULTIMITED2", FilterIDs: []string{"*string:~*req.CustomField:UnlimitedEvent"}, @@ -943,7 +943,7 @@ func testV1RsRemResourceProfileWithoutTenant(t *testing.T) { } func testV1RsSetResourceProfileWithOpts(t *testing.T) { - rlsCfg := &engine.ResourceProfileWithOpts{ + rlsCfg := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "TEST_WITH_OPTS", diff --git a/apier/v1/routes_it_test.go b/apier/v1/routes_it_test.go index 84e03de8c..e9a7ff3b0 100644 --- a/apier/v1/routes_it_test.go +++ b/apier/v1/routes_it_test.go @@ -116,7 +116,7 @@ func testV1RouteInitDataDb(t *testing.T) { func testV1RouteClearCache(t *testing.T) { var reply string - if err := routeSv1Rpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{}, &reply); err != nil { + if err := routeSv1Rpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{}, &reply); err != nil { t.Fatal(err) } } diff --git a/apier/v1/servicemanager.go b/apier/v1/servicemanager.go index f876b5a52..f238a9505 100644 --- a/apier/v1/servicemanager.go +++ b/apier/v1/servicemanager.go @@ -32,15 +32,15 @@ type ServiceManagerV1 struct { sm *servmanager.ServiceManager // Need to have them capitalize so we can export in V2 } -func (servManager *ServiceManagerV1) StartService(args *dispatchers.ArgStartServiceWithOpts, reply *string) (err error) { +func (servManager *ServiceManagerV1) StartService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) (err error) { return servManager.sm.V1StartService(args.ArgStartService, reply) } -func (servManager *ServiceManagerV1) StopService(args *dispatchers.ArgStartServiceWithOpts, reply *string) (err error) { +func (servManager *ServiceManagerV1) StopService(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) (err error) { return servManager.sm.V1StopService(args.ArgStartService, reply) } -func (servManager *ServiceManagerV1) ServiceStatus(args *dispatchers.ArgStartServiceWithOpts, reply *string) (err error) { +func (servManager *ServiceManagerV1) ServiceStatus(args *dispatchers.ArgStartServiceWithAPIOpts, reply *string) (err error) { return servManager.sm.V1ServiceStatus(args.ArgStartService, reply) } diff --git a/apier/v1/sessions_process_event_it_test.go b/apier/v1/sessions_process_event_it_test.go index 5f77abace..3dccc2df4 100644 --- a/apier/v1/sessions_process_event_it_test.go +++ b/apier/v1/sessions_process_event_it_test.go @@ -471,7 +471,7 @@ func testSSv1ItProcessCDRForSessionFromProcessEvent(t *testing.T) { func testSSv1ItGetCDRs(t *testing.T) { var cdrCnt int64 - req := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{}} + req := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 3 { // 3 for each CDR @@ -479,7 +479,7 @@ func testSSv1ItGetCDRs(t *testing.T) { } var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"raw"}}} + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"raw"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -489,7 +489,7 @@ func testSSv1ItGetCDRs(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testSSv1ItProcessEvent"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -500,7 +500,7 @@ func testSSv1ItGetCDRs(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"testSSv1ItProcessEvent"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -729,7 +729,7 @@ func testSSv1ItProcessEventWithCDR(t *testing.T) { func testSSv1ItGetCDRsFromProcessEvent(t *testing.T) { var cdrCnt int64 - req := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + req := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -738,7 +738,7 @@ func testSSv1ItGetCDRsFromProcessEvent(t *testing.T) { } var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}, RunIDs: []string{"raw"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -750,7 +750,7 @@ func testSSv1ItGetCDRsFromProcessEvent(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -762,7 +762,7 @@ func testSSv1ItGetCDRsFromProcessEvent(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -806,7 +806,7 @@ func testSSv1ItProcessEventWithCDRResourceError(t *testing.T) { func testSSv1ItGetCDRsFromProcessEventResourceError(t *testing.T) { var cdrCnt int64 - req := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + req := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testSSv1ItProcessEventWithCDRResourceError"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -815,7 +815,7 @@ func testSSv1ItGetCDRsFromProcessEventResourceError(t *testing.T) { } var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testSSv1ItProcessEventWithCDRResourceError"}, RunIDs: []string{"raw"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -827,7 +827,7 @@ func testSSv1ItGetCDRsFromProcessEventResourceError(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"testSSv1ItProcessEventWithCDRResourceError"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -839,7 +839,7 @@ func testSSv1ItGetCDRsFromProcessEventResourceError(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"testSSv1ItProcessEventWithCDRResourceError"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { @@ -884,7 +884,7 @@ func testSSv1ItProcessEventWithCDRResourceErrorBlockError(t *testing.T) { func testSSv1ItGetCDRsFromProcessEventResourceErrorBlockError(t *testing.T) { var cdrCnt int64 - req := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ + req := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testSSv1ItProcessEventWithCDRResourceErrorBlockError"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) diff --git a/apier/v1/sessionsv1_it_test.go b/apier/v1/sessionsv1_it_test.go index 8f0770f8f..5ce776246 100644 --- a/apier/v1/sessionsv1_it_test.go +++ b/apier/v1/sessionsv1_it_test.go @@ -673,7 +673,7 @@ func testSSv1ItProcessEvent(t *testing.T) { func testSSv1ItCDRsGetCdrs(t *testing.T) { var cdrCnt int64 - req := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{}} + req := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil { t.Error("Unexpected error: ", err.Error()) } else if cdrCnt != 6 { // 3 for each CDR @@ -681,7 +681,7 @@ func testSSv1ItCDRsGetCdrs(t *testing.T) { } var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"raw"}}} + args := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"raw"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 2 { @@ -691,7 +691,7 @@ func testSSv1ItCDRsGetCdrs(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"TestSSv1It1"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -708,7 +708,7 @@ func testSSv1ItCDRsGetCdrs(t *testing.T) { t.Errorf("Unexpected cost from CostDetails for CDR: %+v", cdrs[0].CostDetails.Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"TestSSv1It1"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -726,7 +726,7 @@ func testSSv1ItCDRsGetCdrs(t *testing.T) { } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"TestSSv1It2"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -743,7 +743,7 @@ func testSSv1ItCDRsGetCdrs(t *testing.T) { t.Errorf("Unexpected cost from CostDetails for CDR: %+v", cdrs[0].CostDetails.Cost) } } - args = &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, + args = &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"TestSSv1It2"}}} if err := sSApierRpc.Call(utils.CDRsV1GetCDRs, args, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) @@ -869,7 +869,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) { t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MetaMonetary].GetTotalValue()) } var cdrs []*engine.CDR - argsCDR := &utils.RPCCDRsFilterWithOpts{ + argsCDR := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"TestSSv1It"}, @@ -884,7 +884,7 @@ func testSSv1ItForceUpdateSession(t *testing.T) { t.Errorf("Unexpected cost for CDR: %f", cdrs[0].Cost) } } - argsCDR = &utils.RPCCDRsFilterWithOpts{ + argsCDR = &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"SupplierCharges"}, OriginIDs: []string{"TestSSv1It"}, diff --git a/apier/v1/stats.go b/apier/v1/stats.go index 634c6f1e9..280132934 100644 --- a/apier/v1/stats.go +++ b/apier/v1/stats.go @@ -66,7 +66,7 @@ func (apierSv1 *APIerSv1) GetStatQueueProfileIDs(args *utils.PaginatorWithTenant } // SetStatQueueProfile alters/creates a StatQueueProfile -func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueProfileWithOpts, reply *string) (err error) { +func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueProfileWithAPIOpts, reply *string) (err error) { if missing := utils.MissingStructFields(arg.StatQueueProfile, []string{utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } @@ -83,8 +83,8 @@ func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueProfileWithOp return utils.APIErrorHandler(err) } //handle caching for StatQueueProfile - if err = apierSv1.CallCache(utils.IfaceAsString(arg.Opts[utils.CacheOpt]), arg.Tenant, utils.CacheStatQueueProfiles, - arg.TenantID(), &arg.FilterIDs, nil, arg.Opts); err != nil { + if err = apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheStatQueueProfiles, + arg.TenantID(), &arg.FilterIDs, nil, arg.APIOpts); err != nil { return utils.APIErrorHandler(err) } var ttl *time.Duration @@ -108,8 +108,8 @@ func (apierSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueProfileWithOp return err } //handle caching for StatQueues - if err := apierSv1.CallCache(utils.IfaceAsString(arg.Opts[utils.CacheOpt]), arg.Tenant, utils.CacheStatQueues, - arg.TenantID(), nil, nil, arg.Opts); err != nil { + if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheStatQueues, + arg.TenantID(), nil, nil, arg.APIOpts); err != nil { return utils.APIErrorHandler(err) } diff --git a/apier/v1/stats_it_test.go b/apier/v1/stats_it_test.go index 0125c869f..209ebc921 100644 --- a/apier/v1/stats_it_test.go +++ b/apier/v1/stats_it_test.go @@ -37,7 +37,7 @@ var ( stsV1CfgPath string stsV1Cfg *config.CGRConfig stsV1Rpc *rpc.Client - statConfig *engine.StatQueueProfileWithOpts + statConfig *engine.StatQueueProfileWithAPIOpts stsV1ConfDIR string //run tests for specific configuration evs = []*utils.CGREvent{ @@ -424,7 +424,7 @@ func testV1STSGetStatsAfterRestart(t *testing.T) { func testV1STSSetStatQueueProfile(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "TEST_PROFILE1", @@ -576,7 +576,7 @@ func testV1STSRemoveStatQueueProfile(t *testing.T) { } func testV1STSProcessMetricsWithFilter(t *testing.T) { - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "CustomStatProfile", @@ -701,7 +701,7 @@ func testV1STSProcessMetricsWithFilter(t *testing.T) { } func testV1STSProcessStaticMetrics(t *testing.T) { - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StaticStatQueue", @@ -824,7 +824,7 @@ func testV1STSStatsPing(t *testing.T) { } func testV1STSProcessStatWithThreshold(t *testing.T) { - stTh := &engine.StatQueueProfileWithOpts{ + stTh := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatWithThreshold", @@ -904,7 +904,7 @@ func testV1STSProcessStatWithThreshold(t *testing.T) { } func testV1STSProcessCDRStat(t *testing.T) { - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatForCDR", @@ -1039,7 +1039,7 @@ func testV1STSProcessCDRStat(t *testing.T) { } func testV1STSOverWriteStats(t *testing.T) { - initStat := &engine.StatQueueProfileWithOpts{ + initStat := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "InitStat", @@ -1089,7 +1089,7 @@ func testV1STSOverWriteStats(t *testing.T) { t.Errorf("expecting: %+v, received reply: %s", expectedMetrics, metrics) } // set the new profile with other metric and make sure the statQueue is updated - initStat2 := &engine.StatQueueProfileWithOpts{ + initStat2 := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "InitStat", @@ -1131,7 +1131,7 @@ func testV1STSOverWriteStats(t *testing.T) { } func testV1STSProcessStatWithThreshold2(t *testing.T) { - stTh := &engine.StatQueueProfileWithOpts{ + stTh := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatWithThreshold2", @@ -1253,7 +1253,7 @@ func BenchmarkSTSV1GetQueueStringMetrics(b *testing.B) { } func testV1STSGetStatQueueProfileWithoutTenant(t *testing.T) { - statConfig := &engine.StatQueueProfileWithOpts{ + statConfig := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ ID: "TEST_PROFILE10", FilterIDs: []string{"FLTR_1"}, @@ -1365,7 +1365,7 @@ func testV1STSV1GetStatQueuesForEventWithoutTenant(t *testing.T) { } func testV1STSSimulateAccountUpdate(t *testing.T) { - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "StatForAccountUpdate", @@ -1486,7 +1486,7 @@ func testV1STSSimulateAccountUpdate(t *testing.T) { func testV1STSGetStatQueueWithoutExpired(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "Sq1Nanao", @@ -1549,7 +1549,7 @@ func testV1STSGetStatQueueWithoutExpired(t *testing.T) { func testV1STSGetStatQueueWithoutStored(t *testing.T) { var result string var reply *engine.StatQueueProfile - statConfig = &engine.StatQueueProfileWithOpts{ + statConfig = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "Sq1NotStored", diff --git a/apier/v2/cdrs_it_test.go b/apier/v2/cdrs_it_test.go index 79a333466..e39402c97 100644 --- a/apier/v2/cdrs_it_test.go +++ b/apier/v2/cdrs_it_test.go @@ -852,7 +852,7 @@ func testv2CDRsGetCDRsDest(t *testing.T) { func testV2CDRsRerate(t *testing.T) { var reply string - if err := cdrsRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := cdrsRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error(err) @@ -1018,7 +1018,7 @@ func testv2CDRsDynaPrepaid(t *testing.T) { func testV2CDRsDuplicateCDRs(t *testing.T) { var reply string - if err := cdrsRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := cdrsRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error(err) diff --git a/apier/v2/cdrs_offline_it_test.go b/apier/v2/cdrs_offline_it_test.go index c05c745c3..b572d45b9 100644 --- a/apier/v2/cdrs_offline_it_test.go +++ b/apier/v2/cdrs_offline_it_test.go @@ -206,7 +206,7 @@ func testV2CDRsOfflineBalanceUpdate(t *testing.T) { t.Error("Unexpected error received: ", err) } //process cdr should trigger balance update event - if err := cdrsOfflineRpc.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithOpts{CDR: cdr}, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithAPIOpts{CDR: cdr}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) @@ -377,7 +377,7 @@ func testV2CDRsBalancesWithSameWeight(t *testing.T) { t.Error("Unexpected error received: ", err) } //process cdr should trigger balance update event - if err := cdrsOfflineRpc.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithOpts{CDR: cdr}, &reply); err != nil { + if err := cdrsOfflineRpc.Call(utils.CDRsV1ProcessCDR, &engine.CDRWithAPIOpts{CDR: cdr}, &reply); err != nil { t.Error("Unexpected error: ", err.Error()) } else if reply != utils.OK { t.Error("Unexpected reply received: ", reply) diff --git a/config/config.go b/config/config.go index 08c49542c..54080f779 100644 --- a/config/config.go +++ b/config/config.go @@ -1612,7 +1612,7 @@ func (cfg *CGRConfig) AsMapInterface(separator string) (mp map[string]interface{ // ReloadArgs the API params for V1ReloadConfig type ReloadArgs struct { - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string Path string Section string @@ -1653,15 +1653,15 @@ func (cfg *CGRConfig) V1ReloadConfig(args *ReloadArgs, reply *string) (err error return } -// SectionWithOpts the API params for GetConfig -type SectionWithOpts struct { - Opts map[string]interface{} +// SectionWithAPIOpts the API params for GetConfig +type SectionWithAPIOpts struct { + APIOpts map[string]interface{} Tenant string Section string } // V1GetConfig will retrieve from CGRConfig a section -func (cfg *CGRConfig) V1GetConfig(args *SectionWithOpts, reply *map[string]interface{}) (err error) { +func (cfg *CGRConfig) V1GetConfig(args *SectionWithAPIOpts, reply *map[string]interface{}) (err error) { args.Section = utils.FirstNonEmpty(args.Section, utils.MetaAll) cfg.cacheDPMux.RLock() if mp, has := cfg.cacheDP[args.Section]; has && mp != nil { @@ -1782,10 +1782,10 @@ func (cfg *CGRConfig) V1GetConfig(args *SectionWithOpts, reply *map[string]inter // SetConfigArgs the API params for V1SetConfig type SetConfigArgs struct { - Opts map[string]interface{} - Tenant string - Config map[string]interface{} - DryRun bool + APIOpts map[string]interface{} + Tenant string + Config map[string]interface{} + DryRun bool } // V1SetConfig reloads the sections of config @@ -1829,7 +1829,7 @@ func (cfg *CGRConfig) V1SetConfig(args *SetConfigArgs, reply *string) (err error } //V1GetConfigAsJSON will retrieve from CGRConfig a section as a string -func (cfg *CGRConfig) V1GetConfigAsJSON(args *SectionWithOpts, reply *string) (err error) { +func (cfg *CGRConfig) V1GetConfigAsJSON(args *SectionWithAPIOpts, reply *string) (err error) { args.Section = utils.FirstNonEmpty(args.Section, utils.MetaAll) cfg.cacheDPMux.RLock() if mp, has := cfg.cacheDP[args.Section]; has && mp != nil { @@ -1951,10 +1951,10 @@ func (cfg *CGRConfig) V1GetConfigAsJSON(args *SectionWithOpts, reply *string) (e // SetConfigFromJSONArgs the API params for V1SetConfigFromJSON type SetConfigFromJSONArgs struct { - Opts map[string]interface{} - Tenant string - Config string - DryRun bool + APIOpts map[string]interface{} + Tenant string + Config string + DryRun bool } // V1SetConfigFromJSON reloads the sections of config diff --git a/config/config_it_test.go b/config/config_it_test.go index 66c273751..ba8859250 100644 --- a/config/config_it_test.go +++ b/config/config_it_test.go @@ -825,7 +825,7 @@ func testCgrCfgV1ReloadConfigSection(t *testing.T) { expected = map[string]interface{}{ ERsJson: expected, } - if err := cfg.V1GetConfig(&SectionWithOpts{Section: ERsJson}, &rcv); err != nil { + if err := cfg.V1GetConfig(&SectionWithAPIOpts{Section: ERsJson}, &rcv); err != nil { t.Error(err) } else if utils.ToJSON(expected) != utils.ToJSON(rcv) { t.Errorf("Expected: %+v, \n received: %+v", utils.ToJSON(expected), utils.ToJSON(rcv)) @@ -958,7 +958,7 @@ func testCGRConfigReloadConfigFromStringSessionS(t *testing.T) { var rcv string expected := `{"sessions":{"alterable_fields":[],"attributes_conns":["*localhost"],"cdrs_conns":["*internal"],"channel_sync_interval":"0","chargers_conns":["*localhost"],"client_protocol":1,"debit_interval":"0","default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":true,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","rals_conns":["*internal"],"replication_conns":[],"resources_conns":["*localhost"],"routes_conns":["*localhost"],"scheduler_conns":[],"session_indexes":[],"session_ttl":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]}}` - if err := cfg.V1GetConfigAsJSON(&SectionWithOpts{Section: SessionSJson}, &rcv); err != nil { + if err := cfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: SessionSJson}, &rcv); err != nil { t.Error(err) } else if expected != rcv { t.Errorf("Expected: %+q, \n received: %s", expected, rcv) diff --git a/config/config_test.go b/config/config_test.go index 16a7a90c2..b5281ed17 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -3776,13 +3776,13 @@ func TestCgrCfgV1GetConfigAllConfig(t *testing.T) { t.Error(err) } expected := cgrCfg.AsMapInterface(cgrCfg.GeneralCfg().RSRSep) - if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: utils.EmptyString}, &rcv); err != nil { + if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: utils.EmptyString}, &rcv); err != nil { t.Fatal(err) } if !reflect.DeepEqual(expected, rcv) { t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rcv)) } - if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: utils.EmptyString}, &rcv); err != nil { + if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: utils.EmptyString}, &rcv); err != nil { t.Fatal(err) } if !reflect.DeepEqual(expected, rcv) { @@ -3810,7 +3810,7 @@ func TestCgrCfgV1GetConfigSectionLoader(t *testing.T) { }, } cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: LoaderJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: LoaderJson}, &reply); err != nil { t.Error(err) } else if mp, can := reply[LoaderJson].([]map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[LoaderJson]) @@ -3828,7 +3828,7 @@ func TestCgrCfgV1GetConfigSectionHTTPAgent(t *testing.T) { HttpAgentJson: []map[string]interface{}{}, } cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: HttpAgentJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: HttpAgentJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, reply) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -3846,7 +3846,7 @@ func TestCgrCfgV1GetConfigSectionCoreS(t *testing.T) { }, } cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: CoreSCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: CoreSCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, reply) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -3875,7 +3875,7 @@ func TestCgrCfgV1GetConfigListen(t *testing.T) { var rcv map[string]interface{} if cgrCfg, err := NewCGRConfigFromJSONStringWithDefaults(jsnCfg); err != nil { t.Error(err) - } else if err := cgrCfg.V1GetConfig(&SectionWithOpts{Section: LISTEN_JSN}, &rcv); err != nil { + } else if err := cgrCfg.V1GetConfig(&SectionWithAPIOpts{Section: LISTEN_JSN}, &rcv); err != nil { t.Error(err) } else if !reflect.DeepEqual(expected, rcv) { t.Errorf("Expected: %+v, received: %+v", utils.ToJSON(expected), utils.ToJSON(rcv)) @@ -3925,7 +3925,7 @@ func TestV1GetConfigGeneral(t *testing.T) { if err != nil { t.Error(err) } - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: GENERAL_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: GENERAL_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -3953,7 +3953,7 @@ func TestV1GetConfigDataDB(t *testing.T) { DATADB_JSN: expected, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: DATADB_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: DATADB_JSN}, &reply); err != nil { t.Error(err) } else if mp, can := reply[DATADB_JSN].(map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[DATADB_JSN]) @@ -3994,7 +3994,7 @@ func TestV1GetConfigStorDB(t *testing.T) { STORDB_JSN: expected, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: STORDB_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: STORDB_JSN}, &reply); err != nil { t.Error(err) } else if mp, can := reply[STORDB_JSN].(map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[STORDB_JSN]) @@ -4020,7 +4020,7 @@ func TestV1GetConfigTLS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: TlsCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: TlsCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4036,7 +4036,7 @@ func TestV1GetConfigCache(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: CACHE_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: CACHE_JSN}, &reply); err != nil { t.Error(err) } else if mp, can := reply[CACHE_JSN].(map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[CACHE_JSN]) @@ -4078,7 +4078,7 @@ func TestV1GetConfigHTTP(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: HTTP_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: HTTP_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4095,7 +4095,7 @@ func TestV1GetConfigFilterS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: FilterSjsn}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: FilterSjsn}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4128,7 +4128,7 @@ func TestV1GetConfigRals(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RALS_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RALS_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4147,7 +4147,7 @@ func TestV1GetConfigScheduler(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: SCHEDULER_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: SCHEDULER_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4173,7 +4173,7 @@ func TestV1GetConfigCdrs(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: CDRS_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: CDRS_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4222,7 +4222,7 @@ func TestV1GetConfigSessionS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: SessionSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: SessionSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4252,7 +4252,7 @@ func TestV1GetConfigFsAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: FreeSWITCHAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: FreeSWITCHAgentJSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4277,7 +4277,7 @@ func TestV1GetConfigKamailioAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: KamailioAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: KamailioAgentJSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4304,7 +4304,7 @@ func TestV1GetConfigAsteriskAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: AsteriskAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: AsteriskAgentJSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4333,7 +4333,7 @@ func TestV1GetConfigDiameterAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: DA_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: DA_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4359,7 +4359,7 @@ func TestV1GetConfigRadiusAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RA_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RA_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4379,7 +4379,7 @@ func TestV1GetConfigDNSAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: DNSAgentJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: DNSAgentJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4402,7 +4402,7 @@ func TestV1GetConfigAttribute(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ATTRIBUTE_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ATTRIBUTE_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4422,7 +4422,7 @@ func TestV1GetConfigChargers(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ChargerSCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ChargerSCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4443,7 +4443,7 @@ func TestV1GetConfigResourceS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RESOURCES_JSON}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RESOURCES_JSON}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4465,7 +4465,7 @@ func TestV1GetConfigStats(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: STATS_JSON}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: STATS_JSON}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4485,7 +4485,7 @@ func TestV1GetConfigThresholds(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: THRESHOLDS_JSON}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: THRESHOLDS_JSON}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4513,7 +4513,7 @@ func TestV1GetConfigAcounts(t *testing.T) { }, } cfg := NewDefaultCGRConfig() - if err := cfg.V1GetConfig(&SectionWithOpts{Section: AccountSCfgJson}, &reply); err != nil { + if err := cfg.V1GetConfig(&SectionWithAPIOpts{Section: AccountSCfgJson}, &reply); err != nil { t.Error(expected) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4537,7 +4537,7 @@ func TestV1GetConfigRoutes(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RouteSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RouteSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4578,7 +4578,7 @@ func TestV1GetConfigSuretax(t *testing.T) { } cfgCgr := NewDefaultCGRConfig() cfgCgr.SureTaxCfg().Timezone = time.UTC - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: SURETAX_JSON}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: SURETAX_JSON}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4598,7 +4598,7 @@ func TestV1GetConfigDispatcherS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: DispatcherSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: DispatcherSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4624,7 +4624,7 @@ func TestV1GetConfigDispatcherH(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RegistrarCJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RegistrarCJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4646,7 +4646,7 @@ func TestV1GetConfigSectionLoader(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: CgrLoaderCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: CgrLoaderCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4685,7 +4685,7 @@ func TestV1GetConfigSectionMigrator(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: CgrMigratorCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: CgrMigratorCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4704,7 +4704,7 @@ func TestV1GetConfigSectionApierS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ApierS}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ApierS}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4747,7 +4747,7 @@ func TestV1GetConfigSectionEES(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: EEsJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: EEsJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4787,7 +4787,7 @@ func TestV1GetConfigSectionERS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ERsJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ERsJson}, &reply); err != nil { t.Error(err) } else if mp, can := reply[ERsJson].(map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[ERsJson]) @@ -4836,7 +4836,7 @@ func TestV1GetConfigSectionRPConns(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RPCConnsJsonName}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RPCConnsJsonName}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4857,7 +4857,7 @@ func TestV1GetConfigSectionSIPAgent(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: SIPAgentJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: SIPAgentJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4897,7 +4897,7 @@ func TestV1GetConfigSectionTemplates(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: TemplatesJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: TemplatesJson}, &reply); err != nil { t.Error(err) } else if mp, can := reply[TemplatesJson].(map[string][]map[string]interface{}); !can { t.Errorf("Unexpected type: %t", reply[TemplatesJson]) @@ -4923,7 +4923,7 @@ func TestV1GetConfigSectionConfigs(t *testing.T) { } cfgCgr := NewDefaultCGRConfig() cfgCgr.ConfigSCfg().Enabled = true - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ConfigSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ConfigSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4958,7 +4958,7 @@ func TestV1GetConfigSectionAPIBans(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: APIBanCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: APIBanCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4976,7 +4976,7 @@ func TestV1GetConfigSectionMailer(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: MAILER_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: MAILER_JSN}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -4995,7 +4995,7 @@ func TestV1GetConfigSectionAnalyzer(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: AnalyzerCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: AnalyzerCfgJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -5019,7 +5019,7 @@ func TestV1GetConfigSectionRateS(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: RateSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: RateSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) @@ -5030,7 +5030,7 @@ func TestV1GetConfigSectionInvalidSection(t *testing.T) { var reply map[string]interface{} expected := "Invalid section" cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: "invalidSection"}, &reply); err == nil || err.Error() != expected { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: "invalidSection"}, &reply); err == nil || err.Error() != expected { t.Errorf("Expected %+v, received %+v", expected, err) } } @@ -5103,7 +5103,7 @@ func TestV1GetConfigAsJSONGeneral(t *testing.T) { expected := `{"general":{"connect_attempts":5,"connect_timeout":"1s","dbdata_encoding":"*msgpack","default_caching":"*reload","default_category":"call","default_request_type":"*rated","default_tenant":"cgrates.org","default_timezone":"Local","digest_equal":":","digest_separator":",","failed_posts_dir":"/var/spool/cgrates/failed_posts","failed_posts_ttl":"5s","locking_timeout":"0","log_level":6,"logger":"*syslog","max_parallel_conns":100,"node_id":"ENGINE1","poster_attempts":3,"reconnects":-1,"reply_timeout":"2s","rounding_decimals":5,"rsr_separator":";","tpexport_dir":"/var/spool/cgrates/tpe"}}` if cfgCgr, err := NewCGRConfigFromJSONStringWithDefaults(strJSON); err != nil { t.Error(err) - } else if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: GENERAL_JSN}, &reply); err != nil { + } else if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: GENERAL_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5114,7 +5114,7 @@ func TestV1GetConfigAsJSONDataDB(t *testing.T) { var reply string expected := `{"data_db":{"db_host":"127.0.0.1","db_name":"10","db_password":"","db_port":6379,"db_type":"*redis","db_user":"cgrates","items":{"*account_action_plans":{"remote":false,"replicate":false},"*account_profiles":{"remote":false,"replicate":false},"*accounts":{"remote":false,"replicate":false},"*action_plans":{"remote":false,"replicate":false},"*action_profiles":{"remote":false,"replicate":false},"*action_triggers":{"remote":false,"replicate":false},"*actions":{"remote":false,"replicate":false},"*attribute_profiles":{"remote":false,"replicate":false},"*charger_profiles":{"remote":false,"replicate":false},"*destinations":{"remote":false,"replicate":false},"*dispatcher_hosts":{"remote":false,"replicate":false},"*dispatcher_profiles":{"remote":false,"replicate":false},"*filters":{"remote":false,"replicate":false},"*indexes":{"remote":false,"replicate":false},"*load_ids":{"remote":false,"replicate":false},"*rate_profiles":{"remote":false,"replicate":false},"*rating_plans":{"remote":false,"replicate":false},"*rating_profiles":{"remote":false,"replicate":false},"*resource_profiles":{"remote":false,"replicate":false},"*resources":{"remote":false,"replicate":false},"*reverse_destinations":{"remote":false,"replicate":false},"*route_profiles":{"remote":false,"replicate":false},"*shared_groups":{"remote":false,"replicate":false},"*statqueue_profiles":{"remote":false,"replicate":false},"*statqueues":{"remote":false,"replicate":false},"*threshold_profiles":{"remote":false,"replicate":false},"*thresholds":{"remote":false,"replicate":false},"*timings":{"remote":false,"replicate":false}},"opts":{"query_timeout":"10s","redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"remote_conn_id":"","remote_conns":[],"replication_cache":"","replication_conns":[],"replication_filtered":false}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: DATADB_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: DATADB_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5125,7 +5125,7 @@ func TestV1GetConfigAsJSONStorDB(t *testing.T) { var reply string expected := `{"stor_db":{"db_host":"127.0.0.1","db_name":"cgrates","db_password":"","db_port":3306,"db_type":"*mysql","db_user":"cgrates","items":{"*cdrs":{"remote":false,"replicate":false},"*session_costs":{"remote":false,"replicate":false},"*tp_account_actions":{"remote":false,"replicate":false},"*tp_account_profiles":{"remote":false,"replicate":false},"*tp_action_plans":{"remote":false,"replicate":false},"*tp_action_profiles":{"remote":false,"replicate":false},"*tp_action_triggers":{"remote":false,"replicate":false},"*tp_actions":{"remote":false,"replicate":false},"*tp_attributes":{"remote":false,"replicate":false},"*tp_chargers":{"remote":false,"replicate":false},"*tp_destination_rates":{"remote":false,"replicate":false},"*tp_destinations":{"remote":false,"replicate":false},"*tp_dispatcher_hosts":{"remote":false,"replicate":false},"*tp_dispatcher_profiles":{"remote":false,"replicate":false},"*tp_filters":{"remote":false,"replicate":false},"*tp_rate_profiles":{"remote":false,"replicate":false},"*tp_rates":{"remote":false,"replicate":false},"*tp_rating_plans":{"remote":false,"replicate":false},"*tp_rating_profiles":{"remote":false,"replicate":false},"*tp_resources":{"remote":false,"replicate":false},"*tp_routes":{"remote":false,"replicate":false},"*tp_shared_groups":{"remote":false,"replicate":false},"*tp_stats":{"remote":false,"replicate":false},"*tp_thresholds":{"remote":false,"replicate":false},"*tp_timings":{"remote":false,"replicate":false},"*versions":{"remote":false,"replicate":false}},"opts":{"conn_max_lifetime":0,"max_idle_conns":10,"max_open_conns":100,"mysql_location":"Local","query_timeout":"10s","sslmode":"disable"},"prefix_indexed_fields":[],"remote_conns":null,"replication_conns":null,"string_indexed_fields":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: STORDB_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: STORDB_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5136,7 +5136,7 @@ func TestV1GetConfigAsJSONTls(t *testing.T) { var reply string expected := `{"tls":{"ca_certificate":"","client_certificate":"","client_key":"","server_certificate":"","server_key":"","server_name":"","server_policy":4}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: TlsCfgJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: TlsCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5147,7 +5147,7 @@ func TestV1GetConfigAsJSONTCache(t *testing.T) { var reply string expected := `{"caches":{"partitions":{"*account_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*accounts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*actions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*apiban":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2m0s"},"*attribute_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*attribute_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*caps_events":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*cdr_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10m0s"},"*cdrs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*charger_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*closed_sessions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*destinations":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*diameter_messages":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*dispatcher_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_loads":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatcher_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*dispatchers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*event_charges":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"10s"},"*event_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*load_ids":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profile_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rating_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*replication_hosts":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resource_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*reverse_destinations":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*reverse_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*route_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_connections":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*rpc_responses":{"limit":0,"precache":false,"replicate":false,"static_ttl":false,"ttl":"2s"},"*session_costs":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*shared_groups":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stat_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueue_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*statqueues":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*stir":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*threshold_filter_indexes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*threshold_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*timings":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_actions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_account_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_action_triggers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_actions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_attributes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_chargers":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_destination_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_destinations":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_hosts":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_dispatcher_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_filters":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rate_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rates":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_plans":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_rating_profiles":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_resources":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_routes":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_shared_groups":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_stats":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_thresholds":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*tp_timings":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""},"*uch":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"3h0m0s"},"*versions":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":""}},"replication_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: CACHE_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: CACHE_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5158,7 +5158,7 @@ func TestV1GetConfigAsJSONTListen(t *testing.T) { var reply string expected := `{"listen":{"http":"127.0.0.1:2080","http_tls":"127.0.0.1:2280","rpc_gob":"127.0.0.1:2013","rpc_gob_tls":"127.0.0.1:2023","rpc_json":"127.0.0.1:2012","rpc_json_tls":"127.0.0.1:2022"}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: LISTEN_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: LISTEN_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5169,7 +5169,7 @@ func TestV1GetConfigAsJSONAccounts(t *testing.T) { var reply string expected := `{"accounts":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"max_iterations":1000,"max_usage":259200000000000,"nested_fields":false,"prefix_indexed_fields":[],"rates_conns":[],"suffix_indexed_fields":[],"thresholds_conns":[]}}` cfg := NewDefaultCGRConfig() - if err := cfg.V1GetConfigAsJSON(&SectionWithOpts{Section: AccountSCfgJson}, &reply); err != nil { + if err := cfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: AccountSCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5180,7 +5180,7 @@ func TestV1GetConfigAsJSONHTTP(t *testing.T) { var reply string expected := `{"http":{"auth_users":{},"client_opts":{"dialFallbackDelay":"300ms","dialKeepAlive":"30s","dialTimeout":"30s","disableCompression":false,"disableKeepAlives":false,"expectContinueTimeout":"0","forceAttemptHttp2":true,"idleConnTimeout":"90s","maxConnsPerHost":0,"maxIdleConns":100,"maxIdleConnsPerHost":2,"responseHeaderTimeout":"0","skipTlsVerify":false,"tlsHandshakeTimeout":"10s"},"freeswitch_cdrs_url":"/freeswitch_json","http_cdrs":"/cdr_http","json_rpc_url":"/jsonrpc","registrars_url":"/registrar","use_basic_auth":false,"ws_url":"/ws"}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: HTTP_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: HTTP_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5191,7 +5191,7 @@ func TestV1GetConfigAsJSONFilterS(t *testing.T) { var reply string expected := `{"filters":{"apiers_conns":[],"resources_conns":[],"stats_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: FilterSjsn}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: FilterSjsn}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5202,7 +5202,7 @@ func TestV1GetConfigAsJSONRals(t *testing.T) { var reply string expected := `{"rals":{"balance_rating_subject":{"*any":"*zero1ns","*voice":"*zero1s"},"caches_conns":["*internal"],"dynaprepaid_actionplans":[],"enabled":false,"max_computed_usage":{"*any":"189h0m0s","*data":"107374182400","*mms":"10000","*sms":"10000","*voice":"72h0m0s"},"max_increments":1000000,"remove_expired":true,"rp_subject_prefix_matching":false,"stats_conns":[],"thresholds_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: RALS_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RALS_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5213,7 +5213,7 @@ func TestV1GetConfigAsJSONScheduler(t *testing.T) { var reply string expected := `{"schedulers":{"cdrs_conns":[],"enabled":false,"filters":[],"stats_conns":[],"thresholds_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: SCHEDULER_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: SCHEDULER_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5224,7 +5224,7 @@ func TestV1GetConfigAsJSONCdrs(t *testing.T) { var reply string expected := `{"cdrs":{"attributes_conns":[],"chargers_conns":[],"ees_conns":[],"enabled":false,"extra_fields":[],"online_cdr_exports":[],"rals_conns":[],"scheduler_conns":[],"session_cost_retries":5,"stats_conns":[],"store_cdrs":true,"thresholds_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: CDRS_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: CDRS_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5235,7 +5235,7 @@ func TestV1GetConfigAsJSONSessionS(t *testing.T) { var reply string expected := `{"sessions":{"alterable_fields":[],"attributes_conns":[],"cdrs_conns":[],"channel_sync_interval":"0","chargers_conns":[],"client_protocol":1,"debit_interval":"0","default_usage":{"*any":"3h0m0s","*data":"1048576","*sms":"1","*voice":"3h0m0s"},"enabled":false,"listen_bigob":"","listen_bijson":"127.0.0.1:2014","min_dur_low_balance":"0","rals_conns":[],"replication_conns":[],"resources_conns":[],"routes_conns":[],"scheduler_conns":[],"session_indexes":[],"session_ttl":"0","stats_conns":[],"stir":{"allowed_attest":["*any"],"default_attest":"A","payload_maxduration":"-1","privatekey_path":"","publickey_path":""},"store_session_costs":false,"terminate_attempts":5,"thresholds_conns":[]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: SessionSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: SessionSJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5246,7 +5246,7 @@ func TestV1GetConfigAsJSONFreeSwitchAgent(t *testing.T) { var reply string expected := `{"freeswitch_agent":{"create_cdr":false,"empty_balance_ann_file":"","empty_balance_context":"","enabled":false,"event_socket_conns":[{"address":"127.0.0.1:8021","alias":"127.0.0.1:8021","password":"ClueCon","reconnects":5}],"extra_fields":"","low_balance_ann_file":"","max_wait_connection":"2s","sessions_conns":["*birpc_internal"],"subscribe_park":true}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: FreeSWITCHAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: FreeSWITCHAgentJSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5257,7 +5257,7 @@ func TestV1GetConfigAsJSONFKamailioAgent(t *testing.T) { var reply string expected := `{"kamailio_agent":{"create_cdr":false,"enabled":false,"evapi_conns":[{"address":"127.0.0.1:8448","alias":"","reconnects":5}],"sessions_conns":["*birpc_internal"],"timezone":""}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: KamailioAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: KamailioAgentJSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5268,7 +5268,7 @@ func TestV1GetConfigAsJSONAsteriskAgent(t *testing.T) { var reply string expected := `{"asterisk_agent":{"asterisk_conns":[{"address":"127.0.0.1:8088","alias":"","connect_attempts":3,"password":"CGRateS.org","reconnects":5,"user":"cgrates"}],"create_cdr":false,"enabled":false,"sessions_conns":["*birpc_internal"]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: AsteriskAgentJSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: AsteriskAgentJSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5279,7 +5279,7 @@ func TestV1GetConfigAsJSONADiameterAgent(t *testing.T) { var reply string expected := `{"diameter_agent":{"asr_template":"","concurrent_requests":-1,"dictionaries_path":"/usr/share/cgrates/diameter/dict/","enabled":false,"forced_disconnect":"*none","listen":"127.0.0.1:3868","listen_net":"tcp","origin_host":"CGR-DA","origin_realm":"cgrates.org","product_name":"CGRateS","rar_template":"","request_processors":[],"sessions_conns":["*birpc_internal"],"synced_conn_requests":false,"vendor_id":0}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: DA_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: DA_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5290,7 +5290,7 @@ func TestV1GetConfigAsJSONARadiusAgent(t *testing.T) { var reply string expected := `{"radius_agent":{"client_dictionaries":{"*default":"/usr/share/cgrates/radius/dict/"},"client_secrets":{"*default":"CGRateS.org"},"enabled":false,"listen_acct":"127.0.0.1:1813","listen_auth":"127.0.0.1:1812","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"]}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: RA_JSN}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RA_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5301,7 +5301,7 @@ func TestV1GetConfigAsJSONDNSAgent(t *testing.T) { var reply string expected := `{"dns_agent":{"enabled":false,"listen":"127.0.0.1:2053","listen_net":"udp","request_processors":[],"sessions_conns":["*internal"],"timezone":""}}` cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfigAsJSON(&SectionWithOpts{Section: DNSAgentJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: DNSAgentJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5312,7 +5312,7 @@ func TestV1GetConfigAsJSONAttributes(t *testing.T) { var reply string expected := `{"attributes":{"apiers_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"process_runs":1,"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: ATTRIBUTE_JSN}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: ATTRIBUTE_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5323,7 +5323,7 @@ func TestV1GetConfigAsJSONChargerS(t *testing.T) { var reply string expected := `{"chargers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: ChargerSCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: ChargerSCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5334,7 +5334,7 @@ func TestV1GetConfigAsJSONResourceS(t *testing.T) { var reply string expected := `{"resources":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[],"thresholds_conns":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RESOURCES_JSON}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RESOURCES_JSON}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5345,7 +5345,7 @@ func TestV1GetConfigAsJSONStatS(t *testing.T) { var reply string expected := `{"stats":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","store_uncompressed_limit":0,"suffix_indexed_fields":[],"thresholds_conns":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: STATS_JSON}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: STATS_JSON}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5356,7 +5356,7 @@ func TestV1GetConfigAsJSONThresholdS(t *testing.T) { var reply string expected := `{"thresholds":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"store_interval":"","suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: THRESHOLDS_JSON}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: THRESHOLDS_JSON}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5367,7 +5367,7 @@ func TestV1GetConfigAsJSONRouteS(t *testing.T) { var reply string expected := `{"routes":{"attributes_conns":[],"default_ratio":1,"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"rals_conns":[],"resources_conns":[],"stats_conns":[],"suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RouteSJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RouteSJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5380,7 +5380,7 @@ func TestV1GetConfigAsJSONSureTax(t *testing.T) { cgrCfg := NewDefaultCGRConfig() cgrCfg.SureTaxCfg().Timezone = time.UTC - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: SURETAX_JSON}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: SURETAX_JSON}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5391,7 +5391,7 @@ func TestV1GetConfigAsJSONDispatcherS(t *testing.T) { var reply string expected := `{"dispatchers":{"attributes_conns":[],"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"suffix_indexed_fields":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: DispatcherSJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: DispatcherSJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5402,7 +5402,7 @@ func TestV1GetConfigAsJSONDispatcherH(t *testing.T) { var reply string expected := `{"registrarc":{"dispatcher":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]},"rpc":{"enabled":false,"hosts":{},"refresh_interval":"5m0s","registrars_conns":[]}}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RegistrarCJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RegistrarCJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5413,7 +5413,7 @@ func TestV1GetConfigAsJSONLoaders(t *testing.T) { var reply string expected := `{"loaders":[{"caches_conns":["*internal"],"data":[{"fields":[{"mandatory":true,"path":"Tenant","tag":"TenantID","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ProfileID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"AttributeFilterIDs","tag":"AttributeFilterIDs","type":"*variable","value":"~*req.5"},{"path":"Path","tag":"Path","type":"*variable","value":"~*req.6"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.7"},{"path":"Value","tag":"Value","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.10"}],"file_name":"Attributes.csv","flags":null,"type":"*attributes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Type","tag":"Type","type":"*variable","value":"~*req.2"},{"path":"Element","tag":"Element","type":"*variable","value":"~*req.3"},{"path":"Values","tag":"Values","type":"*variable","value":"~*req.4"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.5"}],"file_name":"Filters.csv","flags":null,"type":"*filters"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"UsageTTL","tag":"TTL","type":"*variable","value":"~*req.4"},{"path":"Limit","tag":"Limit","type":"*variable","value":"~*req.5"},{"path":"AllocationMessage","tag":"AllocationMessage","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.8"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.9"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.10"}],"file_name":"Resources.csv","flags":null,"type":"*resources"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"QueueLength","tag":"QueueLength","type":"*variable","value":"~*req.4"},{"path":"TTL","tag":"TTL","type":"*variable","value":"~*req.5"},{"path":"MinItems","tag":"MinItems","type":"*variable","value":"~*req.6"},{"path":"MetricIDs","tag":"MetricIDs","type":"*variable","value":"~*req.7"},{"path":"MetricFilterIDs","tag":"MetricFilterIDs","type":"*variable","value":"~*req.8"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.9"},{"path":"Stored","tag":"Stored","type":"*variable","value":"~*req.10"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.11"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.12"}],"file_name":"Stats.csv","flags":null,"type":"*stats"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"MaxHits","tag":"MaxHits","type":"*variable","value":"~*req.4"},{"path":"MinHits","tag":"MinHits","type":"*variable","value":"~*req.5"},{"path":"MinSleep","tag":"MinSleep","type":"*variable","value":"~*req.6"},{"path":"Blocker","tag":"Blocker","type":"*variable","value":"~*req.7"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.8"},{"path":"ActionIDs","tag":"ActionIDs","type":"*variable","value":"~*req.9"},{"path":"Async","tag":"Async","type":"*variable","value":"~*req.10"}],"file_name":"Thresholds.csv","flags":null,"type":"*thresholds"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Sorting","tag":"Sorting","type":"*variable","value":"~*req.4"},{"path":"SortingParameters","tag":"SortingParameters","type":"*variable","value":"~*req.5"},{"path":"RouteID","tag":"RouteID","type":"*variable","value":"~*req.6"},{"path":"RouteFilterIDs","tag":"RouteFilterIDs","type":"*variable","value":"~*req.7"},{"path":"RouteAccountIDs","tag":"RouteAccountIDs","type":"*variable","value":"~*req.8"},{"path":"RouteRatingPlanIDs","tag":"RouteRatingPlanIDs","type":"*variable","value":"~*req.9"},{"path":"RouteResourceIDs","tag":"RouteResourceIDs","type":"*variable","value":"~*req.10"},{"path":"RouteStatIDs","tag":"RouteStatIDs","type":"*variable","value":"~*req.11"},{"path":"RouteWeight","tag":"RouteWeight","type":"*variable","value":"~*req.12"},{"path":"RouteBlocker","tag":"RouteBlocker","type":"*variable","value":"~*req.13"},{"path":"RouteParameters","tag":"RouteParameters","type":"*variable","value":"~*req.14"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.15"}],"file_name":"Routes.csv","flags":null,"type":"*routes"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"RunID","tag":"RunID","type":"*variable","value":"~*req.4"},{"path":"AttributeIDs","tag":"AttributeIDs","type":"*variable","value":"~*req.5"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.6"}],"file_name":"Chargers.csv","flags":null,"type":"*chargers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Contexts","tag":"Contexts","type":"*variable","value":"~*req.2"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.3"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.4"},{"path":"Strategy","tag":"Strategy","type":"*variable","value":"~*req.5"},{"path":"StrategyParameters","tag":"StrategyParameters","type":"*variable","value":"~*req.6"},{"path":"ConnID","tag":"ConnID","type":"*variable","value":"~*req.7"},{"path":"ConnFilterIDs","tag":"ConnFilterIDs","type":"*variable","value":"~*req.8"},{"path":"ConnWeight","tag":"ConnWeight","type":"*variable","value":"~*req.9"},{"path":"ConnBlocker","tag":"ConnBlocker","type":"*variable","value":"~*req.10"},{"path":"ConnParameters","tag":"ConnParameters","type":"*variable","value":"~*req.11"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.12"}],"file_name":"DispatcherProfiles.csv","flags":null,"type":"*dispatchers"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"Address","tag":"Address","type":"*variable","value":"~*req.2"},{"path":"Transport","tag":"Transport","type":"*variable","value":"~*req.3"},{"path":"TLS","tag":"TLS","type":"*variable","value":"~*req.4"}],"file_name":"DispatcherHosts.csv","flags":null,"type":"*dispatcher_hosts"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"MinCost","tag":"MinCost","type":"*variable","value":"~*req.5"},{"path":"MaxCost","tag":"MaxCost","type":"*variable","value":"~*req.6"},{"path":"MaxCostStrategy","tag":"MaxCostStrategy","type":"*variable","value":"~*req.7"},{"path":"RateID","tag":"RateID","type":"*variable","value":"~*req.8"},{"path":"RateFilterIDs","tag":"RateFilterIDs","type":"*variable","value":"~*req.9"},{"path":"RateActivationTimes","tag":"RateActivationTimes","type":"*variable","value":"~*req.10"},{"path":"RateWeight","tag":"RateWeight","type":"*variable","value":"~*req.11"},{"path":"RateBlocker","tag":"RateBlocker","type":"*variable","value":"~*req.12"},{"path":"RateIntervalStart","tag":"RateIntervalStart","type":"*variable","value":"~*req.13"},{"path":"RateFixedFee","tag":"RateFixedFee","type":"*variable","value":"~*req.14"},{"path":"RateRecurrentFee","tag":"RateRecurrentFee","type":"*variable","value":"~*req.15"},{"path":"RateUnit","tag":"RateUnit","type":"*variable","value":"~*req.16"},{"path":"RateIncrement","tag":"RateIncrement","type":"*variable","value":"~*req.17"}],"file_name":"RateProfiles.csv","flags":null,"type":"*rate_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"Schedule","tag":"Schedule","type":"*variable","value":"~*req.5"},{"path":"TargetType","tag":"TargetType","type":"*variable","value":"~*req.6"},{"path":"TargetIDs","tag":"TargetIDs","type":"*variable","value":"~*req.7"},{"path":"ActionID","tag":"ActionID","type":"*variable","value":"~*req.8"},{"path":"ActionFilterIDs","tag":"ActionFilterIDs","type":"*variable","value":"~*req.9"},{"path":"ActionBlocker","tag":"ActionBlocker","type":"*variable","value":"~*req.10"},{"path":"ActionTTL","tag":"ActionTTL","type":"*variable","value":"~*req.11"},{"path":"ActionType","tag":"ActionType","type":"*variable","value":"~*req.12"},{"path":"ActionOpts","tag":"ActionOpts","type":"*variable","value":"~*req.13"},{"path":"ActionPath","tag":"ActionPath","type":"*variable","value":"~*req.14"},{"path":"ActionValue","tag":"ActionValue","type":"*variable","value":"~*req.15"}],"file_name":"ActionProfiles.csv","flags":null,"type":"*action_profiles"},{"fields":[{"mandatory":true,"path":"Tenant","tag":"Tenant","type":"*variable","value":"~*req.0"},{"mandatory":true,"path":"ID","tag":"ID","type":"*variable","value":"~*req.1"},{"path":"FilterIDs","tag":"FilterIDs","type":"*variable","value":"~*req.2"},{"path":"ActivationInterval","tag":"ActivationInterval","type":"*variable","value":"~*req.3"},{"path":"Weight","tag":"Weight","type":"*variable","value":"~*req.4"},{"path":"BalanceID","tag":"BalanceID","type":"*variable","value":"~*req.5"},{"path":"BalanceFilterIDs","tag":"BalanceFilterIDs","type":"*variable","value":"~*req.6"},{"path":"BalanceWeight","tag":"BalanceWeight","type":"*variable","value":"~*req.7"},{"path":"BalanceBlocker","tag":"BalanceBlocker","type":"*variable","value":"~*req.8"},{"path":"BalanceType","tag":"BalanceType","type":"*variable","value":"~*req.9"},{"path":"BalanceOpts","tag":"BalanceOpts","type":"*variable","value":"~*req.10"},{"path":"BalanceCostIncrements","tag":"BalanceCostIncrements","type":"*variable","value":"~*req.11"},{"path":"BalanceAttributeIDs","tag":"BalanceAttributeIDs","type":"*variable","value":"~*req.12"},{"path":"BalanceRateProfileIDs","tag":"BalanceRateProfileIDs","type":"*variable","value":"~*req.13"},{"path":"BalanceUnitFactors","tag":"BalanceUnitFactors","type":"*variable","value":"~*req.14"},{"path":"BalanceUnits","tag":"BalanceUnits","type":"*variable","value":"~*req.15"},{"path":"ThresholdIDs","tag":"ThresholdIDs","type":"*variable","value":"~*req.16"}],"file_name":"AccountProfiles.csv","flags":null,"type":"*account_profiles"}],"dry_run":false,"enabled":false,"field_separator":",","id":"*default","lock_filename":".cgr.lck","run_delay":"0","tenant":"","tp_in_dir":"/var/spool/cgrates/loader/in","tp_out_dir":"/var/spool/cgrates/loader/out"}]}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: LoaderJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: LoaderJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5424,7 +5424,7 @@ func TestV1GetConfigAsJSONCgrLoader(t *testing.T) { var reply string expected := `{"loader":{"caches_conns":["*localhost"],"data_path":"./","disable_reverse":false,"field_separator":",","gapi_credentials":".gapi/credentials.json","gapi_token":".gapi/token.json","scheduler_conns":["*localhost"],"tpid":""}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: CgrLoaderCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: CgrLoaderCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5435,7 +5435,7 @@ func TestV1GetConfigAsJSONCgrMigrator(t *testing.T) { var reply string expected := `{"migrator":{"out_datadb_encoding":"msgpack","out_datadb_host":"127.0.0.1","out_datadb_name":"10","out_datadb_opts":{"redis_ca_certificate":"","redis_client_certificate":"","redis_client_key":"","redis_cluster":false,"redis_cluster_ondown_delay":"0","redis_cluster_sync":"5s","redis_sentinel":"","redis_tls":false},"out_datadb_password":"","out_datadb_port":"6379","out_datadb_type":"redis","out_datadb_user":"cgrates","out_stordb_host":"127.0.0.1","out_stordb_name":"cgrates","out_stordb_opts":{},"out_stordb_password":"","out_stordb_port":"3306","out_stordb_type":"mysql","out_stordb_user":"cgrates","users_filters":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: CgrMigratorCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: CgrMigratorCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5446,7 +5446,7 @@ func TestV1GetConfigAsJSONApierS(t *testing.T) { var reply string expected := `{"apiers":{"attributes_conns":[],"caches_conns":["*internal"],"ees_conns":[],"enabled":false,"scheduler_conns":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: ApierS}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: ApierS}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5457,7 +5457,7 @@ func TestV1GetConfigAsJSONCfgEES(t *testing.T) { var reply string expected := `{"ees":{"attributes_conns":[],"cache":{"*file_csv":{"limit":-1,"precache":false,"replicate":false,"static_ttl":false,"ttl":"5s"}},"enabled":false,"exporters":[{"attempts":1,"attribute_context":"","attribute_ids":[],"export_path":"/var/spool/cgrates/ees","field_separator":",","fields":[],"filters":[],"flags":[],"id":"*default","opts":{},"synchronous":false,"tenant":"","timezone":"","type":"*none"}]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: EEsJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: EEsJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5468,7 +5468,7 @@ func TestV1GetConfigAsJSONCfgERS(t *testing.T) { var reply string expected := `{"ers":{"enabled":false,"readers":[{"cache_dump_fields":[],"concurrent_requests":1024,"failed_calls_prefix":"","field_separator":",","fields":[{"mandatory":true,"path":"*cgreq.ToR","tag":"ToR","type":"*variable","value":"~*req.2"},{"mandatory":true,"path":"*cgreq.OriginID","tag":"OriginID","type":"*variable","value":"~*req.3"},{"mandatory":true,"path":"*cgreq.RequestType","tag":"RequestType","type":"*variable","value":"~*req.4"},{"mandatory":true,"path":"*cgreq.Tenant","tag":"Tenant","type":"*variable","value":"~*req.6"},{"mandatory":true,"path":"*cgreq.Category","tag":"Category","type":"*variable","value":"~*req.7"},{"mandatory":true,"path":"*cgreq.Account","tag":"Account","type":"*variable","value":"~*req.8"},{"mandatory":true,"path":"*cgreq.Subject","tag":"Subject","type":"*variable","value":"~*req.9"},{"mandatory":true,"path":"*cgreq.Destination","tag":"Destination","type":"*variable","value":"~*req.10"},{"mandatory":true,"path":"*cgreq.SetupTime","tag":"SetupTime","type":"*variable","value":"~*req.11"},{"mandatory":true,"path":"*cgreq.AnswerTime","tag":"AnswerTime","type":"*variable","value":"~*req.12"},{"mandatory":true,"path":"*cgreq.Usage","tag":"Usage","type":"*variable","value":"~*req.13"}],"filters":[],"flags":[],"header_define_character":":","id":"*default","opts":{},"partial_cache_expiry_action":"","partial_record_cache":"0","processed_path":"/var/spool/cgrates/ers/out","row_length":0,"run_delay":"0","source_path":"/var/spool/cgrates/ers/in","tenant":"","timezone":"","type":"*none","xml_root_path":[""]}],"sessions_conns":["*internal"]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: ERsJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: ERsJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5479,7 +5479,7 @@ func TestV1GetConfigAsJSONSIPAgent(t *testing.T) { var reply string expected := `{"sip_agent":{"enabled":false,"listen":"127.0.0.1:5060","listen_net":"udp","request_processors":[],"retransmission_timer":1000000000,"sessions_conns":["*internal"],"timezone":""}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: SIPAgentJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: SIPAgentJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5490,7 +5490,7 @@ func TestV1GetConfigAsJSONConfigS(t *testing.T) { var reply string expected := `{"configs":{"enabled":false,"root_dir":"/var/spool/cgrates/configs","url":"/configs/"}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: ConfigSJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: ConfigSJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5501,7 +5501,7 @@ func TestV1GetConfigAsJSONApiBan(t *testing.T) { var reply string expected := `{"apiban":{"enabled":false,"keys":[]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: APIBanCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: APIBanCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5512,7 +5512,7 @@ func TestV1GetConfigAsJSONRPCConns(t *testing.T) { var reply string expected := `{"rpc_conns":{"*birpc_internal":{"conns":[{"address":"*birpc_internal","transport":""}],"poolSize":0,"strategy":"*first"},"*internal":{"conns":[{"address":"*internal","transport":""}],"poolSize":0,"strategy":"*first"},"*localhost":{"conns":[{"address":"127.0.0.1:2012","transport":"*json"}],"poolSize":0,"strategy":"*first"}}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RPCConnsJsonName}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RPCConnsJsonName}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5523,7 +5523,7 @@ func TestV1GetConfigAsJSONTemplates(t *testing.T) { var reply string expected := `{"templates":{"*asr":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"}],"*cca":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"path":"*rep.Result-Code","tag":"ResultCode","type":"*constant","value":"2001"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"},{"mandatory":true,"path":"*rep.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"mandatory":true,"path":"*rep.CC-Request-Type","tag":"CCRequestType","type":"*variable","value":"~*req.CC-Request-Type"},{"mandatory":true,"path":"*rep.CC-Request-Number","tag":"CCRequestNumber","type":"*variable","value":"~*req.CC-Request-Number"}],"*cdrLog":[{"mandatory":true,"path":"*cdr.ToR","tag":"ToR","type":"*variable","value":"~*req.BalanceType"},{"mandatory":true,"path":"*cdr.OriginHost","tag":"OriginHost","type":"*constant","value":"127.0.0.1"},{"mandatory":true,"path":"*cdr.RequestType","tag":"RequestType","type":"*constant","value":"*none"},{"mandatory":true,"path":"*cdr.Tenant","tag":"Tenant","type":"*variable","value":"~*req.Tenant"},{"mandatory":true,"path":"*cdr.Account","tag":"Account","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Subject","tag":"Subject","type":"*variable","value":"~*req.Account"},{"mandatory":true,"path":"*cdr.Cost","tag":"Cost","type":"*variable","value":"~*req.Cost"},{"mandatory":true,"path":"*cdr.Source","tag":"Source","type":"*constant","value":"*cdrLog"},{"mandatory":true,"path":"*cdr.Usage","tag":"Usage","type":"*constant","value":"1"},{"mandatory":true,"path":"*cdr.RunID","tag":"RunID","type":"*variable","value":"~*req.ActionType"},{"mandatory":true,"path":"*cdr.SetupTime","tag":"SetupTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.AnswerTime","tag":"AnswerTime","type":"*constant","value":"*now"},{"mandatory":true,"path":"*cdr.PreRated","tag":"PreRated","type":"*constant","value":"true"}],"*err":[{"mandatory":true,"path":"*rep.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*rep.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*vars.OriginHost"},{"mandatory":true,"path":"*rep.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*vars.OriginRealm"}],"*errSip":[{"mandatory":true,"path":"*rep.Request","tag":"Request","type":"*constant","value":"SIP/2.0 500 Internal Server Error"}],"*rar":[{"mandatory":true,"path":"*diamreq.Session-Id","tag":"SessionId","type":"*variable","value":"~*req.Session-Id"},{"mandatory":true,"path":"*diamreq.Origin-Host","tag":"OriginHost","type":"*variable","value":"~*req.Destination-Host"},{"mandatory":true,"path":"*diamreq.Origin-Realm","tag":"OriginRealm","type":"*variable","value":"~*req.Destination-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Realm","tag":"DestinationRealm","type":"*variable","value":"~*req.Origin-Realm"},{"mandatory":true,"path":"*diamreq.Destination-Host","tag":"DestinationHost","type":"*variable","value":"~*req.Origin-Host"},{"mandatory":true,"path":"*diamreq.Auth-Application-Id","tag":"AuthApplicationId","type":"*variable","value":"~*vars.*appid"},{"path":"*diamreq.Re-Auth-Request-Type","tag":"ReAuthRequestType","type":"*constant","value":"0"}]}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: TemplatesJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: TemplatesJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5534,7 +5534,7 @@ func TestV1GetConfigAsJSONHTTPAgent(t *testing.T) { var reply string expected := `{"http_agent":[]}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: HttpAgentJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: HttpAgentJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5545,7 +5545,7 @@ func TestV1GetConfigAsJSONMailer(t *testing.T) { var reply string expected := `{"mailer":{"auth_password":"CGRateS.org","auth_user":"cgrates","from_address":"cgr-mailer@localhost.localdomain","server":"localhost"}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: MAILER_JSN}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: MAILER_JSN}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5556,7 +5556,7 @@ func TestV1GetConfigAsJSONAnalyzer(t *testing.T) { var reply string expected := `{"analyzers":{"cleanup_interval":"1h0m0s","db_path":"/var/spool/cgrates/analyzers","enabled":false,"index_type":"*scorch","ttl":"24h0m0s"}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: AnalyzerCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: AnalyzerCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5567,7 +5567,7 @@ func TestV1GetConfigAsJSONRateS(t *testing.T) { var reply string expected := `{"rates":{"enabled":false,"indexed_selects":true,"nested_fields":false,"prefix_indexed_fields":[],"rate_indexed_selects":true,"rate_nested_fields":false,"rate_prefix_indexed_fields":[],"rate_suffix_indexed_fields":[],"suffix_indexed_fields":[],"verbosity":1000}}` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: RateSJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: RateSJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5580,7 +5580,7 @@ func TestV1GetConfigAsJSONCoreS(t *testing.T) { cgrCfg := NewDefaultCGRConfig() cgrCfg.coreSCfg.Caps = 10 - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: CoreSCfgJson}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: CoreSCfgJson}, &reply); err != nil { t.Error(err) } else if expected != reply { t.Errorf("Expected %+v \n, received %+v", expected, reply) @@ -5633,7 +5633,7 @@ func TestV1GetConfigAsJSONInvalidSection(t *testing.T) { var reply string expected := `Invalid section` cgrCfg := NewDefaultCGRConfig() - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: "InvalidSection"}, &reply); err == nil || err.Error() != expected { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: "InvalidSection"}, &reply); err == nil || err.Error() != expected { t.Errorf("Expected %+v, received %+v", expected, err) } } @@ -5651,12 +5651,12 @@ func TestV1GetConfigAsJSONAllConfig(t *testing.T) { t.Fatal(err) } cgrCfg.SureTaxCfg().Timezone = time.UTC - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: utils.EmptyString}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: utils.EmptyString}, &reply); err != nil { t.Fatal(err) } else if expected != reply { t.Fatalf("Expected %+v \n, received %+v", expected, reply) } - if err := cgrCfg.V1GetConfigAsJSON(&SectionWithOpts{Section: utils.EmptyString}, &reply); err != nil { + if err := cgrCfg.V1GetConfigAsJSON(&SectionWithAPIOpts{Section: utils.EmptyString}, &reply); err != nil { t.Fatal(err) } else if expected != reply { t.Fatalf("Expected %+v \n, received %+v", expected, reply) @@ -6213,7 +6213,7 @@ func TestV1GetConfigSectionActionSJson(t *testing.T) { }, } cfgCgr := NewDefaultCGRConfig() - if err := cfgCgr.V1GetConfig(&SectionWithOpts{Section: ActionSJson}, &reply); err != nil { + if err := cfgCgr.V1GetConfig(&SectionWithAPIOpts{Section: ActionSJson}, &reply); err != nil { t.Error(err) } else if !reflect.DeepEqual(reply, expected) { t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(expected), utils.ToJSON(reply)) diff --git a/console/active_sessions.go b/console/active_sessions.go index 63bea6148..dbd346be3 100644 --- a/console/active_sessions.go +++ b/console/active_sessions.go @@ -50,7 +50,7 @@ func (self *CmdActiveSessions) RpcMethod() string { func (self *CmdActiveSessions) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.SessionFilter{Opts: make(map[string]interface{})} + self.rpcParams = &utils.SessionFilter{APIOpts: make(map[string]interface{})} } return self.rpcParams diff --git a/console/cache_clear.go b/console/cache_clear.go index c3796b387..9457ea585 100644 --- a/console/cache_clear.go +++ b/console/cache_clear.go @@ -26,7 +26,7 @@ func init() { c := &CmdClear{ name: "cache_clear", rpcMethod: utils.CacheSv1Clear, - rpcParams: &utils.AttrCacheIDsWithOpts{}, + rpcParams: &utils.AttrCacheIDsWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +36,7 @@ func init() { type CmdClear struct { name string rpcMethod string - rpcParams *utils.AttrCacheIDsWithOpts + rpcParams *utils.AttrCacheIDsWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdClear) RpcMethod() string { func (self *CmdClear) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = new(utils.AttrCacheIDsWithOpts) + self.rpcParams = new(utils.AttrCacheIDsWithAPIOpts) } return self.rpcParams } diff --git a/console/cache_group_item_id.go b/console/cache_group_item_id.go index 708736c64..28e5994fa 100644 --- a/console/cache_group_item_id.go +++ b/console/cache_group_item_id.go @@ -26,7 +26,7 @@ func init() { c := &CmdCacheGetGroupItemIDs{ name: "cache_group_item_ids", rpcMethod: utils.CacheSv1GetGroupItemIDs, - rpcParams: &utils.ArgsGetGroupWithOpts{}, + rpcParams: &utils.ArgsGetGroupWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +36,7 @@ func init() { type CmdCacheGetGroupItemIDs struct { name string rpcMethod string - rpcParams *utils.ArgsGetGroupWithOpts + rpcParams *utils.ArgsGetGroupWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdCacheGetGroupItemIDs) RpcMethod() string { func (self *CmdCacheGetGroupItemIDs) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.ArgsGetGroupWithOpts{} + self.rpcParams = &utils.ArgsGetGroupWithAPIOpts{} } return self.rpcParams } diff --git a/console/cache_has_group.go b/console/cache_has_group.go index da43dc931..01c38fb2f 100644 --- a/console/cache_has_group.go +++ b/console/cache_has_group.go @@ -26,7 +26,7 @@ func init() { c := &CmdCacheHasGroup{ name: "cache_has_group", rpcMethod: utils.CacheSv1HasGroup, - rpcParams: &utils.ArgsGetGroupWithOpts{}, + rpcParams: &utils.ArgsGetGroupWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +36,7 @@ func init() { type CmdCacheHasGroup struct { name string rpcMethod string - rpcParams *utils.ArgsGetGroupWithOpts + rpcParams *utils.ArgsGetGroupWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdCacheHasGroup) RpcMethod() string { func (self *CmdCacheHasGroup) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.ArgsGetGroupWithOpts{} + self.rpcParams = &utils.ArgsGetGroupWithAPIOpts{} } return self.rpcParams } diff --git a/console/cache_precache_status.go b/console/cache_precache_status.go index b49e1bb6c..574fe66ef 100644 --- a/console/cache_precache_status.go +++ b/console/cache_precache_status.go @@ -26,7 +26,7 @@ func init() { c := &CmdGetPrecacheStatus{ name: "cache_precache_status", rpcMethod: utils.CacheSv1PrecacheStatus, - rpcParams: &utils.AttrCacheIDsWithOpts{}, + rpcParams: &utils.AttrCacheIDsWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +36,7 @@ func init() { type CmdGetPrecacheStatus struct { name string rpcMethod string - rpcParams *utils.AttrCacheIDsWithOpts + rpcParams *utils.AttrCacheIDsWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdGetPrecacheStatus) RpcMethod() string { func (self *CmdGetPrecacheStatus) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = new(utils.AttrCacheIDsWithOpts) + self.rpcParams = new(utils.AttrCacheIDsWithAPIOpts) } return self.rpcParams } diff --git a/console/cache_remove_group.go b/console/cache_remove_group.go index e3f1f2b55..21145e81d 100644 --- a/console/cache_remove_group.go +++ b/console/cache_remove_group.go @@ -26,7 +26,7 @@ func init() { c := &CmdCacheRemoveGroup{ name: "cache_remove_group", rpcMethod: utils.CacheSv1RemoveGroup, - rpcParams: &utils.ArgsGetGroupWithOpts{}, + rpcParams: &utils.ArgsGetGroupWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -36,7 +36,7 @@ func init() { type CmdCacheRemoveGroup struct { name string rpcMethod string - rpcParams *utils.ArgsGetGroupWithOpts + rpcParams *utils.ArgsGetGroupWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdCacheRemoveGroup) RpcMethod() string { func (self *CmdCacheRemoveGroup) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.ArgsGetGroupWithOpts{} + self.rpcParams = &utils.ArgsGetGroupWithAPIOpts{} } return self.rpcParams } diff --git a/console/cache_stats.go b/console/cache_stats.go index 46c777f14..d54db95e5 100644 --- a/console/cache_stats.go +++ b/console/cache_stats.go @@ -27,7 +27,7 @@ func init() { c := &CmdGetCacheStats{ name: "cache_stats", rpcMethod: utils.CacheSv1GetCacheStats, - rpcParams: &utils.AttrCacheIDsWithOpts{}, + rpcParams: &utils.AttrCacheIDsWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdGetCacheStats struct { name string rpcMethod string - rpcParams *utils.AttrCacheIDsWithOpts + rpcParams *utils.AttrCacheIDsWithAPIOpts *CommandExecuter } @@ -51,7 +51,7 @@ func (self *CmdGetCacheStats) RpcMethod() string { func (self *CmdGetCacheStats) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = new(utils.AttrCacheIDsWithOpts) + self.rpcParams = new(utils.AttrCacheIDsWithAPIOpts) } return self.rpcParams } diff --git a/console/cdrs.go b/console/cdrs.go index 0c21257d9..09dc56709 100644 --- a/console/cdrs.go +++ b/console/cdrs.go @@ -36,7 +36,7 @@ func init() { type CmdGetCDRs struct { name string rpcMethod string - rpcParams *utils.RPCCDRsFilterWithOpts + rpcParams *utils.RPCCDRsFilterWithAPIOpts *CommandExecuter } @@ -50,7 +50,7 @@ func (self *CmdGetCDRs) RpcMethod() string { func (self *CmdGetCDRs) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.RPCCDRsFilterWithOpts{ + self.rpcParams = &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: new(utils.RPCCDRsFilter), } } diff --git a/console/get_json_section.go b/console/get_json_section.go index 4601c6861..0a2e6ea58 100644 --- a/console/get_json_section.go +++ b/console/get_json_section.go @@ -27,7 +27,7 @@ func init() { c := &CmdGetJSONConfig{ name: "get_json_section", rpcMethod: utils.ConfigSv1GetConfig, - rpcParams: &config.SectionWithOpts{}, + rpcParams: &config.SectionWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdGetJSONConfig struct { name string rpcMethod string - rpcParams *config.SectionWithOpts + rpcParams *config.SectionWithAPIOpts *CommandExecuter } @@ -51,7 +51,7 @@ func (self *CmdGetJSONConfig) RpcMethod() string { func (self *CmdGetJSONConfig) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &config.SectionWithOpts{Opts: make(map[string]interface{})} + self.rpcParams = &config.SectionWithAPIOpts{APIOpts: make(map[string]interface{})} } return self.rpcParams } diff --git a/console/passive_sessions.go b/console/passive_sessions.go index ef37af134..ee4afc64d 100644 --- a/console/passive_sessions.go +++ b/console/passive_sessions.go @@ -50,7 +50,7 @@ func (self *CmdPassiveSessions) RpcMethod() string { func (self *CmdPassiveSessions) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &utils.SessionFilter{Opts: make(map[string]interface{})} + self.rpcParams = &utils.SessionFilter{APIOpts: make(map[string]interface{})} } return self.rpcParams } diff --git a/console/reload_config.go b/console/reload_config.go index 3b7c9b4c7..6add0ff71 100644 --- a/console/reload_config.go +++ b/console/reload_config.go @@ -51,7 +51,7 @@ func (self *CmdRelaodConfigSection) RpcMethod() string { func (self *CmdRelaodConfigSection) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &config.ReloadArgs{Opts: make(map[string]interface{})} + self.rpcParams = &config.ReloadArgs{APIOpts: make(map[string]interface{})} } return self.rpcParams } diff --git a/console/resources_profile_set.go b/console/resources_profile_set.go index 3595db4ce..b987ebe3b 100644 --- a/console/resources_profile_set.go +++ b/console/resources_profile_set.go @@ -27,7 +27,7 @@ func init() { c := &CmdSetResource{ name: "resources_profile_set", rpcMethod: utils.APIerSv1SetResourceProfile, - rpcParams: &engine.ResourceProfileWithOpts{}, + rpcParams: &engine.ResourceProfileWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdSetResource struct { name string rpcMethod string - rpcParams *engine.ResourceProfileWithOpts + rpcParams *engine.ResourceProfileWithAPIOpts *CommandExecuter } @@ -51,9 +51,9 @@ func (self *CmdSetResource) RpcMethod() string { func (self *CmdSetResource) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &engine.ResourceProfileWithOpts{ + self.rpcParams = &engine.ResourceProfileWithAPIOpts{ ResourceProfile: new(engine.ResourceProfile), - Opts: make(map[string]interface{}), + APIOpts: make(map[string]interface{}), } } return self.rpcParams diff --git a/console/stats_profile_set.go b/console/stats_profile_set.go index de9aed86f..93770afe7 100644 --- a/console/stats_profile_set.go +++ b/console/stats_profile_set.go @@ -27,7 +27,7 @@ func init() { c := &CmdSetStatQueue{ name: "stats_profile_set", rpcMethod: utils.APIerSv1SetStatQueueProfile, - rpcParams: &engine.StatQueueProfileWithOpts{}, + rpcParams: &engine.StatQueueProfileWithAPIOpts{}, } commands[c.Name()] = c c.CommandExecuter = &CommandExecuter{c} @@ -37,7 +37,7 @@ func init() { type CmdSetStatQueue struct { name string rpcMethod string - rpcParams *engine.StatQueueProfileWithOpts + rpcParams *engine.StatQueueProfileWithAPIOpts *CommandExecuter } @@ -51,9 +51,9 @@ func (self *CmdSetStatQueue) RpcMethod() string { func (self *CmdSetStatQueue) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { - self.rpcParams = &engine.StatQueueProfileWithOpts{ + self.rpcParams = &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: new(engine.StatQueueProfile), - Opts: make(map[string]interface{}), + APIOpts: make(map[string]interface{}), } } return self.rpcParams diff --git a/dispatchers/caches.go b/dispatchers/caches.go index 5dbcba507..21f156dfd 100644 --- a/dispatchers/caches.go +++ b/dispatchers/caches.go @@ -143,7 +143,7 @@ func (dS *DispatcherService) CacheSv1RemoveItems(args utils.AttrReloadCacheWithA } // CacheSv1Clear will clear partitions in the cache (nil fol all, empty slice for none) -func (dS *DispatcherService) CacheSv1Clear(args *utils.AttrCacheIDsWithOpts, +func (dS *DispatcherService) CacheSv1Clear(args *utils.AttrCacheIDsWithAPIOpts, reply *string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -162,7 +162,7 @@ func (dS *DispatcherService) CacheSv1Clear(args *utils.AttrCacheIDsWithOpts, } // CacheSv1GetCacheStats returns CacheStats filtered by cacheIDs -func (dS *DispatcherService) CacheSv1GetCacheStats(args *utils.AttrCacheIDsWithOpts, +func (dS *DispatcherService) CacheSv1GetCacheStats(args *utils.AttrCacheIDsWithAPIOpts, reply *map[string]*ltcache.CacheStats) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -181,7 +181,7 @@ func (dS *DispatcherService) CacheSv1GetCacheStats(args *utils.AttrCacheIDsWithO } // CacheSv1PrecacheStatus checks status of active precache processes -func (dS *DispatcherService) CacheSv1PrecacheStatus(args *utils.AttrCacheIDsWithOpts, reply *map[string]string) (err error) { +func (dS *DispatcherService) CacheSv1PrecacheStatus(args *utils.AttrCacheIDsWithAPIOpts, reply *map[string]string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { tnt = args.Tenant @@ -199,7 +199,7 @@ func (dS *DispatcherService) CacheSv1PrecacheStatus(args *utils.AttrCacheIDsWith } // CacheSv1HasGroup checks existence of a group in cache -func (dS *DispatcherService) CacheSv1HasGroup(args *utils.ArgsGetGroupWithOpts, +func (dS *DispatcherService) CacheSv1HasGroup(args *utils.ArgsGetGroupWithAPIOpts, reply *bool) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -207,18 +207,18 @@ func (dS *DispatcherService) CacheSv1HasGroup(args *utils.ArgsGetGroupWithOpts, } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CacheSv1HasGroup, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCaches, utils.CacheSv1HasGroup, args, reply) } // CacheSv1GetGroupItemIDs returns a list of itemIDs in a cache group -func (dS *DispatcherService) CacheSv1GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, +func (dS *DispatcherService) CacheSv1GetGroupItemIDs(args *utils.ArgsGetGroupWithAPIOpts, reply *[]string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -226,31 +226,31 @@ func (dS *DispatcherService) CacheSv1GetGroupItemIDs(args *utils.ArgsGetGroupWit } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CacheSv1GetGroupItemIDs, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCaches, utils.CacheSv1GetGroupItemIDs, args, reply) } // CacheSv1RemoveGroup will remove a group and all items belonging to it from cache -func (dS *DispatcherService) CacheSv1RemoveGroup(args *utils.ArgsGetGroupWithOpts, reply *string) (err error) { +func (dS *DispatcherService) CacheSv1RemoveGroup(args *utils.ArgsGetGroupWithAPIOpts, 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.CacheSv1RemoveGroup, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCaches, utils.CacheSv1RemoveGroup, args, reply) } @@ -298,13 +298,13 @@ func (dS *DispatcherService) CacheSv1ReplicateRemove(args *utils.ArgCacheReplica } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CacheSv1ReplicateRemove, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCaches, utils.CacheSv1ReplicateRemove, args, reply) } @@ -316,12 +316,12 @@ func (dS *DispatcherService) CacheSv1ReplicateSet(args *utils.ArgCacheReplicateS } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CacheSv1ReplicateSet, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCaches, utils.CacheSv1ReplicateSet, args, reply) } diff --git a/dispatchers/caches_it_test.go b/dispatchers/caches_it_test.go index 6600df28d..96d6f0958 100644 --- a/dispatchers/caches_it_test.go +++ b/dispatchers/caches_it_test.go @@ -102,7 +102,7 @@ func testDspChcLoadAfterFolder(t *testing.T) { expStats[utils.CacheDestinations].Items = 4 expStats[utils.CacheLoadIDs].Items = 17 expStats[utils.CacheRPCConnections].Items = 2 - args := utils.AttrCacheIDsWithOpts{ + args := utils.AttrCacheIDsWithAPIOpts{ APIOpts: map[string]interface{}{ utils.OptsAPIKey: "chc12345", }, @@ -250,7 +250,7 @@ func testDspChcPrecacheStatus(t *testing.T) { utils.CacheReplicationHosts: utils.MetaReady, } - if err := dispEngine.RPC.Call(utils.CacheSv1PrecacheStatus, utils.AttrCacheIDsWithOpts{ + if err := dispEngine.RPC.Call(utils.CacheSv1PrecacheStatus, utils.AttrCacheIDsWithAPIOpts{ APIOpts: map[string]interface{}{ utils.OptsAPIKey: "chc12345", }, @@ -369,7 +369,7 @@ func testDspChcRemoveItem(t *testing.T) { func testDspChcClear(t *testing.T) { reply := "" - if err := dispEngine.RPC.Call(utils.CacheSv1Clear, utils.AttrCacheIDsWithOpts{ + if err := dispEngine.RPC.Call(utils.CacheSv1Clear, utils.AttrCacheIDsWithAPIOpts{ APIOpts: map[string]interface{}{ utils.OptsAPIKey: "chc12345", }, @@ -381,7 +381,7 @@ func testDspChcClear(t *testing.T) { } var rcvStats map[string]*ltcache.CacheStats expStats := engine.GetDefaultEmptyCacheStats() - if err := dispEngine.RPC.Call(utils.CacheSv1GetCacheStats, utils.AttrCacheIDsWithOpts{ + if err := dispEngine.RPC.Call(utils.CacheSv1GetCacheStats, utils.AttrCacheIDsWithAPIOpts{ APIOpts: map[string]interface{}{ utils.OptsAPIKey: "chc12345", }, diff --git a/dispatchers/cdrs.go b/dispatchers/cdrs.go index 910dd59dd..2f643c5bf 100644 --- a/dispatchers/cdrs.go +++ b/dispatchers/cdrs.go @@ -46,38 +46,38 @@ func (dS *DispatcherService) CDRsV1Ping(args *utils.CGREvent, } // CDRsV1GetCDRs returns the CDRs that match the filter -func (dS *DispatcherService) CDRsV1GetCDRs(args *utils.RPCCDRsFilterWithOpts, reply *[]*engine.CDR) (err error) { +func (dS *DispatcherService) CDRsV1GetCDRs(args *utils.RPCCDRsFilterWithAPIOpts, reply *[]*engine.CDR) (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.CDRsV1GetCDRs, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1GetCDRs, args, reply) } // CDRsV1GetCDRsCount counts the cdrs that match the filter -func (dS *DispatcherService) CDRsV1GetCDRsCount(args *utils.RPCCDRsFilterWithOpts, reply *int64) (err error) { +func (dS *DispatcherService) CDRsV1GetCDRsCount(args *utils.RPCCDRsFilterWithAPIOpts, reply *int64) (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.CDRsV1GetCDRsCount, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1GetCDRsCount, args, reply) } @@ -88,13 +88,13 @@ func (dS *DispatcherService) CDRsV1StoreSessionCost(args *engine.AttrCDRSStoreSM } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CDRsV1StoreSessionCost, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1StoreSessionCost, args, reply) } @@ -105,30 +105,30 @@ func (dS *DispatcherService) CDRsV1RateCDRs(args *engine.ArgRateCDRs, reply *str } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CDRsV1RateCDRs, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1RateCDRs, args, reply) } -func (dS *DispatcherService) CDRsV1ProcessExternalCDR(args *engine.ExternalCDRWithOpts, reply *string) (err error) { +func (dS *DispatcherService) CDRsV1ProcessExternalCDR(args *engine.ExternalCDRWithAPIOpts, 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.CDRsV1ProcessExternalCDR, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1ProcessExternalCDR, args, reply) } @@ -147,20 +147,20 @@ func (dS *DispatcherService) CDRsV1ProcessEvent(args *engine.ArgV1ProcessEvent, utils.CDRsV1ProcessEvent, args, reply) } -func (dS *DispatcherService) CDRsV1ProcessCDR(args *engine.CDRWithOpts, reply *string) (err error) { +func (dS *DispatcherService) CDRsV1ProcessCDR(args *engine.CDRWithAPIOpts, 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.CDRsV1ProcessCDR, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCDRs, utils.CDRsV1ProcessCDR, args, reply) } diff --git a/dispatchers/cdrs_it_test.go b/dispatchers/cdrs_it_test.go index 23ac96dcb..03db5b5d9 100644 --- a/dispatchers/cdrs_it_test.go +++ b/dispatchers/cdrs_it_test.go @@ -149,13 +149,13 @@ func testDspCDRsProcessEvent(t *testing.T) { func testDspCDRsCountCDR(t *testing.T) { var reply int64 - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, }, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -169,13 +169,13 @@ func testDspCDRsCountCDR(t *testing.T) { func testDspCDRsGetCDR(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, }, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -191,12 +191,12 @@ func testDspCDRsGetCDR(t *testing.T) { func testDspCDRsGetCDRWithoutTenant(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, }, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -212,7 +212,7 @@ func testDspCDRsGetCDRWithoutTenant(t *testing.T) { func testDspCDRsProcessCDR(t *testing.T) { var reply string - args := &engine.CDRWithOpts{ + args := &engine.CDRWithAPIOpts{ CDR: &engine.CDR{ Tenant: "cgrates.org", OriginID: "testDspCDRsProcessCDR", @@ -225,7 +225,7 @@ func testDspCDRsProcessCDR(t *testing.T) { AnswerTime: time.Date(2018, 8, 24, 16, 00, 26, 0, time.UTC), Usage: 2 * time.Minute, }, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -238,14 +238,14 @@ func testDspCDRsProcessCDR(t *testing.T) { func testDspCDRsGetCDR2(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, OriginIDs: []string{"testDspCDRsProcessCDR"}, }, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -261,7 +261,7 @@ func testDspCDRsGetCDR2(t *testing.T) { func testDspCDRsProcessExternalCDR(t *testing.T) { var reply string - args := &engine.ExternalCDRWithOpts{ + args := &engine.ExternalCDRWithAPIOpts{ ExternalCDR: &engine.ExternalCDR{ ToR: utils.MetaVoice, OriginID: "testDspCDRsProcessExternalCDR", @@ -278,7 +278,7 @@ func testDspCDRsProcessExternalCDR(t *testing.T) { Usage: "1s", ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}, }, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -291,14 +291,14 @@ func testDspCDRsProcessExternalCDR(t *testing.T) { func testDspCDRsGetCDR3(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1003"}, RunIDs: []string{utils.MetaDefault}, OriginIDs: []string{"testDspCDRsProcessExternalCDR"}, }, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cdrs12345", }, } @@ -431,7 +431,7 @@ func testDspCDRsProcessEventNoAuth(t *testing.T) { func testDspCDRsCountCDRNoAuth(t *testing.T) { var reply int64 - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, @@ -448,7 +448,7 @@ func testDspCDRsCountCDRNoAuth(t *testing.T) { func testDspCDRsGetCDRNoAuth(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, @@ -467,7 +467,7 @@ func testDspCDRsGetCDRNoAuth(t *testing.T) { func testDspCDRsGetCDRNoAuthWithoutTenant(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, @@ -485,7 +485,7 @@ func testDspCDRsGetCDRNoAuthWithoutTenant(t *testing.T) { func testDspCDRsProcessCDRNoAuth(t *testing.T) { var reply string - args := &engine.CDRWithOpts{ + args := &engine.CDRWithAPIOpts{ CDR: &engine.CDR{ Tenant: "cgrates.org", OriginID: "testDspCDRsProcessCDR", @@ -508,7 +508,7 @@ func testDspCDRsProcessCDRNoAuth(t *testing.T) { func testDspCDRsGetCDR2NoAuth(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1001"}, RunIDs: []string{utils.MetaDefault}, @@ -528,7 +528,7 @@ func testDspCDRsGetCDR2NoAuth(t *testing.T) { func testDspCDRsProcessExternalCDRNoAuth(t *testing.T) { var reply string - args := &engine.ExternalCDRWithOpts{ + args := &engine.ExternalCDRWithAPIOpts{ ExternalCDR: &engine.ExternalCDR{ ToR: utils.MetaVoice, OriginID: "testDspCDRsProcessExternalCDR", @@ -555,7 +555,7 @@ func testDspCDRsProcessExternalCDRNoAuth(t *testing.T) { func testDspCDRsGetCDR3NoAuth(t *testing.T) { var reply []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{ + args := utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ Accounts: []string{"1003"}, RunIDs: []string{utils.MetaDefault}, diff --git a/dispatchers/config.go b/dispatchers/config.go index a56396b30..cfdcfe431 100644 --- a/dispatchers/config.go +++ b/dispatchers/config.go @@ -25,20 +25,20 @@ import ( "github.com/cgrates/cgrates/utils" ) -func (dS *DispatcherService) ConfigSv1GetConfig(args *config.SectionWithOpts, reply *map[string]interface{}) (err error) { +func (dS *DispatcherService) ConfigSv1GetConfig(args *config.SectionWithAPIOpts, reply *map[string]interface{}) (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.ConfigSv1GetConfig, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaConfig, utils.ConfigSv1GetConfig, args, reply) } @@ -49,13 +49,13 @@ func (dS *DispatcherService) ConfigSv1ReloadConfig(args *config.ReloadArgs, repl } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ConfigSv1ReloadConfig, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaConfig, utils.ConfigSv1ReloadConfig, args, reply) } @@ -66,13 +66,13 @@ func (dS *DispatcherService) ConfigSv1SetConfig(args *config.SetConfigArgs, repl } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ConfigSv1SetConfig, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaConfig, utils.ConfigSv1SetConfig, args, reply) } @@ -83,29 +83,29 @@ func (dS *DispatcherService) ConfigSv1SetConfigFromJSON(args *config.SetConfigFr } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ConfigSv1SetConfigFromJSON, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaConfig, utils.ConfigSv1SetConfigFromJSON, args, reply) } -func (dS *DispatcherService) ConfigSv1GetConfigAsJSON(args *config.SectionWithOpts, reply *string) (err error) { +func (dS *DispatcherService) ConfigSv1GetConfigAsJSON(args *config.SectionWithAPIOpts, 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.ConfigSv1GetConfigAsJSON, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaConfig, utils.ConfigSv1GetConfigAsJSON, args, reply) } diff --git a/dispatchers/config_it_test.go b/dispatchers/config_it_test.go index e65375c1c..3151f3fc0 100644 --- a/dispatchers/config_it_test.go +++ b/dispatchers/config_it_test.go @@ -72,9 +72,9 @@ func testDspConfigSv1GetJSONSection(t *testing.T) { "listen": expected, } var reply map[string]interface{} - if err := dispEngine.RPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := dispEngine.RPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "cfg12345", }, Section: "listen", diff --git a/dispatchers/core.go b/dispatchers/core.go index 1928fd8aa..3d9651f82 100644 --- a/dispatchers/core.go +++ b/dispatchers/core.go @@ -64,12 +64,12 @@ func (dS *DispatcherService) CoreSv1Sleep(args *utils.DurationArgs, } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.CoreSv1Sleep, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaCore, utils.CoreSv1Sleep, args, reply) } diff --git a/dispatchers/core_it_test.go b/dispatchers/core_it_test.go index 11c7d0650..a99c283bc 100644 --- a/dispatchers/core_it_test.go +++ b/dispatchers/core_it_test.go @@ -78,7 +78,7 @@ func testDspCoreLoad(t *testing.T) { dur := &utils.DurationArgs{ Duration: 500 * time.Millisecond, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "core12345", utils.OptsRouteID: "core1", "EventType": "LoadDispatcher", diff --git a/dispatchers/guardian.go b/dispatchers/guardian.go index 0231d9dfa..ae23cc002 100644 --- a/dispatchers/guardian.go +++ b/dispatchers/guardian.go @@ -41,7 +41,7 @@ func (dS *DispatcherService) GuardianSv1Ping(args *utils.CGREvent, } // GuardianSv1RemoteLock will lock a key from remote -func (dS *DispatcherService) GuardianSv1RemoteLock(args AttrRemoteLockWithOpts, +func (dS *DispatcherService) GuardianSv1RemoteLock(args AttrRemoteLockWithAPIOpts, reply *string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -49,18 +49,18 @@ func (dS *DispatcherService) GuardianSv1RemoteLock(args AttrRemoteLockWithOpts, } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.GuardianSv1RemoteLock, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaGuardian, utils.GuardianSv1RemoteLock, args, reply) } // GuardianSv1RemoteUnlock will unlock a key from remote based on reference ID -func (dS *DispatcherService) GuardianSv1RemoteUnlock(args AttrRemoteUnlockWithOpts, +func (dS *DispatcherService) GuardianSv1RemoteUnlock(args AttrRemoteUnlockWithAPIOpts, reply *[]string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -68,12 +68,12 @@ func (dS *DispatcherService) GuardianSv1RemoteUnlock(args AttrRemoteUnlockWithOp } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.GuardianSv1RemoteUnlock, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaGuardian, utils.GuardianSv1RemoteUnlock, args, reply) } diff --git a/dispatchers/guardian_it_test.go b/dispatchers/guardian_it_test.go index 3b30252eb..2220ff285 100644 --- a/dispatchers/guardian_it_test.go +++ b/dispatchers/guardian_it_test.go @@ -88,10 +88,10 @@ func testDspGrdLock(t *testing.T) { Timeout: 500 * time.Millisecond, } var reply string - if err := dispEngine.RPC.Call(utils.GuardianSv1RemoteLock, &AttrRemoteLockWithOpts{ + if err := dispEngine.RPC.Call(utils.GuardianSv1RemoteLock, &AttrRemoteLockWithAPIOpts{ AttrRemoteLock: args, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "grd12345", }, }, &reply); err != nil { @@ -99,10 +99,10 @@ func testDspGrdLock(t *testing.T) { } var unlockReply []string - if err := dispEngine.RPC.Call(utils.GuardianSv1RemoteUnlock, &AttrRemoteUnlockWithOpts{ + if err := dispEngine.RPC.Call(utils.GuardianSv1RemoteUnlock, &AttrRemoteUnlockWithAPIOpts{ RefID: reply, Tenant: "cgrates.org", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "grd12345", }, }, &unlockReply); err != nil { diff --git a/dispatchers/rals.go b/dispatchers/rals.go index 5987498c0..0d0d10c97 100644 --- a/dispatchers/rals.go +++ b/dispatchers/rals.go @@ -42,12 +42,12 @@ func (dS *DispatcherService) RALsV1GetRatingPlansCost(args *utils.RatingPlanCost tenant := dS.cfg.GeneralCfg().DefaultTenant if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.RALsV1GetRatingPlansCost, tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaRALs, utils.RALsV1GetRatingPlansCost, args, rpl) } diff --git a/dispatchers/rals_it_test.go b/dispatchers/rals_it_test.go index cc9136feb..41c287543 100644 --- a/dispatchers/rals_it_test.go +++ b/dispatchers/rals_it_test.go @@ -85,7 +85,7 @@ func testDspRALsGetRatingPlanCost(t *testing.T) { RatingPlanIDs: []string{"RP_1001", "RP_1002"}, SetupTime: utils.MetaNow, Usage: "1h", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "rals12345", }, } diff --git a/dispatchers/replicator.go b/dispatchers/replicator.go index e633b4948..6c9fd10d1 100644 --- a/dispatchers/replicator.go +++ b/dispatchers/replicator.go @@ -631,20 +631,20 @@ func (dS *DispatcherService) ReplicatorSv1SetFilter(args *engine.FilterWithAPIOp }, utils.MetaReplicator, utils.ReplicatorSv1SetFilter, args, rpl) } -func (dS *DispatcherService) ReplicatorSv1SetStatQueueProfile(args *engine.StatQueueProfileWithOpts, rpl *string) (err error) { +func (dS *DispatcherService) ReplicatorSv1SetStatQueueProfile(args *engine.StatQueueProfileWithAPIOpts, rpl *string) (err error) { if args == nil { - args = &engine.StatQueueProfileWithOpts{} + args = &engine.StatQueueProfileWithAPIOpts{} } args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant) if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ReplicatorSv1SetStatQueueProfile, args.Tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: args.Tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaReplicator, utils.ReplicatorSv1SetStatQueueProfile, args, rpl) } @@ -682,37 +682,37 @@ func (dS *DispatcherService) ReplicatorSv1SetResource(args *engine.ResourceWithA }, utils.MetaReplicator, utils.ReplicatorSv1SetResource, args, rpl) } -func (dS *DispatcherService) ReplicatorSv1SetResourceProfile(args *engine.ResourceProfileWithOpts, rpl *string) (err error) { +func (dS *DispatcherService) ReplicatorSv1SetResourceProfile(args *engine.ResourceProfileWithAPIOpts, rpl *string) (err error) { if args == nil { - args = &engine.ResourceProfileWithOpts{} + args = &engine.ResourceProfileWithAPIOpts{} } args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant) if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ReplicatorSv1SetResourceProfile, args.Tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: args.Tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaReplicator, utils.ReplicatorSv1SetResourceProfile, args, rpl) } -func (dS *DispatcherService) ReplicatorSv1SetActionTriggers(args *engine.SetActionTriggersArgWithOpts, rpl *string) (err error) { +func (dS *DispatcherService) ReplicatorSv1SetActionTriggers(args *engine.SetActionTriggersArgWithAPIOpts, rpl *string) (err error) { if args == nil { - args = &engine.SetActionTriggersArgWithOpts{} + args = &engine.SetActionTriggersArgWithAPIOpts{} } args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant) if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ReplicatorSv1SetActionTriggers, args.Tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: args.Tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaReplicator, utils.ReplicatorSv1SetActionTriggers, args, rpl) } diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go index dabfa8510..7daa7eba8 100644 --- a/dispatchers/replicator_it_test.go +++ b/dispatchers/replicator_it_test.go @@ -732,12 +732,12 @@ func testDspRplStatQueue(t *testing.T) { func testDspRplStatQueueProfile(t *testing.T) { // Set StatQueueProfile var replyStr string - setStatQueueProfile := &engine.StatQueueProfileWithOpts{ + setStatQueueProfile := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "ID", }, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "repl12345", }, } @@ -850,12 +850,12 @@ func testDspRplResource(t *testing.T) { func testDspRplResourceProfile(t *testing.T) { // Set ResourceProfile var replyStr string - setResourceProfile := &engine.ResourceProfileWithOpts{ + setResourceProfile := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ID", }, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "repl12345", }, } @@ -967,11 +967,11 @@ func testDspRplTiming(t *testing.T) { func testDspRplActionTriggers(t *testing.T) { // Set ActionTriggers var replyStr string - setActionTriggers := &engine.SetActionTriggersArgWithOpts{ + setActionTriggers := &engine.SetActionTriggersArgWithAPIOpts{ Key: "testActionTriggers", Attrs: engine.ActionTriggers{ &engine.ActionTrigger{ID: "testActionTriggers"}}, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "repl12345", }, } diff --git a/dispatchers/scheduler.go b/dispatchers/scheduler.go index 7bd0e231c..56e7c1120 100644 --- a/dispatchers/scheduler.go +++ b/dispatchers/scheduler.go @@ -53,13 +53,13 @@ func (dS *DispatcherService) SchedulerSv1ExecuteActions(args *utils.AttrsExecute args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant) if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SchedulerSv1ExecuteActions, args.Tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: args.Tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaScheduler, utils.SchedulerSv1ExecuteActions, args, reply) } @@ -67,12 +67,12 @@ func (dS *DispatcherService) SchedulerSv1ExecuteActionPlans(args *utils.AttrsExe args.Tenant = utils.FirstNonEmpty(args.Tenant, dS.cfg.GeneralCfg().DefaultTenant) if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SchedulerSv1ExecuteActionPlans, args.Tenant, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: args.Tenant, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaScheduler, utils.SchedulerSv1ExecuteActionPlans, args, reply) } diff --git a/dispatchers/servicemanager.go b/dispatchers/servicemanager.go index f0a06e126..925338253 100644 --- a/dispatchers/servicemanager.go +++ b/dispatchers/servicemanager.go @@ -40,7 +40,7 @@ func (dS *DispatcherService) ServiceManagerV1Ping(args *utils.CGREvent, return dS.Dispatch(args, utils.MetaServiceManager, utils.ServiceManagerV1Ping, args, reply) } -func (dS *DispatcherService) ServiceManagerV1StartService(args ArgStartServiceWithOpts, +func (dS *DispatcherService) ServiceManagerV1StartService(args ArgStartServiceWithAPIOpts, reply *string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -48,17 +48,17 @@ func (dS *DispatcherService) ServiceManagerV1StartService(args ArgStartServiceWi } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ServiceManagerV1StartService, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaServiceManager, utils.ServiceManagerV1StartService, args, reply) } -func (dS *DispatcherService) ServiceManagerV1StopService(args ArgStartServiceWithOpts, +func (dS *DispatcherService) ServiceManagerV1StopService(args ArgStartServiceWithAPIOpts, reply *string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -66,17 +66,17 @@ func (dS *DispatcherService) ServiceManagerV1StopService(args ArgStartServiceWit } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ServiceManagerV1StopService, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaServiceManager, utils.ServiceManagerV1StopService, args, reply) } -func (dS *DispatcherService) ServiceManagerV1ServiceStatus(args ArgStartServiceWithOpts, +func (dS *DispatcherService) ServiceManagerV1ServiceStatus(args ArgStartServiceWithAPIOpts, reply *string) (err error) { tnt := dS.cfg.GeneralCfg().DefaultTenant if args.Tenant != utils.EmptyString { @@ -84,12 +84,12 @@ func (dS *DispatcherService) ServiceManagerV1ServiceStatus(args ArgStartServiceW } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.ServiceManagerV1ServiceStatus, tnt, - utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaServiceManager, utils.ServiceManagerV1ServiceStatus, args, reply) } diff --git a/dispatchers/sessions.go b/dispatchers/sessions.go index 30317250c..7f716666c 100755 --- a/dispatchers/sessions.go +++ b/dispatchers/sessions.go @@ -182,13 +182,13 @@ func (dS *DispatcherService) SessionSv1GetActiveSessions(args *utils.SessionFilt } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1GetActiveSessions, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1GetActiveSessions, args, reply) } @@ -200,13 +200,13 @@ func (dS *DispatcherService) SessionSv1GetActiveSessionsCount(args *utils.Sessio } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1GetActiveSessionsCount, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1GetActiveSessionsCount, args, reply) } @@ -218,13 +218,13 @@ func (dS *DispatcherService) SessionSv1ForceDisconnect(args *utils.SessionFilter } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1ForceDisconnect, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1ForceDisconnect, args, reply) } @@ -236,13 +236,13 @@ func (dS *DispatcherService) SessionSv1GetPassiveSessions(args *utils.SessionFil } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1GetPassiveSessions, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1GetPassiveSessions, args, reply) } @@ -254,13 +254,13 @@ func (dS *DispatcherService) SessionSv1GetPassiveSessionsCount(args *utils.Sessi } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1GetPassiveSessionsCount, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1GetPassiveSessionsCount, args, reply) } @@ -307,13 +307,13 @@ func (dS *DispatcherService) SessionSv1ActivateSessions(args *utils.SessionIDsWi } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1ActivateSessions, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1ActivateSessions, args, reply) } @@ -324,13 +324,13 @@ func (dS *DispatcherService) SessionSv1DeactivateSessions(args *utils.SessionIDs } if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1DeactivateSessions, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1DeactivateSessions, args, reply) } @@ -338,13 +338,13 @@ func (dS *DispatcherService) SessionSv1STIRAuthenticate(args *sessions.V1STIRAut tnt := dS.cfg.GeneralCfg().DefaultTenant if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1STIRAuthenticate, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1STIRAuthenticate, args, reply) } @@ -352,12 +352,12 @@ func (dS *DispatcherService) SessionSv1STIRIdentity(args *sessions.V1STIRIdentit tnt := dS.cfg.GeneralCfg().DefaultTenant if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 { if err = dS.authorize(utils.SessionSv1STIRIdentity, - tnt, utils.IfaceAsString(args.Opts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { + tnt, utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), utils.TimePointer(time.Now())); err != nil { return } } return dS.Dispatch(&utils.CGREvent{ Tenant: tnt, - APIOpts: args.Opts, + APIOpts: args.APIOpts, }, utils.MetaSessionS, utils.SessionSv1STIRIdentity, args, reply) } diff --git a/dispatchers/sessions_it_test.go b/dispatchers/sessions_it_test.go index 939bc9a91..f56f610e0 100755 --- a/dispatchers/sessions_it_test.go +++ b/dispatchers/sessions_it_test.go @@ -315,7 +315,7 @@ func testDspSessionInit(t *testing.T) { func testDspGetSessions(t *testing.T) { filtr := utils.SessionFilter{ - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, Tenant: "cgrates.org", @@ -730,7 +730,7 @@ func testDspSessionReplicate(t *testing.T) { allEngine.resetStorDb(t) var reply string // reload cache in order to corectly cahce the indexes - if err := allEngine.RPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := allEngine.RPC.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error(err) @@ -773,7 +773,7 @@ func testDspSessionPassive(t *testing.T) { testDspSessionUpdate2(t) var repl int filtr := utils.SessionFilter{ - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, Tenant: "cgrates.org", @@ -875,7 +875,7 @@ func testDspSessionForceDisconect(t *testing.T) { testDspSessionInit(t) var repl int filtr := utils.SessionFilter{ - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, Tenant: "cgrates.org", @@ -957,7 +957,7 @@ func testDspSessionProcessEvent3(t *testing.T) { var repl int if err := dispEngine.RPC.Call(utils.SessionSv1GetActiveSessionsCount, utils.SessionFilter{ - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, Tenant: "cgrates.org", @@ -1018,7 +1018,7 @@ func testDspSessionSTIRAuthenticate(t *testing.T) { DestinationTn: "1002", Identity: "eyJhbGciOiJFUzI1NiIsInBwdCI6InNoYWtlbiIsInR5cCI6InBhc3Nwb3J0IiwieDV1IjoiL3Vzci9zaGFyZS9jZ3JhdGVzL3N0aXIvc3Rpcl9wdWJrZXkucGVtIn0.eyJhdHRlc3QiOiJBIiwiZGVzdCI6eyJ0biI6WyIxMDAyIl19LCJpYXQiOjE1ODcwMzg4MDIsIm9yaWciOnsidG4iOiIxMDAxIn0sIm9yaWdpZCI6IjEyMzQ1NiJ9.cMEMlFnfyTu8uxfeU4RoZTamA7ifFT9Ibwrvi1_LKwL2xAU6fZ_CSIxKbtyOpNhM_sV03x7CfA_v0T4sHkifzg;info=;ppt=shaken", OriginatorTn: "1001", - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, }, &rply); err != nil { @@ -1040,7 +1040,7 @@ func testDspSessionSTIRIdentity(t *testing.T) { PublicKeyPath: "/usr/share/cgrates/stir/stir_pubkey.pem", PrivateKeyPath: "/usr/share/cgrates/stir/stir_privatekey.pem", OverwriteIAT: true, - Opts: map[string]interface{}{ + APIOpts: map[string]interface{}{ utils.OptsAPIKey: "ses12345", }, } diff --git a/dispatchers/utils.go b/dispatchers/utils.go index f0c08f31d..896a76087 100755 --- a/dispatchers/utils.go +++ b/dispatchers/utils.go @@ -34,21 +34,21 @@ type ArgsReplicateSessionsWithAPIOpts struct { sessions.ArgsReplicateSessions } -type AttrRemoteLockWithOpts struct { - Opts map[string]interface{} - Tenant string +type AttrRemoteLockWithAPIOpts struct { + APIOpts map[string]interface{} + Tenant string utils.AttrRemoteLock } -type AttrRemoteUnlockWithOpts struct { - Opts map[string]interface{} - Tenant string - RefID string +type AttrRemoteUnlockWithAPIOpts struct { + APIOpts map[string]interface{} + Tenant string + RefID string } -type ArgStartServiceWithOpts struct { - Opts map[string]interface{} - Tenant string +type ArgStartServiceWithAPIOpts struct { + APIOpts map[string]interface{} + Tenant string servmanager.ArgStartService } diff --git a/engine/caches.go b/engine/caches.go index 83e7bb7b1..a7e6a7b35 100644 --- a/engine/caches.go +++ b/engine/caches.go @@ -46,14 +46,14 @@ func init() { // Resource gob.Register(new(Resource)) gob.Register(new(ResourceProfile)) - gob.Register(new(ResourceProfileWithOpts)) + gob.Register(new(ResourceProfileWithAPIOpts)) gob.Register(new(ResourceWithAPIOpts)) // Stats gob.Register(new(StatQueue)) gob.Register(new(StatQueueProfile)) - gob.Register(new(StatQueueProfileWithOpts)) + gob.Register(new(StatQueueProfileWithAPIOpts)) gob.Register(new(StoredStatQueue)) - gob.Register(new(StatQueueProfileWithOpts)) + gob.Register(new(StatQueueProfileWithAPIOpts)) // RouteS gob.Register(new(RouteProfile)) gob.Register(new(RouteProfileWithAPIOpts)) @@ -309,21 +309,21 @@ func (chS *CacheS) V1RemoveItems(args utils.AttrReloadCacheWithAPIOpts, return } -func (chS *CacheS) V1Clear(args *utils.AttrCacheIDsWithOpts, +func (chS *CacheS) V1Clear(args *utils.AttrCacheIDsWithAPIOpts, reply *string) (err error) { chS.tCache.Clear(args.CacheIDs) *reply = utils.OK return } -func (chS *CacheS) V1GetCacheStats(args *utils.AttrCacheIDsWithOpts, +func (chS *CacheS) V1GetCacheStats(args *utils.AttrCacheIDsWithAPIOpts, rply *map[string]*ltcache.CacheStats) (err error) { cs := chS.tCache.GetCacheStats(args.CacheIDs) *rply = cs return } -func (chS *CacheS) V1PrecacheStatus(args *utils.AttrCacheIDsWithOpts, rply *map[string]string) (err error) { +func (chS *CacheS) V1PrecacheStatus(args *utils.AttrCacheIDsWithAPIOpts, rply *map[string]string) (err error) { if len(args.CacheIDs) == 0 { args.CacheIDs = utils.CachePartitions.AsSlice() } @@ -343,13 +343,13 @@ func (chS *CacheS) V1PrecacheStatus(args *utils.AttrCacheIDsWithOpts, rply *map[ return } -func (chS *CacheS) V1HasGroup(args *utils.ArgsGetGroupWithOpts, +func (chS *CacheS) V1HasGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *bool) (err error) { *rply = chS.tCache.HasGroup(args.CacheID, args.GroupID) return } -func (chS *CacheS) V1GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, +func (chS *CacheS) V1GetGroupItemIDs(args *utils.ArgsGetGroupWithAPIOpts, rply *[]string) (err error) { if has := chS.tCache.HasGroup(args.CacheID, args.GroupID); !has { return utils.ErrNotFound @@ -358,7 +358,7 @@ func (chS *CacheS) V1GetGroupItemIDs(args *utils.ArgsGetGroupWithOpts, return } -func (chS *CacheS) V1RemoveGroup(args *utils.ArgsGetGroupWithOpts, +func (chS *CacheS) V1RemoveGroup(args *utils.ArgsGetGroupWithAPIOpts, rply *string) (err error) { chS.tCache.RemoveGroup(args.CacheID, args.GroupID, true, utils.NonTransactional) *rply = utils.OK diff --git a/engine/cdr.go b/engine/cdr.go index d54fa58fb..9afa7b128 100644 --- a/engine/cdr.go +++ b/engine/cdr.go @@ -562,9 +562,9 @@ func (self *UsageRecord) GetId() string { return utils.Sha1(self.ToR, self.RequestType, self.Tenant, self.Category, self.Account, self.Subject, self.Destination, self.SetupTime, self.AnswerTime, self.Usage) } -type ExternalCDRWithOpts struct { +type ExternalCDRWithAPIOpts struct { *ExternalCDR - Opts map[string]interface{} + APIOpts map[string]interface{} } type UsageRecordWithOpts struct { @@ -572,7 +572,7 @@ type UsageRecordWithOpts struct { Opts map[string]interface{} } -type CDRWithOpts struct { +type CDRWithAPIOpts struct { *CDR - Opts map[string]interface{} + APIOpts map[string]interface{} } diff --git a/engine/cdrs.go b/engine/cdrs.go index 2a1c1d9f1..4f3ad75e1 100644 --- a/engine/cdrs.go +++ b/engine/cdrs.go @@ -58,7 +58,7 @@ func (cdrS *CDRServer) cgrCdrHandler(w http.ResponseWriter, r *http.Request) { return } var ignored string - if err := cdrS.V1ProcessCDR(&CDRWithOpts{CDR: cdr}, &ignored); err != nil { + if err := cdrS.V1ProcessCDR(&CDRWithAPIOpts{CDR: cdr}, &ignored); err != nil { utils.Logger.Warning( fmt.Sprintf("<%s> processing CDR: %s, err: <%s>", utils.CDRs, cdr, err.Error())) @@ -79,7 +79,7 @@ func (cdrS *CDRServer) fsCdrHandler(w http.ResponseWriter, r *http.Request) { return } var ignored string - if err := cdrS.V1ProcessCDR(&CDRWithOpts{CDR: cdr}, &ignored); err != nil { + if err := cdrS.V1ProcessCDR(&CDRWithAPIOpts{CDR: cdr}, &ignored); err != nil { utils.Logger.Warning( fmt.Sprintf("<%s> processing CDR: %s, err: <%s>", utils.CDRs, cdr, err.Error())) @@ -155,7 +155,7 @@ func (cdrS *CDRServer) storeSMCost(smCost *SMCost, checkDuplicate bool) error { // rateCDR will populate cost field // Returns more than one rated CDR in case of SMCost retrieved based on prefix -func (cdrS *CDRServer) rateCDR(cdr *CDRWithOpts) ([]*CDR, error) { +func (cdrS *CDRServer) rateCDR(cdr *CDRWithAPIOpts) ([]*CDR, error) { var qryCC *CallCost var err error if cdr.RequestType == utils.MetaNone { @@ -199,7 +199,7 @@ func (cdrS *CDRServer) rateCDR(cdr *CDRWithOpts) ([]*CDR, error) { return nil, err } cdrClone.CostDetails = nil - if qryCC, err = cdrS.getCostFromRater(&CDRWithOpts{CDR: cdrClone}); err != nil { + if qryCC, err = cdrS.getCostFromRater(&CDRWithAPIOpts{CDR: cdrClone}); err != nil { return nil, err } smCost = &SMCost{ @@ -251,7 +251,7 @@ var reqTypes = utils.NewStringSet([]string{utils.MetaPseudoPrepaid, utils.MetaPo utils.PseudoPrepaid, utils.Postpaid, utils.Prepaid, utils.MetaDynaprepaid}) // getCostFromRater will retrieve the cost from RALs -func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithOpts) (*CallCost, error) { +func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithAPIOpts) (*CallCost, error) { if len(cdrS.cgrCfg.CdrsCfg().RaterConns) == 0 { return nil, utils.NewErrNotConnected(utils.RALService) } @@ -278,7 +278,7 @@ func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithOpts) (*CallCost, error) { utils.ResponderDebit, &CallDescriptorWithAPIOpts{ CallDescriptor: cd, - APIOpts: cdr.Opts, + APIOpts: cdr.APIOpts, }, cc) if err != nil && err.Error() == utils.ErrAccountNotFound.Error() && cdr.RequestType == utils.MetaDynaprepaid { @@ -296,7 +296,7 @@ func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithOpts) (*CallCost, error) { utils.ResponderDebit, &CallDescriptorWithAPIOpts{ CallDescriptor: cd, - APIOpts: cdr.Opts, + APIOpts: cdr.APIOpts, }, cc) } } else { @@ -304,7 +304,7 @@ func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithOpts) (*CallCost, error) { utils.ResponderGetCost, &CallDescriptorWithAPIOpts{ CallDescriptor: cd, - APIOpts: cdr.Opts, + APIOpts: cdr.APIOpts, }, cc) } if err != nil { @@ -315,7 +315,7 @@ func (cdrS *CDRServer) getCostFromRater(cdr *CDRWithOpts) (*CallCost, error) { } // rateCDRWithErr rates a CDR including errors -func (cdrS *CDRServer) rateCDRWithErr(cdr *CDRWithOpts) (ratedCDRs []*CDR) { +func (cdrS *CDRServer) rateCDRWithErr(cdr *CDRWithAPIOpts) (ratedCDRs []*CDR) { var err error ratedCDRs, err = cdrS.rateCDR(cdr) if err != nil { @@ -527,9 +527,9 @@ func (cdrS *CDRServer) processEvent(ev *utils.CGREvent, if ralS { for i, cdr := range cdrs { for j, rtCDR := range cdrS.rateCDRWithErr( - &CDRWithOpts{ - CDR: cdr, - Opts: ev.APIOpts, + &CDRWithAPIOpts{ + CDR: cdr, + APIOpts: ev.APIOpts, }) { cgrEv := rtCDR.AsCGREvent() cgrEv.APIOpts = cgrEvs[i].APIOpts @@ -666,7 +666,7 @@ func (cdrS *CDRServer) Call(serviceMethod string, args interface{}, reply interf } // V1ProcessCDR processes a CDR -func (cdrS *CDRServer) V1ProcessCDR(cdr *CDRWithOpts, reply *string) (err error) { +func (cdrS *CDRServer) V1ProcessCDR(cdr *CDRWithAPIOpts, reply *string) (err error) { if cdr.CGRID == utils.EmptyString { // Populate CGRID if not present cdr.ComputeCGRID() } @@ -705,7 +705,7 @@ func (cdrS *CDRServer) V1ProcessCDR(cdr *CDRWithOpts, reply *string) (err error) cdr.RunID = utils.MetaDefault } cgrEv := cdr.AsCGREvent() - cgrEv.APIOpts = cdr.Opts + cgrEv.APIOpts = cdr.APIOpts if _, err = cdrS.processEvent(cgrEv, len(cdrS.cgrCfg.CdrsCfg().ChargerSConns) != 0 && !cdr.PreRated, @@ -1012,8 +1012,8 @@ func (cdrS *CDRServer) V2StoreSessionCost(args *ArgsV2CDRSStoreSMCost, reply *st type ArgRateCDRs struct { Flags []string utils.RPCCDRsFilter - Tenant string - Opts map[string]interface{} + Tenant string + APIOpts map[string]interface{} } // V1RateCDRs is used for re-/rate CDRs which are already stored within StorDB @@ -1059,7 +1059,7 @@ func (cdrS *CDRServer) V1RateCDRs(arg *ArgRateCDRs, reply *string) (err error) { for _, cdr := range cdrs { cdr.Cost = -1 // the cost will be recalculated cgrEv := cdr.AsCGREvent() - cgrEv.APIOpts = arg.Opts + cgrEv.APIOpts = arg.APIOpts if _, err = cdrS.processEvent(cgrEv, chrgS, attrS, false, true, store, true, export, thdS, statS); err != nil { return utils.NewErrServerError(err) @@ -1070,20 +1070,20 @@ func (cdrS *CDRServer) V1RateCDRs(arg *ArgRateCDRs, reply *string) (err error) { } // V1ProcessExternalCDR is used to process external CDRs -func (cdrS *CDRServer) V1ProcessExternalCDR(eCDR *ExternalCDRWithOpts, reply *string) error { +func (cdrS *CDRServer) V1ProcessExternalCDR(eCDR *ExternalCDRWithAPIOpts, reply *string) error { cdr, err := NewCDRFromExternalCDR(eCDR.ExternalCDR, cdrS.cgrCfg.GeneralCfg().DefaultTimezone) if err != nil { return err } - return cdrS.V1ProcessCDR(&CDRWithOpts{ - CDR: cdr, - Opts: eCDR.Opts, + return cdrS.V1ProcessCDR(&CDRWithAPIOpts{ + CDR: cdr, + APIOpts: eCDR.APIOpts, }, reply) } // V1GetCDRs returns CDRs from DB -func (cdrS *CDRServer) V1GetCDRs(args utils.RPCCDRsFilterWithOpts, cdrs *[]*CDR) error { +func (cdrS *CDRServer) V1GetCDRs(args utils.RPCCDRsFilterWithAPIOpts, cdrs *[]*CDR) error { cdrsFltr, err := args.AsCDRsFilter(cdrS.cgrCfg.GeneralCfg().DefaultTimezone) if err != nil { if err.Error() != utils.NotFoundCaps { @@ -1100,7 +1100,7 @@ func (cdrS *CDRServer) V1GetCDRs(args utils.RPCCDRsFilterWithOpts, cdrs *[]*CDR) } // V1CountCDRs counts CDRs from DB -func (cdrS *CDRServer) V1CountCDRs(args *utils.RPCCDRsFilterWithOpts, cnt *int64) error { +func (cdrS *CDRServer) V1CountCDRs(args *utils.RPCCDRsFilterWithAPIOpts, cnt *int64) error { cdrsFltr, err := args.AsCDRsFilter(cdrS.cgrCfg.GeneralCfg().DefaultTimezone) if err != nil { if err.Error() != utils.NotFoundCaps { diff --git a/engine/datamanager.go b/engine/datamanager.go index 8110e90fa..71b2dbd3f 100644 --- a/engine/datamanager.go +++ b/engine/datamanager.go @@ -1270,9 +1270,9 @@ func (dm *DataManager) SetStatQueueProfile(sqp *StatQueueProfile, withIndex bool config.CgrConfig().DataDbCfg().RplFiltered, utils.StatQueueProfilePrefix, sqp.TenantID(), // this are used to get the host IDs from cache utils.ReplicatorSv1SetStatQueueProfile, - &StatQueueProfileWithOpts{ + &StatQueueProfileWithAPIOpts{ StatQueueProfile: sqp, - Opts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, + APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)}) } return @@ -1605,9 +1605,9 @@ func (dm *DataManager) SetResourceProfile(rp *ResourceProfile, withIndex bool) ( config.CgrConfig().DataDbCfg().RplFiltered, utils.ResourceProfilesPrefix, rp.TenantID(), // this are used to get the host IDs from cache utils.ReplicatorSv1SetResourceProfile, - &ResourceProfileWithOpts{ + &ResourceProfileWithAPIOpts{ ResourceProfile: rp, - Opts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, + APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)}) } return @@ -1720,12 +1720,12 @@ func (dm *DataManager) RemoveActionTriggers(id, transactionID string) (err error return } -//SetActionTriggersArgWithOpts is used to send the key and the ActionTriggers to Replicator -type SetActionTriggersArgWithOpts struct { - Key string - Attrs ActionTriggers - Tenant string - Opts map[string]interface{} +//SetActionTriggersArgWithAPIOpts is used to send the key and the ActionTriggers to Replicator +type SetActionTriggersArgWithAPIOpts struct { + Key string + Attrs ActionTriggers + Tenant string + APIOpts map[string]interface{} } func (dm *DataManager) SetActionTriggers(key string, attr ActionTriggers, @@ -1744,11 +1744,11 @@ func (dm *DataManager) SetActionTriggers(key string, attr ActionTriggers, config.CgrConfig().DataDbCfg().RplFiltered, utils.ActionTriggerPrefix, key, // this are used to get the host IDs from cache utils.ReplicatorSv1SetActionTriggers, - &SetActionTriggersArgWithOpts{ + &SetActionTriggersArgWithAPIOpts{ Attrs: attr, Key: key, Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, - Opts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, + APIOpts: utils.GenerateDBItemOpts(itm.APIKey, itm.RouteID, config.CgrConfig().DataDbCfg().RplCache, utils.EmptyString)}) } return diff --git a/engine/libstats.go b/engine/libstats.go index a8a7683a5..8bcc815ab 100644 --- a/engine/libstats.go +++ b/engine/libstats.go @@ -44,10 +44,10 @@ type StatQueueProfile struct { ThresholdIDs []string // list of thresholds to be checked after changes } -// StatQueueProfileWithOpts is used in replicatorV1 for dispatcher -type StatQueueProfileWithOpts struct { +// StatQueueProfileWithAPIOpts is used in replicatorV1 for dispatcher +type StatQueueProfileWithAPIOpts struct { *StatQueueProfile - Opts map[string]interface{} + APIOpts map[string]interface{} } func (sqp *StatQueueProfile) TenantID() string { diff --git a/engine/resources.go b/engine/resources.go index 02d4ea489..861584ae3 100644 --- a/engine/resources.go +++ b/engine/resources.go @@ -50,10 +50,10 @@ type ResourceProfile struct { ThresholdIDs []string // Thresholds to check after changing Limit } -// ResourceProfileWithOpts is used in replicatorV1 for dispatcher -type ResourceProfileWithOpts struct { +// ResourceProfileWithAPIOpts is used in replicatorV1 for dispatcher +type ResourceProfileWithAPIOpts struct { *ResourceProfile - Opts map[string]interface{} + APIOpts map[string]interface{} } // TenantID returns unique identifier of the ResourceProfile in a multi-tenant environment diff --git a/engine/storage_utils.go b/engine/storage_utils.go index 95095c419..3b73f1df5 100644 --- a/engine/storage_utils.go +++ b/engine/storage_utils.go @@ -138,7 +138,7 @@ type SMCost struct { type AttrCDRSStoreSMCost struct { Cost *SMCost CheckDuplicate bool - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string } diff --git a/engine/tpreader.go b/engine/tpreader.go index bd8219824..646e1f858 100644 --- a/engine/tpreader.go +++ b/engine/tpreader.go @@ -2651,7 +2651,7 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i return } case utils.MetaClear: - if err = connMgr.Call(tpr.cacheConns, nil, utils.CacheSv1Clear, new(utils.AttrCacheIDsWithOpts), &reply); err != nil { + if err = connMgr.Call(tpr.cacheConns, nil, utils.CacheSv1Clear, new(utils.AttrCacheIDsWithAPIOpts), &reply); err != nil { return } } @@ -2695,7 +2695,7 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i if verbose { log.Print("Clearing indexes") } - clearArgs := &utils.AttrCacheIDsWithOpts{ + clearArgs := &utils.AttrCacheIDsWithAPIOpts{ APIOpts: opts, CacheIDs: cacheIDs, } diff --git a/engine/z_actions_it_test.go b/engine/z_actions_it_test.go index f8dfd04e2..278a1eb14 100644 --- a/engine/z_actions_it_test.go +++ b/engine/z_actions_it_test.go @@ -482,7 +482,7 @@ func testActionsitCDRAccount(t *testing.T) { } } - args := &CDRWithOpts{ + args := &CDRWithAPIOpts{ CDR: &CDR{ Tenant: "cgrates.org", OriginID: "testDspCDRsProcessCDR", @@ -740,7 +740,7 @@ func testActionsitSetSDestinations(t *testing.T) { } // set a StatQueueProfile and simulate process event - statConfig := &StatQueueProfileWithOpts{ + statConfig := &StatQueueProfileWithAPIOpts{ StatQueueProfile: &StatQueueProfile{ Tenant: "cgrates.org", ID: "DistinctMetricProfile", @@ -863,7 +863,7 @@ func testActionsitresetAccountCDR(t *testing.T) { break } } - args := &CDRWithOpts{ + args := &CDRWithAPIOpts{ CDR: &CDR{ Tenant: "cgrates.org", OriginID: "testDsp", diff --git a/ers/ers_reload_it_test.go b/ers/ers_reload_it_test.go index bf2daa6ee..1b8a61ef7 100644 --- a/ers/ers_reload_it_test.go +++ b/ers/ers_reload_it_test.go @@ -140,7 +140,7 @@ func testReloadReloadConfigFromPath(t *testing.T) { func testReloadVerifyFirstReload(t *testing.T) { var reply map[string]interface{} - if err := reloadRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithOpts{ + if err := reloadRPC.Call(utils.ConfigSv1GetConfig, &config.SectionWithAPIOpts{ Section: config.ERsJson, }, &reply); err != nil { t.Error(err) diff --git a/ers/filecsv_it_test.go b/ers/filecsv_it_test.go index 109307dcc..1f18d53aa 100644 --- a/ers/filecsv_it_test.go +++ b/ers/filecsv_it_test.go @@ -238,7 +238,7 @@ func testCsvITAnalyseCDRs(t *testing.T) { time.Sleep(100 * time.Millisecond) var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ RunIDs: []string{"CustomerCharges"}, OriginIDs: []string{"SessionFromCsv"}, @@ -290,7 +290,7 @@ func testCsvITAnalyzeFilteredCDR(t *testing.T) { time.Sleep(100 * time.Millisecond) var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ NotRunIDs: []string{"CustomerCharges", "SupplierCharges"}, Sources: []string{"ers_csv"}, @@ -346,7 +346,7 @@ func testCsvITAnalyzeReaderWithFilter(t *testing.T) { time.Sleep(100 * time.Millisecond) var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ NotRunIDs: []string{"CustomerCharges", "SupplierCharges"}, Sources: []string{"ers_template_combined"}, diff --git a/ers/filejson_it_test.go b/ers/filejson_it_test.go index 68858329a..bf3a4dba2 100644 --- a/ers/filejson_it_test.go +++ b/ers/filejson_it_test.go @@ -196,7 +196,7 @@ func testJSONHandleFile(t *testing.T) { func testJSONVerify(t *testing.T) { var cdrs []*engine.CDR - args := &utils.RPCCDRsFilterWithOpts{ + args := &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{ OriginIDs: []string{"testJsonCDR"}, }, diff --git a/general_tests/attributes_it_test.go b/general_tests/attributes_it_test.go index 71d68d7aa..4a890413b 100644 --- a/general_tests/attributes_it_test.go +++ b/general_tests/attributes_it_test.go @@ -557,7 +557,7 @@ func testAttributeSProcessEventWithResource(t *testing.T) { } var result string - if err := attrRPC.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithOpts{ResourceProfile: rlsConfig}, &result); err != nil { + if err := attrRPC.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithAPIOpts{ResourceProfile: rlsConfig}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) diff --git a/general_tests/broadcast_client_it_test.go b/general_tests/broadcast_client_it_test.go index 71b583204..e77b6db72 100644 --- a/general_tests/broadcast_client_it_test.go +++ b/general_tests/broadcast_client_it_test.go @@ -185,7 +185,7 @@ func testbrodcastItGetCDRs(t *testing.T) { Cost: -1, } var cdrs []*engine.CDR - args := utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} + args := utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} if err := brodcastRPC.Call(utils.CDRsV1GetCDRs, &args, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index 0838dec47..c2cdcc7fb 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -469,7 +469,7 @@ func testV2CDRsSetStats(t *testing.T) { err.Error() != utils.ErrNotFound.Error() { t.Error(err) } - statConfig := &engine.StatQueueProfileWithOpts{ + statConfig := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "STS_PoccessCDR", diff --git a/general_tests/cdrs_processevent_it_test.go b/general_tests/cdrs_processevent_it_test.go index cfea308f9..85873c935 100644 --- a/general_tests/cdrs_processevent_it_test.go +++ b/general_tests/cdrs_processevent_it_test.go @@ -208,7 +208,7 @@ func testV1CDRsProcessEventAttrS(t *testing.T) { t.Error("Unexpected reply received: ", reply) } // check if the CDR was correctly processed - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost1"}}}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -262,7 +262,7 @@ func testV1CDRsProcessEventChrgS(t *testing.T) { t.Error("Unexpected reply received: ", reply) } var cdrs []*engine.CDR - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost2"}}}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 3 { @@ -305,7 +305,7 @@ func testV1CDRsProcessEventRalS(t *testing.T) { t.Error("Unexpected reply received: ", reply) } var cdrs []*engine.CDR - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost3"}}}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -372,7 +372,7 @@ func testV1CDRsProcessEventSts(t *testing.T) { CostDetails: nil, }, } - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost4"}}}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -425,7 +425,7 @@ func testV1CDRsProcessEventStore(t *testing.T) { t.Error("Unexpected reply received: ", reply) } var cdrs []*engine.CDR - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost5"}}}, &cdrs); err == nil || err.Error() != "SERVER_ERROR: NOT_FOUND" { t.Fatal("Unexpected error: ", err.Error()) @@ -519,7 +519,7 @@ func testV1CDRsProcessEventThreshold(t *testing.T) { } var cdrs []*engine.CDR - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost6"}}}, &cdrs); err != nil { t.Error("Unexpected error: ", err) } else if len(cdrs) != 1 { @@ -662,7 +662,7 @@ func testV1CDRsV2ProcessEventRalS(t *testing.T) { } } var cdrs []*engine.CDR - if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithOpts{ + if err := pecdrsRpc.Call(utils.CDRsV1GetCDRs, &utils.RPCCDRsFilterWithAPIOpts{ RPCCDRsFilter: &utils.RPCCDRsFilter{OriginHosts: []string{"OriginHost101"}}}, &cdrs); err != nil { t.Fatal("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { diff --git a/general_tests/doubleremove_it_test.go b/general_tests/doubleremove_it_test.go index 52b6f4001..52223e0f9 100644 --- a/general_tests/doubleremove_it_test.go +++ b/general_tests/doubleremove_it_test.go @@ -110,7 +110,7 @@ func testdoubleRemoveStatQueueProfile(t *testing.T) { t.Error(err) } // set - statConfig := &engine.StatQueueProfileWithOpts{ + statConfig := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: doubleRemoveTenant, ID: "TEST_PROFILE1", diff --git a/general_tests/filtered_replication_it_test.go b/general_tests/filtered_replication_it_test.go index fe7ac80f7..b8958d261 100644 --- a/general_tests/filtered_replication_it_test.go +++ b/general_tests/filtered_replication_it_test.go @@ -547,7 +547,7 @@ func testFltrRplThresholdProfile(t *testing.T) { func testFltrRplStatQueueProfile(t *testing.T) { stID := "ST1" - stPrf := &engine.StatQueueProfileWithOpts{ + stPrf := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: stID, @@ -740,7 +740,7 @@ func testFltrRplStatQueueProfile(t *testing.T) { func testFltrRplResourceProfile(t *testing.T) { resID := "RES1" - resPrf := &engine.ResourceProfileWithOpts{ + resPrf := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: resID, diff --git a/general_tests/filters_it_test.go b/general_tests/filters_it_test.go index 630ba2f2a..b7ae38469 100644 --- a/general_tests/filters_it_test.go +++ b/general_tests/filters_it_test.go @@ -417,7 +417,7 @@ func testV1FltrPopulateResources(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithOpts{ResourceProfile: rlsConfig}, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithAPIOpts{ResourceProfile: rlsConfig}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -562,7 +562,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) { } var result string - if err := fltrRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithOpts{ResourceProfile: rlsConfig}, &result); err != nil { + if err := fltrRpc.Call(utils.APIerSv1SetResourceProfile, &engine.ResourceProfileWithAPIOpts{ResourceProfile: rlsConfig}, &result); err != nil { t.Error(err) } else if result != utils.OK { t.Error("Unexpected reply returned", result) @@ -622,7 +622,7 @@ func testV1FltrPopulateResourcesAvailableUnits(t *testing.T) { } //set a statQueueProfile with that filter - statsPrf := &engine.StatQueueProfileWithOpts{ + statsPrf := &engine.StatQueueProfileWithAPIOpts{ StatQueueProfile: &engine.StatQueueProfile{ Tenant: "cgrates.org", ID: "STATS_RES_TEST12", @@ -886,7 +886,7 @@ func testV1FltrAccountsExistsDynamicaly(t *testing.T) { func testV1FltrChargerSuffix(t *testing.T) { var reply string - if err := fltrRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err := fltrRpc.Call(utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: nil, }, &reply); err != nil { t.Error(err) diff --git a/general_tests/resourcesv1_it_test.go b/general_tests/resourcesv1_it_test.go index f4c8d9f97..2785a698d 100644 --- a/general_tests/resourcesv1_it_test.go +++ b/general_tests/resourcesv1_it_test.go @@ -104,7 +104,7 @@ func testV1RsRpcConn(t *testing.T) { } func testV1RsSetProfile(t *testing.T) { - rls := &engine.ResourceProfileWithOpts{ + rls := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "RES_GR_TEST", diff --git a/general_tests/route_it_test.go b/general_tests/route_it_test.go index 0b0b6a4b9..7653d3442 100644 --- a/general_tests/route_it_test.go +++ b/general_tests/route_it_test.go @@ -245,7 +245,7 @@ func testV1SplSAddNewSplPrf(t *testing.T) { func testV1SplSAddNewResPrf(t *testing.T) { var result string //add ResourceSupplier1 - rPrf := &engine.ResourceProfileWithOpts{ + rPrf := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ResourceSupplier1", @@ -268,7 +268,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { t.Error("Unexpected reply returned", result) } //add Resource2Supplier1 - rPrf2 := &engine.ResourceProfileWithOpts{ + rPrf2 := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "Resource2Supplier1", @@ -291,7 +291,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { t.Error("Unexpected reply returned", result) } //add ResourceSupplier2 - rPrf3 := &engine.ResourceProfileWithOpts{ + rPrf3 := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ResourceSupplier2", @@ -314,7 +314,7 @@ func testV1SplSAddNewResPrf(t *testing.T) { t.Error("Unexpected reply returned", result) } //add ResourceSupplier2 - rPrf4 := &engine.ResourceProfileWithOpts{ + rPrf4 := &engine.ResourceProfileWithAPIOpts{ ResourceProfile: &engine.ResourceProfile{ Tenant: "cgrates.org", ID: "ResourceSupplier3", diff --git a/general_tests/rpccaching_it_test.go b/general_tests/rpccaching_it_test.go index 2bde3a46b..9dd15b765 100644 --- a/general_tests/rpccaching_it_test.go +++ b/general_tests/rpccaching_it_test.go @@ -558,7 +558,7 @@ func testRPCMethodsProcessCDR(t *testing.T) { time.Sleep(100 * time.Millisecond) //verify the CDR var cdrs []*engine.CDR - argsCDR := &utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} + argsCDR := &utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} if err := rpcRpc.Call(utils.CDRsV1GetCDRs, argsCDR, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { @@ -726,7 +726,7 @@ func testRPCMethodsCdrsProcessCDR(t *testing.T) { time.Sleep(150 * time.Millisecond) // Give time for CDR to be rated //verify the CDR var cdrs []*engine.CDR - argsCDR := utils.RPCCDRsFilterWithOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} + argsCDR := utils.RPCCDRsFilterWithAPIOpts{RPCCDRsFilter: &utils.RPCCDRsFilter{RunIDs: []string{utils.MetaDefault}}} if err := rpcRpc.Call(utils.CDRsV1GetCDRs, &argsCDR, &cdrs); err != nil { t.Error("Unexpected error: ", err.Error()) } else if len(cdrs) != 1 { diff --git a/general_tests/tut_smgeneric_it_test.go b/general_tests/tut_smgeneric_it_test.go index e02414f50..97988e478 100644 --- a/general_tests/tut_smgeneric_it_test.go +++ b/general_tests/tut_smgeneric_it_test.go @@ -170,7 +170,7 @@ func testTutSMGCacheStats(t *testing.T) { expectedStats[utils.CacheAttributeFilterIndexes].Groups = 2 expectedStats[utils.CacheReverseFilterIndexes].Items = 15 expectedStats[utils.CacheReverseFilterIndexes].Groups = 13 - if err := tutSMGRpc.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil { + if err := tutSMGRpc.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithAPIOpts), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { t.Errorf("Calling APIerSv2.CacheSv1 expected: %+v,\n received: %+v", utils.ToJSON(expectedStats), utils.ToJSON(rcvStats)) diff --git a/loaders/loader.go b/loaders/loader.go index 661c39575..fa432f981 100644 --- a/loaders/loader.go +++ b/loaders/loader.go @@ -698,12 +698,12 @@ func (ldr *Loader) storeLoadedData(loaderType string, } case utils.MetaClear: if err = ldr.connMgr.Call(ldr.cacheConns, nil, - utils.CacheSv1Clear, new(utils.AttrCacheIDsWithOpts), &reply); err != nil { + utils.CacheSv1Clear, new(utils.AttrCacheIDsWithAPIOpts), &reply); err != nil { return } } if len(cacheIDs) != 0 { - if err = ldr.connMgr.Call(ldr.cacheConns, nil, utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err = ldr.connMgr.Call(ldr.cacheConns, nil, utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: cacheIDs, }, &reply); err != nil { return @@ -1054,12 +1054,12 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa } case utils.MetaClear: if err = ldr.connMgr.Call(ldr.cacheConns, nil, - utils.CacheSv1Clear, new(utils.AttrCacheIDsWithOpts), &reply); err != nil { + utils.CacheSv1Clear, new(utils.AttrCacheIDsWithAPIOpts), &reply); err != nil { return } } if len(cacheIDs) != 0 { - if err = ldr.connMgr.Call(ldr.cacheConns, nil, utils.CacheSv1Clear, &utils.AttrCacheIDsWithOpts{ + if err = ldr.connMgr.Call(ldr.cacheConns, nil, utils.CacheSv1Clear, &utils.AttrCacheIDsWithAPIOpts{ CacheIDs: cacheIDs, }, &reply); err != nil { return diff --git a/sessions/libsessions.go b/sessions/libsessions.go index 514d2a8ee..8b31082c2 100644 --- a/sessions/libsessions.go +++ b/sessions/libsessions.go @@ -259,7 +259,7 @@ type V1STIRAuthenticateArgs struct { OriginatorTn string // the expected originator telephone number OriginatorURI string // the expected originator URI; if this is populated the OriginatorTn is ignored PayloadMaxDuration string // the duration the payload is valid after it's creation - Opts map[string]interface{} + APIOpts map[string]interface{} } // V1STIRIdentityArgs are the arguments for STIRIdentity API @@ -268,7 +268,7 @@ type V1STIRIdentityArgs struct { PublicKeyPath string // the path to the public key used in the header PrivateKeyPath string // the private key path OverwriteIAT bool // if true the IAT from payload is overwrited with the present unix timestamp - Opts map[string]interface{} + APIOpts map[string]interface{} } // getDerivedEvents returns only the *raw event if derivedReply flag is not specified diff --git a/sessions/sessions.go b/sessions/sessions.go index ba19a4b7b..076ecf78f 100644 --- a/sessions/sessions.go +++ b/sessions/sessions.go @@ -691,7 +691,7 @@ func (sS *SessionS) storeSCost(s *Session, sRunIdx int) (err error) { argSmCost := &engine.AttrCDRSStoreSMCost{ Cost: smCost, CheckDuplicate: true, - Opts: s.OptsStart, + APIOpts: s.OptsStart, Tenant: s.Tenant, } var reply string diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 54a9ae38f..2deae03c8 100755 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -1284,10 +1284,10 @@ func AppendToSMCostFilter(smcFilter *SMCostFilter, fieldType, fieldName string, return smcFilter, err } -type RPCCDRsFilterWithOpts struct { +type RPCCDRsFilterWithAPIOpts struct { *RPCCDRsFilter - Opts map[string]interface{} - Tenant string + APIOpts map[string]interface{} + Tenant string } type ArgsGetCacheItemIDsWithAPIOpts struct { @@ -1349,15 +1349,15 @@ type AttrReloadCacheWithAPIOpts struct { ArgsCache map[string][]string } -type AttrCacheIDsWithOpts struct { +type AttrCacheIDsWithAPIOpts struct { APIOpts map[string]interface{} Tenant string CacheIDs []string } -type ArgsGetGroupWithOpts struct { - Opts map[string]interface{} - Tenant string +type ArgsGetGroupWithAPIOpts struct { + APIOpts map[string]interface{} + Tenant string ArgsGetGroup } @@ -1380,7 +1380,7 @@ type SessionFilter struct { Limit *int Filters []string Tenant string - Opts map[string]interface{} + APIOpts map[string]interface{} } type RatingPlanCostArg struct { @@ -1388,12 +1388,12 @@ type RatingPlanCostArg struct { Destination string SetupTime string Usage string - Opts map[string]interface{} + APIOpts map[string]interface{} } type SessionIDsWithArgsDispatcher struct { - IDs []string - Tenant string - Opts map[string]interface{} + IDs []string + Tenant string + APIOpts map[string]interface{} } type GetCostOnRatingPlansArgs struct { @@ -1431,7 +1431,7 @@ type ArgCacheReplicateSet struct { CacheID string ItemID string Value interface{} - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string } @@ -1443,7 +1443,7 @@ type Compiler interface { type ArgCacheReplicateRemove struct { CacheID string ItemID string - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string } @@ -1451,7 +1451,7 @@ type AttrsExecuteActions struct { ActionPlanID string TimeStart time.Time TimeEnd time.Time // replay the action timings between the two dates - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string } @@ -1459,7 +1459,7 @@ type AttrsExecuteActionPlans struct { ActionPlanIDs []string Tenant string AccountID string - Opts map[string]interface{} + APIOpts map[string]interface{} } type TPRateProfile struct { diff --git a/utils/coreutils.go b/utils/coreutils.go index f43628afb..2ff9f1eea 100644 --- a/utils/coreutils.go +++ b/utils/coreutils.go @@ -966,7 +966,7 @@ type SetIndexesArg struct { type DurationArgs struct { Duration time.Duration - Opts map[string]interface{} + APIOpts map[string]interface{} Tenant string }