Replaced hardcoded strings with consts in RPC.Call methods

This commit is contained in:
adragusin
2019-11-22 15:34:41 +02:00
committed by Dan Christian Bogos
parent 413e47ff37
commit d1787cb3fa
65 changed files with 444 additions and 324 deletions

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdRemoveAccount{
name: "account_remove",
rpcMethod: "ApierV1.RemoveAccount",
rpcMethod: utils.ApierV1RemoveAccount,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v2"
import (
"github.com/cgrates/cgrates/apier/v2"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdAddAccount{
name: "account_set",
rpcMethod: "ApierV2.SetAccount",
rpcMethod: utils.ApierV2SetAccount,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdAccountAddTriggers{
name: "account_triggers_add",
rpcMethod: "ApierV1.AddAccountActionTriggers",
rpcMethod: utils.ApierV1AddAccountActionTriggers,
rpcParams: &v1.AttrAddAccountActionTriggers{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdAccountRemoveTriggers{
name: "account_triggers_remove",
rpcMethod: "ApierV1.RemoveAccountActionTriggers",
rpcMethod: utils.ApierV1RemoveAccountActionTriggers,
rpcParams: &v1.AttrRemoveAccountActionTriggers{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdAccountResetTriggers{
name: "account_triggers_reset",
rpcMethod: "ApierV1.ResetAccountActionTriggers",
rpcMethod: utils.ApierV1ResetAccountActionTriggers,
rpcParams: &v1.AttrRemoveAccountActionTriggers{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdAccountSetTriggers{
name: "account_triggers_set",
rpcMethod: "ApierV1.SetAccountActionTriggers",
rpcMethod: utils.ApierV1SetAccountActionTriggers,
rpcParams: &v1.AttrSetAccountActionTriggers{},
}
commands[c.Name()] = c

View File

@@ -26,7 +26,7 @@ import (
func init() {
c := &CmdGetAccounts{
name: "accounts",
rpcMethod: "ApierV2.GetAccounts",
rpcMethod: utils.ApierV2GetAccounts,
rpcParams: &utils.AttrGetAccounts{},
}
commands[c.Name()] = c

View File

@@ -25,7 +25,7 @@ import (
func init() {
c := &CmdExecuteAction{
name: "action_execute",
rpcMethod: "ApierV1.ExecuteAction",
rpcMethod: utils.ApierV1ExecuteAction,
rpcParams: &utils.AttrExecuteAction{},
}
commands[c.Name()] = c

View File

@@ -20,12 +20,13 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdRemoveActionPlan{
name: "actionplan_remove",
rpcMethod: "ApierV1.RemoveActionPlan",
rpcMethod: utils.ApierV1RemoveActionPlan,
rpcParams: &v1.AttrGetActionPlan{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetActionPlan{
name: "actionplan_set",
rpcMethod: "ApierV1.SetActionPlan",
rpcMethod: utils.ApierV1SetActionPlan,
rpcParams: &v1.AttrSetActionPlan{},
}
commands[c.Name()] = c

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/apier/v2"
v2 "github.com/cgrates/cgrates/apier/v2"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetActions{
name: "actions",
rpcMethod: "ApierV2.GetActions",
rpcMethod: utils.ApierV2GetActions,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdRemoveActions{
name: "actions_remove",
rpcMethod: "ApierV1.RemoveActions",
rpcMethod: utils.ApierV1RemoveActions,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -19,14 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import (
"github.com/cgrates/cgrates/apier/v1"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdRemoveBalance{
name: "balance_remove",
rpcMethod: "ApierV1.RemoveBalances",
rpcMethod: utils.ApierV1RemoveBalances,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -20,12 +20,13 @@ package console
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCdrcConfigReload{
name: "cdrc_config_reload",
rpcMethod: "ApierV1.ReloadCdrcConfig",
rpcMethod: utils.ApierV1ReloadCdrcConfig,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -20,12 +20,14 @@ package console
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdCdreConfigReload{
name: "cdre_config_reload",
rpcMethod: "ApierV1.ReloadCdreConfig",
rpcMethod: utils.ApierV1ReloadCdreConfig,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -27,7 +27,7 @@ import (
func init() {
c := &CmdGetCost{
name: "cost",
rpcMethod: "ApierV1.GetCost",
rpcMethod: utils.ApierV1GetCost,
clientArgs: []string{"Tenant", "Category", "Subject", "AnswerTime", "Destination", "Usage"},
rpcParams: &v1.AttrGetCost{},
}

View File

@@ -27,7 +27,7 @@ import (
func init() {
c := &CmdGetDataCost{
name: "datacost",
rpcMethod: "ApierV1.GetDataCost",
rpcMethod: utils.ApierV1GetDataCost,
clientArgs: []string{"Direction", "Category", "Tenant", "Account", "Subject", "StartTime", "Usage"},
}
commands[c.Name()] = c

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdSetDestination{
name: "destination_set",
rpcMethod: "ApierV1.SetDestination",
rpcMethod: utils.ApierV1SetDestination,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

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/apier/v2"
v2 "github.com/cgrates/cgrates/apier/v2"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetDestination{
name: "destinations",
rpcMethod: "ApierV2.GetDestinations",
rpcMethod: utils.ApierV2GetDestinations,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &ImportTpFromFolder{
name: "import_tp_from_folder",
rpcMethod: "ApierV1.ImportTariffPlanFromFolder",
rpcMethod: utils.ApierV1ImportTariffPlanFromFolder,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdGetLoadHistory{
name: "load_history",
rpcMethod: "ApierV1.GetLoadHistory",
rpcMethod: utils.ApierV1GetLoadHistory,
rpcParams: new(utils.Paginator),
}
commands[c.Name()] = c

View File

@@ -18,10 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/utils"
func init() {
c := &CmdCacheVersions{
name: "get_load_ids",
rpcMethod: "ApierV1.GetLoadIDs",
rpcMethod: utils.ApierV1GetLoadIDs ,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -20,12 +20,13 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdLoadTimes{
name: "get_load_times",
rpcMethod: "ApierV1.GetLoadTimes",
rpcMethod: utils.ApierV1GetLoadTimes,
rpcParams: &v1.LoadTimeArgs{},
}
commands[c.Name()] = c

View File

@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
func init() {
c := &LoadTpFromFolder{
name: "load_tp_from_folder",
rpcMethod: "ApierV1.LoadTariffPlanFromFolder",
rpcMethod: utils.ApierV1LoadTariffPlanFromFolder,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &LoadTpFromStorDb{
name: "load_tp_from_stordb",
rpcMethod: "ApierV1.LoadTariffPlanFromStorDb",
rpcMethod: utils.ApierV1LoadTariffPlanFromStorDb,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdExecuteScheduledActions{
name: "scheduler_execute",
rpcMethod: "ApierV1.ExecuteScheduledActions",
rpcMethod: utils.ApierV1ExecuteScheduledActions,
rpcParams: &v1.AttrsExecuteScheduledActions{},
}
commands[c.Name()] = c

View File

@@ -20,12 +20,13 @@ package console
import (
"github.com/cgrates/cgrates/scheduler"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetScheduledActions{
name: "scheduler_queue",
rpcMethod: "ApierV1.GetScheduledActions",
rpcMethod: utils.ApierV1GetScheduledActions,
rpcParams: &scheduler.ArgsGetScheduledActions{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/engine"
import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetSharedGroup{
name: "sharedgroup",
rpcMethod: "ApierV1.GetSharedGroup",
rpcMethod: utils.ApierV1GetSharedGroup,
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdRemoveTriggers{
name: "triggers_remove",
rpcMethod: "ApierV1.RemoveActionTrigger",
rpcMethod: utils.ApierV1RemoveActionTrigger,
rpcParams: &v1.AttrRemoveActionTrigger{},
}
commands[c.Name()] = c

View File

@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import "github.com/cgrates/cgrates/apier/v1"
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdSetTriggers{
name: "triggers_set",
rpcMethod: "ApierV1.SetActionTrigger",
rpcMethod: utils.ApierV1SetActionTrigger,
rpcParams: &v1.AttrSetActionTrigger{},
}
commands[c.Name()] = c

View File

@@ -21,12 +21,13 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
func init() {
c := &CmdGetTriggers{
name: "triggers",
rpcMethod: "ApierV1.GetActionTriggers",
rpcMethod: utils.ApierV1GetActionTriggers,
rpcParams: &v1.AttrGetActionTriggers{},
}
commands[c.Name()] = c