Documentation
¶
Index ¶
- type RiskTemplateHandler
- func (h *RiskTemplateHandler) BatchUpsert(ctx *echo.Context) error
- func (h *RiskTemplateHandler) Create(ctx *echo.Context) error
- func (h *RiskTemplateHandler) Delete(ctx *echo.Context) error
- func (h *RiskTemplateHandler) Get(ctx *echo.Context) error
- func (h *RiskTemplateHandler) List(ctx *echo.Context) error
- func (h *RiskTemplateHandler) Register(apiGroup *echo.Group)
- func (h *RiskTemplateHandler) RegisterAgent(apiGroup *echo.Group, middlewares ...echo.MiddlewareFunc)
- func (h *RiskTemplateHandler) Update(ctx *echo.Context) error
- type SSPTemplateHandler
- func (h *SSPTemplateHandler) Create(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Delete(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Forget(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Get(ctx *echo.Context) error
- func (h *SSPTemplateHandler) List(ctx *echo.Context) error
- func (h *SSPTemplateHandler) ListSSPs(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Preview(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Register(group *echo.Group)
- func (h *SSPTemplateHandler) Run(ctx *echo.Context) error
- func (h *SSPTemplateHandler) Update(ctx *echo.Context) error
- type SSPTemplateRunEnqueuer
- type SubjectTemplateHandler
- func (h *SubjectTemplateHandler) BatchUpsert(ctx *echo.Context) error
- func (h *SubjectTemplateHandler) Create(ctx *echo.Context) error
- func (h *SubjectTemplateHandler) Get(ctx *echo.Context) error
- func (h *SubjectTemplateHandler) List(ctx *echo.Context) error
- func (h *SubjectTemplateHandler) Register(apiGroup *echo.Group)
- func (h *SubjectTemplateHandler) RegisterAgent(apiGroup *echo.Group, middlewares ...echo.MiddlewareFunc)
- func (h *SubjectTemplateHandler) Update(ctx *echo.Context) error
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, middlewares ...echo.MiddlewareFunc)
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 SSPTemplateHandler ¶ added in v0.22.0
type SSPTemplateHandler struct {
// contains filtered or unexported fields
}
SSPTemplateHandler serves /admin/ssp-templates.
func NewSSPTemplateHandler ¶ added in v0.22.0
func NewSSPTemplateHandler(sugar *zap.SugaredLogger, db *gorm.DB, enqueuer SSPTemplateRunEnqueuer, cfg *config.SSPTemplateConfig) *SSPTemplateHandler
NewSSPTemplateHandler builds the handler. A nil enqueuer makes the run route answer 503; a nil cfg means the default stale-after.
func (*SSPTemplateHandler) Create ¶ added in v0.22.0
func (h *SSPTemplateHandler) Create(ctx *echo.Context) error
Create godoc
@Summary Create SSP template
@Description Create an SSP template. Discovery creates one SSP per distinct combination of its key label values.
@Tags SSP Templates
@Accept json
@Produce json
@Param template body sspTemplateRequest true "SSP template"
@Success 201 {object} sspTemplateDataResponse
@Failure 400 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates [post]
func (*SSPTemplateHandler) Delete ¶ added in v0.22.0
func (h *SSPTemplateHandler) Delete(ctx *echo.Context) error
Delete godoc
@Summary Delete SSP template
@Description Delete an SSP template. The SSPs it created and their scope entries are kept.
@Tags SSP Templates
@Param id path string true "SSP template ID"
@Success 204
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/{id} [delete]
func (*SSPTemplateHandler) Forget ¶ added in v0.22.0
func (h *SSPTemplateHandler) Forget(ctx *echo.Context) error
Forget godoc
@Summary Forget a deleted SSP of an SSP template
@Description Delete the record of an SSP the template created and a user then deleted, so the next discovery run creates it again. Only allowed once the SSP was deleted (409 otherwise).
@Tags SSP Templates
@Param id path string true "SSP template ID"
@Param keyHash path string true "Instance key hash"
@Success 204
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 409 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/{id}/ssps/{keyHash} [delete]
func (*SSPTemplateHandler) Get ¶ added in v0.22.0
func (h *SSPTemplateHandler) Get(ctx *echo.Context) error
Get godoc
@Summary Get SSP template
@Tags SSP Templates
@Produce json
@Param id path string true "SSP template ID"
@Success 200 {object} sspTemplateDataResponse
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/{id} [get]
func (*SSPTemplateHandler) List ¶ added in v0.22.0
func (h *SSPTemplateHandler) List(ctx *echo.Context) error
List godoc
@Summary List SSP templates
@Tags SSP Templates
@Produce json
@Param page query int false "Page number"
@Param limit query int false "Page size"
@Success 200 {object} svc.ListResponse[sspTemplateResponse]
@Failure 400 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates [get]
func (*SSPTemplateHandler) ListSSPs ¶ added in v0.22.0
func (h *SSPTemplateHandler) ListSSPs(ctx *echo.Context) error
ListSSPs godoc
@Summary List the SSPs an SSP template created
@Description List the template's instances, newest first: the SSP (null once deleted), when it was last seen in evidence, whether it is stale, and the last run's error and skipped entries.
@Tags SSP Templates
@Produce json
@Param id path string true "SSP template ID"
@Param page query int false "Page number"
@Param limit query int false "Page size"
@Success 200 {object} svc.ListResponse[sspTemplateInstanceResponse]
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/{id}/ssps [get]
func (*SSPTemplateHandler) Preview ¶ added in v0.22.0
func (h *SSPTemplateHandler) Preview(ctx *echo.Context) error
Preview godoc
@Summary Preview an SSP template
@Description Show what discovery would do now for a template, saved or not: the SSPs it would create or update, the scope entries it would learn, groups under min-streams, streams lacking a key and groups whose key values cannot be stored. Writes nothing.
@Tags SSP Templates
@Accept json
@Produce json
@Param template body sspTemplatePreviewRequest true "SSP template, with its id when saved"
@Success 200 {object} sspTemplatePreviewResponse
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/preview [post]
func (*SSPTemplateHandler) Register ¶ added in v0.22.0
func (h *SSPTemplateHandler) Register(group *echo.Group)
Register mounts the routes on a group guarded by JWT and admin:manage.
func (*SSPTemplateHandler) Run ¶ added in v0.22.0
func (h *SSPTemplateHandler) Run(ctx *echo.Context) error
Run godoc
@Summary Run SSP template discovery
@Description Queue a discovery run of the template now. A run already queued for it is not queued twice.
@Tags SSP Templates
@Param id path string true "SSP template ID"
@Success 202
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 409 {object} api.Error "the template is disabled"
@Failure 500 {object} api.Error
@Failure 503 {object} api.Error "background jobs are not available"
@Security OAuth2Password
@Router /admin/ssp-templates/{id}/run [post]
func (*SSPTemplateHandler) Update ¶ added in v0.22.0
func (h *SSPTemplateHandler) Update(ctx *echo.Context) error
Update godoc
@Summary Update SSP template
@Description Replace an SSP template's settings. Keys cannot change (400): create a new template instead. SSPs already created are not changed.
@Tags SSP Templates
@Accept json
@Produce json
@Param id path string true "SSP template ID"
@Param template body sspTemplateRequest true "SSP template"
@Success 200 {object} sspTemplateDataResponse
@Failure 400 {object} api.Error
@Failure 404 {object} api.Error
@Failure 500 {object} api.Error
@Security OAuth2Password
@Router /admin/ssp-templates/{id} [put]
type SSPTemplateRunEnqueuer ¶ added in v0.22.0
type SSPTemplateRunEnqueuer interface {
EnqueueSSPTemplateDiscovery(ctx context.Context, templateID uuid.UUID) error
}
SSPTemplateRunEnqueuer queues a discovery run of one SSP template (the worker service).
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 ¶
func (h *SubjectTemplateHandler) Get(ctx *echo.Context) error
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 ¶
func (h *SubjectTemplateHandler) List(ctx *echo.Context) error
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, middlewares ...echo.MiddlewareFunc)
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]
Click to show internal directories.
Click to hide internal directories.