services

package
v0.0.0-...-7c12fc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHistoryForTarget

func AddHistoryForTarget(ctx context.Context, db *sqlx.DB, history *models.TargetHistory) error

func CountChecks

func CountChecks(ctx context.Context, db *sqlx.DB) (int, error)

func CountHooks

func CountHooks(ctx context.Context, db *sqlx.DB) (int, error)

func CountTargets

func CountTargets(ctx context.Context, db *sqlx.DB) (int, error)

func CountTriggers

func CountTriggers(ctx context.Context, db *sqlx.DB) (int, error)

func CountWorkerGroups

func CountWorkerGroups(ctx context.Context, db *sqlx.DB) (int, error)

func CreateCheck

func CreateCheck(ctx context.Context, db *sqlx.DB, check *models.Check) error

func CreateHook

func CreateHook(ctx context.Context, db *sqlx.DB, hook *models.Hook) error

func CreateOAuth2State

func CreateOAuth2State(ctx context.Context, db *sqlx.DB, oauth2State *models.OAuth2State) error

func CreateOrUpdateCheckSchedule

func CreateOrUpdateCheckSchedule(
	ctx context.Context,
	t client.Client,
	check *models.Check,
	workerGroups []*models.WorkerGroup,
) error

func CreateOrUpdateHookSchedule

func CreateOrUpdateHookSchedule(
	ctx context.Context,
	t client.Client,
	hook *models.Hook,
) error

func CreateTarget

func CreateTarget(ctx context.Context, db *sqlx.DB, target *models.Target) error

func CreateTrigger

func CreateTrigger(ctx context.Context, db *sqlx.DB, trigger *models.Trigger) error

func CreateWorkerGroup

func CreateWorkerGroup(ctx context.Context, db *sqlx.DB, workerGroup *models.WorkerGroup) error

func DeleteCheck

func DeleteCheck(ctx context.Context, db *sqlx.DB, id string) error

func DeleteCheckSchedule

func DeleteCheckSchedule(ctx context.Context, t client.Client, id string) error

func DeleteHook

func DeleteHook(ctx context.Context, db *sqlx.DB, id string) error

func DeleteHookSchedule

func DeleteHookSchedule(ctx context.Context, t client.Client, id string) error

func DeleteOAuth2State

func DeleteOAuth2State(ctx context.Context, db *sqlx.DB, state string) (deleted bool, err error)

func DeleteTarget

func DeleteTarget(ctx context.Context, db *sqlx.DB, id string) error

func DeleteTrigger

func DeleteTrigger(ctx context.Context, db *sqlx.DB, id string) error

func DeleteWorkerGroup

func DeleteWorkerGroup(ctx context.Context, db *sqlx.DB, id string) error

func GetActiveWorkers

func GetActiveWorkers(ctx context.Context, workerGroupId string, temporal client.Client) ([]string, error)

func GetCheck

func GetCheck(ctx context.Context, db *sqlx.DB, id string) (*models.Check, error)

func GetCheckState

func GetCheckState(ctx context.Context, temporal client.Client, id string) (models.CheckState, error)

func GetCheckWithWorkerGroups

func GetCheckWithWorkerGroups(ctx context.Context, db *sqlx.DB, id string) (*models.CheckWithWorkerGroups, error)

func GetChecks

func GetChecks(ctx context.Context, db *sqlx.DB) ([]*models.Check, error)

func GetChecksWithWorkerGroups

func GetChecksWithWorkerGroups(ctx context.Context, db *sqlx.DB) ([]*models.CheckWithWorkerGroups, error)

func GetHook

func GetHook(ctx context.Context, db *sqlx.DB, id string) (*models.Hook, error)

func GetHookState

func GetHookState(ctx context.Context, temporal client.Client, id string) (models.HookState, error)

func GetHooks

func GetHooks(ctx context.Context, db *sqlx.DB) ([]*models.Hook, error)

func GetTarget

func GetTarget(ctx context.Context, db *sqlx.DB, id string) (*models.Target, error)

func GetTargets

func GetTargets(ctx context.Context, db *sqlx.DB) ([]*models.Target, error)

func GetTargetsWithFilter

func GetTargetsWithFilter(ctx context.Context, db *sqlx.DB, filter string) ([]*models.Target, error)

func GetTrigger

func GetTrigger(ctx context.Context, db *sqlx.DB, id string) (*models.Trigger, error)

func GetTriggers

func GetTriggers(ctx context.Context, db *sqlx.DB) ([]*models.Trigger, error)

func GetWorkerGroup

func GetWorkerGroup(ctx context.Context, db *sqlx.DB, id string) (*models.WorkerGroup, error)

func GetWorkerGroupWithChecks

func GetWorkerGroupWithChecks(ctx context.Context, db *sqlx.DB, id string) (*models.WorkerGroupWithChecks, error)

func GetWorkerGroups

func GetWorkerGroups(ctx context.Context, db *sqlx.DB) ([]*models.WorkerGroup, error)

func GetWorkerGroupsById

func GetWorkerGroupsById(ctx context.Context, db *sqlx.DB, ids []string) ([]*models.WorkerGroup, error)

func GetWorkerGroupsWithChecks

func GetWorkerGroupsWithChecks(ctx context.Context, db *sqlx.DB) ([]*models.WorkerGroupWithChecks, error)

func SetCheckState

func SetCheckState(ctx context.Context, temporal client.Client, id string, state models.CheckState) error

func SetHookState

func SetHookState(ctx context.Context, temporal client.Client, id string, state models.HookState) error

func SetTargetState

func SetTargetState(ctx context.Context, db *sqlx.DB, id string, state models.TargetState) error

func UpdateCheck

func UpdateCheck(ctx context.Context, db *sqlx.DB, check *models.Check) error

func UpdateCheckWorkerGroups

func UpdateCheckWorkerGroups(ctx context.Context, db *sqlx.DB, check *models.Check, workerGroups []*models.WorkerGroup) error

func UpdateHook

func UpdateHook(ctx context.Context, db *sqlx.DB, hook *models.Hook) error

func UpdateTarget

func UpdateTarget(ctx context.Context, db *sqlx.DB, target *models.Target) error

func UpdateTrigger

func UpdateTrigger(ctx context.Context, db *sqlx.DB, trigger *models.Trigger) error

Types

type CheckHistory

type CheckHistory struct {
	CheckId         string
	Status          string
	Duration        time.Duration
	StartTime       time.Time
	EndTime         time.Time
	WorkerGroupName string
	Note            string
}

func GetCheckHistoryForCheck

func GetCheckHistoryForCheck(ctx context.Context, t client.Client, checkId string) ([]*CheckHistory, error)

func GetLastNCheckHistory

func GetLastNCheckHistory(ctx context.Context, t client.Client, n int32) ([]*CheckHistory, error)

type HookHistory

type HookHistory struct {
	HookId          string
	Status          string
	Duration        time.Duration
	StartTime       time.Time
	EndTime         time.Time
	WorkerGroupName string
	Note            string
}

func GetHookHistoryForHook

func GetHookHistoryForHook(ctx context.Context, t client.Client, hookId string) ([]*HookHistory, error)

func GetLastNHookHistory

func GetLastNHookHistory(ctx context.Context, t client.Client, n int32) ([]*HookHistory, error)

type TargetHistory

type TargetHistory struct {
	*models.TargetHistory
	TargetName      string `db:"target_name"`
	WorkerGroupName string `db:"worker_group_name"`
	CheckName       string `db:"check_name"`
}

func GetTargetHistoryForTarget

func GetTargetHistoryForTarget(ctx context.Context, db *sqlx.DB, targetId string, dateRange TargetHistoryDateRange) ([]*TargetHistory, error)

type TargetHistoryDateRange

type TargetHistoryDateRange string
const (
	TargetHistoryDateRange60Days    TargetHistoryDateRange = "60_DAYS"
	TargetHistoryDateRange48Hours   TargetHistoryDateRange = "48_HOURS"
	TargetHistoryDateRange60Minutes TargetHistoryDateRange = "60_MINUTES"
)

type TriggerHistory

type TriggerHistory struct {
	TriggerId string
	Status    string
	Duration  time.Duration
}

func GetLastNTriggerHistory

func GetLastNTriggerHistory(ctx context.Context, temporal client.Client, n int32) ([]*TriggerHistory, error)

func GetTriggerHistoryForTrigger

func GetTriggerHistoryForTrigger(ctx context.Context, temporal client.Client, checkId string) ([]*TriggerHistory, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL