MCPcopy
hub / github.com/crowdsecurity/crowdsec / GetAllowListByID

Method GetAllowListByID

pkg/database/allowlists.go:120–132  ·  view source on GitHub ↗
(ctx context.Context, allowlistID string, withContent bool)

Source from the content-addressed store, hash-verified

118}
119
120func (c *Client) GetAllowListByID(ctx context.Context, allowlistID string, withContent bool) (*ent.AllowList, error) {
121 q := c.Ent.AllowList.Query().Where(allowlist.AllowlistIDEQ(allowlistID))
122 if withContent {
123 q = q.WithAllowlistItems()
124 }
125
126 result, err := q.First(ctx)
127 if err != nil {
128 return nil, err
129 }
130
131 return result, nil
132}
133
134func (c *Client) AddToAllowlist(ctx context.Context, list *ent.AllowList, items []*models.AllowlistItem) (int, error) {
135 added := 0

Callers 1

updateOneAllowlistMethod · 0.80

Calls 5

AllowlistIDEQFunction · 0.92
WithAllowlistItemsMethod · 0.80
WhereMethod · 0.45
QueryMethod · 0.45
FirstMethod · 0.45

Tested by

no test coverage detected