mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 13:19:53 +05:00
ActionSv1 ScheduleActions and ExecuteActions API calls
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
@@ -1562,3 +1562,9 @@ type TPAccountBalance struct {
|
||||
Opts string
|
||||
Value float64
|
||||
}
|
||||
|
||||
// ArgActionSv1ScheduleActions is used in ActionSv1 methods
|
||||
type ArgActionSv1ScheduleActions struct {
|
||||
*CGREventWithOpts
|
||||
ActionProfileIDs []string
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user