Compare commits
8 Commits
v0.0.1-alp
...
v0.0.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| db4af29aa6 | |||
| db8d86a2c5 | |||
| 5626d6341e | |||
| 825508ed03 | |||
| b3b119c402 | |||
| b4e2400bcf | |||
| 8974e82e78 | |||
| 01e89ca98d |
@@ -14,25 +14,23 @@ type FirewallZone struct {
|
||||
// NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Name string `json:"name"`
|
||||
Description string `json:"desc"`
|
||||
DefaultZone bool `json:default_zone,omitempty`
|
||||
NetworkIDs []string `json:network_ids,omitempty`
|
||||
DefaultZone bool `json:"default_zone,omitempty"`
|
||||
NetworkIDs []string `json:"network_ids,omitempty"`
|
||||
ZoneKey string `json:"zone_key,omitempty"`
|
||||
|
||||
// Role string `json:"role"`
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
"log"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -273,7 +274,9 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user