Pass QOS always for WAN networks
This commit is contained in:
@@ -2,9 +2,30 @@ package unifi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func (dst *Network) MarshalJSON() ([]byte, error) {
|
||||
type Alias Network
|
||||
aux := &struct {
|
||||
*Alias
|
||||
|
||||
WANEgressQOS *emptyStringInt `json:"wan_egress_qos,omitempty"`
|
||||
}{
|
||||
Alias: (*Alias)(dst),
|
||||
}
|
||||
|
||||
if dst.Purpose == "wan" {
|
||||
// only send QOS when this is a WAN network
|
||||
v := emptyStringInt(dst.WANEgressQOS)
|
||||
aux.WANEgressQOS = &v
|
||||
}
|
||||
|
||||
b, err := json.Marshal(aux)
|
||||
return b, err
|
||||
}
|
||||
|
||||
func (c *Client) DeleteNetwork(ctx context.Context, site, id, name string) error {
|
||||
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), struct {
|
||||
Name string `json:"name"`
|
||||
|
||||
Reference in New Issue
Block a user