mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
refactor for v1 and v2 api
added Load api for multiple id resources
This commit is contained in:
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
// Tariff plan related APIs
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
// This file deals with tp_destination_rates management over APIs
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
/*
|
||||
// Creates a new LcrRules profile within a tariff plan
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
// This file deals with tp_rates management over APIs
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
// This file deals with tp_destrates_timing management over APIs
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
// This file deals with tp_rate_profiles management over APIs
|
||||
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package apier
|
||||
package v1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
135
apier/v2/apier.go
Normal file
135
apier/v2/apier.go
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
Real-time Charging System for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package v2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
type ApierV2 struct {
|
||||
v1.ApierV1
|
||||
}
|
||||
|
||||
type AttrLoadRatingProfile struct {
|
||||
TPid string
|
||||
RatingProfileId string
|
||||
}
|
||||
|
||||
// Process dependencies and load a specific rating profile from storDb into dataDb.
|
||||
func (self *ApierV2) LoadRatingProfile(attrs AttrLoadRatingProfile, reply *string) error {
|
||||
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "RatingProfileId"}); len(missing) != 0 {
|
||||
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
|
||||
}
|
||||
|
||||
if attrs.RatingProfileId == utils.EMPTY {
|
||||
attrs.RatingProfileId = ""
|
||||
}
|
||||
tpRpf := &utils.TPRatingProfile{TPid: attrs.TPid}
|
||||
tpRpf.SetRatingProfilesId(attrs.RatingProfileId)
|
||||
dbReader := engine.NewDbReader(self.StorDb, self.RatingDb, self.AccountDb, attrs.TPid)
|
||||
if err := dbReader.LoadRatingProfileFiltered(tpRpf); err != nil {
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
}
|
||||
//Automatic cache of the newly inserted rating profile
|
||||
didNotChange := []string{}
|
||||
var ratingProfile []string
|
||||
if tpRpf.KeyId() != ":::" { // if has some filters
|
||||
ratingProfile = []string{engine.RATING_PROFILE_PREFIX + tpRpf.KeyId()}
|
||||
}
|
||||
if err := self.RatingDb.CacheRating(didNotChange, didNotChange, ratingProfile, didNotChange, didNotChange); err != nil {
|
||||
return err
|
||||
}
|
||||
*reply = v1.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
type AttrLoadAccountActions struct {
|
||||
TPid string
|
||||
AccountActionsId string
|
||||
}
|
||||
|
||||
// Process dependencies and load a specific AccountActions profile from storDb into dataDb.
|
||||
func (self *ApierV2) LoadAccountActions(attrs AttrLoadAccountActions, reply *string) error {
|
||||
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "AccountActionsId"}); len(missing) != 0 {
|
||||
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
|
||||
}
|
||||
dbReader := engine.NewDbReader(self.StorDb, self.RatingDb, self.AccountDb, attrs.TPid)
|
||||
|
||||
if attrs.AccountActionsId == utils.EMPTY {
|
||||
attrs.AccountActionsId = ""
|
||||
}
|
||||
|
||||
tpAa := &utils.TPAccountActions{TPid: attrs.TPid}
|
||||
tpAa.SetAccountActionsId(attrs.AccountActionsId)
|
||||
|
||||
if _, err := engine.AccLock.Guard(attrs.AccountActionsId, func() (float64, error) {
|
||||
if err := dbReader.LoadAccountActionsFiltered(tpAa); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 0, nil
|
||||
}); err != nil {
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
}
|
||||
// ToDo: Get the action keys loaded by dbReader so we reload only these in cache
|
||||
// Need to do it before scheduler otherwise actions to run will be unknown
|
||||
if err := self.AccountDb.CacheAccounting(nil, nil, nil, []string{}); err != nil {
|
||||
return err
|
||||
}
|
||||
if self.Sched != nil {
|
||||
self.Sched.LoadActionTimings(self.AccountDb)
|
||||
self.Sched.Restart()
|
||||
}
|
||||
*reply = v1.OK
|
||||
return nil
|
||||
}
|
||||
|
||||
type AttrLoadDerivedChargers struct {
|
||||
TPid string
|
||||
DerivedChargersId string
|
||||
}
|
||||
|
||||
// Load derived chargers from storDb into dataDb.
|
||||
func (self *ApierV2) LoadDerivedChargers(attrs AttrLoadDerivedChargers, reply *string) error {
|
||||
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "DerivedChargersId"}); len(missing) != 0 {
|
||||
log.Printf("ATTR: %+v", attrs)
|
||||
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
|
||||
}
|
||||
if attrs.DerivedChargersId == utils.EMPTY {
|
||||
attrs.DerivedChargersId = ""
|
||||
}
|
||||
tpDc := &utils.TPDerivedChargers{TPid: attrs.TPid}
|
||||
tpDc.SetDerivedChargersId(attrs.DerivedChargersId)
|
||||
|
||||
dbReader := engine.NewDbReader(self.StorDb, self.RatingDb, self.AccountDb, attrs.TPid)
|
||||
if err := dbReader.LoadDerivedChargersFiltered(tpDc); err != nil {
|
||||
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
|
||||
}
|
||||
//Automatic cache of the newly inserted rating plan
|
||||
didNotChange := []string{}
|
||||
if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, didNotChange, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
*reply = v1.OK
|
||||
return nil
|
||||
}
|
||||
@@ -28,7 +28,8 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/apier"
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/apier/v2"
|
||||
"github.com/cgrates/cgrates/balancer2go"
|
||||
"github.com/cgrates/cgrates/cdrc"
|
||||
"github.com/cgrates/cgrates/config"
|
||||
@@ -118,7 +119,7 @@ func startMediator(responder *engine.Responder, loggerDb engine.LogStorage, cdrD
|
||||
return
|
||||
}
|
||||
engine.Logger.Info("Registering Mediator RPC service.")
|
||||
server.RpcRegister(&apier.MediatorV1{Medi: medi})
|
||||
server.RpcRegister(&v1.MediatorV1{Medi: medi})
|
||||
|
||||
close(chanDone)
|
||||
}
|
||||
@@ -208,7 +209,7 @@ func startCDRS(responder *engine.Responder, cdrDb engine.CdrStorage, mediChan, d
|
||||
cdrServer = engine.NewCdrS(cdrDb, medi, cdrStats, cfg)
|
||||
cdrServer.RegisterHanlersToServer(server)
|
||||
engine.Logger.Info("Registering CDRS RPC service.")
|
||||
server.RpcRegister(&apier.CDRSV1{CdrSrv: cdrServer})
|
||||
server.RpcRegister(&v1.CDRSV1{CdrSrv: cdrServer})
|
||||
responder.CdrSrv = cdrServer // Make the cdrserver available for internal communication
|
||||
close(doneChan)
|
||||
}
|
||||
@@ -412,16 +413,18 @@ func main() {
|
||||
cdrStats.AddQueue(engine.NewCdrStatsFromCdrStatsCfg(cfg.CDRStatConfig), nil)
|
||||
}
|
||||
server.RpcRegister(cdrStats)
|
||||
server.RpcRegister(&apier.CDRStatsV1{cdrStats}) // Public APIs
|
||||
server.RpcRegister(&v1.CDRStatsV1{cdrStats}) // Public APIs
|
||||
}
|
||||
|
||||
responder := &engine.Responder{ExitChan: exitChan}
|
||||
apierRpc := &apier.ApierV1{StorDb: loadDb, RatingDb: ratingDb, AccountDb: accountDb, CdrDb: cdrDb, LogDb: logDb, Config: cfg, Responder: responder, CdrStatsSrv: cdrStats}
|
||||
apierRpcV1 := &v1.ApierV1{StorDb: loadDb, RatingDb: ratingDb, AccountDb: accountDb, CdrDb: cdrDb, LogDb: logDb, Config: cfg, Responder: responder, CdrStatsSrv: cdrStats}
|
||||
apierRpcV2 := &v2.ApierV2{ApierV1: v1.ApierV1{StorDb: loadDb, RatingDb: ratingDb, AccountDb: accountDb, CdrDb: cdrDb, LogDb: logDb, Config: cfg, Responder: responder, CdrStatsSrv: cdrStats}}
|
||||
|
||||
if cfg.RaterEnabled && !cfg.BalancerEnabled && cfg.RaterBalancer != utils.INTERNAL {
|
||||
engine.Logger.Info("Registering Rater service")
|
||||
server.RpcRegister(responder)
|
||||
server.RpcRegister(apierRpc)
|
||||
server.RpcRegister(apierRpcV1)
|
||||
server.RpcRegister(apierRpcV2)
|
||||
}
|
||||
|
||||
if cfg.BalancerEnabled {
|
||||
@@ -430,7 +433,8 @@ func main() {
|
||||
stopHandled = true
|
||||
responder.Bal = bal
|
||||
server.RpcRegister(responder)
|
||||
server.RpcRegister(apierRpc)
|
||||
server.RpcRegister(apierRpcV1)
|
||||
server.RpcRegister(apierRpcV2)
|
||||
if cfg.RaterEnabled {
|
||||
engine.Logger.Info("<Balancer> Registering internal rater")
|
||||
bal.AddClient("local", new(engine.ResponderWorker))
|
||||
@@ -446,7 +450,8 @@ func main() {
|
||||
go func() {
|
||||
sched := scheduler.NewScheduler()
|
||||
go reloadSchedulerSingnalHandler(sched, accountDb)
|
||||
apierRpc.Sched = sched
|
||||
apierRpcV1.Sched = sched
|
||||
apierRpcV2.Sched = sched
|
||||
sched.LoadActionTimings(accountDb)
|
||||
sched.Loop()
|
||||
}()
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/apier"
|
||||
import "github.com/cgrates/cgrates/apier/v1"
|
||||
|
||||
func init() {
|
||||
c := &CmdAddAccount{
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
type CmdAddAccount struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrSetAccount
|
||||
rpcParams *v1.AttrSetAccount
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (self *CmdAddAccount) RpcMethod() string {
|
||||
|
||||
func (self *CmdAddAccount) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrSetAccount{Direction: "*out"}
|
||||
self.rpcParams = &v1.AttrSetAccount{Direction: "*out"}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/apier"
|
||||
import "github.com/cgrates/cgrates/apier/v1"
|
||||
|
||||
func init() {
|
||||
c := &CmdExecuteAction{
|
||||
name: "action_execute",
|
||||
rpcMethod: "ApierV1.ExecuteAction",
|
||||
rpcParams: &apier.AttrExecuteAction{Direction: "*out"},
|
||||
rpcParams: &v1.AttrExecuteAction{Direction: "*out"},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
type CmdExecuteAction struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrExecuteAction
|
||||
rpcParams *v1.AttrExecuteAction
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (self *CmdExecuteAction) RpcMethod() string {
|
||||
|
||||
func (self *CmdExecuteAction) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrExecuteAction{Direction: "*out"}
|
||||
self.rpcParams = &v1.AttrExecuteAction{Direction: "*out"}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/apier"
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ func init() {
|
||||
type CmdAddBalance struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrAddBalance
|
||||
rpcParams *v1.AttrAddBalance
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (self *CmdAddBalance) RpcMethod() string {
|
||||
|
||||
func (self *CmdAddBalance) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrAddBalance{BalanceType: engine.CREDIT, Overwrite: false}
|
||||
self.rpcParams = &v1.AttrAddBalance{BalanceType: engine.CREDIT, Overwrite: false}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/apier"
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -37,7 +37,7 @@ func init() {
|
||||
type CmdGetCostDetails struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrGetCallCost
|
||||
rpcParams *v1.AttrGetCallCost
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -52,7 +52,7 @@ func (self *CmdGetCostDetails) RpcMethod() string {
|
||||
|
||||
func (self *CmdGetCostDetails) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrGetCallCost{RunId: utils.DEFAULT_RUNID}
|
||||
self.rpcParams = &v1.AttrGetCallCost{RunId: utils.DEFAULT_RUNID}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/apier"
|
||||
import "github.com/cgrates/cgrates/apier/v1"
|
||||
|
||||
func init() {
|
||||
c := &CmdCdrStatsMetrics{
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
type CmdCdrStatsMetrics struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrGetMetrics
|
||||
rpcParams *v1.AttrGetMetrics
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (self *CmdCdrStatsMetrics) RpcMethod() string {
|
||||
|
||||
func (self *CmdCdrStatsMetrics) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrGetMetrics{}
|
||||
self.rpcParams = &v1.AttrGetMetrics{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/apier"
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
@@ -38,7 +38,7 @@ func init() {
|
||||
type CmdGetDataCost struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrGetDataCost
|
||||
rpcParams *v1.AttrGetDataCost
|
||||
clientArgs []string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func (self *CmdGetDataCost) RpcMethod() string {
|
||||
|
||||
func (self *CmdGetDataCost) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrGetDataCost{Direction: utils.OUT}
|
||||
self.rpcParams = &v1.AttrGetDataCost{Direction: utils.OUT}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/apier"
|
||||
import "github.com/cgrates/cgrates/apier/v1"
|
||||
|
||||
func init() {
|
||||
c := &CmdAddTriggeredAction{
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
type CmdAddTriggeredAction struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrAddActionTrigger
|
||||
rpcParams *v1.AttrAddActionTrigger
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ func (self *CmdAddTriggeredAction) RpcMethod() string {
|
||||
|
||||
func (self *CmdAddTriggeredAction) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrAddActionTrigger{Direction: "*out"}
|
||||
self.rpcParams = &v1.AttrAddActionTrigger{Direction: "*out"}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
./test.sh
|
||||
gen=$?
|
||||
go test github.com/cgrates/cgrates/apier -local
|
||||
ap=$?
|
||||
go test github.com/cgrates/cgrates/apier/v1 -local
|
||||
ap1=$?
|
||||
go test github.com/cgrates/cgrates/apier/v2 -local
|
||||
ap2=$?
|
||||
go test github.com/cgrates/cgrates/engine -local
|
||||
en=$?
|
||||
go test github.com/cgrates/cgrates/cdrc -local
|
||||
@@ -18,5 +20,5 @@ utl=$?
|
||||
|
||||
|
||||
|
||||
exit $gen && $ap && $en && $cdrc && $cfg && $utl
|
||||
exit $gen && $ap1 && $ap2 && $en && $cdrc && $cfg && $utl
|
||||
|
||||
|
||||
Reference in New Issue
Block a user