Update dispatcher and console with ArgsAttrProcessEvent

This commit is contained in:
TeoV
2018-07-10 03:10:22 -04:00
committed by Dan Christian Bogos
parent 834f130949
commit b5dacd910f
5 changed files with 23 additions and 18 deletions

View File

@@ -135,15 +135,15 @@ func (dA *DispatcherAttributeSv1) Ping(ign string, reply *string) error {
}
// GetAttributeForEvent implements AttributeSv1GetAttributeForEvent
func (dA *DispatcherAttributeSv1) GetAttributeForEvent(ev *dispatcher.CGREvWithApiKey,
func (dA *DispatcherAttributeSv1) GetAttributeForEvent(args *dispatcher.ArgsAttrProcessEventWithApiKey,
reply *engine.AttributeProfile) error {
return dA.dA.AttributeSv1GetAttributeForEvent(ev, reply)
return dA.dA.AttributeSv1GetAttributeForEvent(args, reply)
}
// ProcessEvent implements AttributeSv1ProcessEvent
func (dA *DispatcherAttributeSv1) ProcessEvent(ev *dispatcher.CGREvWithApiKey,
func (dA *DispatcherAttributeSv1) ProcessEvent(args *dispatcher.ArgsAttrProcessEventWithApiKey,
reply *engine.AttrSProcessEventReply) error {
return dA.dA.AttributeSv1ProcessEvent(ev, reply)
return dA.dA.AttributeSv1ProcessEvent(args, reply)
}
func NewDispatcherSessionSv1(dps *dispatcher.DispatcherService) *DispatcherSessionSv1 {

View File

@@ -30,7 +30,7 @@ func init() {
c := &CmdAttributesProcessEvent{
name: "attributes_process_event",
rpcMethod: utils.AttributeSv1ProcessEvent,
rpcParams: &dispatcher.CGREvWithApiKey{},
rpcParams: &dispatcher.ArgsAttrProcessEventWithApiKey{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -39,7 +39,7 @@ func init() {
type CmdAttributesProcessEvent struct {
name string
rpcMethod string
rpcParams *dispatcher.CGREvWithApiKey
rpcParams *dispatcher.ArgsAttrProcessEventWithApiKey
*CommandExecuter
}
@@ -53,7 +53,7 @@ func (self *CmdAttributesProcessEvent) RpcMethod() string {
func (self *CmdAttributesProcessEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &dispatcher.CGREvWithApiKey{}
self.rpcParams = &dispatcher.ArgsAttrProcessEventWithApiKey{}
}
return self.rpcParams
}

View File

@@ -28,7 +28,7 @@ func init() {
c := &CmdGetAttributeForEvent{
name: "attributes_for_event",
rpcMethod: utils.AttributeSv1GetAttributeForEvent,
rpcParams: &dispatcher.CGREvWithApiKey{},
rpcParams: &dispatcher.ArgsAttrProcessEventWithApiKey{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdGetAttributeForEvent struct {
name string
rpcMethod string
rpcParams *dispatcher.CGREvWithApiKey
rpcParams *dispatcher.ArgsAttrProcessEventWithApiKey
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdGetAttributeForEvent) RpcMethod() string {
func (self *CmdGetAttributeForEvent) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &dispatcher.CGREvWithApiKey{}
self.rpcParams = &dispatcher.ArgsAttrProcessEventWithApiKey{}
}
return self.rpcParams
}

View File

@@ -30,28 +30,28 @@ func (dS *DispatcherService) AttributeSv1Ping(ign string, reply *string) error {
return dS.attrS.Call(utils.AttributeSv1Ping, ign, reply)
}
func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(args *CGREvWithApiKey,
func (dS *DispatcherService) AttributeSv1GetAttributeForEvent(args *ArgsAttrProcessEventWithApiKey,
reply *engine.AttributeProfile) (err error) {
if dS.attrS == nil {
return utils.NewErrNotConnected(utils.AttributeS)
}
if err = dS.authorize(utils.AttributeSv1GetAttributeForEvent, args.CGREvent.Tenant,
args.APIKey, args.CGREvent.Time); err != nil {
if err = dS.authorize(utils.AttributeSv1GetAttributeForEvent, args.AttrArgsProcessEvent.CGREvent.Tenant,
args.APIKey, args.AttrArgsProcessEvent.CGREvent.Time); err != nil {
return
}
return dS.attrS.Call(utils.AttributeSv1GetAttributeForEvent, args.CGREvent, reply)
return dS.attrS.Call(utils.AttributeSv1GetAttributeForEvent, args.AttrArgsProcessEvent, reply)
}
func (dS *DispatcherService) AttributeSv1ProcessEvent(args *CGREvWithApiKey,
func (dS *DispatcherService) AttributeSv1ProcessEvent(args *ArgsAttrProcessEventWithApiKey,
reply *engine.AttrSProcessEventReply) (err error) {
if dS.attrS == nil {
return utils.NewErrNotConnected(utils.AttributeS)
}
if err = dS.authorize(utils.AttributeSv1ProcessEvent, args.CGREvent.Tenant,
args.APIKey, args.CGREvent.Time); err != nil {
if err = dS.authorize(utils.AttributeSv1ProcessEvent, args.AttrArgsProcessEvent.CGREvent.Tenant,
args.APIKey, args.AttrArgsProcessEvent.CGREvent.Time); err != nil {
return
}
return dS.attrS.Call(utils.AttributeSv1ProcessEvent, args.CGREvent, reply)
return dS.attrS.Call(utils.AttributeSv1ProcessEvent, args.AttrArgsProcessEvent, reply)
}

View File

@@ -57,6 +57,11 @@ type ArgsProcessEventWithApiKey struct {
engine.ArgsProcessEvent
}
type ArgsAttrProcessEventWithApiKey struct {
APIKey string
engine.AttrArgsProcessEvent
}
type ArgsGetSuppliersWithApiKey struct {
APIKey string
engine.ArgsGetSuppliers