func CreateTriggerAction()

in commands/trigger/trigger.go [57:77]


func CreateTriggerAction() (trigger.Action, error) {
	if err := config.GlobalConfig.Error; err != nil {
		return nil, err
	}

	switch t := config.GlobalConfig.E2EConfig.Trigger; t.Action {
	case "":
		return nil, nil
	case constant.ActionHTTP:
		return trigger.NewHTTPAction(
			t.Interval,
			t.Times,
			t.URL,
			t.Method,
			t.Body,
			t.Headers,
		)
	default:
		return nil, fmt.Errorf("unsupported trigger action: %s", t.Action)
	}
}