Generate from 5.12.72 fields
This commit is contained in:
@@ -52,6 +52,7 @@ var fieldReps = []replacement{
|
|||||||
{"Pd", "PD"},
|
{"Pd", "PD"},
|
||||||
{"Pmf", "PMF"},
|
{"Pmf", "PMF"},
|
||||||
{"Qos", "QOS"},
|
{"Qos", "QOS"},
|
||||||
|
{"Radiusprofile", "RADIUSProfile"},
|
||||||
{"Radius", "RADIUS"},
|
{"Radius", "RADIUS"},
|
||||||
{"Ssid", "SSID"},
|
{"Ssid", "SSID"},
|
||||||
{"Startdate", "StartDate"},
|
{"Startdate", "StartDate"},
|
||||||
@@ -75,6 +76,7 @@ var fileReps = []replacement{
|
|||||||
{"Dhcp", "DHCP"},
|
{"Dhcp", "DHCP"},
|
||||||
{"Wlan", "WLAN"},
|
{"Wlan", "WLAN"},
|
||||||
{"NetworkConf", "Network"},
|
{"NetworkConf", "Network"},
|
||||||
|
{"RadiusProfile", "RADIUSProfile"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanName(name string, reps []replacement) string {
|
func cleanName(name string, reps []replacement) string {
|
||||||
@@ -118,6 +120,10 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if name == "Wall.json" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
name = name[:len(name)-len(ext)]
|
name = name[:len(name)-len(ext)]
|
||||||
|
|
||||||
urlPath := strings.ToLower(name)
|
urlPath := strings.ToLower(name)
|
||||||
@@ -325,7 +331,7 @@ func normalizeValidation(re string) string {
|
|||||||
return re
|
return re
|
||||||
}
|
}
|
||||||
|
|
||||||
func typeFromValidation(validation interface{}) (string, string, bool, error) {
|
func typeFromValidation(validation interface{}) (ty string, comment string, omitempty bool, err error) {
|
||||||
switch validation := validation.(type) {
|
switch validation := validation.(type) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
if len(validation) == 0 {
|
if len(validation) == 0 {
|
||||||
@@ -339,6 +345,28 @@ func typeFromValidation(validation interface{}) (string, string, bool, error) {
|
|||||||
return "", "", false, err
|
return "", "", false, err
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("[]%s", elementType), elementComment, true, nil
|
return fmt.Sprintf("[]%s", elementType), elementComment, true, nil
|
||||||
|
case map[string]interface{}:
|
||||||
|
fieldNames := []string{}
|
||||||
|
fieldCodes := map[string]string{}
|
||||||
|
for name, fv := range validation {
|
||||||
|
fieldNames = append(fieldNames, name)
|
||||||
|
fieldCode, err := generateField(name, fv)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", false, err
|
||||||
|
}
|
||||||
|
fieldCodes[name] = fieldCode
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: sort by normalized name, not this name
|
||||||
|
sort.Strings(fieldNames)
|
||||||
|
|
||||||
|
code := "struct {\n"
|
||||||
|
for _, name := range fieldNames {
|
||||||
|
code += fieldCodes[name] + "\n"
|
||||||
|
}
|
||||||
|
code += "\n}"
|
||||||
|
|
||||||
|
return code, "", false, nil
|
||||||
case string:
|
case string:
|
||||||
comment := validation
|
comment := validation
|
||||||
normalized := normalizeValidation(validation)
|
normalized := normalizeValidation(validation)
|
||||||
|
|||||||
144
unifi/channel_plan.generated.go
Normal file
144
unifi/channel_plan.generated.go
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type ChannelPlan struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
ApBlacklistedChannels []struct {
|
||||||
|
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
|
||||||
|
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
|
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
|
||||||
|
|
||||||
|
} `json:"ap_blacklisted_channels,omitempty"`
|
||||||
|
ConfSource string `json:"conf_source,omitempty"` // manual|radio-ai
|
||||||
|
Coupling []struct {
|
||||||
|
Rssi int `json:"rssi,omitempty"`
|
||||||
|
Source string `json:"source,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
|
||||||
|
Target string `json:"target,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
|
||||||
|
|
||||||
|
} `json:"coupling,omitempty"`
|
||||||
|
Date string `json:"date"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$
|
||||||
|
Fitness float64 `json:"fitness,omitempty"`
|
||||||
|
Note string `json:"note,omitempty"` // .{0,1024}
|
||||||
|
Radio string `json:"radio,omitempty"` // na|ng|ng\+na
|
||||||
|
RadioTable []struct {
|
||||||
|
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||||
|
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||||
|
DeviceMAC string `json:"device_mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
|
Name string `json:"name,omitempty"` // [a-z]*[0-9]*
|
||||||
|
TxPower string `json:"tx_power,omitempty"` // [\d]+|auto
|
||||||
|
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
|
||||||
|
Width int `json:"width,omitempty"` // 20|40|80|160
|
||||||
|
|
||||||
|
} `json:"radio_table,omitempty"`
|
||||||
|
Satisfaction float64 `json:"satisfaction,omitempty"`
|
||||||
|
SatisfactionTable []struct {
|
||||||
|
DeviceMAC string `json:"device_mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
|
Satisfaction float64 `json:"satisfaction,omitempty"`
|
||||||
|
} `json:"satisfaction_table,omitempty"`
|
||||||
|
SiteBlacklistedChannels []struct {
|
||||||
|
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
|
||||||
|
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
|
||||||
|
|
||||||
|
} `json:"site_blacklisted_channels,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listChannelPlan(ctx context.Context, site string) ([]ChannelPlan, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ChannelPlan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/channelplan", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getChannelPlan(ctx context.Context, site, id string) (*ChannelPlan, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ChannelPlan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/channelplan/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteChannelPlan(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/channelplan/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ChannelPlan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/channelplan", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ChannelPlan `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/channelplan/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
117
unifi/dashboard.generated.go
Normal file
117
unifi/dashboard.generated.go
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type Dashboard struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
ControllerVersion string `json:"controller_version,omitempty"`
|
||||||
|
Desc string `json:"desc,omitempty"`
|
||||||
|
IsPublic bool `json:"is_public"`
|
||||||
|
Modules []struct {
|
||||||
|
Config string `json:"config,omitempty"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
ModuleID string `json:"module_id"`
|
||||||
|
Restrictions string `json:"restrictions,omitempty"`
|
||||||
|
} `json:"modules,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listDashboard(ctx context.Context, site string) ([]Dashboard, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Dashboard `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/dashboard", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getDashboard(ctx context.Context, site, id string) (*Dashboard, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Dashboard `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/dashboard/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteDashboard(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/dashboard/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Dashboard `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/dashboard", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Dashboard `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/dashboard/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
248
unifi/device.generated.go
Normal file
248
unifi/device.generated.go
Normal file
@@ -0,0 +1,248 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type Device struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
AtfEnabled bool `json:"atf_enabled"`
|
||||||
|
BandsteeringMode string `json:"bandsteering_mode,omitempty"` // off|equal|prefer_5g
|
||||||
|
BaresipAuthUser string `json:"baresip_auth_user,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||||
|
BaresipEnabled bool `json:"baresip_enabled"`
|
||||||
|
BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||||
|
ConfigNetwork struct {
|
||||||
|
BondingEnabled bool `json:"bonding_enabled"`
|
||||||
|
DNS1 string `json:"dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||||
|
DNS2 string `json:"dns2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||||
|
DNSsuffix string `json:"dnssuffix,omitempty"`
|
||||||
|
Gateway string `json:"gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||||
|
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||||
|
Netmask string `json:"netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
|
||||||
|
Type string `json:"type,omitempty"` // dhcp|static
|
||||||
|
|
||||||
|
} `json:"config_network"`
|
||||||
|
Disabled bool `json:"disabled"`
|
||||||
|
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id"` // [\d\w]+|
|
||||||
|
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled"`
|
||||||
|
DPIEnabled bool `json:"dpi_enabled"`
|
||||||
|
EthernetOverrides []struct {
|
||||||
|
Ifname string `json:"ifname,omitempty"` // eth[0-9]{1,2}
|
||||||
|
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?|WAN[2]?
|
||||||
|
|
||||||
|
} `json:"ethernet_overrides,omitempty"`
|
||||||
|
FlowctrlEnabled bool `json:"flowctrl_enabled"`
|
||||||
|
HeightInMeters float64 `json:"heightInMeters,omitempty"`
|
||||||
|
JumboframeEnabled bool `json:"jumboframe_enabled"`
|
||||||
|
LcmBrightness int `json:"lcm_brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||||
|
LcmBrightnessOverride bool `json:"lcm_brightness_override"`
|
||||||
|
LcmIDleTimeout int `json:"lcm_idle_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||||
|
LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override"`
|
||||||
|
LcmTrackerEnabled bool `json:"lcm_tracker_enabled"`
|
||||||
|
LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50}
|
||||||
|
LedOverride string `json:"led_override,omitempty"` // default|on|off
|
||||||
|
LedOverrideColor string `json:"led_override_color,omitempty"` // ^#(?:[0-9a-fA-F]{3}){1,2}$
|
||||||
|
LedOverrideColorBrightness int `json:"led_override_color_brightness,omitempty"` // ^[0-9][0-9]?$|^100$
|
||||||
|
Locked bool `json:"locked"`
|
||||||
|
LteExtAnt bool `json:"lte_ext_ant"`
|
||||||
|
LtePoe bool `json:"lte_poe"`
|
||||||
|
LteSoftLimit int `json:"lte_soft_limit,omitempty"`
|
||||||
|
MapID string `json:"map_id"`
|
||||||
|
MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled"`
|
||||||
|
MgmtNetworkID string `json:"mgmt_network_id"` // [\d\w]+
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off
|
||||||
|
OutletCycleEnabled bool `json:"outlet_cycle_enabled"`
|
||||||
|
OutletOverrides []struct {
|
||||||
|
Index int `json:"index,omitempty"`
|
||||||
|
RelayState bool `json:"relay_state"`
|
||||||
|
} `json:"outlet_overrides,omitempty"`
|
||||||
|
PortOverrides []struct {
|
||||||
|
AggregateNumPorts int `json:"aggregate_num_ports,omitempty"` // [2-6]
|
||||||
|
Autoneg bool `json:"autoneg"`
|
||||||
|
Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host
|
||||||
|
EgressRateLimitKbps int `json:"egress_rate_limit_kbps,omitempty"` // 6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}
|
||||||
|
EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled"`
|
||||||
|
FullDuplex bool `json:"full_duplex"`
|
||||||
|
Isolation bool `json:"isolation"`
|
||||||
|
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
||||||
|
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
||||||
|
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||||
|
Name string `json:"name,omitempty"` // .{0,128}
|
||||||
|
OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate
|
||||||
|
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||||
|
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||||
|
PortSecurityEnabled bool `json:"port_security_enabled"`
|
||||||
|
PortSecurityMACAddress []string `json:"port_security_mac_address,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
||||||
|
PortconfID string `json:"portconf_id"` // [\d\w]+
|
||||||
|
PriorityQueue1Level int `json:"priority_queue1_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
PriorityQueue2Level int `json:"priority_queue2_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
PriorityQueue3Level int `json:"priority_queue3_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
PriorityQueue4Level int `json:"priority_queue4_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
Speed int `json:"speed,omitempty"` // 10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000
|
||||||
|
StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled"`
|
||||||
|
StormctrlBroadcastastLevel int `json:"stormctrl_bcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
StormctrlBroadcastastRate int `json:"stormctrl_bcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||||
|
StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled"`
|
||||||
|
StormctrlMcastLevel int `json:"stormctrl_mcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
StormctrlMcastRate int `json:"stormctrl_mcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||||
|
StormctrlType string `json:"stormctrl_type,omitempty"` // level|rate
|
||||||
|
StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled"`
|
||||||
|
StormctrlUcastLevel int `json:"stormctrl_ucast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
StormctrlUcastRate int `json:"stormctrl_ucast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||||
|
StpPortMode bool `json:"stp_port_mode"`
|
||||||
|
} `json:"port_overrides,omitempty"`
|
||||||
|
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
|
||||||
|
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled"`
|
||||||
|
RadioTable []struct {
|
||||||
|
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
|
||||||
|
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
|
||||||
|
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||||
|
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||||
|
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled"`
|
||||||
|
Ht int `json:"ht,omitempty"` // 20|40|80|160|1080|2160
|
||||||
|
MinRssi int `json:"min_rssi,omitempty"` // ^-([1-9]|[1-8][0-9]|9[0-4])$
|
||||||
|
MinRssiEnabled bool `json:"min_rssi_enabled"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Radio string `json:"radio,omitempty"` // ng|na|ad
|
||||||
|
SensLevel int `json:"sens_level,omitempty"` // ^-([5-8][0-9]|90)$
|
||||||
|
SensLevelEnabled bool `json:"sens_level_enabled"`
|
||||||
|
TxPower string `json:"tx_power,omitempty"` // [\d]+|auto
|
||||||
|
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
|
||||||
|
VwireEnabled bool `json:"vwire_enabled"`
|
||||||
|
WLANGroupID string `json:"wlangroup_id"` // [\d\w]+
|
||||||
|
|
||||||
|
} `json:"radio_table,omitempty"`
|
||||||
|
RADIUSProfileID string `json:"radiusprofile_id"`
|
||||||
|
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
|
||||||
|
RpsOverride struct {
|
||||||
|
PowerManagementMode string `json:"power_management_mode,omitempty"` // dynamic|static
|
||||||
|
RpsPortTable []struct {
|
||||||
|
Name string `json:"name,omitempty"` // .{0,32}
|
||||||
|
PortIDX int `json:"port_idx,omitempty"` // [1-6]
|
||||||
|
PortMode string `json:"port_mode,omitempty"` // auto|force_active|manual|disabled
|
||||||
|
|
||||||
|
} `json:"rps_port_table,omitempty"`
|
||||||
|
} `json:"rps_override"`
|
||||||
|
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
|
||||||
|
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
|
||||||
|
StpPriority int `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
|
||||||
|
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
|
||||||
|
SwitchVLANEnabled bool `json:"switch_vlan_enabled"`
|
||||||
|
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
|
||||||
|
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
|
WLANOverrides []struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
Name string `json:"name,omitempty"` // .{1,32}
|
||||||
|
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||||
|
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
||||||
|
Radio string `json:"radio,omitempty"` // ng|na
|
||||||
|
RadioName string `json:"radio_name,omitempty"`
|
||||||
|
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$
|
||||||
|
VLANEnabled bool `json:"vlan_enabled"`
|
||||||
|
WLANID string `json:"wlan_id"` // [\d\w]+
|
||||||
|
XPassphrase string `json:"x_passphrase,omitempty"` // [\x20-\x7E]{8,63}|[0-9a-fA-F]{64}
|
||||||
|
|
||||||
|
} `json:"wlan_overrides,omitempty"`
|
||||||
|
X string `json:"x,omitempty"`
|
||||||
|
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
|
||||||
|
Y string `json:"y,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Device `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getDevice(ctx context.Context, site, id string) (*Device, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Device `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteDevice(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/device/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createDevice(ctx context.Context, site string, d *Device) (*Device, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Device `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/device", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateDevice(ctx context.Context, site string, d *Device) (*Device, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Device `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/device/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
210
unifi/hotspot_2_conf.generated.go
Normal file
210
unifi/hotspot_2_conf.generated.go
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type Hotspot2Conf struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
ApIsolate bool `json:"ap_isolate"`
|
||||||
|
Capab []struct {
|
||||||
|
Port string `json:"port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||||
|
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp
|
||||||
|
Status string `json:"status,omitempty"` // closed|open|unknown
|
||||||
|
|
||||||
|
} `json:"capab,omitempty"`
|
||||||
|
CellularNetworkList []struct {
|
||||||
|
Mcc int `json:"mcc,omitempty"`
|
||||||
|
Mnc int `json:"mnc,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"cellular_network_list,omitempty"`
|
||||||
|
DeauthReqTimeout int `json:"deauth_req_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||||
|
DisableDgaf bool `json:"disable_dgaf"`
|
||||||
|
DomainNameList []string `json:"domain_name_list,omitempty"` // .{1,128}
|
||||||
|
FriendlyName []struct {
|
||||||
|
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||||
|
Text string `json:"text,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"friendly_name,omitempty"`
|
||||||
|
GasComebackDelay int `json:"gas_comeback_delay,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|300
|
||||||
|
Hessid string `json:"hessid"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
|
||||||
|
Icons []struct {
|
||||||
|
Data string `json:"data,omitempty"`
|
||||||
|
Filename string `json:"filename,omitempty"` // .{1,256}
|
||||||
|
Height int `json:"height,omitempty"`
|
||||||
|
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||||
|
Media string `json:"media,omitempty"` // .{1,256}
|
||||||
|
Name string `json:"name,omitempty"` // .{1,256}
|
||||||
|
Size int `json:"size,omitempty"`
|
||||||
|
Width int `json:"width,omitempty"`
|
||||||
|
} `json:"icons,omitempty"`
|
||||||
|
MetricsDownlinkLoad int `json:"metrics_downlink_load,omitempty"`
|
||||||
|
MetricsDownlinkSpeed int `json:"metrics_downlink_speed,omitempty"`
|
||||||
|
MetricsInfo string `json:"metrics_info,omitempty"` // [0-9A-Fa-f]{1,2}
|
||||||
|
MetricsMeasurement int `json:"metrics_measurement,omitempty"`
|
||||||
|
MetricsStatus bool `json:"metrics_status"`
|
||||||
|
MetricsUplinkLoad int `json:"metrics_uplink_load,omitempty"`
|
||||||
|
MetricsUplinkSpeed int `json:"metrics_uplink_speed,omitempty"`
|
||||||
|
NaiRealmList []struct {
|
||||||
|
AuthIDs string `json:"auth_ids,omitempty"`
|
||||||
|
AuthVals string `json:"auth_vals,omitempty"`
|
||||||
|
EapMethod int `json:"eap_method,omitempty"` // 13|21|18|23|50
|
||||||
|
Encoding int `json:"encoding,omitempty"` // 0|1
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
Status bool `json:"status"`
|
||||||
|
} `json:"nai_realm_list,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
NetworkAccessAsra bool `json:"network_access_asra"`
|
||||||
|
NetworkAccessEsr bool `json:"network_access_esr"`
|
||||||
|
NetworkAccessInternet bool `json:"network_access_internet"`
|
||||||
|
NetworkAccessUesa bool `json:"network_access_uesa"`
|
||||||
|
NetworkType int `json:"network_type,omitempty"` // 0|1|2|3|4|5|14|15
|
||||||
|
Osu []struct {
|
||||||
|
Description []struct {
|
||||||
|
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||||
|
Text string `json:"text,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"description,omitempty"`
|
||||||
|
FriendlyName []struct {
|
||||||
|
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||||
|
Text string `json:"text,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"friendly_name,omitempty"`
|
||||||
|
Icon []struct {
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"icon,omitempty"`
|
||||||
|
MethodOmaDm bool `json:"method_oma_dm"`
|
||||||
|
MethodSoapXmlSpp bool `json:"method_soap_xml_spp"`
|
||||||
|
Nai string `json:"nai,omitempty"`
|
||||||
|
Nai2 string `json:"nai2,omitempty"`
|
||||||
|
OperatingClass string `json:"operating_class,omitempty"` // [0-9A-Fa-f]{12}
|
||||||
|
ServerUri string `json:"server_uri,omitempty"`
|
||||||
|
} `json:"osu,omitempty"`
|
||||||
|
OsuSSID string `json:"osu_ssid"`
|
||||||
|
P2P bool `json:"p2p"`
|
||||||
|
ProxyArp bool `json:"proxy_arp"`
|
||||||
|
QOSMapDcsp []struct {
|
||||||
|
High int `json:"high,omitempty"`
|
||||||
|
Low int `json:"low,omitempty"`
|
||||||
|
} `json:"qos_map_dcsp,omitempty"`
|
||||||
|
QOSMapExceptions []struct {
|
||||||
|
Dcsp int `json:"dcsp,omitempty"`
|
||||||
|
Up int `json:"up,omitempty"` // [0-7]
|
||||||
|
|
||||||
|
} `json:"qos_map_exceptions,omitempty"`
|
||||||
|
QOSMapStatus bool `json:"qos_map_status"`
|
||||||
|
RoamingConsortiumList []struct {
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
Oid string `json:"oid,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"roaming_consortium_list,omitempty"`
|
||||||
|
TCFilename string `json:"t_c_filename,omitempty"` // .{1,256}
|
||||||
|
TCTimestamp int `json:"t_c_timestamp,omitempty"`
|
||||||
|
VenueGroup int `json:"venue_group,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11
|
||||||
|
VenueName []struct {
|
||||||
|
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
|
||||||
|
} `json:"venue_name,omitempty"`
|
||||||
|
VenueType int `json:"venue_type,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listHotspot2Conf(ctx context.Context, site string) ([]Hotspot2Conf, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Hotspot2Conf `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/hotspot2conf", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getHotspot2Conf(ctx context.Context, site, id string) (*Hotspot2Conf, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Hotspot2Conf `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/hotspot2conf/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteHotspot2Conf(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/hotspot2conf/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Hotspot2Conf `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/hotspot2conf", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []Hotspot2Conf `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/hotspot2conf/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
@@ -118,7 +118,7 @@ type Network struct {
|
|||||||
PptpcUsername string `json:"pptpc_username,omitempty"` // [^\"\' ]+
|
PptpcUsername string `json:"pptpc_username,omitempty"` // [^\"\' ]+
|
||||||
Priority int `json:"priority,omitempty"` // [1-4]
|
Priority int `json:"priority,omitempty"` // [1-4]
|
||||||
Purpose string `json:"purpose,omitempty"` // corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan
|
Purpose string `json:"purpose,omitempty"` // corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan
|
||||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
RADIUSProfileID string `json:"radiusprofile_id"`
|
||||||
RemoteSiteID string `json:"remote_site_id"`
|
RemoteSiteID string `json:"remote_site_id"`
|
||||||
RemoteSiteSubnets []string `json:"remote_site_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
RemoteSiteSubnets []string `json:"remote_site_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
||||||
RemoteVPNSubnets []string `json:"remote_vpn_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
RemoteVPNSubnets []string `json:"remote_vpn_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
|
||||||
|
|||||||
125
unifi/radius_profile.generated.go
Normal file
125
unifi/radius_profile.generated.go
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type RADIUSProfile struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
AccountingEnabled bool `json:"accounting_enabled"`
|
||||||
|
AcctServers []struct {
|
||||||
|
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||||
|
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
|
||||||
|
XSecret string `json:"x_secret,omitempty"`
|
||||||
|
} `json:"acct_servers,omitempty"`
|
||||||
|
AuthServers []struct {
|
||||||
|
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||||
|
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
|
||||||
|
XSecret string `json:"x_secret,omitempty"`
|
||||||
|
} `json:"auth_servers,omitempty"`
|
||||||
|
InterimUpdateEnabled bool `json:"interim_update_enabled"`
|
||||||
|
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
UseUsgAcctServer bool `json:"use_usg_acct_server"`
|
||||||
|
UseUsgAuthServer bool `json:"use_usg_auth_server"`
|
||||||
|
VLANEnabled bool `json:"vlan_enabled"`
|
||||||
|
VLANWLANMode string `json:"vlan_wlan_mode,omitempty"` // disabled|optional|required
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listRADIUSProfile(ctx context.Context, site string) ([]RADIUSProfile, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []RADIUSProfile `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/radiusprofile", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getRADIUSProfile(ctx context.Context, site, id string) (*RADIUSProfile, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []RADIUSProfile `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/radiusprofile/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteRADIUSProfile(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/radiusprofile/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createRADIUSProfile(ctx context.Context, site string, d *RADIUSProfile) (*RADIUSProfile, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []RADIUSProfile `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/radiusprofile", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateRADIUSProfile(ctx context.Context, site string, d *RADIUSProfile) (*RADIUSProfile, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []RADIUSProfile `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/radiusprofile/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
120
unifi/schedule_task.generated.go
Normal file
120
unifi/schedule_task.generated.go
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type ScheduleTask struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
Action string `json:"action,omitempty"` // stream|upgrade
|
||||||
|
AdditionalSoundsEnabled bool `json:"additional_sounds_enabled"`
|
||||||
|
BroadcastgroupID string `json:"broadcastgroup_id"`
|
||||||
|
CronExpr string `json:"cron_expr,omitempty"`
|
||||||
|
ExecuteOnlyOnce bool `json:"execute_only_once"`
|
||||||
|
MediafileID string `json:"mediafile_id"`
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
SampleFilename string `json:"sample_filename,omitempty"`
|
||||||
|
StreamType string `json:"stream_type,omitempty"` // media|sample
|
||||||
|
UpgradeTargets []struct {
|
||||||
|
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
|
|
||||||
|
} `json:"upgrade_targets,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listScheduleTask(ctx context.Context, site string) ([]ScheduleTask, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ScheduleTask `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/scheduletask", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getScheduleTask(ctx context.Context, site, id string) (*ScheduleTask, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ScheduleTask `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/scheduletask/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteScheduleTask(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/scheduletask/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ScheduleTask `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/scheduletask", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []ScheduleTask `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/scheduletask/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
@@ -78,7 +78,7 @@ type SettingGuestAccess struct {
|
|||||||
RADIUSDisconnectEnabled bool `json:"radius_disconnect_enabled"`
|
RADIUSDisconnectEnabled bool `json:"radius_disconnect_enabled"`
|
||||||
RADIUSDisconnectPort int `json:"radius_disconnect_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
RADIUSDisconnectPort int `json:"radius_disconnect_port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]
|
||||||
RADIUSEnabled bool `json:"radius_enabled"`
|
RADIUSEnabled bool `json:"radius_enabled"`
|
||||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
RADIUSProfileID string `json:"radiusprofile_id"`
|
||||||
RedirectEnabled bool `json:"redirect_enabled"`
|
RedirectEnabled bool `json:"redirect_enabled"`
|
||||||
RedirectHttps bool `json:"redirect_https"`
|
RedirectHttps bool `json:"redirect_https"`
|
||||||
RedirectToHttps bool `json:"redirect_to_https"`
|
RedirectToHttps bool `json:"redirect_to_https"`
|
||||||
|
|||||||
66
unifi/setting_ips.generated.go
Normal file
66
unifi/setting_ips.generated.go
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type SettingIps struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
DNSFiltering bool `json:"dns_filtering"`
|
||||||
|
DNSFilters []struct {
|
||||||
|
Filter string `json:"filter,omitempty"` // security|adult|family
|
||||||
|
NetworkID string `json:"network_id"`
|
||||||
|
Version string `json:"version,omitempty"` // v4|v6
|
||||||
|
|
||||||
|
} `json:"dns_filters,omitempty"`
|
||||||
|
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|spamhaus|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
|
||||||
|
EndpointScanning bool `json:"endpoint_scanning"`
|
||||||
|
Honeypot []struct {
|
||||||
|
IPAddress string `json:"ip_address,omitempty"`
|
||||||
|
NetworkID string `json:"network_id"`
|
||||||
|
Version string `json:"version,omitempty"` // v4|v6
|
||||||
|
|
||||||
|
} `json:"honeypot,omitempty"`
|
||||||
|
HoneypotEnabled bool `json:"honeypot_enabled"`
|
||||||
|
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
|
||||||
|
RestrictIPAddresses bool `json:"restrict_ip_addresses"`
|
||||||
|
RestrictTor bool `json:"restrict_tor"`
|
||||||
|
RestrictTorrents bool `json:"restrict_torrents"`
|
||||||
|
Suppression struct {
|
||||||
|
Alerts []struct {
|
||||||
|
Category string `json:"category,omitempty"`
|
||||||
|
Gid int `json:"gid,omitempty"`
|
||||||
|
ID int `json:"id,omitempty"`
|
||||||
|
Signature string `json:"signature,omitempty"`
|
||||||
|
Tracking []struct {
|
||||||
|
Direction string `json:"direction,omitempty"` // both|src|dest
|
||||||
|
Mode string `json:"mode,omitempty"` // ip|subnet|network
|
||||||
|
Value string `json:"value,omitempty"`
|
||||||
|
} `json:"tracking,omitempty"`
|
||||||
|
Type string `json:"type,omitempty"` // all|track
|
||||||
|
|
||||||
|
} `json:"alerts,omitempty"`
|
||||||
|
Whitelist []struct {
|
||||||
|
Direction string `json:"direction,omitempty"` // both|src|dest
|
||||||
|
Mode string `json:"mode,omitempty"` // ip|subnet|network
|
||||||
|
Value string `json:"value,omitempty"`
|
||||||
|
} `json:"whitelist,omitempty"`
|
||||||
|
} `json:"suppression"`
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ type SettingMgmt struct {
|
|||||||
AdvancedFeatureEnabled bool `json:"advanced_feature_enabled"`
|
AdvancedFeatureEnabled bool `json:"advanced_feature_enabled"`
|
||||||
AlertEnabled bool `json:"alert_enabled"`
|
AlertEnabled bool `json:"alert_enabled"`
|
||||||
AutoUpgrade bool `json:"auto_upgrade"`
|
AutoUpgrade bool `json:"auto_upgrade"`
|
||||||
|
BootSound bool `json:"boot_sound"`
|
||||||
LedEnabled bool `json:"led_enabled"`
|
LedEnabled bool `json:"led_enabled"`
|
||||||
OutdoorModeEnabled bool `json:"outdoor_mode_enabled"`
|
OutdoorModeEnabled bool `json:"outdoor_mode_enabled"`
|
||||||
UnifiIDpEnabled bool `json:"unifi_idp_enabled"`
|
UnifiIDpEnabled bool `json:"unifi_idp_enabled"`
|
||||||
|
|||||||
117
unifi/spatial_record.generated.go
Normal file
117
unifi/spatial_record.generated.go
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
// Code generated from ace.jar fields *.json files
|
||||||
|
// DO NOT EDIT.
|
||||||
|
|
||||||
|
package unifi
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// just to fix compile issues with the import
|
||||||
|
var (
|
||||||
|
_ fmt.Formatter
|
||||||
|
_ context.Context
|
||||||
|
)
|
||||||
|
|
||||||
|
type SpatialRecord struct {
|
||||||
|
ID string `json:"_id,omitempty"`
|
||||||
|
SiteID string `json:"site_id,omitempty"`
|
||||||
|
|
||||||
|
Hidden bool `json:"attr_hidden,omitempty"`
|
||||||
|
HiddenID string `json:"attr_hidden_id,omitempty"`
|
||||||
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
|
Devices []struct {
|
||||||
|
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
|
Position struct {
|
||||||
|
X float64 `json:"x,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||||
|
Y float64 `json:"y,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||||
|
Z float64 `json:"z,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||||
|
|
||||||
|
} `json:"position"`
|
||||||
|
} `json:"devices,omitempty"`
|
||||||
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) listSpatialRecord(ctx context.Context, site string) ([]SpatialRecord, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []SpatialRecord `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/spatialrecord", site), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return respBody.Data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) getSpatialRecord(ctx context.Context, site, id string) (*SpatialRecord, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []SpatialRecord `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/spatialrecord/%s", site, id), nil, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
d := respBody.Data[0]
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) deleteSpatialRecord(ctx context.Context, site, id string) error {
|
||||||
|
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/spatialrecord/%s", site, id), struct{}{}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) createSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []SpatialRecord `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/spatialrecord", site), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) updateSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) {
|
||||||
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []SpatialRecord `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/spatialrecord/%s", site, d.ID), d, &respBody)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(respBody.Data) != 1 {
|
||||||
|
return nil, &NotFoundError{}
|
||||||
|
}
|
||||||
|
|
||||||
|
new := respBody.Data[0]
|
||||||
|
|
||||||
|
return &new, nil
|
||||||
|
}
|
||||||
@@ -64,7 +64,7 @@ type WLAN struct {
|
|||||||
RADIUSMACAuthEnabled bool `json:"radius_mac_auth_enabled"`
|
RADIUSMACAuthEnabled bool `json:"radius_mac_auth_enabled"`
|
||||||
RADIUSMACaclEmptyPassword bool `json:"radius_macacl_empty_password"`
|
RADIUSMACaclEmptyPassword bool `json:"radius_macacl_empty_password"`
|
||||||
RADIUSMACaclFormat string `json:"radius_macacl_format,omitempty"` // none_lower|hyphen_lower|colon_lower|none_upper|hyphen_upper|colon_upper
|
RADIUSMACaclFormat string `json:"radius_macacl_format,omitempty"` // none_lower|hyphen_lower|colon_lower|none_upper|hyphen_upper|colon_upper
|
||||||
RADIUSprofileID string `json:"radiusprofile_id"`
|
RADIUSProfileID string `json:"radiusprofile_id"`
|
||||||
RoamClusterID int `json:"roam_cluster_id,omitempty"` // [0-9]|[1-2][0-9]|[3][0-1]|^$
|
RoamClusterID int `json:"roam_cluster_id,omitempty"` // [0-9]|[1-2][0-9]|[3][0-1]|^$
|
||||||
RrmEnabled bool `json:"rrm_enabled"`
|
RrmEnabled bool `json:"rrm_enabled"`
|
||||||
Schedule []string `json:"schedule,omitempty"` // (sun|mon|tue|wed|thu|fri|sat)(\-(sun|mon|tue|wed|thu|fri|sat))?\|([0-2][0-9][0-5][0-9])\-([0-2][0-9][0-5][0-9])
|
Schedule []string `json:"schedule,omitempty"` // (sun|mon|tue|wed|thu|fri|sat)(\-(sun|mon|tue|wed|thu|fri|sat))?\|([0-2][0-9][0-5][0-9])\-([0-2][0-9][0-5][0-9])
|
||||||
|
|||||||
Reference in New Issue
Block a user