templates

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RiskTemplateHandler

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

func NewRiskTemplateHandler

func NewRiskTemplateHandler(sugar *zap.SugaredLogger, db *gorm.DB) *RiskTemplateHandler

func (*RiskTemplateHandler) BatchUpsert

func (h *RiskTemplateHandler) BatchUpsert(ctx echo.Context) error

BatchUpsert godoc

@Summary		Batch upsert risk templates
@Description	Reconcile the full set of risk templates for a (plugin-id, policy-package) scope.
@Description	Creates, updates, and deletes templates atomically. Templates not present in the payload are always deleted.
@Tags			Risk Templates
@Accept			json
@Produce		json
@Param			body	body		batchUpsertRiskTemplatesRequest	true	"Batch upsert payload"
@Success		200		{object}	batchUpsertRiskTemplatesResponse
@Failure		400		{object}	api.Error
@Failure		500		{object}	api.Error
@Router			/agent/risk-templates/batch [post]

func (*RiskTemplateHandler) Create

func (h *RiskTemplateHandler) Create(ctx echo.Context) error

Create godoc

@Summary		Create risk template
@Description	Create a risk template with threat references and remediation template/tasks.
@Tags			Risk Templates
@Accept			json
@Produce		json
@Param			template	body		upsertRiskTemplateRequest	true	"Risk template payload"
@Success		201			{object}	riskTemplateDataResponse
@Failure		400			{object}	api.Error
@Failure		500			{object}	api.Error
@Security		OAuth2Password
@Router			/admin/risk-templates [post]

func (*RiskTemplateHandler) Delete

func (h *RiskTemplateHandler) Delete(ctx echo.Context) error

Delete godoc

@Summary		Delete risk template
@Description	Delete a risk template and its associated threat references and remediation data.
@Tags			Risk Templates
@Produce		json
@Param			id	path	string	true	"Risk Template ID"
@Success		204
@Failure		400	{object}	api.Error
@Failure		404	{object}	api.Error
@Failure		500	{object}	api.Error
@Security		OAuth2Password
@Router			/admin/risk-templates/{id} [delete]

func (*RiskTemplateHandler) Get

func (h *RiskTemplateHandler) Get(ctx echo.Context) error

Get godoc

@Summary		Get risk template
@Description	Get a risk template by ID.
@Tags			Risk Templates
@Produce		json
@Param			id	path		string	true	"Risk Template ID"
@Success		200	{object}	riskTemplateDataResponse
@Failure		400	{object}	api.Error
@Failure		404	{object}	api.Error
@Failure		500	{object}	api.Error
@Security		OAuth2Password
@Router			/admin/risk-templates/{id} [get]

func (*RiskTemplateHandler) List

func (h *RiskTemplateHandler) List(ctx echo.Context) error

List godoc

@Summary		List risk templates
@Description	List risk templates with optional filters and pagination.
@Tags			Risk Templates
@Produce		json
@Param			plugin-id		query		string	false	"Plugin ID"
@Param			policy-package	query		string	false	"Policy package"
@Param			is-active		query		bool	false	"Active flag"
@Param			page			query		int		false	"Page number"
@Param			limit			query		int		false	"Page size"
@Success		200				{object}	svc.ListResponse[riskTemplateResponse]
@Failure		400				{object}	api.Error
@Failure		500				{object}	api.Error
@Security		OAuth2Password
@Router			/admin/risk-templates [get]

func (*RiskTemplateHandler) Register

func (h *RiskTemplateHandler) Register(apiGroup *echo.Group)

func (*RiskTemplateHandler) RegisterAgent

func (h *RiskTemplateHandler) RegisterAgent(apiGroup *echo.Group)

func (*RiskTemplateHandler) Update

func (h *RiskTemplateHandler) Update(ctx echo.Context) error

Update godoc

@Summary		Update risk template
@Description	Update a risk template and atomically replace threat refs and remediation tasks.
@Tags			Risk Templates
@Accept			json
@Produce		json
@Param			id			path		string						true	"Risk Template ID"
@Param			template	body		upsertRiskTemplateRequest	true	"Risk template payload"
@Success		200			{object}	riskTemplateDataResponse
@Failure		400			{object}	api.Error
@Failure		404			{object}	api.Error
@Failure		500			{object}	api.Error
@Security		OAuth2Password
@Router			/admin/risk-templates/{id} [put]

type SubjectTemplateHandler

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

func NewSubjectTemplateHandler

func NewSubjectTemplateHandler(sugar *zap.SugaredLogger, db *gorm.DB) *SubjectTemplateHandler

func (*SubjectTemplateHandler) BatchUpsert

func (h *SubjectTemplateHandler) BatchUpsert(ctx echo.Context) error

BatchUpsert godoc

@Summary		Batch upsert subject templates
@Description	Reconcile the full set of subject templates for a plugin (scoped via selector-label key="_plugin").
@Description	Creates, updates, and deletes templates atomically. Templates not present in the payload are always deleted.
@Tags			Subject Templates
@Accept			json
@Produce		json
@Param			body	body		batchUpsertSubjectTemplatesRequest	true	"Batch upsert payload"
@Success		200		{object}	batchUpsertSubjectTemplatesResponse
@Failure		400		{object}	api.Error
@Failure		500		{object}	api.Error
@Router			/agent/subject-templates/batch [post]

func (*SubjectTemplateHandler) Create

func (h *SubjectTemplateHandler) Create(ctx echo.Context) error

Create godoc

@Summary		Create subject template
@Description	Create a subject template with selector labels and label schema.
@Tags			Subject Templates
@Accept			json
@Produce		json
@Param			template	body		upsertSubjectTemplateRequest	true	"Subject template payload"
@Success		201			{object}	subjectTemplateDataResponse
@Failure		400			{object}	api.Error
@Failure		500			{object}	api.Error
@Security		OAuth2Password
@Router			/admin/subject-templates [post]

func (*SubjectTemplateHandler) Get

Get godoc

@Summary		Get subject template
@Description	Get a subject template by ID.
@Tags			Subject Templates
@Produce		json
@Param			id	path		string	true	"Subject Template ID"
@Success		200	{object}	subjectTemplateDataResponse
@Failure		400	{object}	api.Error
@Failure		404	{object}	api.Error
@Failure		500	{object}	api.Error
@Security		OAuth2Password
@Router			/admin/subject-templates/{id} [get]

func (*SubjectTemplateHandler) List

List godoc

@Summary		List subject templates
@Description	List subject templates with optional filters and pagination.
@Tags			Subject Templates
@Produce		json
@Param			type		query		string	false	"Subject type"
@Param			source-mode	query		string	false	"Source mode"
@Param			page		query		int		false	"Page number"
@Param			limit		query		int		false	"Page size"
@Success		200			{object}	svc.ListResponse[subjectTemplateResponse]
@Failure		400			{object}	api.Error
@Failure		500			{object}	api.Error
@Security		OAuth2Password
@Router			/admin/subject-templates [get]

func (*SubjectTemplateHandler) Register

func (h *SubjectTemplateHandler) Register(apiGroup *echo.Group)

func (*SubjectTemplateHandler) RegisterAgent

func (h *SubjectTemplateHandler) RegisterAgent(apiGroup *echo.Group)

func (*SubjectTemplateHandler) Update

func (h *SubjectTemplateHandler) Update(ctx echo.Context) error

Update godoc

@Summary		Update subject template
@Description	Update a subject template and atomically replace selector labels and label schema.
@Tags			Subject Templates
@Accept			json
@Produce		json
@Param			id			path		string							true	"Subject Template ID"
@Param			template	body		upsertSubjectTemplateRequest	true	"Subject template payload"
@Success		200			{object}	subjectTemplateDataResponse
@Failure		400			{object}	api.Error
@Failure		404			{object}	api.Error
@Failure		500			{object}	api.Error
@Security		OAuth2Password
@Router			/admin/subject-templates/{id} [put]

Jump to

Keyboard shortcuts

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