Compare commits

..

4 Commits

Author SHA1 Message Date
5626d6341e Merge branch '2-create-firewall-zone-api' 2025-04-14 08:19:13 +02:00
825508ed03 debugging 2025-04-14 08:19:06 +02:00
b3b119c402 Merge branch '2-create-firewall-zone-api' 2025-04-13 19:39:29 +02:00
b4e2400bcf Another test 2025-04-13 19:39:16 +02:00
2 changed files with 7 additions and 6 deletions

View File

@@ -22,17 +22,15 @@ type FirewallZone struct {
}
func (c *Client) ListFirewallZones(ctx context.Context, site string) ([]FirewallZone, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallZone `json:"data"`
}
var respBody []FirewallZone
err := c.do(ctx, "GET", fmt.Sprintf("site/%s/firewall/zone", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
return respBody, nil
}
func (c *Client) GetFirewallZone(ctx context.Context, site, id string) (*FirewallZone, error) {

View File

@@ -13,6 +13,7 @@ import (
"path"
"strings"
"sync"
"log"
)
const (
@@ -274,6 +275,8 @@ func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody int
// TODO: check rc in addition to status code?
log.Printf("%+v", respBody)
log.Printf("%+v", resp.Body)
err = json.NewDecoder(resp.Body).Decode(respBody)
if err != nil {
return fmt.Errorf("unable to decode body: %s %s %w", method, relativeURL, err)