(ctx context.Context, name string, fromConsole bool)
| 40 | } |
| 41 | |
| 42 | func (c *Client) DeleteAllowList(ctx context.Context, name string, fromConsole bool) error { |
| 43 | nbDeleted, err := c.Ent.AllowListItem.Delete().Where(allowlistitem.HasAllowlistWith(allowlist.NameEQ(name), allowlist.FromConsoleEQ(fromConsole))).Exec(ctx) |
| 44 | if err != nil { |
| 45 | return fmt.Errorf("unable to delete allowlist items: %w", err) |
| 46 | } |
| 47 | |
| 48 | c.Log.Debugf("deleted %d items from allowlist %s", nbDeleted, name) |
| 49 | |
| 50 | nbDeleted, err = c.Ent.AllowList. |
| 51 | Delete(). |
| 52 | Where(allowlist.NameEQ(name), allowlist.FromConsoleEQ(fromConsole)). |
| 53 | Exec(ctx) |
| 54 | if err != nil { |
| 55 | return fmt.Errorf("unable to delete allowlist: %w", err) |
| 56 | } |
| 57 | |
| 58 | if nbDeleted == 0 { |
| 59 | return fmt.Errorf("allowlist %s not found", name) |
| 60 | } |
| 61 | |
| 62 | return nil |
| 63 | } |
| 64 | |
| 65 | func (c *Client) DeleteAllowListByID(ctx context.Context, name string, allowlistID string, fromConsole bool) error { |
| 66 | nbDeleted, err := c.Ent.AllowListItem.Delete().Where(allowlistitem.HasAllowlistWith(allowlist.AllowlistIDEQ(allowlistID), allowlist.FromConsoleEQ(fromConsole))).Exec(ctx) |
no test coverage detected