rulecontroller

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RuleController

type RuleController struct {
	// contains filtered or unexported fields
}

func NewRuleController

func NewRuleController(
	router gin.IRouter,
	ruleService RuleService,
	auth gin.HandlerFunc,
	registry *errmap.Registry,
) *RuleController

func (*RuleController) CreateRule

func (c *RuleController) CreateRule(gc *gin.Context)

CreateRule

@Summary		Create Rule
@Description	Create a new rule. A rule determines on which conditions which action is triggered.
@Tags			rule
@Accept			json
@Produce		json
@Security		KeycloakAuth
@Param			rule	body		models.Rule	true	"new rule"
@Success		201		{object}	models.Rule
@Failure		400		{object}	errorResponses.ErrorResponse
@Failure		422		{object}	errorResponses.ErrorResponse
@Header			all		{string}	api-version	"API version"
@Router			/rules [post]

func (*RuleController) DeleteRule

func (c *RuleController) DeleteRule(gc *gin.Context)

DeleteRule

@Summary		Delete Rule
@Description	Delete a rule.
@Tags			rule
@Security		KeycloakAuth
@Param			id	path	string	true	"unique ID of the rule"
@Success		204	"deleted"
@Failure		400 {object}	errorResponses.ErrorResponse "invalid id"
@Header			all	{string}	api-version	"API version"
@Router			/rules/{id} [delete]

func (*RuleController) GetRule

func (c *RuleController) GetRule(gc *gin.Context)

GetRule

@Summary		Get a rule by id
@Description	Returns the rule
@Tags			rule
@Produce		json
@Security		KeycloakAuth
@Param			id	path		string	true	"unique id of the rule"
@Success		200	{object}	models.Rule
@Failure		400 {object}	errorResponses.ErrorResponse "invalid id"
@Failure		404	{object}	errorResponses.ErrorResponse
@Header			all	{string}	api-version	"API version"
@Router			/rulse/{id} [get]

func (*RuleController) ListRules

func (c *RuleController) ListRules(gc *gin.Context)

ListRules

@Summary		List Rules
@Description	Returns a list of rules matching the provided filters.
@Tags			rule
@Accept			json
@Produce		json
@Security		KeycloakAuth
@Success		200	{object}	[]models.Rule
@Header			all	{string}	api-version	"API version"
@Router			/rules [get]

func (*RuleController) RegisterRoutes

func (c *RuleController) RegisterRoutes(router gin.IRouter, auth gin.HandlerFunc)

func (*RuleController) RuleOptions

func (c *RuleController) RuleOptions(gc *gin.Context)

RuleOptions

@Summary		Options to create a new alert rule
@Description	Returns all required options to create a new alert rule
@Tags			rule
@Accept			json
@Produce		json
@Security		KeycloakAuth
@Success		200	{object}	models.RuleOptions
@Header			all	{string}	api-version	"API version"
@Router			/rules/ruleoptions [get]

func (*RuleController) UpdateRule

func (c *RuleController) UpdateRule(gc *gin.Context)

UpdateRule

@Summary		Update Rule
@Description	Update/replace a rule.
@Tags			rule
@Accept			json
@Produce		json
@Security		KeycloakAuth
@Param			id		path		string		true	"unique ID of the rule"
@Param			rule	body		models.Rule	true	"updated rule"
@Success		200		{object}	models.Rule
@Failure		400		{object}	errorResponses.ErrorResponse
@Failure		404		{object}	errorResponses.ErrorResponse
@Header			all		{string}	api-version	"API version"
@Router			/rules/{id} [put]

type RuleService

type RuleService interface {
	Get(ctx context.Context, id string) (models.Rule, error)
	List(ctx context.Context) ([]models.Rule, error)
	Create(ctx context.Context, rule models.Rule) (models.Rule, error)
	Update(ctx context.Context, id string, rule models.Rule) (models.Rule, error)
	Delete(ctx context.Context, id string) error
	GetAllRuleOptions(ctx context.Context) (*models.RuleOptions, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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