mirror of https://github.com/goharbor/harbor.git
32 lines
699 B
Go
32 lines
699 B
Go
package replication
|
|
|
|
import (
|
|
"github.com/goharbor/harbor/src/common/notifier"
|
|
"github.com/goharbor/harbor/src/replication/event/notification"
|
|
"github.com/goharbor/harbor/src/replication/event/topic"
|
|
)
|
|
|
|
//Task is the task for triggering one replication
|
|
type Task struct {
|
|
PolicyID int64
|
|
}
|
|
|
|
//NewTask is constructor of creating ReplicationTask
|
|
func NewTask(policyID int64) *Task {
|
|
return &Task{
|
|
PolicyID: policyID,
|
|
}
|
|
}
|
|
|
|
//Name returns the name of this task
|
|
func (t *Task) Name() string {
|
|
return "replication"
|
|
}
|
|
|
|
//Run the actions here
|
|
func (t *Task) Run() error {
|
|
return notifier.Publish(topic.StartReplicationTopic, notification.StartReplicationNotification{
|
|
PolicyID: t.PolicyID,
|
|
})
|
|
}
|