Add console commands for Get*Profiles apis and update some of the others to improve consistency

This commit is contained in:
ionutboangiu
2022-01-17 16:18:22 +02:00
committed by Dan Christian Bogos
parent a927220fdb
commit b229d5861b
58 changed files with 1073 additions and 340 deletions

65
console/account.go Normal file
View File

@@ -0,0 +1,65 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetAccount{
name: "account",
rpcMethod: utils.AdminSv1GetAccount,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetAccount struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdGetAccount) Name() string {
return self.name
}
func (self *CmdGetAccount) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAccount) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdGetAccount) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAccount) RpcResult() interface{} {
var atr utils.Account
return &atr
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdGetAccountsIDs{
name: "accounts_ids",
c := &CmdGetAccountIDs{
name: "account_ids",
rpcMethod: utils.AdminSv1GetAccountIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdGetAccountsIDs struct {
type CmdGetAccountIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetAccountsIDs) Name() string {
func (self *CmdGetAccountIDs) Name() string {
return self.name
}
func (self *CmdGetAccountsIDs) RpcMethod() string {
func (self *CmdGetAccountIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAccountsIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetAccountIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetAccountsIDs) PostprocessRpcParams() error {
func (self *CmdGetAccountIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAccountsIDs) RpcResult() interface{} {
func (self *CmdGetAccountIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveAccounts{
name: "accounts_remove",
c := &CmdRemoveAccount{
name: "account_remove",
rpcMethod: utils.AdminSv1RemoveAccount,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -30,33 +30,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveAccounts struct {
type CmdRemoveAccount struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveAccounts) Name() string {
func (self *CmdRemoveAccount) Name() string {
return self.name
}
func (self *CmdRemoveAccounts) RpcMethod() string {
func (self *CmdRemoveAccount) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveAccounts) RpcParams(reset bool) interface{} {
func (self *CmdRemoveAccount) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveAccounts) PostprocessRpcParams() error {
func (self *CmdRemoveAccount) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveAccounts) RpcResult() interface{} {
func (self *CmdRemoveAccount) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -19,14 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import (
"github.com/cgrates/cgrates/apis"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetAccount{
name: "accounts_set",
name: "account_set",
rpcMethod: utils.AdminSv1SetAccount,
rpcParams: &utils.APIAccountWithOpts{},
rpcParams: &apis.APIAccountWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -35,7 +36,7 @@ func init() {
type CmdSetAccount struct {
name string
rpcMethod string
rpcParams *utils.APIAccountWithOpts
rpcParams *apis.APIAccountWithAPIOpts
*CommandExecuter
}
@@ -49,7 +50,7 @@ func (self *CmdSetAccount) RpcMethod() string {
func (self *CmdSetAccount) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.APIAccountWithOpts{APIAccount: new(utils.APIAccount)}
self.rpcParams = &apis.APIAccountWithAPIOpts{APIAccount: new(utils.APIAccount)}
}
return self.rpcParams
}

View File

@@ -25,8 +25,8 @@ import (
func init() {
c := &CmdGetAccounts{
name: "accounts",
rpcMethod: utils.AdminSv1GetAccount,
rpcParams: &utils.TenantIDWithAPIOpts{},
rpcMethod: utils.AdminSv1GetAccounts,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetAccounts struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetAccounts) RpcMethod() string {
func (self *CmdGetAccounts) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
@@ -60,6 +60,6 @@ func (self *CmdGetAccounts) PostprocessRpcParams() error {
}
func (self *CmdGetAccounts) RpcResult() interface{} {
var atr utils.Account
return &atr
var accs []*utils.Account
return &accs
}

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetAttributeProfile{
name: "attribute_profile",
rpcMethod: utils.AdminSv1GetAttributeProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetAttributeProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdGetAttributeProfile) Name() string {
return self.name
}
func (self *CmdGetAttributeProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAttributeProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdGetAttributeProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAttributeProfile) RpcResult() interface{} {
var atr engine.APIAttributeProfile
return &atr
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdGetAttributeIDs{
name: "attributes_profile_ids",
c := &CmdGetAttributeProfileIDs{
name: "attribute_profile_ids",
rpcMethod: utils.AdminSv1GetAttributeProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdGetAttributeIDs struct {
type CmdGetAttributeProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetAttributeIDs) Name() string {
func (self *CmdGetAttributeProfileIDs) Name() string {
return self.name
}
func (self *CmdGetAttributeIDs) RpcMethod() string {
func (self *CmdGetAttributeProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetAttributeIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetAttributeProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetAttributeIDs) PostprocessRpcParams() error {
func (self *CmdGetAttributeProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetAttributeIDs) RpcResult() interface{} {
func (self *CmdGetAttributeProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveAttributes{
name: "attributes_profile_remove",
c := &CmdRemoveAttributeProfile{
name: "attribute_profile_remove",
rpcMethod: utils.AdminSv1RemoveAttributeProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -30,33 +30,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveAttributes struct {
type CmdRemoveAttributeProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveAttributes) Name() string {
func (self *CmdRemoveAttributeProfile) Name() string {
return self.name
}
func (self *CmdRemoveAttributes) RpcMethod() string {
func (self *CmdRemoveAttributeProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveAttributes) RpcParams(reset bool) interface{} {
func (self *CmdRemoveAttributeProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveAttributes) PostprocessRpcParams() error {
func (self *CmdRemoveAttributeProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveAttributes) RpcResult() interface{} {
func (self *CmdRemoveAttributeProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -24,8 +24,8 @@ import (
)
func init() {
c := &CmdSetAttributes{
name: "attributes_profile_set",
c := &CmdSetAttributeProfile{
name: "attribute_profile_set",
rpcMethod: utils.AdminSv1SetAttributeProfile,
rpcParams: &engine.APIAttributeProfileWithAPIOpts{},
}
@@ -33,33 +33,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetAttributes struct {
type CmdSetAttributeProfile struct {
name string
rpcMethod string
rpcParams *engine.APIAttributeProfileWithAPIOpts
*CommandExecuter
}
func (self *CmdSetAttributes) Name() string {
func (self *CmdSetAttributeProfile) Name() string {
return self.name
}
func (self *CmdSetAttributes) RpcMethod() string {
func (self *CmdSetAttributeProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetAttributes) RpcParams(reset bool) interface{} {
func (self *CmdSetAttributeProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.APIAttributeProfileWithAPIOpts{APIAttributeProfile: new(engine.APIAttributeProfile)}
}
return self.rpcParams
}
func (self *CmdSetAttributes) PostprocessRpcParams() error {
func (self *CmdSetAttributeProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetAttributes) RpcResult() interface{} {
func (self *CmdSetAttributeProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -25,9 +25,9 @@ import (
func init() {
c := &CmdGetAttributes{
name: "attributes_profile",
rpcMethod: utils.AdminSv1GetAttributeProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
name: "attribute_profiles",
rpcMethod: utils.AdminSv1GetAttributeProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdGetAttributes struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdGetAttributes) RpcMethod() string {
func (self *CmdGetAttributes) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
@@ -61,6 +61,6 @@ func (self *CmdGetAttributes) PostprocessRpcParams() error {
}
func (self *CmdGetAttributes) RpcResult() interface{} {
var atr engine.AttributeProfile
var atr []*engine.APIAttributeProfile
return &atr
}

View File

@@ -24,43 +24,43 @@ import (
)
func init() {
c := &CmdGetChargers{
name: "chargers_profile",
c := &CmdGetChargerProfile{
name: "charger_profile",
rpcMethod: utils.AdminSv1GetChargerProfile,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetChargers struct {
type CmdGetChargerProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdGetChargers) Name() string {
func (self *CmdGetChargerProfile) Name() string {
return self.name
}
func (self *CmdGetChargers) RpcMethod() string {
func (self *CmdGetChargerProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetChargers) RpcParams(reset bool) interface{} {
func (self *CmdGetChargerProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdGetChargers) PostprocessRpcParams() error {
func (self *CmdGetChargerProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetChargers) RpcResult() interface{} {
func (self *CmdGetChargerProfile) RpcResult() interface{} {
var atr engine.ChargerProfile
return &atr
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdGetChargerIDs{
name: "chargers_profile_ids",
c := &CmdGetChargerProfileIDs{
name: "charger_profile_ids",
rpcMethod: utils.AdminSv1GetChargerProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdGetChargerIDs struct {
type CmdGetChargerProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetChargerIDs) Name() string {
func (self *CmdGetChargerProfileIDs) Name() string {
return self.name
}
func (self *CmdGetChargerIDs) RpcMethod() string {
func (self *CmdGetChargerProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetChargerIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetChargerProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetChargerIDs) PostprocessRpcParams() error {
func (self *CmdGetChargerProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetChargerIDs) RpcResult() interface{} {
func (self *CmdGetChargerProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveChargers{
name: "chargers_profile_remove",
c := &CmdRemoveChargerProfile{
name: "charger_profile_remove",
rpcMethod: utils.AdminSv1RemoveChargerProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -30,33 +30,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveChargers struct {
type CmdRemoveChargerProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveChargers) Name() string {
func (self *CmdRemoveChargerProfile) Name() string {
return self.name
}
func (self *CmdRemoveChargers) RpcMethod() string {
func (self *CmdRemoveChargerProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveChargers) RpcParams(reset bool) interface{} {
func (self *CmdRemoveChargerProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdRemoveChargers) PostprocessRpcParams() error {
func (self *CmdRemoveChargerProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveChargers) RpcResult() interface{} {
func (self *CmdRemoveChargerProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/apis"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetChargerProfile{
name: "charger_profile_set",
rpcMethod: utils.AdminSv1SetChargerProfile,
rpcParams: &apis.ChargerWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetChargerProfile struct {
name string
rpcMethod string
rpcParams *apis.ChargerWithAPIOpts
*CommandExecuter
}
func (self *CmdSetChargerProfile) Name() string {
return self.name
}
func (self *CmdSetChargerProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetChargerProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &apis.ChargerWithAPIOpts{ChargerProfile: new(engine.ChargerProfile)}
}
return self.rpcParams
}
func (self *CmdSetChargerProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetChargerProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetChargerProfiles{
name: "charger_profiles",
rpcMethod: utils.AdminSv1GetChargerProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetChargerProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetChargerProfiles) Name() string {
return self.name
}
func (self *CmdGetChargerProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetChargerProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetChargerProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetChargerProfiles) RpcResult() interface{} {
var atr []*engine.ChargerProfile
return &atr
}

View File

@@ -1,62 +0,0 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
/*
func init() {
c := &CmdSetChargers{
name: "chargers_profile_set",
rpcMethod: utils.AdminSv1SetChargerProfile,
rpcParams: &v1.ChargerWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetChargers struct {
name string
rpcMethod string
rpcParams *v1.ChargerWithAPIOpts
*CommandExecuter
}
func (self *CmdSetChargers) Name() string {
return self.name
}
func (self *CmdSetChargers) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetChargers) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.ChargerWithAPIOpts{ChargerProfile: new(engine.ChargerProfile)}
}
return self.rpcParams
}
func (self *CmdSetChargers) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetChargers) RpcResult() interface{} {
var s string
return &s
}
*/

View File

@@ -25,8 +25,9 @@ import (
func init() {
c := &CmdGetDispatcherHost{
name: "dispatchers_host",
name: "dispatcher_host",
rpcMethod: utils.AdminSv1GetDispatcherHost,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +37,7 @@ func init() {
type CmdGetDispatcherHost struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -50,7 +51,7 @@ func (self *CmdGetDispatcherHost) RpcMethod() string {
func (self *CmdGetDispatcherHost) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.TenantID)
self.rpcParams = new(utils.TenantIDWithAPIOpts)
}
return self.rpcParams
}

View File

@@ -24,8 +24,9 @@ import (
func init() {
c := &CmdGetDispatcherHostIDs{
name: "dispatchers_host_ids",
name: "dispatcher_host_ids",
rpcMethod: utils.AdminSv1GetDispatcherHostIDs,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -24,8 +24,9 @@ import (
func init() {
c := &CmdRemoveDispatcherHost{
name: "dispatchers_host_remove",
name: "dispatcher_host_remove",
rpcMethod: utils.AdminSv1RemoveDispatcherHost,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -25,8 +25,9 @@ import (
func init() {
c := &CmdSetDispatcherHost{
name: "dispatchers_host_set",
name: "dispatcher_host_set",
rpcMethod: utils.AdminSv1SetDispatcherHost,
rpcParams: &engine.DispatcherHostWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetDispatcherHosts{
name: "dispatcher_hosts",
rpcMethod: utils.AdminSv1GetDispatcherHosts,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetDispatcherHosts struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetDispatcherHosts) Name() string {
return self.name
}
func (self *CmdGetDispatcherHosts) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetDispatcherHosts) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.ArgsItemIDs)
}
return self.rpcParams
}
func (self *CmdGetDispatcherHosts) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetDispatcherHosts) RpcResult() interface{} {
var s []*engine.DispatcherHost
return &s
}

View File

@@ -25,8 +25,9 @@ import (
func init() {
c := &CmdGetDispatcherProfile{
name: "dispatchers_profile",
name: "dispatcher_profile",
rpcMethod: utils.AdminSv1GetDispatcherProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +37,7 @@ func init() {
type CmdGetDispatcherProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -50,7 +51,7 @@ func (self *CmdGetDispatcherProfile) RpcMethod() string {
func (self *CmdGetDispatcherProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.TenantID)
self.rpcParams = new(utils.TenantIDWithAPIOpts)
}
return self.rpcParams
}

View File

@@ -24,8 +24,9 @@ import (
func init() {
c := &CmdGetDispatcherProfileIDs{
name: "dispatchers_profile_ids",
name: "dispatcher_profile_ids",
rpcMethod: utils.AdminSv1GetDispatcherProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -24,8 +24,9 @@ import (
func init() {
c := &CmdRemoveDispatcherProfile{
name: "dispatchers_profile_remove",
name: "dispatcher_profile_remove",
rpcMethod: utils.AdminSv1RemoveDispatcherProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,16 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
/*
import (
"github.com/cgrates/cgrates/apis"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetDispatcherProfile{
name: "dispatchers_profile_set",
rpcMethod: utils.APIerSv1SetDispatcherProfile,
name: "dispatcher_profile_set",
rpcMethod: utils.AdminSv1SetDispatcherProfile,
rpcParams: &apis.DispatcherWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +38,7 @@ func init() {
type CmdSetDispatcherProfile struct {
name string
rpcMethod string
rpcParams *v1.DispatcherWithAPIOpts
rpcParams *apis.DispatcherWithAPIOpts
*CommandExecuter
}
@@ -51,7 +52,7 @@ func (self *CmdSetDispatcherProfile) RpcMethod() string {
func (self *CmdSetDispatcherProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.DispatcherWithAPIOpts{
self.rpcParams = &apis.DispatcherWithAPIOpts{
DispatcherProfile: new(engine.DispatcherProfile),
APIOpts: make(map[string]interface{}),
}
@@ -67,4 +68,3 @@ func (self *CmdSetDispatcherProfile) RpcResult() interface{} {
var s string
return &s
}
*/

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetDispatcherProfiles{
name: "dispatcher_profiles",
rpcMethod: utils.AdminSv1GetDispatcherProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetDispatcherProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetDispatcherProfiles) Name() string {
return self.name
}
func (self *CmdGetDispatcherProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetDispatcherProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.ArgsItemIDs)
}
return self.rpcParams
}
func (self *CmdGetDispatcherProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetDispatcherProfiles) RpcResult() interface{} {
var s []*engine.DispatcherProfile
return &s
}

View File

@@ -25,7 +25,7 @@ import (
func init() {
c := &CmdDispatcherProfile{
name: "dispatches_for_event",
name: "dispatchers_for_event",
rpcMethod: utils.DispatcherSv1GetProfilesForEvent,
}
commands[c.Name()] = c

View File

@@ -27,7 +27,7 @@ func init() {
c := &CmdGetFilter{
name: "filter",
rpcMethod: utils.AdminSv1GetFilter,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdGetFilter struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdGetFilter) RpcMethod() string {
func (self *CmdGetFilter) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}

66
console/filters.go Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetFilters{
name: "filters",
rpcMethod: utils.AdminSv1GetFilters,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetFilters struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetFilters) Name() string {
return self.name
}
func (self *CmdGetFilters) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetFilters) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetFilters) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetFilters) RpcResult() interface{} {
var atr []*engine.Filter
return &atr
}

View File

@@ -24,7 +24,7 @@ import (
func init() {
c := &CmdGetRateProfile{
name: "rates_profile",
name: "rate_profile",
rpcMethod: utils.AdminSv1GetRateProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdRateProfileIDs{
name: "rates_profile_ids",
c := &CmdGetRateProfileIDs{
name: "rate_profile_ids",
rpcMethod: utils.AdminSv1GetRateProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdRateProfileIDs struct {
type CmdGetRateProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdRateProfileIDs) Name() string {
func (self *CmdGetRateProfileIDs) Name() string {
return self.name
}
func (self *CmdRateProfileIDs) RpcMethod() string {
func (self *CmdGetRateProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRateProfileIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetRateProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdRateProfileIDs) PostprocessRpcParams() error {
func (self *CmdGetRateProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdRateProfileIDs) RpcResult() interface{} {
func (self *CmdGetRateProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -22,7 +22,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveRateProfile{
name: "rates_profile_remove",
name: "rate_profile_remove",
rpcMethod: utils.AdminSv1RemoveRateProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}

View File

@@ -24,7 +24,7 @@ import (
func init() {
c := &CmdSetRateProfile{
name: "rates_profile_set",
name: "rate_profile_set",
rpcMethod: utils.AdminSv1SetRateProfile,
rpcParams: &utils.APIRateProfile{},
}

65
console/rate_profiles.go Normal file
View File

@@ -0,0 +1,65 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetRateProfiles{
name: "rate_profiles",
rpcMethod: utils.AdminSv1GetRateProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetRateProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetRateProfiles) Name() string {
return self.name
}
func (self *CmdGetRateProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetRateProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetRateProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetRateProfiles) RpcResult() interface{} {
var atr []*utils.RateProfile
return &atr
}

View File

@@ -25,9 +25,9 @@ import (
func init() {
c := &CmdGetResourceProfile{
name: "resources_profile",
name: "resource_profile",
rpcMethod: utils.AdminSv1GetResourceProfile,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdGetResourceProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdGetResourceProfile) RpcMethod() string {
func (self *CmdGetResourceProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdGetResourceIDs{
name: "resources_profile_ids",
c := &CmdGetResourceProfileIDs{
name: "resource_profile_ids",
rpcMethod: utils.AdminSv1GetResourceProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdGetResourceIDs struct {
type CmdGetResourceProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetResourceIDs) Name() string {
func (self *CmdGetResourceProfileIDs) Name() string {
return self.name
}
func (self *CmdGetResourceIDs) RpcMethod() string {
func (self *CmdGetResourceProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetResourceIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetResourceProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetResourceIDs) PostprocessRpcParams() error {
func (self *CmdGetResourceProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetResourceIDs) RpcResult() interface{} {
func (self *CmdGetResourceProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveResource{
name: "resources_profile_remove",
c := &CmdRemoveResourceProfile{
name: "resource_profile_remove",
rpcMethod: utils.AdminSv1RemoveResourceProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -31,33 +31,33 @@ func init() {
}
// Commander implementation
type CmdRemoveResource struct {
type CmdRemoveResourceProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveResource) Name() string {
func (self *CmdRemoveResourceProfile) Name() string {
return self.name
}
func (self *CmdRemoveResource) RpcMethod() string {
func (self *CmdRemoveResourceProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveResource) RpcParams(reset bool) interface{} {
func (self *CmdRemoveResourceProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveResource) PostprocessRpcParams() error {
func (self *CmdRemoveResourceProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveResource) RpcResult() interface{} {
func (self *CmdRemoveResourceProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -24,8 +24,8 @@ import (
)
func init() {
c := &CmdSetResource{
name: "resources_profile_set",
c := &CmdSetResourceProfile{
name: "resource_profile_set",
rpcMethod: utils.AdminSv1SetResourceProfile,
rpcParams: &engine.ResourceProfileWithAPIOpts{},
}
@@ -34,22 +34,22 @@ func init() {
}
// Commander implementation
type CmdSetResource struct {
type CmdSetResourceProfile struct {
name string
rpcMethod string
rpcParams *engine.ResourceProfileWithAPIOpts
*CommandExecuter
}
func (self *CmdSetResource) Name() string {
func (self *CmdSetResourceProfile) Name() string {
return self.name
}
func (self *CmdSetResource) RpcMethod() string {
func (self *CmdSetResourceProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetResource) RpcParams(reset bool) interface{} {
func (self *CmdSetResourceProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ResourceProfileWithAPIOpts{
ResourceProfile: new(engine.ResourceProfile),
@@ -59,11 +59,11 @@ func (self *CmdSetResource) RpcParams(reset bool) interface{} {
return self.rpcParams
}
func (self *CmdSetResource) PostprocessRpcParams() error {
func (self *CmdSetResourceProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetResource) RpcResult() interface{} {
func (self *CmdSetResourceProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetResourceProfiles{
name: "resource_profiles",
rpcMethod: utils.AdminSv1GetResourceProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetResourceProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetResourceProfiles) Name() string {
return self.name
}
func (self *CmdGetResourceProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetResourceProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetResourceProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetResourceProfiles) RpcResult() interface{} {
var atr engine.ResourceProfile
return &atr
}

View File

@@ -24,42 +24,42 @@ import (
)
func init() {
c := &CmdGetRoute{
name: "routes_profile",
c := &CmdGetRouteProfile{
name: "route_profile",
rpcMethod: utils.AdminSv1GetRouteProfile,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdGetRoute struct {
type CmdGetRouteProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdGetRoute) Name() string {
func (self *CmdGetRouteProfile) Name() string {
return self.name
}
func (self *CmdGetRoute) RpcMethod() string {
func (self *CmdGetRouteProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetRoute) RpcParams(reset bool) interface{} {
func (self *CmdGetRouteProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}
func (self *CmdGetRoute) PostprocessRpcParams() error {
func (self *CmdGetRouteProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetRoute) RpcResult() interface{} {
func (self *CmdGetRouteProfile) RpcResult() interface{} {
var atr engine.APIRouteProfile
return &atr
}

View File

@@ -23,7 +23,7 @@ import (
)
func init() {
c := &CmdRouteIDs{
c := &CmdGetRouteProfileIDs{
name: "route_profile_ids",
rpcMethod: utils.AdminSv1GetRouteProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
@@ -32,33 +32,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRouteIDs struct {
type CmdGetRouteProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdRouteIDs) Name() string {
func (self *CmdGetRouteProfileIDs) Name() string {
return self.name
}
func (self *CmdRouteIDs) RpcMethod() string {
func (self *CmdGetRouteProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRouteIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetRouteProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdRouteIDs) PostprocessRpcParams() error {
func (self *CmdGetRouteProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdRouteIDs) RpcResult() interface{} {
func (self *CmdGetRouteProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveRoute{
name: "routes_profile_remove",
c := &CmdRemoveRouteProfile{
name: "route_profile_remove",
rpcMethod: utils.AdminSv1RemoveRouteProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -30,33 +30,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveRoute struct {
type CmdRemoveRouteProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveRoute) Name() string {
func (self *CmdRemoveRouteProfile) Name() string {
return self.name
}
func (self *CmdRemoveRoute) RpcMethod() string {
func (self *CmdRemoveRouteProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveRoute) RpcParams(reset bool) interface{} {
func (self *CmdRemoveRouteProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveRoute) PostprocessRpcParams() error {
func (self *CmdRemoveRouteProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveRoute) RpcResult() interface{} {
func (self *CmdRemoveRouteProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -0,0 +1,68 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetRouteProfile{
name: "route_profile_set",
rpcMethod: utils.AdminSv1SetRouteProfile,
rpcParams: &engine.APIRouteProfileWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetRouteProfile struct {
name string
rpcMethod string
rpcParams *engine.APIRouteProfileWithAPIOpts
*CommandExecuter
}
func (self *CmdSetRouteProfile) Name() string {
return self.name
}
func (self *CmdSetRouteProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetRouteProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.APIRouteProfileWithAPIOpts{
APIRouteProfile: new(engine.APIRouteProfile),
APIOpts: map[string]interface{}{},
}
}
return self.rpcParams
}
func (self *CmdSetRouteProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetRouteProfile) RpcResult() interface{} {
var s string
return &s
}

65
console/route_profiles.go Normal file
View File

@@ -0,0 +1,65 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetRouteProfiles{
name: "route_profiles",
rpcMethod: utils.AdminSv1GetRouteProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdGetRouteProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetRouteProfiles) Name() string {
return self.name
}
func (self *CmdGetRouteProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetRouteProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetRouteProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetRouteProfiles) RpcResult() interface{} {
var atr []*engine.APIRouteProfile
return &atr
}

View File

@@ -1,65 +0,0 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
/*
func init() {
c := &CmdSetRoute{
name: "routes_profile_set",
rpcMethod: utils.APIerSv1SetRouteProfile,
rpcParams: &v1.RouteWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdSetRoute struct {
name string
rpcMethod string
rpcParams *v1.RouteWithAPIOpts
*CommandExecuter
}
func (self *CmdSetRoute) Name() string {
return self.name
}
func (self *CmdSetRoute) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetRoute) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.RouteWithAPIOpts{
RouteProfile: new(engine.RouteProfile),
APIOpts: map[string]interface{}{},
}
}
return self.rpcParams
}
func (self *CmdSetRoute) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetRoute) RpcResult() interface{} {
var s string
return &s
}
*/

View File

@@ -27,7 +27,7 @@ func init() {
c := &CmdGetStatQueueProfile{
name: "stats_profile",
rpcMethod: utils.AdminSv1GetStatQueueProfile,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdGetStatQueueProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdGetStatQueueProfile) RpcMethod() string {
func (self *CmdGetStatQueueProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}

View File

@@ -23,7 +23,7 @@ import (
)
func init() {
c := &CmdGetStatQueueIDs{
c := &CmdGetStatQueueProfileIDs{
name: "stats_profile_ids",
rpcMethod: utils.AdminSv1GetStatQueueProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
@@ -33,33 +33,33 @@ func init() {
}
// Commander implementation
type CmdGetStatQueueIDs struct {
type CmdGetStatQueueProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetStatQueueIDs) Name() string {
func (self *CmdGetStatQueueProfileIDs) Name() string {
return self.name
}
func (self *CmdGetStatQueueIDs) RpcMethod() string {
func (self *CmdGetStatQueueProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetStatQueueIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetStatQueueProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetStatQueueIDs) PostprocessRpcParams() error {
func (self *CmdGetStatQueueProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetStatQueueIDs) RpcResult() interface{} {
func (self *CmdGetStatQueueProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

66
console/stats_profiles.go Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetStatQueueProfiles{
name: "stats_profiles",
rpcMethod: utils.AdminSv1GetStatQueueProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
// Commander implementation
type CmdGetStatQueueProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetStatQueueProfiles) Name() string {
return self.name
}
func (self *CmdGetStatQueueProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetStatQueueProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetStatQueueProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetStatQueueProfiles) RpcResult() interface{} {
var atr []*engine.StatQueueProfile
return &atr
}

View File

@@ -25,9 +25,9 @@ import (
func init() {
c := &CmdGetThresholdProfile{
name: "thresholds_profile",
name: "threshold_profile",
rpcMethod: utils.AdminSv1GetThresholdProfile,
rpcParams: &utils.TenantID{},
rpcParams: &utils.TenantIDWithAPIOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +36,7 @@ func init() {
type CmdGetThresholdProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantID
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
@@ -50,7 +50,7 @@ func (self *CmdGetThresholdProfile) RpcMethod() string {
func (self *CmdGetThresholdProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantID{}
self.rpcParams = &utils.TenantIDWithAPIOpts{}
}
return self.rpcParams
}

View File

@@ -23,8 +23,8 @@ import (
)
func init() {
c := &CmdGetThresholdIDs{
name: "thresholds_profile_ids",
c := &CmdGetThresholdProfileIDs{
name: "threshold_profile_ids",
rpcMethod: utils.AdminSv1GetThresholdProfileIDs,
rpcParams: &utils.ArgsItemIDs{},
}
@@ -32,33 +32,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdGetThresholdIDs struct {
type CmdGetThresholdProfileIDs struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetThresholdIDs) Name() string {
func (self *CmdGetThresholdProfileIDs) Name() string {
return self.name
}
func (self *CmdGetThresholdIDs) RpcMethod() string {
func (self *CmdGetThresholdProfileIDs) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetThresholdIDs) RpcParams(reset bool) interface{} {
func (self *CmdGetThresholdProfileIDs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetThresholdIDs) PostprocessRpcParams() error {
func (self *CmdGetThresholdProfileIDs) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetThresholdIDs) RpcResult() interface{} {
func (self *CmdGetThresholdProfileIDs) RpcResult() interface{} {
var atr []string
return &atr
}

View File

@@ -21,8 +21,8 @@ package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveThreshold{
name: "thresholds_profile_remove",
c := &CmdRemoveThresholdProfile{
name: "threshold_profile_remove",
rpcMethod: utils.AdminSv1RemoveThresholdProfile,
rpcParams: &utils.TenantIDWithAPIOpts{},
}
@@ -30,33 +30,33 @@ func init() {
c.CommandExecuter = &CommandExecuter{c}
}
type CmdRemoveThreshold struct {
type CmdRemoveThresholdProfile struct {
name string
rpcMethod string
rpcParams *utils.TenantIDWithAPIOpts
*CommandExecuter
}
func (self *CmdRemoveThreshold) Name() string {
func (self *CmdRemoveThresholdProfile) Name() string {
return self.name
}
func (self *CmdRemoveThreshold) RpcMethod() string {
func (self *CmdRemoveThresholdProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdRemoveThreshold) RpcParams(reset bool) interface{} {
func (self *CmdRemoveThresholdProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithAPIOpts{APIOpts: make(map[string]interface{})}
}
return self.rpcParams
}
func (self *CmdRemoveThreshold) PostprocessRpcParams() error {
func (self *CmdRemoveThresholdProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdRemoveThreshold) RpcResult() interface{} {
func (self *CmdRemoveThresholdProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -24,8 +24,8 @@ import (
)
func init() {
c := &CmdSetThreshold{
name: "thresholds_profile_set",
c := &CmdSetThresholdProfile{
name: "threshold_profile_set",
rpcMethod: utils.AdminSv1SetThresholdProfile,
rpcParams: &engine.ThresholdProfileWithAPIOpts{},
}
@@ -34,22 +34,22 @@ func init() {
}
// Commander implementation
type CmdSetThreshold struct {
type CmdSetThresholdProfile struct {
name string
rpcMethod string
rpcParams *engine.ThresholdProfileWithAPIOpts
*CommandExecuter
}
func (self *CmdSetThreshold) Name() string {
func (self *CmdSetThresholdProfile) Name() string {
return self.name
}
func (self *CmdSetThreshold) RpcMethod() string {
func (self *CmdSetThresholdProfile) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdSetThreshold) RpcParams(reset bool) interface{} {
func (self *CmdSetThresholdProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ThresholdProfileWithAPIOpts{
ThresholdProfile: new(engine.ThresholdProfile),
@@ -59,11 +59,11 @@ func (self *CmdSetThreshold) RpcParams(reset bool) interface{} {
return self.rpcParams
}
func (self *CmdSetThreshold) PostprocessRpcParams() error {
func (self *CmdSetThresholdProfile) PostprocessRpcParams() error {
return nil
}
func (self *CmdSetThreshold) RpcResult() interface{} {
func (self *CmdSetThresholdProfile) RpcResult() interface{} {
var s string
return &s
}

View File

@@ -0,0 +1,65 @@
/*
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 <http://www.gnu.org/licenses/>
*/
package console
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetThresholdProfiles{
name: "threshold_profiles",
rpcMethod: utils.AdminSv1GetThresholdProfiles,
rpcParams: &utils.ArgsItemIDs{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
}
type CmdGetThresholdProfiles struct {
name string
rpcMethod string
rpcParams *utils.ArgsItemIDs
*CommandExecuter
}
func (self *CmdGetThresholdProfiles) Name() string {
return self.name
}
func (self *CmdGetThresholdProfiles) RpcMethod() string {
return self.rpcMethod
}
func (self *CmdGetThresholdProfiles) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgsItemIDs{}
}
return self.rpcParams
}
func (self *CmdGetThresholdProfiles) PostprocessRpcParams() error {
return nil
}
func (self *CmdGetThresholdProfiles) RpcResult() interface{} {
var atr []*engine.ThresholdProfile
return &atr
}

View File

@@ -487,12 +487,6 @@ func (bWws BalancesWithWeight) Balances() (blncs []*Balance) {
return
}
// APIAccountWithOpts is used in API calls
type APIAccountWithOpts struct {
*APIAccount
APIOpts map[string]interface{}
}
type AccountWithAPIOpts struct {
*Account
APIOpts map[string]interface{}

View File

@@ -1161,11 +1161,13 @@ const (
AdminSv1Ping = "AdminSv1.Ping"
AdminSv1SetDispatcherProfile = "AdminSv1.SetDispatcherProfile"
AdminSv1GetDispatcherProfile = "AdminSv1.GetDispatcherProfile"
AdminSv1GetDispatcherProfiles = "AdminSv1.GetDispatcherProfiles"
AdminSv1GetDispatcherProfileIDs = "AdminSv1.GetDispatcherProfileIDs"
AdminSv1RemoveDispatcherProfile = "AdminSv1.RemoveDispatcherProfile"
// APIerSv1SetBalances = "APIerSv1.SetBalances"
AdminSv1SetDispatcherHost = "AdminSv1.SetDispatcherHost"
AdminSv1GetDispatcherHost = "AdminSv1.GetDispatcherHost"
AdminSv1GetDispatcherHosts = "AdminSv1.GetDispatcherHosts"
AdminSv1GetDispatcherHostIDs = "AdminSv1.GetDispatcherHostIDs"
AdminSv1RemoveDispatcherHost = "AdminSv1.RemoveDispatcherHost"
// APIerSv1GetEventCost = "APIerSv1.GetEventCost"