-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c879cee
commit e9718f5
Showing
3 changed files
with
79 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,41 @@ | ||
package webhook | ||
|
||
import "github.com/caraml-dev/mlp/api/pkg/webhooks" | ||
import ( | ||
"errors" | ||
|
||
"github.com/caraml-dev/mlp/api/pkg/webhooks" | ||
) | ||
|
||
var ( | ||
OnRouterCreated = webhooks.EventType("OnRouterCreated") | ||
OnRouterUpdated = webhooks.EventType("OnRouterUpdated") | ||
OnRouterDeleted = webhooks.EventType("OnRouterDeleted") | ||
OnRouterDeployed = webhooks.EventType("OnRouterDeployed") | ||
OnRouterUndeployed = webhooks.EventType("OnRouterUndeployed") | ||
|
||
OnEnsemblerCreated = webhooks.EventType("OnEnsemblerCreated") | ||
OnEnsemblerUpdated = webhooks.EventType("OnEnsemblerUpdated") | ||
OnEnsemblerDeleted = webhooks.EventType("OnEnsemblerDeleted") | ||
) | ||
|
||
var ( | ||
OnRouterCreated = webhooks.EventType("on-router-created") | ||
OnRouterUpdated = webhooks.EventType("on-router-updated") | ||
OnRouterDeleted = webhooks.EventType("on-router-deleted") | ||
OnRouterDeployed = webhooks.EventType("on-router-deployed") | ||
OnRouterUndeployed = webhooks.EventType("on-router-undeployed") | ||
// event list for router event | ||
eventListRouter = map[webhooks.EventType]bool{ | ||
OnRouterCreated: true, | ||
OnRouterUpdated: true, | ||
OnRouterDeleted: true, | ||
OnRouterDeployed: true, | ||
OnRouterUndeployed: true, | ||
} | ||
|
||
OnEnsemblerCreated = webhooks.EventType("on-ensembler-created") | ||
OnEnsemblerUpdated = webhooks.EventType("on-ensembler-updated") | ||
OnEnsemblerDeleted = webhooks.EventType("on-ensembler-deleted") | ||
// event list for ensembler event | ||
eventListEnsembler = map[webhooks.EventType]bool{ | ||
OnEnsemblerCreated: true, | ||
OnEnsemblerUpdated: true, | ||
OnEnsemblerDeleted: true, | ||
} | ||
) | ||
|
||
var eventList = []webhooks.EventType{ | ||
OnRouterCreated, | ||
OnRouterUpdated, | ||
OnRouterDeleted, | ||
OnRouterDeployed, | ||
OnRouterUndeployed, | ||
OnEnsemblerCreated, | ||
OnEnsemblerUpdated, | ||
OnEnsemblerDeleted, | ||
} | ||
var ( | ||
ErrInvalidEventType = errors.New("invalid event type") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters