From b229d5861b21639ca8c4703833f582d30ac554be Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Mon, 17 Jan 2022 16:18:22 +0200 Subject: [PATCH] Add console commands for Get*Profiles apis and update some of the others to improve consistency --- apis/{account.go => accounts.go} | 0 ...account_it_test.go => accounts_it_test.go} | 0 apis/{account_test.go => accounts_test.go} | 0 console/account.go | 65 ++++++++++++++++++ ...accounts_profile_ids.go => account_ids.go} | 16 ++--- ...ounts_profile_rem.go => account_remove.go} | 16 ++--- ...accounts_profile_set.go => account_set.go} | 9 +-- console/{accounts_profile.go => accounts.go} | 12 ++-- console/attribute_profile.go | 66 ++++++++++++++++++ ...rofile_ids.go => attribute_profile_ids.go} | 16 ++--- ...ile_rem.go => attribute_profile_remove.go} | 16 ++--- ...rofile_set.go => attribute_profile_set.go} | 16 ++--- ...butes_profile.go => attribute_profiles.go} | 12 ++-- ...chargers_profile.go => charger_profile.go} | 22 +++--- ..._profile_ids.go => charger_profile_ids.go} | 16 ++--- ...ofile_rem.go => charger_profile_remove.go} | 16 ++--- console/charger_profile_set.go | 66 ++++++++++++++++++ console/charger_profiles.go | 66 ++++++++++++++++++ console/chargers_profile_set.go | 62 ----------------- ...dispatchers_host.go => dispatcher_host.go} | 7 +- ...ers_host_ids.go => dispatcher_host_ids.go} | 3 +- ..._host_rem.go => dispatcher_host_remove.go} | 3 +- ...ers_host_set.go => dispatcher_host_set.go} | 3 +- console/dispatcher_hosts.go | 66 ++++++++++++++++++ ...chers_profile.go => dispatcher_profile.go} | 7 +- ...ofile_ids.go => dispatcher_profile_ids.go} | 3 +- ...le_rem.go => dispatcher_profile_remove.go} | 3 +- ...ofile_set.go => dispatcher_profile_set.go} | 12 ++-- console/dispatcher_profiles.go | 66 ++++++++++++++++++ console/dispatchers_for_event.go | 2 +- console/filter.go | 6 +- console/filters.go | 66 ++++++++++++++++++ console/{rates_profile.go => rate_profile.go} | 2 +- ...tes_profile_ids.go => rate_profile_ids.go} | 16 ++--- ...ofile_remove.go => rate_profile_remove.go} | 2 +- ...tes_profile_set.go => rate_profile_set.go} | 2 +- console/rate_profiles.go | 65 ++++++++++++++++++ ...sources_profile.go => resource_profile.go} | 8 +-- ...profile_ids.go => resource_profile_ids.go} | 16 ++--- ...file_rem.go => resource_profile_remove.go} | 16 ++--- ...profile_set.go => resource_profile_set.go} | 16 ++--- console/resource_profiles.go | 66 ++++++++++++++++++ .../{routes_profile.go => route_profile.go} | 22 +++--- ...es_profile_ids.go => route_profile_ids.go} | 14 ++-- ...file_remove.go => route_profile_remove.go} | 16 ++--- console/route_profile_set.go | 68 +++++++++++++++++++ console/route_profiles.go | 65 ++++++++++++++++++ console/routes_profile_set.go | 65 ------------------ console/stats_profile.go | 6 +- console/stats_profile_ids.go | 14 ++-- console/stats_profiles.go | 66 ++++++++++++++++++ ...sholds_profile.go => threshold_profile.go} | 8 +-- ...rofile_ids.go => threshold_profile_ids.go} | 16 ++--- ..._remove.go => threshold_profile_remove.go} | 16 ++--- ...rofile_set.go => threshold_profile_set.go} | 16 ++--- console/threshold_profiles.go | 65 ++++++++++++++++++ utils/account.go | 6 -- utils/consts.go | 2 + 58 files changed, 1073 insertions(+), 340 deletions(-) rename apis/{account.go => accounts.go} (100%) rename apis/{account_it_test.go => accounts_it_test.go} (100%) rename apis/{account_test.go => accounts_test.go} (100%) create mode 100644 console/account.go rename console/{accounts_profile_ids.go => account_ids.go} (77%) rename console/{accounts_profile_rem.go => account_remove.go} (77%) rename console/{accounts_profile_set.go => account_set.go} (86%) rename console/{accounts_profile.go => accounts.go} (87%) create mode 100644 console/attribute_profile.go rename console/{attributes_profile_ids.go => attribute_profile_ids.go} (74%) rename console/{attributes_profile_rem.go => attribute_profile_remove.go} (74%) rename console/{attributes_profile_set.go => attribute_profile_set.go} (76%) rename console/{attributes_profile.go => attribute_profiles.go} (85%) rename console/{chargers_profile.go => charger_profile.go} (69%) rename console/{chargers_profile_ids.go => charger_profile_ids.go} (75%) rename console/{chargers_profile_rem.go => charger_profile_remove.go} (74%) create mode 100644 console/charger_profile_set.go create mode 100644 console/charger_profiles.go delete mode 100644 console/chargers_profile_set.go rename console/{dispatchers_host.go => dispatcher_host.go} (90%) rename console/{dispatchers_host_ids.go => dispatcher_host_ids.go} (95%) rename console/{dispatchers_host_rem.go => dispatcher_host_remove.go} (95%) rename console/{dispatchers_host_set.go => dispatcher_host_set.go} (95%) create mode 100644 console/dispatcher_hosts.go rename console/{dispatchers_profile.go => dispatcher_profile.go} (90%) rename console/{dispatchers_profile_ids.go => dispatcher_profile_ids.go} (95%) rename console/{dispatchers_profile_rem.go => dispatcher_profile_remove.go} (95%) rename console/{dispatchers_profile_set.go => dispatcher_profile_set.go} (86%) create mode 100644 console/dispatcher_profiles.go create mode 100644 console/filters.go rename console/{rates_profile.go => rate_profile.go} (98%) rename console/{rates_profile_ids.go => rate_profile_ids.go} (76%) rename console/{rates_profile_remove.go => rate_profile_remove.go} (97%) rename console/{rates_profile_set.go => rate_profile_set.go} (97%) create mode 100644 console/rate_profiles.go rename console/{resources_profile.go => resource_profile.go} (91%) rename console/{resources_profile_ids.go => resource_profile_ids.go} (74%) rename console/{resources_profile_rem.go => resource_profile_remove.go} (75%) rename console/{resources_profile_set.go => resource_profile_set.go} (78%) create mode 100644 console/resource_profiles.go rename console/{routes_profile.go => route_profile.go} (70%) rename console/{routes_profile_ids.go => route_profile_ids.go} (77%) rename console/{routes_profile_remove.go => route_profile_remove.go} (76%) create mode 100644 console/route_profile_set.go create mode 100644 console/route_profiles.go delete mode 100644 console/routes_profile_set.go create mode 100644 console/stats_profiles.go rename console/{thresholds_profile.go => threshold_profile.go} (91%) rename console/{thresholds_profile_ids.go => threshold_profile_ids.go} (74%) rename console/{thresholds_profile_remove.go => threshold_profile_remove.go} (74%) rename console/{thresholds_profile_set.go => threshold_profile_set.go} (77%) create mode 100644 console/threshold_profiles.go diff --git a/apis/account.go b/apis/accounts.go similarity index 100% rename from apis/account.go rename to apis/accounts.go diff --git a/apis/account_it_test.go b/apis/accounts_it_test.go similarity index 100% rename from apis/account_it_test.go rename to apis/accounts_it_test.go diff --git a/apis/account_test.go b/apis/accounts_test.go similarity index 100% rename from apis/account_test.go rename to apis/accounts_test.go diff --git a/console/account.go b/console/account.go new file mode 100644 index 000000000..91b46c3f4 --- /dev/null +++ b/console/account.go @@ -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 +*/ + +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 +} diff --git a/console/accounts_profile_ids.go b/console/account_ids.go similarity index 77% rename from console/accounts_profile_ids.go rename to console/account_ids.go index 048a6e17c..7005d4444 100644 --- a/console/accounts_profile_ids.go +++ b/console/account_ids.go @@ -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 } diff --git a/console/accounts_profile_rem.go b/console/account_remove.go similarity index 77% rename from console/accounts_profile_rem.go rename to console/account_remove.go index cd1e98704..4c465cd39 100644 --- a/console/accounts_profile_rem.go +++ b/console/account_remove.go @@ -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 } diff --git a/console/accounts_profile_set.go b/console/account_set.go similarity index 86% rename from console/accounts_profile_set.go rename to console/account_set.go index 950468f12..58b7d12a2 100644 --- a/console/accounts_profile_set.go +++ b/console/account_set.go @@ -19,14 +19,15 @@ along with this program. If not, see 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 } diff --git a/console/accounts_profile.go b/console/accounts.go similarity index 87% rename from console/accounts_profile.go rename to console/accounts.go index 92e93264d..b1a2c6602 100644 --- a/console/accounts_profile.go +++ b/console/accounts.go @@ -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 } diff --git a/console/attribute_profile.go b/console/attribute_profile.go new file mode 100644 index 000000000..7ae0a7ca1 --- /dev/null +++ b/console/attribute_profile.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 := &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 +} diff --git a/console/attributes_profile_ids.go b/console/attribute_profile_ids.go similarity index 74% rename from console/attributes_profile_ids.go rename to console/attribute_profile_ids.go index 765283089..52a97e6e4 100644 --- a/console/attributes_profile_ids.go +++ b/console/attribute_profile_ids.go @@ -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 } diff --git a/console/attributes_profile_rem.go b/console/attribute_profile_remove.go similarity index 74% rename from console/attributes_profile_rem.go rename to console/attribute_profile_remove.go index 91dcd1336..5f62e57e3 100644 --- a/console/attributes_profile_rem.go +++ b/console/attribute_profile_remove.go @@ -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 } diff --git a/console/attributes_profile_set.go b/console/attribute_profile_set.go similarity index 76% rename from console/attributes_profile_set.go rename to console/attribute_profile_set.go index a88b77788..1353f1186 100644 --- a/console/attributes_profile_set.go +++ b/console/attribute_profile_set.go @@ -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 } diff --git a/console/attributes_profile.go b/console/attribute_profiles.go similarity index 85% rename from console/attributes_profile.go rename to console/attribute_profiles.go index fa54f57ec..ac9b75ccb 100644 --- a/console/attributes_profile.go +++ b/console/attribute_profiles.go @@ -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 } diff --git a/console/chargers_profile.go b/console/charger_profile.go similarity index 69% rename from console/chargers_profile.go rename to console/charger_profile.go index cad307803..4ce66cf70 100644 --- a/console/chargers_profile.go +++ b/console/charger_profile.go @@ -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 } diff --git a/console/chargers_profile_ids.go b/console/charger_profile_ids.go similarity index 75% rename from console/chargers_profile_ids.go rename to console/charger_profile_ids.go index d634efd9d..bd09361af 100644 --- a/console/chargers_profile_ids.go +++ b/console/charger_profile_ids.go @@ -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 } diff --git a/console/chargers_profile_rem.go b/console/charger_profile_remove.go similarity index 74% rename from console/chargers_profile_rem.go rename to console/charger_profile_remove.go index 3f70f2844..ba6bd2a53 100644 --- a/console/chargers_profile_rem.go +++ b/console/charger_profile_remove.go @@ -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 } diff --git a/console/charger_profile_set.go b/console/charger_profile_set.go new file mode 100644 index 000000000..002c7a45c --- /dev/null +++ b/console/charger_profile_set.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/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 +} diff --git a/console/charger_profiles.go b/console/charger_profiles.go new file mode 100644 index 000000000..d5e08c451 --- /dev/null +++ b/console/charger_profiles.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 := &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 +} diff --git a/console/chargers_profile_set.go b/console/chargers_profile_set.go deleted file mode 100644 index c33eab8ba..000000000 --- a/console/chargers_profile_set.go +++ /dev/null @@ -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 -*/ - -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 -} -*/ diff --git a/console/dispatchers_host.go b/console/dispatcher_host.go similarity index 90% rename from console/dispatchers_host.go rename to console/dispatcher_host.go index 6042d1d7a..12b2b4055 100644 --- a/console/dispatchers_host.go +++ b/console/dispatcher_host.go @@ -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 } diff --git a/console/dispatchers_host_ids.go b/console/dispatcher_host_ids.go similarity index 95% rename from console/dispatchers_host_ids.go rename to console/dispatcher_host_ids.go index d980923e2..aae9337c4 100644 --- a/console/dispatchers_host_ids.go +++ b/console/dispatcher_host_ids.go @@ -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} diff --git a/console/dispatchers_host_rem.go b/console/dispatcher_host_remove.go similarity index 95% rename from console/dispatchers_host_rem.go rename to console/dispatcher_host_remove.go index c527bc181..cf3851daf 100644 --- a/console/dispatchers_host_rem.go +++ b/console/dispatcher_host_remove.go @@ -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} diff --git a/console/dispatchers_host_set.go b/console/dispatcher_host_set.go similarity index 95% rename from console/dispatchers_host_set.go rename to console/dispatcher_host_set.go index 6c04031fa..e7860fc1d 100644 --- a/console/dispatchers_host_set.go +++ b/console/dispatcher_host_set.go @@ -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} diff --git a/console/dispatcher_hosts.go b/console/dispatcher_hosts.go new file mode 100644 index 000000000..15a8e3491 --- /dev/null +++ b/console/dispatcher_hosts.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 := &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 +} diff --git a/console/dispatchers_profile.go b/console/dispatcher_profile.go similarity index 90% rename from console/dispatchers_profile.go rename to console/dispatcher_profile.go index 3d8590073..3998b6f4c 100644 --- a/console/dispatchers_profile.go +++ b/console/dispatcher_profile.go @@ -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 } diff --git a/console/dispatchers_profile_ids.go b/console/dispatcher_profile_ids.go similarity index 95% rename from console/dispatchers_profile_ids.go rename to console/dispatcher_profile_ids.go index 4fed57d98..9f5ce3c6d 100644 --- a/console/dispatchers_profile_ids.go +++ b/console/dispatcher_profile_ids.go @@ -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} diff --git a/console/dispatchers_profile_rem.go b/console/dispatcher_profile_remove.go similarity index 95% rename from console/dispatchers_profile_rem.go rename to console/dispatcher_profile_remove.go index d706d8439..6ee2c7e47 100644 --- a/console/dispatchers_profile_rem.go +++ b/console/dispatcher_profile_remove.go @@ -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} diff --git a/console/dispatchers_profile_set.go b/console/dispatcher_profile_set.go similarity index 86% rename from console/dispatchers_profile_set.go rename to console/dispatcher_profile_set.go index 2dcd5a7cc..dbfc34723 100644 --- a/console/dispatchers_profile_set.go +++ b/console/dispatcher_profile_set.go @@ -18,16 +18,17 @@ along with this program. If not, see 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 } -*/ diff --git a/console/dispatcher_profiles.go b/console/dispatcher_profiles.go new file mode 100644 index 000000000..fbe2cef8e --- /dev/null +++ b/console/dispatcher_profiles.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 := &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 +} diff --git a/console/dispatchers_for_event.go b/console/dispatchers_for_event.go index 26533ba71..d86206bf5 100644 --- a/console/dispatchers_for_event.go +++ b/console/dispatchers_for_event.go @@ -25,7 +25,7 @@ import ( func init() { c := &CmdDispatcherProfile{ - name: "dispatches_for_event", + name: "dispatchers_for_event", rpcMethod: utils.DispatcherSv1GetProfilesForEvent, } commands[c.Name()] = c diff --git a/console/filter.go b/console/filter.go index e61ea8fec..e22b94d76 100644 --- a/console/filter.go +++ b/console/filter.go @@ -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 } diff --git a/console/filters.go b/console/filters.go new file mode 100644 index 000000000..155076f1c --- /dev/null +++ b/console/filters.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 := &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 +} diff --git a/console/rates_profile.go b/console/rate_profile.go similarity index 98% rename from console/rates_profile.go rename to console/rate_profile.go index b2a99426a..d88025557 100644 --- a/console/rates_profile.go +++ b/console/rate_profile.go @@ -24,7 +24,7 @@ import ( func init() { c := &CmdGetRateProfile{ - name: "rates_profile", + name: "rate_profile", rpcMethod: utils.AdminSv1GetRateProfile, rpcParams: &utils.TenantIDWithAPIOpts{}, } diff --git a/console/rates_profile_ids.go b/console/rate_profile_ids.go similarity index 76% rename from console/rates_profile_ids.go rename to console/rate_profile_ids.go index 240b9b90e..fefce357a 100644 --- a/console/rates_profile_ids.go +++ b/console/rate_profile_ids.go @@ -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 } diff --git a/console/rates_profile_remove.go b/console/rate_profile_remove.go similarity index 97% rename from console/rates_profile_remove.go rename to console/rate_profile_remove.go index d4f2f90e8..b52fdcf6a 100644 --- a/console/rates_profile_remove.go +++ b/console/rate_profile_remove.go @@ -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{}, } diff --git a/console/rates_profile_set.go b/console/rate_profile_set.go similarity index 97% rename from console/rates_profile_set.go rename to console/rate_profile_set.go index 2ba4aa7ac..4ec14c7c9 100644 --- a/console/rates_profile_set.go +++ b/console/rate_profile_set.go @@ -24,7 +24,7 @@ import ( func init() { c := &CmdSetRateProfile{ - name: "rates_profile_set", + name: "rate_profile_set", rpcMethod: utils.AdminSv1SetRateProfile, rpcParams: &utils.APIRateProfile{}, } diff --git a/console/rate_profiles.go b/console/rate_profiles.go new file mode 100644 index 000000000..594b241af --- /dev/null +++ b/console/rate_profiles.go @@ -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 +*/ + +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 +} diff --git a/console/resources_profile.go b/console/resource_profile.go similarity index 91% rename from console/resources_profile.go rename to console/resource_profile.go index c436e90a9..64d017092 100644 --- a/console/resources_profile.go +++ b/console/resource_profile.go @@ -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 } diff --git a/console/resources_profile_ids.go b/console/resource_profile_ids.go similarity index 74% rename from console/resources_profile_ids.go rename to console/resource_profile_ids.go index 63b65782c..7dd7cba5d 100644 --- a/console/resources_profile_ids.go +++ b/console/resource_profile_ids.go @@ -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 } diff --git a/console/resources_profile_rem.go b/console/resource_profile_remove.go similarity index 75% rename from console/resources_profile_rem.go rename to console/resource_profile_remove.go index 89a63affc..97577099d 100644 --- a/console/resources_profile_rem.go +++ b/console/resource_profile_remove.go @@ -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 } diff --git a/console/resources_profile_set.go b/console/resource_profile_set.go similarity index 78% rename from console/resources_profile_set.go rename to console/resource_profile_set.go index b65074eb4..472f56a31 100644 --- a/console/resources_profile_set.go +++ b/console/resource_profile_set.go @@ -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 } diff --git a/console/resource_profiles.go b/console/resource_profiles.go new file mode 100644 index 000000000..3a29c9352 --- /dev/null +++ b/console/resource_profiles.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 := &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 +} diff --git a/console/routes_profile.go b/console/route_profile.go similarity index 70% rename from console/routes_profile.go rename to console/route_profile.go index fb545380f..31fbf586b 100644 --- a/console/routes_profile.go +++ b/console/route_profile.go @@ -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 } diff --git a/console/routes_profile_ids.go b/console/route_profile_ids.go similarity index 77% rename from console/routes_profile_ids.go rename to console/route_profile_ids.go index cda5b9662..27aee38e3 100644 --- a/console/routes_profile_ids.go +++ b/console/route_profile_ids.go @@ -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 } diff --git a/console/routes_profile_remove.go b/console/route_profile_remove.go similarity index 76% rename from console/routes_profile_remove.go rename to console/route_profile_remove.go index f0182c98a..7d02defdd 100644 --- a/console/routes_profile_remove.go +++ b/console/route_profile_remove.go @@ -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 } diff --git a/console/route_profile_set.go b/console/route_profile_set.go new file mode 100644 index 000000000..5fea9828e --- /dev/null +++ b/console/route_profile_set.go @@ -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 +*/ + +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 +} diff --git a/console/route_profiles.go b/console/route_profiles.go new file mode 100644 index 000000000..8d775032e --- /dev/null +++ b/console/route_profiles.go @@ -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 +*/ + +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 +} diff --git a/console/routes_profile_set.go b/console/routes_profile_set.go deleted file mode 100644 index 48bd29f90..000000000 --- a/console/routes_profile_set.go +++ /dev/null @@ -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 -*/ - -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 -} -*/ diff --git a/console/stats_profile.go b/console/stats_profile.go index 6fafdae26..97fdeeaf1 100644 --- a/console/stats_profile.go +++ b/console/stats_profile.go @@ -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 } diff --git a/console/stats_profile_ids.go b/console/stats_profile_ids.go index 31456b968..f92edad18 100644 --- a/console/stats_profile_ids.go +++ b/console/stats_profile_ids.go @@ -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 } diff --git a/console/stats_profiles.go b/console/stats_profiles.go new file mode 100644 index 000000000..f8f62251f --- /dev/null +++ b/console/stats_profiles.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 := &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 +} diff --git a/console/thresholds_profile.go b/console/threshold_profile.go similarity index 91% rename from console/thresholds_profile.go rename to console/threshold_profile.go index 089678712..a96f529b0 100644 --- a/console/thresholds_profile.go +++ b/console/threshold_profile.go @@ -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 } diff --git a/console/thresholds_profile_ids.go b/console/threshold_profile_ids.go similarity index 74% rename from console/thresholds_profile_ids.go rename to console/threshold_profile_ids.go index 6ad2e99d1..871678de4 100644 --- a/console/thresholds_profile_ids.go +++ b/console/threshold_profile_ids.go @@ -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 } diff --git a/console/thresholds_profile_remove.go b/console/threshold_profile_remove.go similarity index 74% rename from console/thresholds_profile_remove.go rename to console/threshold_profile_remove.go index eb17085ac..238b2daa2 100644 --- a/console/thresholds_profile_remove.go +++ b/console/threshold_profile_remove.go @@ -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 } diff --git a/console/thresholds_profile_set.go b/console/threshold_profile_set.go similarity index 77% rename from console/thresholds_profile_set.go rename to console/threshold_profile_set.go index 1db36a948..fa55a7de9 100644 --- a/console/thresholds_profile_set.go +++ b/console/threshold_profile_set.go @@ -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 } diff --git a/console/threshold_profiles.go b/console/threshold_profiles.go new file mode 100644 index 000000000..19ec8f4f7 --- /dev/null +++ b/console/threshold_profiles.go @@ -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 +*/ + +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 +} diff --git a/utils/account.go b/utils/account.go index 7eaf693d7..63551d4f2 100644 --- a/utils/account.go +++ b/utils/account.go @@ -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{} diff --git a/utils/consts.go b/utils/consts.go index 87985d718..030a6dcab 100644 --- a/utils/consts.go +++ b/utils/consts.go @@ -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"