mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added GetSupplierProfileIDs to console
This commit is contained in:
committed by
Dan Christian Bogos
parent
7093dd70d1
commit
87d5f6dd15
@@ -39,8 +39,11 @@ func (apierV1 *ApierV1) GetSupplierProfile(arg utils.TenantID, reply *engine.Sup
|
||||
}
|
||||
|
||||
// GetSupplierProfileIDs returns list of supplierProfile IDs registered for a tenant
|
||||
func (apierV1 *ApierV1) GetSupplierProfileIDs(tenant string, sppPrfIDs *[]string) error {
|
||||
prfx := utils.SupplierProfilePrefix + tenant + ":"
|
||||
func (apierV1 *ApierV1) GetSupplierProfileIDs(tenantArg *utils.TenantArg, sppPrfIDs *[]string) error {
|
||||
if tenantArg.Tenant == "" {
|
||||
return utils.NewErrMandatoryIeMissing(utils.Tenant)
|
||||
}
|
||||
prfx := utils.SupplierProfilePrefix + tenantArg.Tenant + ":"
|
||||
keys, err := apierV1.DataManager.DataDB().GetKeysForPrefix(prfx)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
func init() {
|
||||
c := &CmdGetSupplier{
|
||||
name: "supplier_get",
|
||||
rpcMethod: "ApierV1.GetSupplierProfile",
|
||||
rpcMethod: utils.ApierV1GetSupplierProfile,
|
||||
rpcParams: &utils.TenantID{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
65
console/supplier_ids.go
Normal file
65
console/supplier_ids.go
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSuppliersIDs{
|
||||
name: "supplier_ids",
|
||||
rpcMethod: utils.ApierV1GetSupplierProfileIDs,
|
||||
rpcParams: &utils.TenantArg{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSuppliersIDs struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.TenantArg
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSuppliersIDs) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSuppliersIDs) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSuppliersIDs) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.TenantArg{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSuppliersIDs) PostprocessRpcParams() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSuppliersIDs) RpcResult() interface{} {
|
||||
var atr *engine.SortedSuppliers
|
||||
return &atr
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import "github.com/cgrates/cgrates/utils"
|
||||
func init() {
|
||||
c := &CmdRemoveSupplier{
|
||||
name: "supplier_remove",
|
||||
rpcMethod: "ApierV1.RemoveSupplierProfile",
|
||||
rpcMethod: utils.ApierV1RemoveSupplierProfile,
|
||||
rpcParams: &utils.TenantIDWithCache{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -18,12 +18,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import v1 "github.com/cgrates/cgrates/apier/v1"
|
||||
import (
|
||||
v1 "github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSetSupplier{
|
||||
name: "supplier_set",
|
||||
rpcMethod: "ApierV1.SetSupplierProfile",
|
||||
rpcMethod: utils.ApierV1SetSupplierProfile,
|
||||
rpcParams: &v1.SupplierWithCache{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
|
||||
@@ -722,6 +722,10 @@ const (
|
||||
ApierV1LoadTariffPlanFromFolder = "ApierV1.LoadTariffPlanFromFolder"
|
||||
ApierV1GetCost = "ApierV1.GetCost"
|
||||
ApierV1SetBalance = "ApierV1.SetBalance"
|
||||
ApierV1GetSupplierProfile = "ApierV1.GetSupplierProfile"
|
||||
ApierV1GetSupplierProfileIDs = "ApierV1.GetSupplierProfileIDs"
|
||||
ApierV1RemoveSupplierProfile = "ApierV1.RemoveSupplierProfile"
|
||||
ApierV1SetSupplierProfile = "ApierV1.SetSupplierProfile"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user