Updated console RpcParams

This commit is contained in:
Trial97
2020-10-21 09:39:06 +03:00
committed by Dan Christian Bogos
parent dbf7fb15be
commit edcc2d959c
36 changed files with 151 additions and 41 deletions

View File

@@ -50,9 +50,12 @@ func (self *CmdGetAttributeForEvent) RpcMethod() string {
func (self *CmdGetAttributeForEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.AttrArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{
Opts: make(map[string]interface{}),
}}
self.rpcParams = &engine.AttrArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,9 +52,12 @@ func (self *CmdAttributesProcessEvent) RpcMethod() string {
func (self *CmdAttributesProcessEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.AttrArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{
Opts: make(map[string]interface{}),
}}
self.rpcParams = &engine.AttrArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -47,7 +47,7 @@ func (self *CmdRemoveAttributes) RpcMethod() string {
func (self *CmdRemoveAttributes) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -50,7 +50,9 @@ func (self *CmdGetCDRs) RpcMethod() string {
func (self *CmdGetCDRs) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.RPCCDRsFilterWithOpts{}
self.rpcParams = &utils.RPCCDRsFilterWithOpts{
RPCCDRsFilter: new(utils.RPCCDRsFilter),
}
}
return self.rpcParams
}

View File

@@ -70,7 +70,7 @@ func (ce *CommandExecuter) clientArgs(iface interface{}) (args []string) {
for i := 0; i < typ.NumField(); i++ {
valField := val.Field(i)
typeField := typ.Field(i)
//log.Printf("%v (%v : %v)", typeField.Name, valField.Kind(), typeField.PkgPath)
// log.Printf("%v (%v : %v)", typeField.Name, valField.Kind(), typeField.PkgPath)
if len(typeField.PkgPath) > 0 { //unexported field
continue
}
@@ -79,7 +79,7 @@ func (ce *CommandExecuter) clientArgs(iface interface{}) (args []string) {
if valField.Kind() == reflect.Ptr {
valField = reflect.New(valField.Type().Elem()).Elem()
if valField.Kind() != reflect.Struct {
//log.Printf("Here: %v (%v)", typeField.Name, valField.Kind())
// log.Printf("Here: %v (%v)", typeField.Name, valField.Kind())
args = append(args, typeField.Name)
continue
}

View File

@@ -50,7 +50,10 @@ func (self *CmdDispatcherProfile) RpcMethod() string {
func (self *CmdDispatcherProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.CGREventWithOpts{Opts: make(map[string]interface{})}
self.rpcParams = &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
}
}
return self.rpcParams
}

View File

@@ -49,7 +49,7 @@ func (self *CmdRemoveDispatcherHost) RpcMethod() string {
func (self *CmdRemoveDispatcherHost) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.TenantIDWithCache)
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -20,6 +20,7 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -50,7 +51,10 @@ func (self *CmdSetDispatcherHost) RpcMethod() string {
func (self *CmdSetDispatcherHost) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(v1.DispatcherHostWithCache)
self.rpcParams = &v1.DispatcherHostWithCache{
DispatcherHost: new(engine.DispatcherHost),
Opts: make(map[string]interface{}),
}
}
return self.rpcParams
}

View File

@@ -49,7 +49,7 @@ func (self *CmdRemoveDispatcherProfile) RpcMethod() string {
func (self *CmdRemoveDispatcherProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(utils.TenantIDWithCache)
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -20,6 +20,7 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -50,7 +51,10 @@ func (self *CmdSetDispatcherProfile) RpcMethod() string {
func (self *CmdSetDispatcherProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = new(v1.DispatcherWithCache)
self.rpcParams = &v1.DispatcherWithCache{
DispatcherProfile: new(engine.DispatcherProfile),
Opts: make(map[string]interface{}),
}
}
return self.rpcParams
}

View File

@@ -48,7 +48,7 @@ func (self *CmdRemoveFilter) RpcMethod() string {
func (self *CmdRemoveFilter) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -47,7 +47,7 @@ func (self *CmdRemoveRateProfile) RpcMethod() string {
func (self *CmdRemoveRateProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -51,7 +51,12 @@ func (self *CmdSetRateProfile) RpcMethod() string {
func (self *CmdSetRateProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.RateProfileWithCache{RateProfileWithOpts: new(engine.RateProfileWithOpts)}
self.rpcParams = &v1.RateProfileWithCache{
RateProfileWithOpts: &engine.RateProfileWithOpts{
RateProfile: new(engine.RateProfile),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -51,7 +51,10 @@ func (self *CmdGetResource) RpcMethod() string {
func (self *CmdGetResource) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithOpts{}
self.rpcParams = &utils.TenantIDWithOpts{
TenantID: new(utils.TenantID),
Opts: map[string]interface{}{},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdResourceAllocate) RpcMethod() string {
func (self *CmdResourceAllocate) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgRSv1ResourceUsage{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &utils.ArgRSv1ResourceUsage{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdResourceAuthorize) RpcMethod() string {
func (self *CmdResourceAuthorize) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgRSv1ResourceUsage{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &utils.ArgRSv1ResourceUsage{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -53,7 +53,12 @@ func (self *CmdGetResourceForEvent) RpcMethod() string {
func (self *CmdGetResourceForEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgRSv1ResourceUsage{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &utils.ArgRSv1ResourceUsage{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -48,7 +48,7 @@ func (self *CmdRemoveResource) RpcMethod() string {
func (self *CmdRemoveResource) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -20,6 +20,7 @@ package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
)
@@ -51,7 +52,10 @@ func (self *CmdSetResource) RpcMethod() string {
func (self *CmdSetResource) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.ResourceWithCache{}
self.rpcParams = &v1.ResourceWithCache{
ResourceProfile: new(engine.ResourceProfile),
Opts: make(map[string]interface{}),
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdResourceRelease) RpcMethod() string {
func (self *CmdResourceRelease) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.ArgRSv1ResourceUsage{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &utils.ArgRSv1ResourceUsage{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdRoutesSort) RpcMethod() string {
func (self *CmdRoutesSort) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ArgsGetRoutes{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &engine.ArgsGetRoutes{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -47,7 +47,7 @@ func (self *CmdRemoveRoute) RpcMethod() string {
func (self *CmdRemoveRoute) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -51,7 +51,10 @@ func (self *CmdSetRoute) RpcMethod() string {
func (self *CmdSetRoute) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.RouteWithCache{RouteProfile: new(engine.RouteProfile)}
self.rpcParams = &v1.RouteWithCache{
RouteProfile: new(engine.RouteProfile),
Opts: map[string]interface{}{},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdSessionsAuthorize) RpcMethod() string {
func (self *CmdSessionsAuthorize) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1AuthorizeArgs{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &sessions.V1AuthorizeArgs{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdSessionsInitiate) RpcMethod() string {
func (self *CmdSessionsInitiate) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1InitSessionArgs{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &sessions.V1InitSessionArgs{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdSessionsProcessEvent) RpcMethod() string {
func (self *CmdSessionsProcessEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1ProcessMessageArgs{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &sessions.V1ProcessMessageArgs{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdSessionsTerminate) RpcMethod() string {
func (self *CmdSessionsTerminate) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1TerminateSessionArgs{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &sessions.V1TerminateSessionArgs{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdSessionsUpdate) RpcMethod() string {
func (self *CmdSessionsUpdate) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &sessions.V1UpdateSessionArgs{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &sessions.V1UpdateSessionArgs{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -53,7 +53,12 @@ func (self *CmdStatsQueueForEvent) RpcMethod() string {
func (self *CmdStatsQueueForEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.StatsArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &engine.StatsArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -53,7 +53,12 @@ func (self *CmdStatQueueProcessEvent) RpcMethod() string {
func (self *CmdStatQueueProcessEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.StatsArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &engine.StatsArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -48,7 +48,7 @@ func (self *CmdRemoveStatQueue) RpcMethod() string {
func (self *CmdRemoveStatQueue) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -51,7 +51,10 @@ func (self *CmdSetStatQueue) RpcMethod() string {
func (self *CmdSetStatQueue) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.StatQueueWithCache{StatQueueProfile: new(engine.StatQueueProfile)}
self.rpcParams = &engine.StatQueueWithCache{
StatQueueProfile: new(engine.StatQueueProfile),
Opts: make(map[string]interface{}),
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdThresholdsForEvent) RpcMethod() string {
func (self *CmdThresholdsForEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ThresholdsArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &engine.ThresholdsArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -52,7 +52,12 @@ func (self *CmdThresholdProcessEvent) RpcMethod() string {
func (self *CmdThresholdProcessEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ThresholdsArgsProcessEvent{CGREventWithOpts: &utils.CGREventWithOpts{Opts: make(map[string]interface{})}}
self.rpcParams = &engine.ThresholdsArgsProcessEvent{
CGREventWithOpts: &utils.CGREventWithOpts{
CGREvent: new(utils.CGREvent),
Opts: make(map[string]interface{}),
},
}
}
return self.rpcParams
}

View File

@@ -47,7 +47,7 @@ func (self *CmdRemoveThreshold) RpcMethod() string {
func (self *CmdRemoveThreshold) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &utils.TenantIDWithCache{}
self.rpcParams = &utils.TenantIDWithCache{Opts: make(map[string]interface{})}
}
return self.rpcParams
}

View File

@@ -51,7 +51,10 @@ func (self *CmdSetThreshold) RpcMethod() string {
func (self *CmdSetThreshold) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.ThresholdWithCache{ThresholdProfile: new(engine.ThresholdProfile)}
self.rpcParams = &engine.ThresholdWithCache{
ThresholdProfile: new(engine.ThresholdProfile),
Opts: map[string]interface{}{},
}
}
return self.rpcParams
}