mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
console results fix
This commit is contained in:
@@ -86,9 +86,10 @@ func executeCommand(command string) {
|
||||
//log.Printf("Param: %+v", param)
|
||||
if rpcErr := client.Call(cmd.RpcMethod(), param, res); rpcErr != nil {
|
||||
fmt.Println("Error executing command: " + rpcErr.Error())
|
||||
} else {
|
||||
result, _ := json.MarshalIndent(res, "", " ")
|
||||
fmt.Println(string(result))
|
||||
}
|
||||
result, _ := json.MarshalIndent(res, "", " ")
|
||||
fmt.Println(string(result))
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -38,7 +38,6 @@ type CmdGetAccount struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrGetAccount
|
||||
rpcResult engine.Account
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -58,5 +57,5 @@ func (self *CmdGetAccount) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetAccount) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &engine.Account{}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdAddAccount struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrSetAccount
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,6 @@ func (self *CmdAddAccount) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdAddAccount) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdSetAccountActions struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.TPAccountActions
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,6 @@ func (self *CmdSetAccountActions) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdSetAccountActions) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ type CmdExecuteAction struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrExecuteAction
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -55,5 +54,6 @@ func (self *CmdExecuteAction) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdExecuteAction) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ type CmdAddBalance struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrAddBalance
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -50,12 +49,13 @@ func (self *CmdAddBalance) RpcMethod() string {
|
||||
}
|
||||
|
||||
func (self *CmdAddBalance) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &apier.AttrAddBalance{BalanceType: engine.CREDIT}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdAddBalance) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ type CmdDebitBalance struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.CallDescriptor
|
||||
rpcResult string
|
||||
clientArgs []string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -50,14 +49,15 @@ func (self *CmdDebitBalance) RpcMethod() string {
|
||||
}
|
||||
|
||||
func (self *CmdDebitBalance) RpcParams() interface{} {
|
||||
if self.rpcParams == nil {
|
||||
if self.rpcParams == nil {
|
||||
self.rpcParams = &engine.CallDescriptor{Direction: "*out"}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdDebitBalance) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
func (self *CmdDebitBalance) ClientArgs() []string {
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdGetCacheAge struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *StringWrapper
|
||||
rpcResult utils.CachedItemAge
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,5 @@ func (self *CmdGetCacheAge) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetCacheAge) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &utils.CachedItemAge{}
|
||||
}
|
||||
|
||||
@@ -54,5 +54,6 @@ func (self *CmdReloadCache) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdReloadCache) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdGetCacheStats struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.AttrCacheStats
|
||||
rpcResult utils.CacheStats
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,5 @@ func (self *CmdGetCacheStats) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetCacheStats) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &utils.CacheStats{}
|
||||
}
|
||||
|
||||
@@ -57,5 +57,6 @@ func (self *CmdGetCallCost) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetCallCost) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdExportCdrs struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.AttrExpFileCdrs
|
||||
rpcResult utils.ExportedFileCdrs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,5 @@ func (self *CmdExportCdrs) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdExportCdrs) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &utils.ExportedFileCdrs{}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdRemCdrs struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.AttrRemCdrs
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,6 @@ func (self *CmdRemCdrs) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdRemCdrs) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func init() {
|
||||
c := &CmdGetCost{
|
||||
name: "cost",
|
||||
rpcMethod: "Responder.GetCost",
|
||||
clientArgs: []string{"Direction", "TOR", "Tenant", "Subject", "Account", "Destination", "TimeStart", "TimeEnd", "CallDuration", "FallbackSubject"},
|
||||
clientArgs: []string{"Direction", "Category", "TOR", "Tenant", "Subject", "Account", "Destination", "TimeStart", "TimeEnd", "CallDuration", "FallbackSubject"},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -35,7 +35,6 @@ type CmdGetCost struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.CallDescriptor
|
||||
rpcResult engine.CallCost
|
||||
clientArgs []string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -56,7 +55,7 @@ func (self *CmdGetCost) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetCost) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &engine.CallCost{}
|
||||
}
|
||||
|
||||
func (self *CmdGetCost) ClientArgs() []string {
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdGetDestination struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *StringWrapper
|
||||
rpcResult engine.Destination
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,5 @@ func (self *CmdGetDestination) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetDestination) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
return &engine.Destination{}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ type CmdGetMaxDuration struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.CallDescriptor
|
||||
rpcResult *float64
|
||||
clientArgs []string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -56,7 +55,8 @@ func (self *CmdGetMaxDuration) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdGetMaxDuration) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var f float64
|
||||
return &f
|
||||
}
|
||||
|
||||
func (self *CmdGetMaxDuration) ClientArgs() []string {
|
||||
|
||||
@@ -54,5 +54,6 @@ func (self *CmdSetRatingProfile) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdSetRatingProfile) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ type CmdReloadScheduler struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *StringWrapper
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -52,5 +51,6 @@ func (self *CmdReloadScheduler) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdReloadScheduler) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ type CmdStatus struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *StringWrapper
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -51,7 +50,8 @@ func (self *CmdStatus) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdStatus) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
func (self *CmdStatus) ClientArgs() (args []string) {
|
||||
|
||||
@@ -34,7 +34,6 @@ type CmdAddTriggeredAction struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *apier.AttrAddActionTrigger
|
||||
rpcResult string
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -54,5 +53,6 @@ func (self *CmdAddTriggeredAction) RpcParams() interface{} {
|
||||
}
|
||||
|
||||
func (self *CmdAddTriggeredAction) RpcResult() interface{} {
|
||||
return &self.rpcResult
|
||||
var s string
|
||||
return &s
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user