struct.go 759 B

12345678910111213141516171819202122232425262728293031323334
  1. package core
  2. import (
  3. "context"
  4. )
  5. // This structure is used to describe the plugin configuration item name and description.
  6. type Config struct {
  7. ConfigName string
  8. Description string
  9. }
  10. type Stage uint8
  11. // These constants are meant to describe the stage in which the plugin is running.
  12. const (
  13. STAGE_START_RUN_END Stage = iota
  14. STAGE_START_RUN
  15. STAGE_START_END
  16. STAGE_RUN_END
  17. STAGE_START
  18. STAGE_END
  19. STAGE_RUN
  20. )
  21. // Plugin interface, all plugins must implement those functions.
  22. type Plugin interface {
  23. GetConfigName() []*Config
  24. GetBeforePlugin() Plugin
  25. GetStage() Stage
  26. Start(ctx context.Context, config map[string]string) error
  27. Run(ctx context.Context, config map[string]string) error
  28. End(ctx context.Context, config map[string]string) error
  29. }