fix: perform client-side filtering on GET firewall zone, because API for getting single zone by ID does not exist (#58)

This commit is contained in:
Mateusz Filipowicz
2025-03-20 20:42:16 +01:00
committed by GitHub
parent a931ceb6bf
commit b6512ab793

View File

@@ -7,7 +7,18 @@ func (c *client) ListFirewallZone(ctx context.Context, site string) ([]FirewallZ
} }
func (c *client) GetFirewallZone(ctx context.Context, site, id string) (*FirewallZone, error) { func (c *client) GetFirewallZone(ctx context.Context, site, id string) (*FirewallZone, error) {
return c.getFirewallZone(ctx, site, id) // client-side filtering is needed, because of lack of endpoint
zones, err := c.listFirewallZone(ctx, site)
if err != nil {
return nil, err
}
for _, zone := range zones {
if zone.ID == id {
return &zone, nil
}
}
return nil, ErrNotFound
} }
func (c *client) DeleteFirewallZone(ctx context.Context, site, id string) error { func (c *client) DeleteFirewallZone(ctx context.Context, site, id string) error {