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:
committed by
GitHub
parent
a931ceb6bf
commit
b6512ab793
@@ -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) {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user