diff --git a/actions/actions.go b/actions/actions.go index ee292721e..5b2703b0a 100644 --- a/actions/actions.go +++ b/actions/actions.go @@ -283,13 +283,18 @@ func (aS *ActionS) asapExecuteActions(sActs *scheduledActs) (err error) { return } -type ArgActionSv1ExecuteActions struct { - *utils.CGREventWithOpts - ActionProfileIDs []string +// V1ScheduleActions will be called to schedule actions matching the arguments +func (aS *ActionS) V1ScheduleActions(args *utils.ArgActionSv1ScheduleActions, rpl *string) (err error) { + if err = aS.scheduleActions([]*utils.CGREventWithOpts{args.CGREventWithOpts}, + args.ActionProfileIDs, false); err != nil { + return + } + *rpl = utils.OK + return } // V1ExecuteActions will be called to execute ASAP action profiles, ignoring their Schedule field -func (aS *ActionS) V1ExecuteActions(args *ArgActionSv1ExecuteActions, rpl *string) (err error) { +func (aS *ActionS) V1ExecuteActions(args *utils.ArgActionSv1ScheduleActions, rpl *string) (err error) { var schedActSet []*scheduledActs if schedActSet, err = aS.scheduledActions(args.CGREventWithOpts.Tenant, args.CGREventWithOpts, args.ActionProfileIDs, true); err != nil { @@ -309,13 +314,3 @@ func (aS *ActionS) V1ExecuteActions(args *ArgActionSv1ExecuteActions, rpl *strin *rpl = utils.OK return } - -// V1ExecuteActions will be called to schedule actions matching the arguments -func (aS *ActionS) V1ScheduleActions(args *ArgActionSv1ExecuteActions, rpl *string) (err error) { - if err = aS.scheduleActions([]*utils.CGREventWithOpts{args.CGREventWithOpts}, - args.ActionProfileIDs, false); err != nil { - return - } - *rpl = utils.OK - return -} diff --git a/apier/v1/actionprofiles.go b/apier/v1/actions.go similarity index 92% rename from apier/v1/actionprofiles.go rename to apier/v1/actions.go index d435512b0..a2932e0df 100644 --- a/apier/v1/actionprofiles.go +++ b/apier/v1/actions.go @@ -163,3 +163,13 @@ func (aSv1 *ActionSv1) Ping(ign *utils.CGREventWithOpts, reply *string) error { *reply = utils.Pong return nil } + +// ScheduleActions will be called to schedule actions matching the arguments +func (aSv1 *ActionSv1) ScheduleActions(args *utils.ArgActionSv1ScheduleActions, rpl *string) error { + return aSv1.aS.V1ExecuteActions(args, rpl) +} + +// ExecuteActions will be called to execute ASAP action profiles, ignoring their Schedule field +func (aSv1 *ActionSv1) ExecuteActions(args *utils.ArgActionSv1ScheduleActions, rpl *string) error { + return aSv1.aS.V1ExecuteActions(args, rpl) +} diff --git a/apier/v1/actionprofiles_it_test.go b/apier/v1/actions_it_test.go similarity index 100% rename from apier/v1/actionprofiles_it_test.go rename to apier/v1/actions_it_test.go diff --git a/utils/apitpdata.go b/utils/apitpdata.go index e1bdc0ad6..306ef7a99 100755 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -1562,3 +1562,9 @@ type TPAccountBalance struct { Opts string Value float64 } + +// ArgActionSv1ScheduleActions is used in ActionSv1 methods +type ArgActionSv1ScheduleActions struct { + *CGREventWithOpts + ActionProfileIDs []string +} diff --git a/utils/consts.go b/utils/consts.go index e1c8ecfb4..2f8f0ec55 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -1547,11 +1547,6 @@ const ( RateSv1Ping = "RateSv1.Ping" ) -const ( - ActionSv1 = "ActionSv1" - ActionSv1Ping = "ActionSv1.Ping" -) - const ( AccountSv1 = "AccountSv1" AccountSv1Ping = "AccountSv1.Ping" @@ -2744,6 +2739,14 @@ var ( } ) +// ActionSv1 +const ( + ActionSv1 = "ActionSv1" + ActionSv1Ping = "ActionSv1.Ping" + ActionSv1ScheduleActions = "ActionSv1.ScheduleActions" + ActionSv1ExecuteActions = "ActionSv1.ExecuteActions" +) + func buildCacheInstRevPrefixes() { CachePrefixToInstance = make(map[string]string) for k, v := range CacheInstanceToPrefix {