diff --git a/console/atributes_get_for_event.go b/console/atributes_get_for_event.go index b3817fedb..096eb0fc5 100644 --- a/console/atributes_get_for_event.go +++ b/console/atributes_get_for_event.go @@ -20,11 +20,12 @@ package console import ( "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) func init() { - c := &CmdAttributesProcessEvent{ + c := &CmdGetAttributeForEvent{ name: "get_attribute_for_event", rpcMethod: "AttributeSv1.GetAttributeForEvent", } @@ -33,22 +34,22 @@ func init() { } // Commander implementation -type CmdAttributesProcessEvent struct { +type CmdGetAttributeForEvent struct { name string rpcMethod string rpcParams interface{} *CommandExecuter } -func (self *CmdAttributesProcessEvent) Name() string { +func (self *CmdGetAttributeForEvent) Name() string { return self.name } -func (self *CmdAttributesProcessEvent) RpcMethod() string { +func (self *CmdGetAttributeForEvent) RpcMethod() string { return self.rpcMethod } -func (self *CmdAttributesProcessEvent) RpcParams(reset bool) interface{} { +func (self *CmdGetAttributeForEvent) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { mp := make(map[string]interface{}) self.rpcParams = &mp @@ -56,7 +57,7 @@ func (self *CmdAttributesProcessEvent) RpcParams(reset bool) interface{} { return self.rpcParams } -func (self *CmdAttributesProcessEvent) PostprocessRpcParams() error { //utils.CGREvent +func (self *CmdGetAttributeForEvent) PostprocessRpcParams() error { //utils.CGREvent param := self.rpcParams.(*map[string]interface{}) cgrev := utils.CGREvent{ Tenant: config.CgrConfig().DefaultTenant, @@ -70,7 +71,7 @@ func (self *CmdAttributesProcessEvent) PostprocessRpcParams() error { //utils.CG return nil } -func (self *CmdAttributesProcessEvent) RpcResult() interface{} { +func (self *CmdGetAttributeForEvent) RpcResult() interface{} { atr := engine.ExternalAttributeProfile{} return &atr } diff --git a/console/atributes_process_event.go b/console/atributes_process_event.go index a3840f62c..73ff834c6 100644 --- a/console/atributes_process_event.go +++ b/console/atributes_process_event.go @@ -20,6 +20,7 @@ package console import ( "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" ) diff --git a/console/atributes_set.go b/console/atributes_set.go index 057d16e62..fdc5f5f0b 100644 --- a/console/atributes_set.go +++ b/console/atributes_set.go @@ -21,7 +21,7 @@ package console import "github.com/cgrates/cgrates/engine" func init() { - c := &CmdSetResource{ + c := &CmdSetAttributes{ name: "attributes_set", rpcMethod: "ApierV1.SetAttributeProfile", rpcParams: &engine.ExternalAttributeProfile{}, @@ -31,33 +31,33 @@ func init() { } // Commander implementation -type CmdSetResource struct { +type CmdSetAttributes struct { name string rpcMethod string rpcParams *engine.ExternalAttributeProfile *CommandExecuter } -func (self *CmdSetResource) Name() string { +func (self *CmdSetAttributes) Name() string { return self.name } -func (self *CmdSetResource) RpcMethod() string { +func (self *CmdSetAttributes) RpcMethod() string { return self.rpcMethod } -func (self *CmdSetResource) RpcParams(reset bool) interface{} { +func (self *CmdSetAttributes) RpcParams(reset bool) interface{} { if reset || self.rpcParams == nil { self.rpcParams = &engine.ExternalAttributeProfile{} } return self.rpcParams } -func (self *CmdSetResource) PostprocessRpcParams() error { +func (self *CmdSetAttributes) PostprocessRpcParams() error { return nil } -func (self *CmdSetResource) RpcResult() interface{} { +func (self *CmdSetAttributes) RpcResult() interface{} { var s string return &s } diff --git a/console/statqueue_for_event.go b/console/statqueue_for_event.go new file mode 100644 index 000000000..801411983 --- /dev/null +++ b/console/statqueue_for_event.go @@ -0,0 +1,77 @@ +/* +Real-time Online/Offline Charging System (OCS) 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 +*/ + +package console + +import ( + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" +) + +func init() { + c := &CmdStatsQueueProcessEvent{ + name: "statsqueue_for_event", + rpcMethod: "StatSv1.GetStatQueuesForEvent", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdStatsQueueProcessEvent struct { + name string + rpcMethod string + rpcParams interface{} + *CommandExecuter +} + +func (self *CmdStatsQueueProcessEvent) Name() string { + return self.name +} + +func (self *CmdStatsQueueProcessEvent) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdStatsQueueProcessEvent) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + mp := make(map[string]interface{}) + self.rpcParams = &mp + } + return self.rpcParams +} + +func (self *CmdStatsQueueProcessEvent) PostprocessRpcParams() error { //utils.CGREvent + param := self.rpcParams.(*map[string]interface{}) + cgrev := utils.CGREvent{ + Tenant: config.CgrConfig().DefaultTenant, + ID: utils.UUIDSha1Prefix(), + Event: *param, + } + if (*param)[utils.Tenant] != nil && (*param)[utils.Tenant].(string) != "" { + cgrev.Tenant = (*param)[utils.Tenant].(string) + } + self.rpcParams = cgrev + return nil +} + +func (self *CmdStatsQueueProcessEvent) RpcResult() interface{} { + s := engine.StatQueues{} + return &s +} diff --git a/console/statqueue_process_event.go b/console/statqueue_process_event.go new file mode 100644 index 000000000..b4d01aeeb --- /dev/null +++ b/console/statqueue_process_event.go @@ -0,0 +1,76 @@ +/* +Real-time Online/Offline Charging System (OCS) 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 +*/ + +package console + +import ( + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/utils" +) + +func init() { + c := &CmdStatQueueProcessEvent{ + name: "statqueue_process_event", + rpcMethod: "StatSv1.ProcessEvent", + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdStatQueueProcessEvent struct { + name string + rpcMethod string + rpcParams interface{} + *CommandExecuter +} + +func (self *CmdStatQueueProcessEvent) Name() string { + return self.name +} + +func (self *CmdStatQueueProcessEvent) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdStatQueueProcessEvent) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + mp := make(map[string]interface{}) + self.rpcParams = &mp + } + return self.rpcParams +} + +func (self *CmdStatQueueProcessEvent) PostprocessRpcParams() error { //utils.CGREvent + param := self.rpcParams.(*map[string]interface{}) + cgrev := utils.CGREvent{ + Tenant: config.CgrConfig().DefaultTenant, + ID: utils.UUIDSha1Prefix(), + Event: *param, + } + if (*param)[utils.Tenant] != nil && (*param)[utils.Tenant].(string) != "" { + cgrev.Tenant = (*param)[utils.Tenant].(string) + } + self.rpcParams = cgrev + return nil +} + +func (self *CmdStatQueueProcessEvent) RpcResult() interface{} { + var s string + return &s +}