mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Add API's for RateProfiles
This commit is contained in:
committed by
Dan Christian Bogos
parent
75406ceaf2
commit
7d1b0a5e03
@@ -77,6 +77,7 @@ var (
|
||||
utils.ChargerProfilePrefix: true,
|
||||
utils.DispatcherProfilePrefix: true,
|
||||
utils.DispatcherHostPrefix: true,
|
||||
utils.RateProfilePrefix: true,
|
||||
utils.AttributeFilterIndexes: true,
|
||||
utils.ResourceFilterIndexes: true,
|
||||
utils.StatFilterIndexes: true,
|
||||
@@ -84,6 +85,7 @@ var (
|
||||
utils.RouteFilterIndexes: true,
|
||||
utils.ChargerFilterIndexes: true,
|
||||
utils.DispatcherFilterIndexes: true,
|
||||
utils.RateFilterIndexes: true,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -505,6 +505,8 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats {
|
||||
utils.CacheThresholdFilterIndexes: {},
|
||||
utils.CacheThresholdProfiles: {},
|
||||
utils.CacheThresholds: {},
|
||||
utils.CacheRateProfiles: {},
|
||||
utils.CacheRateFilterIndexes: {},
|
||||
utils.CacheTimings: {},
|
||||
utils.CacheDiameterMessages: {},
|
||||
utils.CacheClosedSessions: {},
|
||||
|
||||
@@ -129,7 +129,7 @@ func NewFileCSVStorage(sep rune, dataPath string) *CSVStorage {
|
||||
chargersPaths := appendName(allFoldersPath, utils.ChargersCsv)
|
||||
dispatcherprofilesPaths := appendName(allFoldersPath, utils.DispatcherProfilesCsv)
|
||||
dispatcherhostsPaths := appendName(allFoldersPath, utils.DispatcherHostsCsv)
|
||||
rateProfilesFn := append(allFoldersPath, utils.RateProfilesCsv)
|
||||
rateProfilesFn := appendName(allFoldersPath, utils.RateProfilesCsv)
|
||||
return NewCSVStorage(sep,
|
||||
destinationsPaths,
|
||||
timingsPaths,
|
||||
|
||||
@@ -303,6 +303,11 @@ func newInternalDBCfg(itemsCacheCfg map[string]*config.ItemOpt, isDataDB bool) m
|
||||
TTL: itemsCacheCfg[utils.TBLTPDispatcherHosts].TTL,
|
||||
StaticTTL: itemsCacheCfg[utils.TBLTPDispatcherHosts].StaticTTL,
|
||||
},
|
||||
utils.TBLTPRateProfiles: <cache.CacheConfig{
|
||||
MaxItems: itemsCacheCfg[utils.TBLTPRateProfiles].Limit,
|
||||
TTL: itemsCacheCfg[utils.TBLTPRateProfiles].TTL,
|
||||
StaticTTL: itemsCacheCfg[utils.TBLTPRateProfiles].StaticTTL,
|
||||
},
|
||||
utils.CDRsTBL: <cache.CacheConfig{
|
||||
MaxItems: itemsCacheCfg[utils.CDRsTBL].Limit,
|
||||
TTL: itemsCacheCfg[utils.CDRsTBL].TTL,
|
||||
|
||||
@@ -238,7 +238,7 @@ func (self *SQLStorage) RemTpData(table, tpid string, args map[string]string) er
|
||||
utils.TBLTPSharedGroups, utils.TBLTPActions, utils.TBLTPActionPlans,
|
||||
utils.TBLTPActionTriggers, utils.TBLTPAccountActions,
|
||||
utils.TBLTPResources, utils.TBLTPStats, utils.TBLTPFilters,
|
||||
utils.TBLTPRoutes, utils.TBLTPAttributes,
|
||||
utils.TBLTPRoutes, utils.TBLTPAttributes, utils.TBLTPRateProfiles,
|
||||
utils.TBLTPChargers, utils.TBLTPDispatchers, utils.TBLTPDispatcherHosts} {
|
||||
if err := tx.Table(tblName).Where("tpid = ?", tpid).Delete(nil).Error; err != nil {
|
||||
tx.Rollback()
|
||||
|
||||
@@ -60,6 +60,7 @@ var fileHandlers = map[string]func(*TPCSVImporter, string) error{
|
||||
utils.ChargersCsv: (*TPCSVImporter).importChargerProfiles,
|
||||
utils.DispatcherProfilesCsv: (*TPCSVImporter).importDispatcherProfiles,
|
||||
utils.DispatcherHostsCsv: (*TPCSVImporter).importDispatcherHosts,
|
||||
utils.RateProfilesCsv: (*TPCSVImporter).importRateProfiles,
|
||||
}
|
||||
|
||||
func (self *TPCSVImporter) Run() error {
|
||||
@@ -357,3 +358,14 @@ func (self *TPCSVImporter) importDispatcherHosts(fn string) error {
|
||||
}
|
||||
return self.StorDb.SetTPDispatcherHosts(dpps)
|
||||
}
|
||||
|
||||
func (self *TPCSVImporter) importRateProfiles(fn string) error {
|
||||
if self.Verbose {
|
||||
log.Printf("Processing file: <%s> ", fn)
|
||||
}
|
||||
rpps, err := self.csvr.GetTPRateProfiles(self.TPid, "", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return self.StorDb.SetTPRateProfiles(rpps)
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ func CurrentDataDBVersions() Versions {
|
||||
utils.Chargers: 1,
|
||||
utils.Dispatchers: 1,
|
||||
utils.LoadIDsVrs: 1,
|
||||
utils.RateProfiles: 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +195,7 @@ func CurrentStorDBVersions() Versions {
|
||||
utils.TpRatingProfile: 1,
|
||||
utils.TpChargers: 1,
|
||||
utils.TpDispatchers: 1,
|
||||
utils.TpRateProfiles: 1,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user