MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / RemoveFromAllowlist

Method RemoveFromAllowlist

pkg/database/allowlists.go:192–205  ·  view source on GitHub ↗
(ctx context.Context, list *ent.AllowList, values ...string)

Source from the content-addressed store, hash-verified

190}
191
192func (c *Client) RemoveFromAllowlist(ctx context.Context, list *ent.AllowList, values ...string) (int, error) {
193 c.Log.Debugf("removing %d values from allowlist %s", len(values), list.Name)
194 c.Log.Tracef("values: %v", values)
195
196 nbDeleted, err := c.Ent.AllowListItem.Delete().Where(
197 allowlistitem.HasAllowlistWith(allowlist.IDEQ(list.ID)),
198 allowlistitem.ValueIn(values...),
199 ).Exec(ctx)
200 if err != nil {
201 return 0, fmt.Errorf("unable to remove values from allowlist: %w", err)
202 }
203
204 return nbDeleted, nil
205}
206
207func (c *Client) UpdateAllowlistMeta(ctx context.Context, allowlistID string, name string, description string) error {
208 c.Log.Debugf("updating allowlist %s meta", name)

Callers 1

removeMethod · 0.80

Calls 7

HasAllowlistWithFunction · 0.92
IDEQFunction · 0.92
ValueInFunction · 0.92
TracefMethod · 0.80
ExecMethod · 0.45
WhereMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected