Documentation
¶
Index ¶
- Constants
- func DeleteRule(c zhttp.Context)
- func DeleteRuleset(c zhttp.Context)
- func GetRule(c zhttp.Context)
- func GetRuleset(c zhttp.Context)
- func ListRulesets(c zhttp.Context)
- func PutRule(c zhttp.Context)
- func PutRuleset(c zhttp.Context)
- func TestRuleset(c zhttp.Context)
- type ListResponse
- type MatchedRule
- type ResultResponse
- type RulesetSummary
- type TestRequest
- type TestResponse
Constants ¶
const (
// MaxRules is the Elasticsearch default limit of rules per ruleset.
MaxRules = 100
)
Variables ¶
This section is empty.
Functions ¶
func DeleteRule ¶
DeleteRule deletes a rule of a query ruleset
@Id DeleteQueryRule @Summary Delete query rule for compatible ES @security BasicAuth @Tags QueryRules @Produce json @Param id path string true "Ruleset id" @Param rule_id path string true "Rule id" @Success 200 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Router /es/_query_rules/{id}/_rule/{rule_id} [delete]
func DeleteRuleset ¶
DeleteRuleset deletes a query ruleset
@Id DeleteQueryRuleset @Summary Delete query ruleset for compatible ES @security BasicAuth @Tags QueryRules @Produce json @Param id path string true "Ruleset id" @Success 200 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Router /es/_query_rules/{id} [delete]
func GetRule ¶
GetRule returns a rule of a query ruleset
@Id GetQueryRule @Summary Get query rule for compatible ES @security BasicAuth @Tags QueryRules @Produce json @Param id path string true "Ruleset id" @Param rule_id path string true "Rule id" @Success 200 {object} meta.QueryRule @Failure 404 {object} map[string]interface{} @Router /es/_query_rules/{id}/_rule/{rule_id} [get]
func GetRuleset ¶
GetRuleset returns a query ruleset
@Id GetQueryRuleset @Summary Get query ruleset for compatible ES @security BasicAuth @Tags QueryRules @Produce json @Param id path string true "Ruleset id" @Success 200 {object} meta.QueryRuleset @Failure 404 {object} map[string]interface{} @Router /es/_query_rules/{id} [get]
func ListRulesets ¶
ListRulesets lists the query rulesets sorted by id
@Id ListQueryRulesets @Summary List query rulesets for compatible ES @security BasicAuth @Tags QueryRules @Produce json @Param from query int false "Starting offset" @Param size query int false "Max results, default 100" @Success 200 {object} rules.ListResponse @Failure 400 {object} map[string]interface{} @Router /es/_query_rules [get]
func PutRule ¶
PutRule creates or replaces a rule, creating its ruleset when missing
@Id PutQueryRule @Summary Create or update query rule for compatible ES @security BasicAuth @Tags QueryRules @Accept json @Produce json @Param id path string true "Ruleset id" @Param rule_id path string true "Rule id" @Param rule body meta.QueryRule true "Rule" @Success 200 {object} rules.ResultResponse "Updated" @Success 201 {object} rules.ResultResponse "Created" @Failure 400 {object} map[string]interface{} @Router /es/_query_rules/{id}/_rule/{rule_id} [put]
func PutRuleset ¶
PutRuleset creates or replaces a query ruleset
@Id PutQueryRuleset @Summary Create or update query ruleset for compatible ES @security BasicAuth @Tags QueryRules @Accept json @Produce json @Param id path string true "Ruleset id" @Param ruleset body meta.QueryRuleset true "Rules" @Success 200 {object} rules.ResultResponse "Updated" @Success 201 {object} rules.ResultResponse "Created" @Failure 400 {object} map[string]interface{} @Router /es/_query_rules/{id} [put]
func TestRuleset ¶
TestRuleset returns the rules of a ruleset matching match_criteria
@Id TestQueryRuleset @Summary Test query ruleset for compatible ES @security BasicAuth @Tags QueryRules @Accept json @Produce json @Param id path string true "Ruleset id" @Param body body rules.TestRequest true "Criteria to match, e.g. {\"match_criteria\":{\"query_string\":\"boots\"}}" @Success 200 {object} rules.TestResponse @Failure 400 {object} map[string]interface{} @Failure 404 {object} map[string]interface{} @Router /es/_query_rules/{id}/_test [post]
Types ¶
type ListResponse ¶
type ListResponse struct {
Count int `json:"count"`
Results []RulesetSummary `json:"results"`
}
ListResponse is a page of the rulesets.
type MatchedRule ¶
MatchedRule is a rule matched by the test API.
type ResultResponse ¶
type ResultResponse struct {
Result string `json:"result"`
}
ResultResponse is the response of a ruleset or rule change.
type RulesetSummary ¶
type RulesetSummary struct {
RulesetID string `json:"ruleset_id"`
RuleTotalCount int `json:"rule_total_count"`
RuleCriteriaTypesCounts map[string]int `json:"rule_criteria_types_counts"`
RuleTypeCounts map[string]int `json:"rule_type_counts"`
}
RulesetSummary is a ruleset of the list response.
type TestRequest ¶
type TestRequest struct {
MatchCriteria map[string]interface{} `json:"match_criteria" binding:"required"`
}
TestRequest is the body of the test API; the match_criteria keys are free-form.
type TestResponse ¶
type TestResponse struct {
TotalMatchedRules int `json:"total_matched_rules"`
MatchedRules []MatchedRule `json:"matched_rules"`
}
TestResponse is the response of the test API.