From 0962303baaffbcf1c581bc1bf8b48b4ef0a0586e Mon Sep 17 00:00:00 2001 From: TeoV Date: Sun, 19 Nov 2017 12:25:30 +0200 Subject: [PATCH] Add filter and resource in console --- console/filter.go | 66 ++++++++++++++++++++++++++++++++++++++ console/filter_remove.go | 63 ++++++++++++++++++++++++++++++++++++ console/filter_set.go | 63 ++++++++++++++++++++++++++++++++++++ console/resource.go | 66 ++++++++++++++++++++++++++++++++++++++ console/resource_remove.go | 63 ++++++++++++++++++++++++++++++++++++ console/resource_set.go | 63 ++++++++++++++++++++++++++++++++++++ 6 files changed, 384 insertions(+) create mode 100644 console/filter.go create mode 100644 console/filter_remove.go create mode 100644 console/filter_set.go create mode 100644 console/resource.go create mode 100644 console/resource_remove.go create mode 100644 console/resource_set.go diff --git a/console/filter.go b/console/filter.go new file mode 100644 index 000000000..035e7e9d9 --- /dev/null +++ b/console/filter.go @@ -0,0 +1,66 @@ +/* +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/engine" + "github.com/cgrates/cgrates/utils" +) + +func init() { + c := &CmdGetFilter{ + name: "filter", + rpcMethod: "ApierV1.GetFilter", + rpcParams: &utils.TenantID{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdGetFilter struct { + name string + rpcMethod string + rpcParams *utils.TenantID + *CommandExecuter +} + +func (self *CmdGetFilter) Name() string { + return self.name +} + +func (self *CmdGetFilter) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdGetFilter) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &utils.TenantID{} + } + return self.rpcParams +} + +func (self *CmdGetFilter) PostprocessRpcParams() error { + return nil +} + +func (self *CmdGetFilter) RpcResult() interface{} { + atr := engine.Filter{} + return &atr +} diff --git a/console/filter_remove.go b/console/filter_remove.go new file mode 100644 index 000000000..c52861aad --- /dev/null +++ b/console/filter_remove.go @@ -0,0 +1,63 @@ +/* +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/utils" + +func init() { + c := &CmdRemoveFilter{ + name: "filter_remove", + rpcMethod: "ApierV1.RemFilter", + rpcParams: &utils.TenantID{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdRemoveFilter struct { + name string + rpcMethod string + rpcParams *utils.TenantID + *CommandExecuter +} + +func (self *CmdRemoveFilter) Name() string { + return self.name +} + +func (self *CmdRemoveFilter) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdRemoveFilter) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &utils.TenantID{} + } + return self.rpcParams +} + +func (self *CmdRemoveFilter) PostprocessRpcParams() error { + return nil +} + +func (self *CmdRemoveFilter) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/filter_set.go b/console/filter_set.go new file mode 100644 index 000000000..29edfe8fe --- /dev/null +++ b/console/filter_set.go @@ -0,0 +1,63 @@ +/* +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/engine" + +func init() { + c := &CmdSetFilter{ + name: "filter_set", + rpcMethod: "ApierV1.SetFilter", + rpcParams: &engine.Filter{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdSetFilter struct { + name string + rpcMethod string + rpcParams *engine.Filter + *CommandExecuter +} + +func (self *CmdSetFilter) Name() string { + return self.name +} + +func (self *CmdSetFilter) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdSetFilter) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &engine.Filter{} + } + return self.rpcParams +} + +func (self *CmdSetFilter) PostprocessRpcParams() error { + return nil +} + +func (self *CmdSetFilter) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/resource.go b/console/resource.go new file mode 100644 index 000000000..3fec3c6d2 --- /dev/null +++ b/console/resource.go @@ -0,0 +1,66 @@ +/* +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/engine" + "github.com/cgrates/cgrates/utils" +) + +func init() { + c := &CmdGetResource{ + name: "resource", + rpcMethod: "ApierV1.GetResourceProfile", + rpcParams: &utils.TenantID{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdGetResource struct { + name string + rpcMethod string + rpcParams *utils.TenantID + *CommandExecuter +} + +func (self *CmdGetResource) Name() string { + return self.name +} + +func (self *CmdGetResource) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdGetResource) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &utils.TenantID{} + } + return self.rpcParams +} + +func (self *CmdGetResource) PostprocessRpcParams() error { + return nil +} + +func (self *CmdGetResource) RpcResult() interface{} { + atr := engine.ResourceProfile{} + return &atr +} diff --git a/console/resource_remove.go b/console/resource_remove.go new file mode 100644 index 000000000..dc34f19ed --- /dev/null +++ b/console/resource_remove.go @@ -0,0 +1,63 @@ +/* +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/utils" + +func init() { + c := &CmdRemoveResource{ + name: "resource_remove", + rpcMethod: "ApierV1.RemResourceProfile", + rpcParams: &utils.TenantID{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdRemoveResource struct { + name string + rpcMethod string + rpcParams *utils.TenantID + *CommandExecuter +} + +func (self *CmdRemoveResource) Name() string { + return self.name +} + +func (self *CmdRemoveResource) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdRemoveResource) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &utils.TenantID{} + } + return self.rpcParams +} + +func (self *CmdRemoveResource) PostprocessRpcParams() error { + return nil +} + +func (self *CmdRemoveResource) RpcResult() interface{} { + var s string + return &s +} diff --git a/console/resource_set.go b/console/resource_set.go new file mode 100644 index 000000000..2fc932e4b --- /dev/null +++ b/console/resource_set.go @@ -0,0 +1,63 @@ +/* +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/engine" + +func init() { + c := &CmdSetResource{ + name: "resource_set", + rpcMethod: "ApierV1.SetResourceProfile", + rpcParams: &engine.ResourceProfile{}, + } + commands[c.Name()] = c + c.CommandExecuter = &CommandExecuter{c} +} + +// Commander implementation +type CmdSetResource struct { + name string + rpcMethod string + rpcParams *engine.ResourceProfile + *CommandExecuter +} + +func (self *CmdSetResource) Name() string { + return self.name +} + +func (self *CmdSetResource) RpcMethod() string { + return self.rpcMethod +} + +func (self *CmdSetResource) RpcParams(reset bool) interface{} { + if reset || self.rpcParams == nil { + self.rpcParams = &engine.ResourceProfile{} + } + return self.rpcParams +} + +func (self *CmdSetResource) PostprocessRpcParams() error { + return nil +} + +func (self *CmdSetResource) RpcResult() interface{} { + var s string + return &s +}