mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update dispatcher and console with ArgsAttrProcessEvent
This commit is contained in:
committed by
Dan Christian Bogos
parent
834f130949
commit
b5dacd910f
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ type ArgsProcessEventWithApiKey struct {
|
||||
engine.ArgsProcessEvent
|
||||
}
|
||||
|
||||
type ArgsAttrProcessEventWithApiKey struct {
|
||||
APIKey string
|
||||
engine.AttrArgsProcessEvent
|
||||
}
|
||||
|
||||
type ArgsGetSuppliersWithApiKey struct {
|
||||
APIKey string
|
||||
engine.ArgsGetSuppliers
|
||||
|
||||
Reference in New Issue
Block a user