Experimenting with generating the SDK

This commit is contained in:
Paul Tyng
2020-01-01 03:22:13 -05:00
parent da85d65833
commit b3d435d80f
69 changed files with 2329 additions and 161 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
.envrc
.vscode
dist

1
go.mod
View File

@@ -18,6 +18,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk v1.4.1
github.com/hashicorp/terraform-svchost v0.0.0-20191119180714-d2e4933b9136 // indirect
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d // indirect
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/mattn/go-isatty v0.0.11 // indirect
github.com/posener/complete v1.2.3 // indirect

2
go.sum
View File

@@ -228,6 +228,8 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKe
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d h1:W+SIwDdl3+jXWeidYySAgzytE3piq6GumXeBjFBG67c=
github.com/hashicorp/yamux v0.0.0-20190923154419-df201c70410d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM=

View File

@@ -1,9 +1,6 @@
package provider
import (
"fmt"
"strconv"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
@@ -89,7 +86,7 @@ func resourceNetworkGetResourceData(d *schema.ResourceData) (*unifi.Network, err
return &unifi.Network{
Name: d.Get("name").(string),
Purpose: d.Get("purpose").(string),
VLAN: fmt.Sprintf("%d", d.Get("vlan_id").(int)),
VLAN: vlan,
IPSubnet: d.Get("subnet").(string),
NetworkGroup: d.Get("network_group").(string),
DHCPDStart: d.Get("dhcp_start").(string),
@@ -108,13 +105,9 @@ func resourceNetworkGetResourceData(d *schema.ResourceData) (*unifi.Network, err
}
func resourceNetworkSetResourceData(resp *unifi.Network, d *schema.ResourceData) error {
var err error
vlan := 0
if resp.VLANEnabled {
vlan, err = strconv.Atoi(resp.VLAN)
if err != nil {
return err
}
vlan = resp.VLAN
}
dhcpLease := resp.DHCPDLeaseTime

View File

@@ -1,9 +1,6 @@
package provider
import (
"fmt"
"strconv"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
@@ -68,7 +65,7 @@ func resourceWLANCreate(d *schema.ResourceData, meta interface{}) error {
req := &unifi.WLAN{
Name: d.Get("name").(string),
VLAN: fmt.Sprintf("%d", vlan),
VLAN: vlan,
XPassphrase: d.Get("passphrase").(string),
HideSSID: d.Get("hide_ssid").(bool),
IsGuest: d.Get("is_guest").(bool),
@@ -101,13 +98,9 @@ func resourceWLANCreate(d *schema.ResourceData, meta interface{}) error {
}
func resourceWLANSetResourceData(resp *unifi.WLAN, d *schema.ResourceData) error {
var err error
vlan := 0
if resp.VLANEnabled {
vlan, err = strconv.Atoi(resp.VLAN)
if err != nil {
return err
}
vlan = resp.VLAN
}
d.Set("name", resp.Name)

View File

@@ -0,0 +1,22 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type Account 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"`
IP string `json:"ip"` // ^(([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])$|^$
Name string `json:"name,omitempty"` // ^[^"' ]+$
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
TunnelType int `json:"tunnel_type,omitempty"` // [1-9]|1[0-3]|^$
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
XPassword string `json:"x_password,omitempty"`
}

View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type BroadcastGroup 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"`
MemberTable []string `json:"member_table,omitempty"`
Name string `json:"name,omitempty"`
}

View File

@@ -0,0 +1,20 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type DHCPOption 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"`
Code string `json:"code,omitempty"` // ^(?!(?:15|42|43|44|51|66|67|252)$)([7-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])$
Name string `json:"name,omitempty"` // ^[A-Za-z0-9-_]{1,25}$
Signed bool `json:"signed"`
Type string `json:"type,omitempty"` // ^(boolean|hexarray|integer|ipaddress|macaddress|text)$
Width int `json:"width,omitempty"` // ^(8|16|32)$
}

View File

@@ -0,0 +1,23 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type DpiApp 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"`
Apps []int `json:"apps,omitempty"`
Blocked bool `json:"blocked"`
Cats []int `json:"cats,omitempty"`
Enabled bool `json:"enabled"`
Log bool `json:"log"`
Name string `json:"name,omitempty"` // .{1,128}
QOSRateMaxDown int `json:"qos_rate_max_down,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
QOSRateMaxUp int `json:"qos_rate_max_up,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
}

View File

@@ -0,0 +1,18 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type DpiGroup 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"`
DPIappIDs []string `json:"dpiapp_ids,omitempty"` // [\d\w]+
Enabled bool `json:"enabled"`
Name string `json:"name,omitempty"` // .{1,128}
}

View File

@@ -0,0 +1,23 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type DynamicDNS 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"`
CustomService string `json:"custom_service,omitempty"` // ^[^"' ]+$
HostName string `json:"host_name,omitempty"` // ^[^"' ]+$
Interface string `json:"interface,omitempty"` // wan|wan2
Login string `json:"login,omitempty"` // ^[^"' ]+$
Options []string `json:"options,omitempty"` // ^[^"' ]+$
Server string `json:"server"` // ^[^"' ]+$|^$
Service string `json:"service,omitempty"` // afraid|changeip|cloudflare|dnspark|dslreports|dyndns|easydns|googledomains|namecheap|noip|sitelutions|zoneedit|custom
XPassword string `json:"x_password,omitempty"` // ^[^"' ]+$
}

View File

@@ -0,0 +1,9 @@
{
"name": "^[^\"' ]+$",
"x_password": "",
"vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$",
"ip":"^(([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])$|^$",
"tunnel_config_type": "vpn|802.1x|custom",
"tunnel_type": "[1-9]|1[0-3]|^$",
"tunnel_medium_type": "[1-9]|1[0-5]|^$"
}

View File

@@ -0,0 +1,4 @@
{
"name": "",
"member_table": [""]
}

View File

@@ -0,0 +1,35 @@
{
"conf_source": "manual|radio-ai",
"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": "^[0-9]+\\.?[0-9]*$",
"note": ".{0,1024}",
"radio": "na|ng|ng\\+na",
"radio_table": [{
"device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"name": "[a-z]*[0-9]*",
"channel": "[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",
"backup_channel": "[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",
"width": "20|40|80|160",
"tx_power": "[\\d]+|auto",
"tx_power_mode": "auto|medium|high|low|custom"
}],
"satisfaction_table": [{
"device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"satisfaction": "^[0-9]+\\.?[0-9]*$"
}],
"site_blacklisted_channels": [{
"channel": "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": "[1-9][0-9]{12}"
}],
"ap_blacklisted_channels": [{
"mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"channel": "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": "[1-9][0-9]{12}"
}],
"coupling": [{
"source": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$",
"target": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$",
"rssi": "-?[0-9]{1,3}"
}],
"satisfaction": "^[0-9]+\\.?[0-9]*$"
}

View File

@@ -0,0 +1,12 @@
{
"name": "",
"desc": "",
"is_public": "true|false",
"controller_version": "",
"modules":[{
"id": "",
"module_id": "",
"config": "",
"restrictions": ""
}]
}

View File

@@ -0,0 +1,133 @@
{
"name": ".{1,128}",
"x": "",
"y": "",
"heightInMeters": "^([-]?[\\d]+[.]?[\\d]*)$",
"locked": "true|false",
"map_id": "",
"disabled": "true|false",
"led_override": "default|on|off",
"led_override_color": "^#(?:[0-9a-fA-F]{3}){1,2}$",
"led_override_color_brightness": "^[0-9][0-9]?$|^100$",
"outdoor_mode_override": "default|on|off",
"mesh_sta_vap_enabled": "true|false",
"config_network": {
"bonding_enabled": "true|false",
"type": "dhcp|static",
"ip": "^(([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": "^((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)))))$",
"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])$|^$",
"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": "^(([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": ""
},
"radio_table": [{
"radio": "ng|na|ad",
"channel": "[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",
"backup_channel": "[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",
"ht": "20|40|80|160|1080|2160",
"tx_power_mode": "auto|medium|high|low|custom",
"tx_power": "[\\d]+|auto",
"min_rssi_enabled": "true|false",
"min_rssi": "^-([1-9]|[1-8][0-9]|9[0-4])$",
"name": "",
"hard_noise_floor_enabled": "true|false",
"sens_level_enabled": "true|false",
"sens_level": "^-([5-8][0-9]|90)$",
"antenna_gain": "^-?([0-9]|[1-9][0-9])",
"antenna_id": "-1|[0-9]",
"wlangroup_id": "[\\d\\w]+",
"vwire_enabled":"true|false"
}],
"wlan_overrides": [{
"enabled":"true|false",
"name":".{1,32}",
"name_combine_enabled":"true|false",
"name_combine_suffix":".{0,8}",
"vlan":"[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$",
"vlan_enabled":"true|false",
"x_passphrase": "[\\x20-\\x7E]{8,63}|[0-9a-fA-F]{64}",
"wlan_id":"[\\d\\w]+",
"radio":"ng|na",
"radio_name":""
}],
"ethernet_overrides": [{
"ifname": "eth[0-9]{1,2}",
"networkgroup": "LAN[2-8]?|WAN[2]?"
}],
"jumboframe_enabled": "true|false",
"flowctrl_enabled": "true|false",
"stp_version": "stp|rstp|disabled",
"stp_priority": "0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440",
"dot1x_portctrl_enabled": "true|false",
"dot1x_fallback_networkconf_id": "[\\d\\w]+|",
"radiusprofile_id": "",
"atf_enabled": "true|false",
"bandsteering_mode": "off|equal|prefer_5g",
"dpi_enabled": "true|false",
"resetbtn_enabled": "on|off",
"mgmt_network_id": "[\\d\\w]+",
"switch_vlan_enabled": "false|true",
"port_overrides": [{
"port_idx":"[1-9]|[1-4][0-9]|5[0-2]",
"name":".{0,128}",
"op_mode":"switch|mirror|aggregate",
"autoneg":"true|false",
"speed":"10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000",
"full_duplex":"true|false",
"poe_mode":"auto|pasv24|passthrough|off",
"isolation":"true|false",
"dot1x_ctrl":"auto|force_authorized|force_unauthorized|mac_based|multi_host",
"stormctrl_type": "level|rate",
"stormctrl_ucast_enabled": "true|false",
"stormctrl_ucast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_ucast_rate": "[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",
"stormctrl_mcast_enabled": "true|false",
"stormctrl_mcast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_mcast_rate": "[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",
"stormctrl_bcast_enabled": "true|false",
"stormctrl_bcast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_bcast_rate": "[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",
"priority_queue1_level": "[0-9]|[1-9][0-9]|100",
"priority_queue2_level": "[0-9]|[1-9][0-9]|100",
"priority_queue3_level": "[0-9]|[1-9][0-9]|100",
"priority_queue4_level": "[0-9]|[1-9][0-9]|100",
"portconf_id":"[\\d\\w]+",
"mirror_port_idx":"[1-9]|[1-4][0-9]|5[0-2]",
"lldpmed_enabled": "true|false",
"lldpmed_notify_enabled": "true|false",
"stp_port_mode": "true|false",
"egress_rate_limit_kbps_enabled": "true|false",
"egress_rate_limit_kbps": "6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}",
"aggregate_num_ports":"[2-4]",
"port_security_enabled": "true|false",
"port_security_mac_address": ["^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$"]
}],
"power_source_ctrl_enabled": "true|false",
"power_source_ctrl": "auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps",
"snmp_location": ".{0,255}",
"snmp_contact": ".{0,255}",
"baresip_enabled": "true|false",
"baresip_extension": "^\\+?[a-zA-Z0-9_.\\-!~*'()]*",
"baresip_auth_user": "^\\+?[a-zA-Z0-9_.\\-!~*'()]*",
"x_baresip_password": "^[a-zA-Z0-9_.\\-!~*'()]*",
"volume": "[0-9]|[1-9][0-9]|100",
"lte_ext_ant": "true|false",
"lte_poe": "true|false",
"lte_soft_limit": "\\d+",
"lcm_brightness_override": "true|false",
"lcm_brightness": "[1-9]|[1-9][0-9]|100",
"lcm_idle_timeout_override": "true|false",
"lcm_idle_timeout": "[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",
"rps_override": {
"power_management_mode": "dynamic|static",
"rps_port_table": [{
"port_idx": "[1-6]",
"name": ".{0,32}",
"port_mode":"auto|force_active|manual|disabled"
}]
},
"lcm_tracker_seed": ".{0,50}",
"lcm_tracker_enabled": "true|false",
"ubb_pair_name": ".{1,128}"
}

View File

@@ -0,0 +1,8 @@
{
"type": "^(boolean|hexarray|integer|ipaddress|macaddress|text)$",
"code": "^(?!(?:15|42|43|44|51|66|67|252)$)([7-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])$",
"name": "^[A-Za-z0-9-_]{1,25}$",
"signed": "^(true|false)$",
"width": "^(8|16|32)$"
}

View File

@@ -0,0 +1,10 @@
{
"name": ".{1,128}",
"enabled": "false|true",
"apps": [ "[0-9]{1,8}" ],
"cats": [ "[0-9]{1,3}" ],
"blocked": "false|true",
"log": "false|true",
"qos_rate_max_up": "-1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400",
"qos_rate_max_down": "-1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400"
}

View File

@@ -0,0 +1,5 @@
{
"name":".{1,128}",
"enabled": "false|true",
"dpiapp_ids": [ "[\\d\\w]+" ]
}

View File

@@ -0,0 +1,10 @@
{
"interface": "wan|wan2",
"service": "afraid|changeip|cloudflare|dnspark|dslreports|dyndns|easydns|googledomains|namecheap|noip|sitelutions|zoneedit|custom",
"custom_service": "^[^\"' ]+$",
"host_name": "^[^\"' ]+$",
"login": "^[^\"' ]+$",
"x_password": "^[^\"' ]+$",
"server": "^[^\"' ]+$|^$",
"options": ["^[^\"' ]+$"]
}

View File

@@ -0,0 +1,5 @@
{
"name": ".{1,64}",
"group_type": "address-group|port-group|ipv6-address-group",
"group_members": [ "" ]
}

View File

@@ -0,0 +1,48 @@
{
"name": ".{1,128}",
"ruleset": "WAN_IN|WAN_OUT|WAN_LOCAL|LAN_IN|LAN_OUT|LAN_LOCAL|GUEST_IN|GUEST_OUT|GUEST_LOCAL|WANv6_IN|WANv6_OUT|WANv6_LOCAL|LANv6_IN|LANv6_OUT|LANv6_LOCAL|GUESTv6_IN|GUESTv6_OUT|GUESTv6_LOCAL",
"rule_index": "2[0-9]{3}|4[0-9]{3}",
"enabled": "true|false",
"action": "drop|reject|accept",
"protocol": "^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp",
"protocol_v6": "^$|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|ah|all|dccp|eigrp|esp|gre|icmpv6|ipcomp|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|rsvp|sctp|shim6|tcp|tcp_udp|udp|vrrp",
"protocol_match_excepted": "false|true",
"state_established": "false|true",
"state_invalid": "false|true",
"state_new": "false|true",
"state_related": "false|true",
"ipsec": "match-ipsec|match-none|^$",
"icmp_typename" : "^$|communication-prohibited|destination-unreachable|echo-reply|echo-request|fragmentation-needed|host-precedence-violation|host-prohibited|host-redirect|host-unknown|host-unreachable|ip-header-bad|network-prohibited|network-redirect|network-unknown|network-unreachable|parameter-problem|port-unreachable|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-route-failed|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit",
"icmpv6_typename" : "^$|address-unreachable|bad-header|communication-prohibited|destination-unreachable|echo-reply|echo-request|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option",
"dst_address": "",
"dst_address_ipv6": "",
"dst_port": "",
"dst_firewallgroup_ids": [ "[\\d\\w]+" ],
"dst_networkconf_id": "[\\d\\w]+|^$",
"dst_networkconf_type": "ADDRv4|NETv4",
"src_address": "",
"src_address_ipv6": "",
"src_port": "",
"src_firewallgroup_ids": [ "[\\d\\w]+" ],
"src_networkconf_id": "[\\d\\w]+|^$",
"src_networkconf_type": "ADDRv4|NETv4",
"src_mac_address": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$",
"startdate": "^$|^(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])$",
"stopdate": "^$|^(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])$",
"starttime": "^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$",
"stoptime": "^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$",
"monthdays": "^$|^(([1-9]|[12][0-9]|3[01])(,([1-9]|[12][0-9]|3[01])){0,30})$",
"monthdays_negate": "false|true",
"weekdays": "^$|^((Mon|Tue|Wed|Thu|Fri|Sat|Sun)(,(Mon|Tue|Wed|Thu|Fri|Sat|Sun)){0,6})$",
"weekdays_negate": "false|true",
"utc": "false|true",
"contiguous": "false|true",
"logging": "false|true"
}

View File

@@ -0,0 +1,6 @@
{
"map_id": "",
"type": "download|upload",
"name": ".*[^\\s]+.*",
"description": ""
}

View File

@@ -0,0 +1,7 @@
{
"heatmap_id": "",
"x": "[-+]?[0-9]*\\.?[0-9]+",
"y": "[-+]?[0-9]*\\.?[0-9]+",
"upload_speed": "[-+]?[0-9]*\\.?[0-9]+",
"download_speed": "[-+]?[0-9]*\\.?[0-9]+"
}

View File

@@ -0,0 +1,122 @@
{
"name": ".{1,128}",
"venue_name": [
{
"language": "[a-z]{3}",
"name": ".{1,128}"
}
],
"venue_group": "0|1|2|3|4|5|6|7|8|9|10|11",
"venue_type": "0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15",
"network_type": "0|1|2|3|4|5|14|15",
"network_access_internet": "true|false",
"network_access_asra": "true|false",
"network_access_esr": "true|false",
"network_access_uesa": "true|false",
"hessid": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$",
"disable_dgaf": "true|false",
"deauth_req_timeout" : "[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",
"osu_ssid": "",
"nai_realm_list": [
{
"name": ".{1,128}",
"status": "true|false",
"encoding": "0|1",
"eap_method": "13|21|18|23|50",
"auth_ids": "",
"auth_vals": ""
}
],
"domain_name_list": [".{1,128}"],
"roaming_consortium_list": [
{
"name": ".{1,128}",
"oid": ".{1,128}"
}
],
"cellular_network_list": [
{
"name": ".{1,128}",
"mcc": "[0-9]{3}",
"mnc": "[0-9]{3}"
}
],
"friendly_name" : [
{
"language": "[a-z]{3}",
"text": ".{1,128}"
}
],
"t_c_filename" : ".{1,256}",
"t_c_timestamp" : "[0-9]{1,12}",
"icons" : [
{
"name" : ".{1,256}",
"width": "[0-9]{1,8}",
"height": "[0-9]{1,8}",
"media": ".{1,256}",
"language": "[a-z]{3}",
"filename": ".{1,256}",
"data": "",
"size": "[0-9]{1,8}"
}
],
"metrics_status" : "true|false",
"metrics_info" : "[0-9A-Fa-f]{1,2}",
"metrics_downlink_speed": "[0-9]{1,10}",
"metrics_uplink_speed": "[0-9]{1,10}",
"metrics_downlink_load": "[0-9]{1,3}",
"metrics_uplink_load": "[0-9]{1,3}",
"metrics_measurement": "[0-9]{1,5}",
"capab" : [
{
"protocol" : "icmp|tcp_udp|tcp|udp",
"port": "(([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}",
"status" : "closed|open|unknown"
}
],
"osu" : [
{
"server_uri": "",
"friendly_name" : [
{
"language": "[a-z]{3}",
"text": ".{1,128}"
}
],
"description" : [
{
"language": "[a-z]{3}",
"text": ".{1,128}"
}
],
"nai" : "",
"nai2" : "",
"operating_class" : "[0-9A-Fa-f]{12}",
"method_soap_xml_spp": "true|false",
"method_oma_dm": "true|false",
"icon" : [
{
"name": ".{1,128}"
}
]
}
],
"proxy_arp" : "true|false",
"ap_isolate" : "true|false",
"p2p" : "true|false",
"gas_comeback_delay" : "[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",
"qos_map_status" : "true|false",
"qos_map_exceptions" : [
{
"dcsp" : "[0-9]{1,2}",
"up" : "[0-7]"
}
],
"qos_map_dcsp" : [
{
"low" : "[0-9]{1,3}",
"high" : "[0-9]{1,3}"
}
]
}

View File

@@ -0,0 +1,5 @@
{
"name": ".{1,256}",
"x_password": ".{1,256}",
"note": ""
}

View File

@@ -0,0 +1,31 @@
{
"name": "",
"charged_as": "",
"amount": "^([\\d]+[.]?[\\d]*)$",
"currency": "[A-Z]{3}",
"hours": "[\\d]+",
"trial_reset": "^([\\d]+[.]?[\\d]*)$|^$",
"limit_overwrite": "true|false",
"limit_up": "[\\d]+|^$",
"limit_down": "[\\d]+|^$",
"limit_quota": "[\\d]+|^$",
"index": "[\\d]+",
"custom_payment_fields_enabled": "true|false",
"payment_fields_address_enabled": "true|false",
"payment_fields_address_required": "true|false",
"payment_fields_city_enabled": "true|false",
"payment_fields_city_required": "true|false",
"payment_fields_country_enabled": "true|false",
"payment_fields_country_required": "true|false",
"payment_fields_country_default": "",
"payment_fields_email_enabled": "true|false",
"payment_fields_email_required": "true|false",
"payment_fields_first_name_enabled": "true|false",
"payment_fields_first_name_required": "true|false",
"payment_fields_last_name_enabled": "true|false",
"payment_fields_last_name_required": "true|false",
"payment_fields_state_enabled": "true|false",
"payment_fields_state_required": "true|false",
"payment_fields_zip_enabled": "true|false",
"payment_fields_zip_required": "true|false"
}

View File

@@ -0,0 +1,15 @@
{
"name": "",
"mapTypeId": "satellite|roadmap|hybrid|terrain",
"tilt": "[\\d]+",
"type": "designerMap|imageMap|googleMap",
"upp": "^([\\d]+[.]?[\\d]*)$",
"unit": "m|f",
"lat": "^([-]?[\\d]+[.]?[\\d]*([eE][-+]?[\\d]+)?)$",
"lng": "^([-]?[\\d]+[.]?[\\d]*([eE][-+]?[\\d]+)?)$",
"selected": "true|false",
"zoom": "[\\d]+",
"offset_top": "^([-]?[\\d]+[.]?[\\d]*)$",
"offset_left": "^([-]?[\\d]+[.]?[\\d]*)$",
"opacity": "^(0(\\.[\\d]{1,2})?|1)$|^$"
}

View File

@@ -0,0 +1,3 @@
{
"name": ""
}

View File

@@ -0,0 +1,139 @@
{
"name": ".{1,128}",
"enabled": "true|false",
"purpose": "corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan",
"vpn_type": "auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server",
"vlan_enabled": "false|true",
"vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$",
"priority": "[1-4]",
"igmp_snooping": "true|false",
"igmp_fastleave": "true|false",
"igmp_supression": "true|false",
"igmp_maxresponse": "[1-9]|1[0-9]|2[0-5]|^$",
"igmp_mcrtrexpiretime": "[0-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$",
"igmp_groupmembership": "[2-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$",
"igmp_querier": "^(([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_subnet": "^(([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)$",
"ipv6_subnet": "",
"ipv6_interface_type": "static|pd|none",
"ipv6_pd_interface": "wan|wan2",
"ipv6_pd_prefixid": "^$|[a-fA-F0-9]{1,4}",
"ipv6_ra_enabled": "false|true",
"ipv6_ra_priority": "high|medium|low",
"ipv6_ra_valid_lifetime": "^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$",
"ipv6_ra_preferred_lifetime": "^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$",
"ipv6_pd_start": "",
"ipv6_pd_stop": "",
"domain_name": "(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}",
"dhcpd_enabled": "true|false",
"dhcpd_start": "^(([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])$|^$",
"dhcpd_stop": "^(([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])$|^$",
"dhcpd_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])$|^$",
"dhcpd_gateway_enabled": "^true|false$",
"dhcpd_dns_enabled": "true|false",
"dhcpd_dns_1": "^(([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])$|^$",
"dhcpd_dns_2": "^(([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])$|^$",
"dhcpd_dns_3": "^(([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])$|^$",
"dhcpd_dns_4": "^(([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])$|^$",
"dhcpd_leasetime": "[\\d]+",
"dhcpd_wins_enabled": "true|false",
"dhcpd_wins_1": "^(([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])$|^$",
"dhcpd_wins_2": "^(([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])$|^$",
"dhcpd_ntp_enabled": "true|false",
"dhcpd_ntp_1": "^(([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])$|^$",
"dhcpd_ntp_2": "^(([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])$|^$",
"dhcpd_boot_enabled": "true|false",
"dhcpd_boot_server": "^(([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])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$",
"dhcpd_boot_filename": ".{1,256}",
"dhcpd_unifi_controller": "^(([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])$|^$",
"dhcpd_time_offset_enabled": "true|false",
"dhcpd_time_offset": "^0$|^-?([1-9]([0-9]{1,3})?|[1-7][0-9]{4}|[8][0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$",
"dhcpd_wpad_url": "",
"dhcpd_tftp_server": "",
"dhcp_relay_enabled": "true|false",
"dhcpguard_enabled": "true|false",
"dhcpd_ip_1": "^(([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])$|^$",
"dhcpd_ip_2": "^(([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])$|^$",
"dhcpd_ip_3": "^(([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])$|^$",
"dhcpd_mac_1": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpd_mac_2": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpd_mac_3": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpdv6_enabled": "true|false",
"dhcpdv6_start": "",
"dhcpdv6_stop": "",
"dhcpdv6_leasetime": "[\\d]+",
"dhcpdv6_dns_auto": "true|false",
"dhcpdv6_dns_1": "",
"dhcpdv6_dns_2": "",
"dhcpdv6_dns_3": "",
"dhcpdv6_dns_4": "",
"is_nat": "true|false",
"nat_outbound_ip": "",
"networkgroup": "LAN[2-8]?",
"usergroup_id": "",
"dpi_enabled": "false|true",
"dpigroup_id": "[\\d\\w]+|^$",
"remote_site_id": "",
"remote_site_subnets": [ "^(([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)$|^$" ],
"exposed_to_site_vpn": "false|true",
"require_mschapv2": "true|false",
"remote_vpn_subnets": [ "^(([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)$|^$" ],
"ipsec_peer_ip": "^(([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])$",
"ipsec_local_ip": "^any$|^(([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])$",
"x_ipsec_pre_shared_key": "[^\\\"\\' ]+",
"ipsec_profile": "customized|azure_dynamic|azure_static",
"ipsec_encryption": "aes128|aes192|aes256|3des",
"ipsec_hash": "sha1|md5|sha256|sha384|sha512",
"ipsec_dh_group": "2|5|14|15|16|19|20|21|25|26",
"ipsec_ike_dh_group": "1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32",
"ipsec_esp_dh_group": "1|2|5|14|15|16|17|18",
"ipsec_key_exchange": "ikev1|ikev2",
"ipsec_pfs": "false|true",
"ipsec_dynamic_routing": "true|false",
"lte_lan_enabled": "true|false",
"l2tp_interface": "wan|wan2",
"openvpn_mode": "site-to-site|client|server",
"openvpn_remote_host": "[^\\\"\\' ]+|^(([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])$",
"openvpn_local_port": "^([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])$",
"openvpn_remote_port": "^([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])$",
"openvpn_local_address": "^(([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])$",
"openvpn_remote_address": "^(([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])$",
"x_openvpn_shared_secret_key": "[0-9A-Fa-f]{512}",
"pptpc_server_ip": "^(([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])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$",
"pptpc_username": "[^\\\"\\' ]+",
"x_pptpc_password": "[^\\\"\\' ]+",
"pptpc_require_mppe": "true|false",
"pptpc_route_distance": "^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$",
"vpn_client_pull_dns": "true|false",
"vpn_client_default_route": "true|false",
"upnp_lan_enabled": "true|false",
"route_distance": "^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$",
"radiusprofile_id": "",
"wan_type": "disabled|dhcp|static|pppoe",
"wan_networkgroup": "WAN[2]?|WAN_LTE_FAILOVER",
"wan_ip": "^(([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])$",
"wan_netmask": "^((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)))))$",
"wan_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])$|^$",
"wan_username": "[^\"' ]+",
"x_wan_password": "[^\"' ]+",
"report_wan_event": "true|false",
"wan_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])$|^$",
"wan_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])$|^$",
"wan_dns3": "^(([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])$|^$",
"wan_dns4": "^(([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])$|^$",
"wan_vlan_enabled": "false|true",
"wan_vlan": "[0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$",
"wan_egress_qos": "[1-7]|^$",
"wan_smartq_enabled": "false|true",
"wan_smartq_up_rate": "[0-9]{1,6}|1000000",
"wan_smartq_down_rate": "[0-9]{1,6}|1000000",
"wan_load_balance_type": "failover-only|weighted",
"wan_load_balance_weight": "[1-9]|[1-9][0-9]",
"wan_type_v6": "disabled|dhcpv6|static",
"wan_dhcpv6_pd_size": "^(4[89]|5[0-9]|6[0-4])$|^$",
"wan_ipv6": "^(([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]))$|^$",
"wan_prefixlen": "^([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])$|^$",
"wan_gateway_v6": "^(([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]))$|^$",
"ipsec_interface": "wan|wan2"
}

View File

@@ -0,0 +1,35 @@
{
"name": "",
"forward": "all|native|customize|disabled",
"native_networkconf_id": "",
"tagged_networkconf_ids": [""],
"voice_networkconf_id": "",
"op_mode":"switch",
"autoneg":"true|false",
"speed":"10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000",
"full_duplex":"true|false",
"poe_mode":"auto|pasv24|passthrough|off",
"isolation":"true|false",
"dot1x_ctrl":"auto|force_authorized|force_unauthorized|mac_based|multi_host",
"stormctrl_type": "level|rate",
"stormctrl_ucast_enabled": "true|false",
"stormctrl_ucast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_ucast_rate": "[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",
"stormctrl_mcast_enabled": "true|false",
"stormctrl_mcast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_mcast_rate": "[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",
"stormctrl_bcast_enabled": "true|false",
"stormctrl_bcast_level": "[0-9]|[1-9][0-9]|100",
"stormctrl_bcast_rate": "[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",
"priority_queue1_level": "[0-9]|[1-9][0-9]|100",
"priority_queue2_level": "[0-9]|[1-9][0-9]|100",
"priority_queue3_level": "[0-9]|[1-9][0-9]|100",
"priority_queue4_level": "[0-9]|[1-9][0-9]|100",
"lldpmed_enabled": "true|false",
"lldpmed_notify_enabled": "true|false",
"stp_port_mode": "true|false",
"egress_rate_limit_kbps_enabled": "true|false",
"egress_rate_limit_kbps": "6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}",
"port_security_enabled": "true|false",
"port_security_mac_address": ["^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$"]
}

View File

@@ -0,0 +1,11 @@
{
"name": ".{1,128}",
"enabled": "true|false",
"src": "^(([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-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-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-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-9]|[1-2][0-9]|3[0-2])$|^!(([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-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-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-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-9]|[1-2][0-9]|3[0-2])$|^any$",
"dst_port": "(([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}",
"fwd": "^(([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])$",
"fwd_port": "(([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}",
"proto": "tcp_udp|tcp|udp",
"log": "true|false",
"pfwd_interface": "wan|wan2|both"
}

View File

@@ -0,0 +1,20 @@
{
"name": ".{1,128}",
"vlan_enabled": "false|true",
"vlan_wlan_mode": "disabled|optional|required",
"use_usg_auth_server": "false|true",
"auth_servers": [{
"ip": "^(([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": "^([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])$|^$",
"x_secret": ""
}],
"accounting_enabled": "false|true",
"use_usg_acct_server": "false|true",
"interim_update_enabled": "false|true",
"interim_update_interval": "^([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)$",
"acct_servers": [{
"ip": "^(([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": "^([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])$|^$",
"x_secret": ""
}]
}

View File

@@ -0,0 +1,11 @@
{
"name": ".{1,128}",
"enabled": "true|false",
"type": "static-route",
"static-route_type": "nexthop-route|interface-route|blackhole",
"static-route_network": "^(([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]|3[0-2])$|^([a-fA-F0-9:]+\\/(([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])))$",
"static-route_nexthop": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^([a-fA-F0-9:]+)$|^$",
"static-route_interface": "WAN1|WAN2|[\\d\\w]+|^$",
"static-route_distance": "^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$"
}

View File

@@ -0,0 +1,14 @@
{
"cron_expr": "",
"action": "stream|upgrade",
"execute_only_once": "true|false",
"name": "",
"broadcastgroup_id": "",
"stream_type": "media|sample",
"upgrade_targets": [{
"mac":"^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$"
}],
"mediafile_id": "",
"sample_filename": "",
"additional_sounds_enabled": "true|false"
}

View File

@@ -0,0 +1,408 @@
{
"mgmt": {
"alert_enabled": "true|false",
"auto_upgrade": "true|false",
"led_enabled": "true|false",
"advanced_feature_enabled": "true|false",
"outdoor_mode_enabled": "true|false",
"unifi_idp_enabled": "true|false",
"x_mgmt_key": "[0-9a-f]{32}",
"x_ssh_keys": [""],
"x_ssh_username": "^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$",
"x_ssh_password": ".{1,128}",
"x_ssh_md5passwd": "",
"x_ssh_sha512passwd": "",
"x_ssh_enabled": "true|false",
"x_ssh_bind_wildcard": "true|false",
"x_ssh_auth_password_enabled": "true|false"
},
"country": {
"code": "[\\d]{1,3}"
},
"locale": {
"timezone": ""
},
"snmp": {
"enabled": "true|false",
"enabledV3": "true|false",
"community": ".{1,256}",
"username": "[a-zA-Z0-9_-]{1,30}",
"x_password": "[^'\"]{8,32}"
},
"radio_ai": {
"enabled": "true|false",
"cron_expr": "",
"default": "true|false",
"radios": ["na|ng"],
"optimize": ["channel|power"],
"channels_ng": ["1|2|3|4|5|6|7|8|9|10|11|12|13|14"],
"channels_na": ["36|40|44|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165"],
"ht_modes_ng": ["^(20|40)$"],
"ht_modes_na": ["^(20|40|80|160)$"],
"exclude_devices": ["([0-9a-z]{2}:){5}[0-9a-z]{2}"],
"useXY": "true|false"
},
"network_optimization": {
"enabled": "true|false"
},
"rsyslogd": {
"enabled": "true|false",
"ip": "",
"port": "[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]",
"debug": "false|true",
"this_controller": "false|true",
"this_controller_encrypted_only": "false|true",
"netconsole_enabled": "true|false",
"netconsole_host": "",
"netconsole_port": "[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]"
},
"baresip": {
"enabled": "true|false",
"server": "",
"outbound_proxy": "",
"package_url": ""
},
"super_mgmt": {
"override_inform_host": "true|false",
"auto_upgrade": "true|false",
"discoverable": "true|false",
"led_enabled": "true|false",
"live_chat": "disabled|super-only|everyone",
"live_updates": "disabled|live|auto",
"store_enabled": "disabled|super-only|everyone",
"x_ssh_username": "",
"x_ssh_password": "",
"autobackup_enabled": "true|false",
"autobackup_cron_expr": "",
"autobackup_days": "-?[\\d]+",
"autobackup_max_files": "[\\d]+",
"autobackup_timezone": "",
"autobackup_s3_access_key": "",
"autobackup_s3_access_secret": "",
"autobackup_s3_bucket": "",
"autobackup_gcs_certificate_path": "",
"autobackup_gcs_bucket": "",
"autobackup_local_path": "",
"autobackup_post_actions": ["copy_local|copy_s3|copy_gcs|copy_cloud"],
"backup_to_cloud_enabled": "true|false",
"google_maps_api_key": "",
"minimum_usable_hd_space": "[\\d]+",
"minimum_usable_sd_space": "[\\d]+",
"image_maps_use_google_engine": "true|false",
"data_retention_time_enabled": "true|false",
"data_retention_time_in_hours_for_5minutes_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_hourly_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_daily_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_monthly_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_others": "-?[\\d]+",
"time_series_per_client_stats_enabled": "true|false",
"contact_info_full_name": "",
"contact_info_company_name": "",
"contact_info_phone_number": "",
"contact_info_shipping_address_1": "",
"contact_info_shipping_address_2": "",
"contact_info_city": "",
"contact_info_state": "",
"contact_info_zip": "",
"contact_info_country": "",
"default_site_device_auth_password_alert": "false",
"upload_debugging_info_enabled" : "true|false",
"enable_analytics" : "true|false"
},
"super_identity": {
"name": "",
"hostname": ""
},
"super_mail": {
"provider": "smtp|cloud|disabled"
},
"super_smtp": {
"enabled": "true|false",
"host": "",
"port": "[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]|^$",
"sender": "",
"use_ssl": "true|false",
"use_sender": "true|false",
"use_auth": "true|false",
"username": "",
"x_password": ""
},
"super_sdn": {
"enabled" : "true|false",
"migrated" : "true|false",
"ubic_uuid" : "",
"auth_token" : "",
"device_id": "",
"oauth_enabled": "true|false",
"oauth_redirect_uris": [""],
"oauth_app_id": "",
"x_oauth_app_secret": "",
"sso_login_enabled": ""
},
"super_cloudaccess": {
"enabled" : "true|false",
"x_certificate_arn" : "",
"x_certificate_pem" : "",
"device_id" : "",
"device_auth" : "",
"x_private_key" : "",
"ubic_uuid" : ""
},
"super_events": {
"_ignored": ""
},
"usw": {
"dhcp_snoop" : "true|false"
},
"guest_access": {
"portal_enabled": "true|false",
"auth": "none|password|hotspot|facebook_wifi|custom",
"redirect_enabled": "true|false",
"redirect_url": "",
"redirect_https": "true|false",
"redirect_to_https": "true|false",
"portal_customized": "true|false",
"portal_use_hostname": "true|false",
"portal_hostname": "^[a-zA-Z0-9.-]+$|^$",
"expire": "[\\d]+|custom",
"expire_number": "^[1-9][0-9]{0,5}|1000000$",
"expire_unit": "1|60|1440",
"x_password": "",
"custom_ip": "^(([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])$|^$",
"facebook_enabled": "true|false",
"facebook_app_id": "",
"x_facebook_app_secret": "",
"facebook_scope_email": "true|false",
"facebook_wifi_gw_id": "",
"facebook_wifi_gw_name": "",
"x_facebook_wifi_gw_secret": "",
"facebook_wifi_block_https": "true|false",
"google_enabled": "true|false",
"google_client_id": "",
"x_google_client_secret": "",
"google_domain": "",
"google_scope_email": "true|false",
"voucher_enabled": "true|false",
"voucher_customized": "true|false",
"payment_enabled": "true|false",
"restricted_subnet_": "",
"allowed_subnet_": "",
"restricted_dns_enabled": "false|true",
"restricted_dns_servers": [ "^(([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])$|^$" ],
"gateway": "paypal|stripe|authorize|quickpay|merchantwarrior|ippay",
"paypal_use_sandbox": "true|false",
"x_paypal_username": "",
"x_paypal_password": "",
"x_paypal_signature": "",
"x_stripe_api_key": "",
"x_quickpay_agreementid": "",
"x_quickpay_apikey": "",
"x_quickpay_merchantid": "",
"quickpay_testmode": "true|false",
"x_authorize_loginid": "",
"x_authorize_transactionkey": "",
"x_merchantwarrior_merchantuuid": "",
"x_merchantwarrior_apikey": "",
"x_merchantwarrior_apipassphrase": "",
"x_ippay_terminalid": "",
"merchantwarrior_use_sandbox": "false|true",
"authorize_use_sandbox": "true|false",
"ippay_use_sandbox": "true|false",
"template_engine": "jsp|angular",
"portal_customized_bg_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_bg_image_enabled": "true|false",
"portal_customized_bg_image_filename": "",
"portal_customized_bg_image_tile": "true|false",
"portal_customized_box_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_opacity": "^[1-9][0-9]?$|^100$|^$",
"portal_customized_button_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_button_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_logo_enabled": "true|false",
"portal_customized_logo_filename": "",
"portal_customized_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_title": "",
"portal_customized_tos_enabled": "true|false",
"portal_customized_tos": "",
"portal_customized_unsplash_author_name": "",
"portal_customized_unsplash_author_username": "",
"portal_customized_welcome_text": "",
"portal_customized_welcome_text_enabled": "true|false",
"portal_customized_welcome_text_position": "under_logo|above_boxes",
"portal_customized_box_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_languages": [ "^[a-z]{2}(_[A-Z]{2})*$" ],
"radius_enabled": "true|false",
"radius_auth_type": "chap|mschapv2",
"radius_disconnect_enabled": "true|false",
"radius_disconnect_port": "[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]",
"radiusprofile_id": "",
"wechat_enabled": "true|false",
"wechat_app_id": "",
"wechat_shop_id": "",
"x_wechat_app_secret": "",
"x_wechat_secret_key": "",
"ec_enabled": "true|false"
},
"connectivity": {
"enable_isolated_wlan": "true|false",
"enabled": "true|false",
"x_mesh_essid": "",
"x_mesh_psk": "",
"uplink_host": "",
"uplink_type": ""
},
"element_adopt": {
"enabled": "true|false",
"x_element_essid": "",
"x_element_psk": ""
},
"auto_speedtest": {
"enabled": "false|true",
"interval": "^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$"
},
"provider_capabilities": {
"enabled": "false|true",
"download": "^[1-9][0-9]*$",
"upload": "^[1-9][0-9]*$"
},
"dpi": {
"enabled": "false|true",
"fingerprintingEnabled": "false|true"
},
"porta": {
"ugw3_wan2_enabled": "false|true"
},
"broadcast": {
"sound_before_enabled": "true|false",
"sound_before_type": "sample|media",
"sound_before_resource": "",
"sound_after_enabled": "true|false",
"sound_after_type": "sample|media",
"sound_after_resource": ""
},
"radius": {
"enabled": "true|false",
"auth_port": "[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]",
"acct_port": "[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]",
"configure_whole_network": "true|false",
"tunneled_reply": "true|false",
"interim_update_interval": "^([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)$",
"accounting_enabled": "true|false",
"x_secret": "[^\\\"\\' ]{1,128}"
},
"usg": {
"dhcp_relay_server_1": "^(([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])$|^$",
"dhcp_relay_server_2": "^(([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])$|^$",
"dhcp_relay_server_3": "^(([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])$|^$",
"dhcp_relay_server_4": "^(([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])$|^$",
"dhcp_relay_server_5": "^(([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])$|^$",
"dhcp_relay_hop_count": "([1-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|^$",
"dhcp_relay_max_size": "(6[4-9]|[7-9][0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1[0-3][0-9]{2}|1400)|^$",
"dhcp_relay_port": "[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]|^$",
"dhcp_relay_agents_packets": "append|discard|forward|replace|^$",
"upnp_enabled": "true|false",
"upnp_wan_interface":"WAN|WAN2",
"upnp_nat_pmp_enabled": "true|false",
"upnp_secure_mode": "true|false",
"firewall_wan_default_log": "true|false",
"firewall_lan_default_log": "true|false",
"firewall_guest_default_log": "true|false",
"ftp_module": "true|false",
"gre_module": "true|false",
"h323_module": "true|false",
"pptp_module": "true|false",
"sip_module": "true|false",
"tftp_module": "true|false",
"icmp_timeout": "",
"other_timeout": "",
"tcp_close_timeout": "",
"tcp_close_wait_timeout": "",
"tcp_established_timeout": "",
"tcp_fin_wait_timeout": "",
"tcp_last_ack_timeout": "",
"tcp_syn_recv_timeout": "",
"tcp_syn_sent_timeout": "",
"tcp_time_wait_timeout": "",
"udp_other_timeout": "",
"udp_stream_timeout": "",
"broadcast_ping": "true|false",
"receive_redirects": "true|false",
"send_redirects": "true|false",
"syn_cookies": "true|false",
"offload_accounting": "true|false",
"offload_l2_blocking": "true|false",
"offload_sch": "true|false",
"mdns_enabled": "true|false",
"echo_server": "[^\\\"\\' ]{1,255}",
"lldp_enable_all": "true|false",
"mss_clamp_mss": "[1-9][0-9]{2,3}",
"mss_clamp": "auto|custom|disabled",
"dhcpd_use_dnsmasq": "true|false",
"dhcpd_hostfile_update": "true|false",
"geo_ip_filtering_enabled": "true|false",
"geo_ip_filtering_block": "block|allow",
"geo_ip_filtering_countries": "^([A-Z]{2})?(,[A-Z]{2}){0,149}$",
"geo_ip_filtering_traffic_direction": "^(both|ingress|egress)$",
"arp_cache_timeout": "normal|min-dhcp-lease|custom",
"arp_cache_base_reachable": "^$|^[1-9]{1}[0-9]{0,4}$",
"dnsmasq_all_servers": "true|false"
},
"ntp": {
"ntp_server_1": "",
"ntp_server_2": "",
"ntp_server_3": "",
"ntp_server_4": ""
},
"ips": {
"enabled_categories": ["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"],
"endpoint_scanning": "true|false",
"ips_mode": "ids|ips|ipsInline|disabled",
"restrict_tor": "true|false",
"restrict_torrents": "true|false",
"restrict_ip_addresses": "true|false",
"suppression": {
"alerts": [{
"category": "",
"gid": "[\\d]+",
"id": "[\\d]+",
"signature": "",
"tracking": [{
"direction": "both|src|dest",
"mode": "ip|subnet|network",
"value": ""
}],
"type": "all|track"
}],
"whitelist": [{
"direction": "both|src|dest",
"mode": "ip|subnet|network",
"value": ""
}]
},
"dns_filtering": "true|false",
"dns_filters": [{
"filter": "security|adult|family",
"network_id": "",
"version": "v4|v6"
}],
"honeypot_enabled": "true|false",
"honeypot": [{
"network_id": "",
"ip_address": "",
"version": "v4|v6"
}]
},
"super_fwupdate": {
"controller_channel": "internal|alpha|beta|release-candidate|release",
"firmware_channel": "internal|alpha|beta|release-candidate|release",
"sso_enabled": "true|false"
},
"lcm": {
"enabled": "true|false",
"sync": "true|false",
"touch_event": "true|false",
"brightness": "[1-9]|[1-9][0-9]|100",
"idle_timeout": "[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"
}
}

View File

@@ -0,0 +1,11 @@
{
"name": ".{1,128}",
"devices": [{
"mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"position": {
"x": "(^([-]?[\\d]+)$)|(^([-]?[\\d]+[.]?[\\d]+)$)",
"y": "(^([-]?[\\d]+)$)|(^([-]?[\\d]+[.]?[\\d]+)$)",
"z": "(^([-]?[\\d]+)$)|(^([-]?[\\d]+[.]?[\\d]+)$)"
}
}]
}

View File

@@ -0,0 +1,4 @@
{
"name": "",
"member_table": [""]
}

View File

@@ -0,0 +1,12 @@
{
"mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"name": "",
"note": "",
"blocked": "",
"hostname": "",
"last_seen": "",
"usergroup_id": "",
"use_fixedip": "false|true",
"network_id": "",
"fixed_ip": ""
}

View File

@@ -0,0 +1,5 @@
{
"name": ".{1,128}",
"qos_rate_max_up": "-1|[2-9]|[1-9][0-9]{1,4}|100000",
"qos_rate_max_down": "-1|[2-9]|[1-9][0-9]{1,4}|100000"
}

View File

@@ -0,0 +1,8 @@
{
"type": "uap|usg|usw",
"map_id": "",
"x": "",
"y": "",
"heightInMeters": "^([-]?[\\d]+[.]?[\\d]*)$",
"locked": "true|false"
}

View File

@@ -0,0 +1,9 @@
{
"map_id": "",
"a": ["^([-]?[\\d]+[.]?[\\d]*)$"],
"b": ["^([-]?[\\d]+[.]?[\\d]*)$"],
"id": "",
"heightInMeters": "^([-]?[\\d]+[.]?[\\d]*)$",
"thicknessInMeters": "^([-]?[\\d]+[.]?[\\d]*)$",
"type": ""
}

View File

@@ -0,0 +1,61 @@
{
"name": ".{1,32}",
"name_combine_enabled": "true|false",
"name_combine_suffix": ".{0,8}",
"enabled": "true|false",
"iapp_enabled": "true|false",
"x_iapp_key": "[0-9A-Fa-f]{32}",
"security": "open|wpapsk|wep|wpaeap",
"x_passphrase": "[\\x20-\\x7E]{8,63}|[0-9a-fA-F]{64}",
"x_wep": "",
"wep_idx": "[1-4]",
"radiusprofile_id": "",
"hide_ssid": "false|true",
"priority": "medium|high|low",
"vlan_enabled": "false|true",
"vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$",
"is_guest": "false|true",
"usergroup_id": "",
"wlangroup_id": "",
"roam_cluster_id": "[0-9]|[1-2][0-9]|[3][0-1]|^$",
"wpa_mode": "auto|wpa1|wpa2",
"wpa_enc": "auto|ccmp",
"group_rekey": "^(0|[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)$",
"uapsd_enabled": "false|true",
"dpi_enabled": "false|true",
"dpigroup_id": "[\\d\\w]+|^$",
"schedule_enabled": "false|true",
"schedule_reversed": "false|true",
"schedule": [ "(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])" ],
"dtim_mode": "default|custom",
"dtim_ng": "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dtim_na": "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"minrate_ng_enabled": "true|false",
"minrate_ng_data_rate_kbps": "^[0-9]*$",
"minrate_ng_beacon_rate_kbps": "^[0-9]*$",
"minrate_ng_mgmt_rate_kbps": "^[0-9]*$",
"minrate_ng_advertising_rates": "true|false",
"minrate_ng_cck_rates_enabled": "true|false",
"minrate_na_enabled": "true|false",
"minrate_na_data_rate_kbps": "^[0-9]*$",
"minrate_na_beacon_rate_kbps": "^[0-9]*$",
"minrate_na_mgmt_rate_kbps": "^[0-9]*$",
"minrate_na_advertising_rates": "true|false",
"mac_filter_enabled": "true|false",
"mac_filter_policy": "allow|deny",
"mac_filter_list": ["^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$"],
"bc_filter_enabled": "true|false",
"bc_filter_list": ["^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$"],
"hotspot2conf_enabled": "true|false",
"hotspot2conf_id": "",
"fast_roaming_enabled": "true|false",
"rrm_enabled":"true|false",
"radius_das_enabled": "true|false",
"radius_mac_auth_enabled": "true|false",
"radius_macacl_format": "none_lower|hyphen_lower|colon_lower|none_upper|hyphen_upper|colon_upper",
"radius_macacl_empty_password": "true|false",
"mcastenhance_enabled": "true|false",
"no2ghz_oui": "true|false",
"element_adopt": "true|false",
"country_beacon": "true|false"
}

View File

@@ -0,0 +1,10 @@
{
"name":".{1,128}",
"loadbalance_enabled": "false|true",
"minrssi": "",
"minrssi_enabled": "true|false",
"loadbalance_enabled": "true|false",
"maxsta": "[1-9]|[1-9][0-9]|1[0-9]{2}|200|^$",
"b_supported": "false|true",
"pmf_mode": "disabled|optional|required"
}

264
unifi/fields/main.go Normal file
View File

@@ -0,0 +1,264 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"github.com/iancoleman/strcase"
)
// TODO: this is really gross, I should switch to
// using the java classes in the jar like scala2go
type replacement struct {
Old string
New string
}
var fieldReps = []replacement{
{"Ipv6", "IPV6"},
{"Pd", "PD"},
{"Leasetime", "LeaseTime"},
{"Networkgroup", "NetworkGroup"},
{"Openvpn", "OpenVPN"},
{"Nat", "NAT"},
{"Wlangroup", "WLANGroup"},
{"Dns", "DNS"},
{"Dhcpd", "DHCPD"},
{"Dhcp", "DHCP"},
{"Wlan", "WLAN"},
{"Idx", "IDX"},
{"Id", "ID"},
{"Mac", "MAC"},
{"Vlan", "VLAN"},
{"Wep", "WEP"},
{"Dtim", "DTIM"},
{"Wpa", "WPA"},
{"Usergroup", "UserGroup"},
{"Mcastenhance", "MulticastEnhance"},
{"Ssid", "SSID"},
{"Dpi", "DPI"},
{"Bc", "Broadcast"},
{"Radius", "RADIUS"},
{"Fixedip", "FixedIP"},
{"Ip", "IP"},
{"Pmf", "PMF"},
{"Minrssi", "MinRSSI"},
{"Qos", "QOS"},
}
var fileReps = []replacement{
{"WlanConf", "WLAN"},
{"Dhcp", "DHCP"},
{"Wlan", "WLAN"},
{"NetworkConf", "Network"},
}
func cleanName(name string, reps []replacement) string {
for _, rep := range reps {
name = strings.ReplaceAll(name, rep.Old, rep.New)
}
return name
}
func main() {
version := os.Args[1]
out := os.Args[2]
wd, err := os.Getwd()
if err != nil {
panic(err)
}
fieldsDir := filepath.Join(wd, version)
outDir := filepath.Join(wd, out)
fieldsFiles, err := ioutil.ReadDir(fieldsDir)
if err != nil {
panic(err)
}
for _, fieldsFile := range fieldsFiles {
name := fieldsFile.Name()
// if name != "WlanConf.json" {
// continue
// }
ext := filepath.Ext(name)
if filepath.Ext(name) != ".json" {
continue
}
name = name[:len(name)-len(ext)]
structName := cleanName(name, fileReps)
goFile := strcase.ToSnake(structName) + ".generated.go"
code, err := generateCode(filepath.Join(fieldsDir, fieldsFile.Name()), structName)
if err != nil {
fmt.Printf("skipping file %s: %s", fieldsFile.Name(), err)
continue
// panic(err)
}
_ = os.Remove(filepath.Join(outDir, goFile))
ioutil.WriteFile(filepath.Join(outDir, goFile), ([]byte)(code), 0644)
}
fmt.Printf("%s\n", outDir)
}
func generateCode(fieldsFile string, structName string) (string, error) {
b, err := ioutil.ReadFile(fieldsFile)
if err != nil {
return "", err
}
var fields map[string]interface{}
err = json.Unmarshal(b, &fields)
if err != nil {
return "", err
}
code := fmt.Sprintf(`// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type %s 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\"`"+`
`, structName)
fieldNames := []string{}
for name := range fields {
fieldNames = append(fieldNames, name)
}
// TODO: sort by normalized name, not this name
sort.Strings(fieldNames)
for _, name := range fieldNames {
if structName == "User" && name == "blocked" {
code += "\tBlocked bool `json:\"blocked,omitempty\"`\n"
continue
}
validation := fields[name]
fieldCode, err := generateField(name, validation)
if err != nil {
return "", err
}
code += fieldCode + "\n"
}
code = code + "}\n"
return code, nil
}
func normalizeValidation(re string) string {
re = strings.ReplaceAll(re, "\\d", "[0-9]")
re = strings.ReplaceAll(re, "[-+]?", "")
re = strings.ReplaceAll(re, "[+-]?", "")
re = strings.ReplaceAll(re, "[-]?", "")
re = strings.ReplaceAll(re, "\\.", ".")
re = strings.ReplaceAll(re, "[.]?", ".")
quants := regexp.MustCompile(`\{\d*,?\d*\}|\*|\+|\?`)
re = quants.ReplaceAllString(re, "")
control := regexp.MustCompile(`[\(\[\]\)\|\-\$\^]`)
re = control.ReplaceAllString(re, "")
re = strings.TrimPrefix(re, "^")
re = strings.TrimSuffix(re, "$")
return re
}
func typeFromValidation(validation interface{}) (string, string, bool, error) {
switch validation := validation.(type) {
case []interface{}:
if len(validation) == 0 {
return "[]string", "", false, nil
}
if len(validation) > 1 {
return "", "", false, fmt.Errorf("unknown validation %#v", validation)
}
elementType, elementComment, _, err := typeFromValidation(validation[0])
if err != nil {
return "", "", false, err
}
return fmt.Sprintf("[]%s", elementType), elementComment, true, nil
case string:
comment := validation
normalized := normalizeValidation(validation)
allowEmpty := strings.HasSuffix(validation, "|^$") || strings.HasPrefix(validation, "^$|")
switch {
case normalized == "falsetrue" || normalized == "truefalse":
return "bool", "", false, nil
default:
if _, err := strconv.ParseFloat(normalized, 64); err == nil {
if normalized == "09" || normalized == "09.09" {
comment = ""
}
if strings.Contains(normalized, ".") {
if strings.Contains(validation, "\\.){3}") {
break
}
return "float64", comment, true, nil
}
return "int", comment, true, nil
}
}
if validation != "" && normalized != "" {
fmt.Printf("normalize %q to %q\n", validation, normalized)
}
return "string", validation, !allowEmpty, nil
}
return "", "", false, fmt.Errorf("unable to determine type from validation %q", validation)
}
func generateField(name string, validation interface{}) (string, error) {
field := strcase.ToCamel(name)
field = cleanName(field, fieldReps)
fieldType, comment, omitempty, err := typeFromValidation(validation)
if err != nil {
return "", err
}
comment = strings.TrimSpace(fmt.Sprintf("// %s", comment))
if comment == "//" {
comment = ""
}
if fieldType == "string" && strings.HasSuffix(field, "ID") {
omitempty = false
}
omitemptyCode := ""
if omitempty {
omitemptyCode = ",omitempty"
}
return fmt.Sprintf("\t%s %s `json:\"%s%s\"` %s", field, fieldType, name, omitemptyCode, comment), nil
}

47
unifi/fields/main_test.go Normal file
View File

@@ -0,0 +1,47 @@
package main
import (
"fmt"
"testing"
)
func TestTypeFromValidation(t *testing.T) {
for i, c := range []struct {
expectedType string
expectedComment string
expectedOmitEmpty bool
validation interface{}
}{
{"string", "", true, ""},
{"string", "default|custom", true, "default|custom"},
{"string", ".{0,32}", true, ".{0,32}"},
{"string", "^(([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])$|^$", false, "^(([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])$|^$"},
{"int", "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", false, "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"},
{"int", "", true, "^[0-9]*$"},
{"float64", "", true, "[-+]?[0-9]*\\.?[0-9]+"},
// this one is really an error as the . is not escaped
{"float64", "", true, "^([-]?[\\d]+[.]?[\\d]*)$"},
{"float64", "", true, "^([\\d]+[.]?[\\d]*)$"},
{"bool", "", false, "false|true"},
{"bool", "", false, "true|false"},
} {
t.Run(fmt.Sprintf("%d %s %s", i, c.expectedType, c.validation), func(t *testing.T) {
actualType, actualComment, actualOmitEmpty, err := typeFromValidation(c.validation)
if err != nil {
t.Fatal(err)
}
if actualType != c.expectedType {
t.Fatalf("expected type %q got %q", c.expectedType, actualType)
}
if actualComment != c.expectedComment {
t.Fatalf("expected comment %q got %q", c.expectedComment, actualComment)
}
if actualOmitEmpty != c.expectedOmitEmpty {
t.Fatalf("expected omitempty %t got %t", c.expectedOmitEmpty, actualOmitEmpty)
}
})
}
}

View File

@@ -0,0 +1,18 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type FirewallGroup 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"`
GroupMembers []string `json:"group_members,omitempty"`
GroupType string `json:"group_type,omitempty"` // address-group|port-group|ipv6-address-group
Name string `json:"name,omitempty"` // .{1,64}
}

View File

@@ -0,0 +1,54 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type FirewallRule 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"` // drop|reject|accept
Contiguous bool `json:"contiguous"`
DstAddress string `json:"dst_address,omitempty"`
DstAddressIPV6 string `json:"dst_address_ipv6,omitempty"`
DstFirewallgroupIDs []string `json:"dst_firewallgroup_ids,omitempty"` // [\d\w]+
DstNetworkconfID string `json:"dst_networkconf_id"` // [\d\w]+|^$
DstNetworkconfType string `json:"dst_networkconf_type,omitempty"` // ADDRv4|NETv4
DstPort string `json:"dst_port,omitempty"`
Enabled bool `json:"enabled"`
IcmpTypename string `json:"icmp_typename"` // ^$|communication-prohibited|destination-unreachable|echo-reply|echo-request|fragmentation-needed|host-precedence-violation|host-prohibited|host-redirect|host-unknown|host-unreachable|ip-header-bad|network-prohibited|network-redirect|network-unknown|network-unreachable|parameter-problem|port-unreachable|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-route-failed|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit
Icmpv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|communication-prohibited|destination-unreachable|echo-reply|echo-request|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option
IPsec string `json:"ipsec"` // match-ipsec|match-none|^$
Logging bool `json:"logging"`
Monthdays string `json:"monthdays"` // ^$|^(([1-9]|[12][0-9]|3[01])(,([1-9]|[12][0-9]|3[01])){0,30})$
MonthdaysNegate bool `json:"monthdays_negate"`
Name string `json:"name,omitempty"` // .{1,128}
Protocol string `json:"protocol"` // ^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp
ProtocolMatchExcepted bool `json:"protocol_match_excepted"`
ProtocolV6 string `json:"protocol_v6"` // ^$|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|ah|all|dccp|eigrp|esp|gre|icmpv6|ipcomp|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|rsvp|sctp|shim6|tcp|tcp_udp|udp|vrrp
RuleIndex int `json:"rule_index,omitempty"` // 2[0-9]{3}|4[0-9]{3}
Ruleset string `json:"ruleset,omitempty"` // WAN_IN|WAN_OUT|WAN_LOCAL|LAN_IN|LAN_OUT|LAN_LOCAL|GUEST_IN|GUEST_OUT|GUEST_LOCAL|WANv6_IN|WANv6_OUT|WANv6_LOCAL|LANv6_IN|LANv6_OUT|LANv6_LOCAL|GUESTv6_IN|GUESTv6_OUT|GUESTv6_LOCAL
SrcAddress string `json:"src_address,omitempty"`
SrcAddressIPV6 string `json:"src_address_ipv6,omitempty"`
SrcFirewallgroupIDs []string `json:"src_firewallgroup_ids,omitempty"` // [\d\w]+
SrcMACAddress string `json:"src_mac_address"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
SrcNetworkconfID string `json:"src_networkconf_id"` // [\d\w]+|^$
SrcNetworkconfType string `json:"src_networkconf_type,omitempty"` // ADDRv4|NETv4
SrcPort string `json:"src_port,omitempty"`
Startdate string `json:"startdate"` // ^$|^(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])$
Starttime string `json:"starttime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
StateEstablished bool `json:"state_established"`
StateInvalid bool `json:"state_invalid"`
StateNew bool `json:"state_new"`
StateRelated bool `json:"state_related"`
Stopdate string `json:"stopdate"` // ^$|^(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])$
Stoptime string `json:"stoptime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
Utc bool `json:"utc"`
Weekdays string `json:"weekdays"` // ^$|^((Mon|Tue|Wed|Thu|Fri|Sat|Sun)(,(Mon|Tue|Wed|Thu|Fri|Sat|Sun)){0,6})$
WeekdaysNegate bool `json:"weekdays_negate"`
}

View File

@@ -0,0 +1,19 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type HeatMap 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"`
Description string `json:"description,omitempty"`
MapID string `json:"map_id"`
Name string `json:"name,omitempty"` // .*[^\s]+.*
Type string `json:"type,omitempty"` // download|upload
}

View File

@@ -0,0 +1,20 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type HeatMapPoint 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"`
DownloadSpeed float64 `json:"download_speed,omitempty"`
HeatmapID string `json:"heatmap_id"`
UploadSpeed float64 `json:"upload_speed,omitempty"`
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
}

View File

@@ -0,0 +1,18 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type HotspotOp 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"`
Name string `json:"name,omitempty"` // .{1,256}
Note string `json:"note,omitempty"`
XPassword string `json:"x_password,omitempty"` // .{1,256}
}

View File

@@ -0,0 +1,44 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type HotspotPackage 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"`
Amount float64 `json:"amount,omitempty"`
ChargedAs string `json:"charged_as,omitempty"`
Currency string `json:"currency,omitempty"` // [A-Z]{3}
CustomPaymentFieldsEnabled bool `json:"custom_payment_fields_enabled"`
Hours int `json:"hours,omitempty"`
Index int `json:"index,omitempty"`
LimitDown int `json:"limit_down,omitempty"`
LimitOverwrite bool `json:"limit_overwrite"`
LimitQuota int `json:"limit_quota,omitempty"`
LimitUp int `json:"limit_up,omitempty"`
Name string `json:"name,omitempty"`
PaymentFieldsAddressEnabled bool `json:"payment_fields_address_enabled"`
PaymentFieldsAddressRequired bool `json:"payment_fields_address_required"`
PaymentFieldsCityEnabled bool `json:"payment_fields_city_enabled"`
PaymentFieldsCityRequired bool `json:"payment_fields_city_required"`
PaymentFieldsCountryDefault string `json:"payment_fields_country_default,omitempty"`
PaymentFieldsCountryEnabled bool `json:"payment_fields_country_enabled"`
PaymentFieldsCountryRequired bool `json:"payment_fields_country_required"`
PaymentFieldsEmailEnabled bool `json:"payment_fields_email_enabled"`
PaymentFieldsEmailRequired bool `json:"payment_fields_email_required"`
PaymentFieldsFirstNameEnabled bool `json:"payment_fields_first_name_enabled"`
PaymentFieldsFirstNameRequired bool `json:"payment_fields_first_name_required"`
PaymentFieldsLastNameEnabled bool `json:"payment_fields_last_name_enabled"`
PaymentFieldsLastNameRequired bool `json:"payment_fields_last_name_required"`
PaymentFieldsStateEnabled bool `json:"payment_fields_state_enabled"`
PaymentFieldsStateRequired bool `json:"payment_fields_state_required"`
PaymentFieldsZipEnabled bool `json:"payment_fields_zip_enabled"`
PaymentFieldsZipRequired bool `json:"payment_fields_zip_required"`
TrialReset float64 `json:"trial_reset,omitempty"`
}

28
unifi/map.generated.go Normal file
View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type Map 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"`
Lat string `json:"lat,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
Lng string `json:"lng,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
MapTypeID string `json:"mapTypeId"` // satellite|roadmap|hybrid|terrain
Name string `json:"name,omitempty"`
OffsetLeft float64 `json:"offset_left,omitempty"`
OffsetTop float64 `json:"offset_top,omitempty"`
Opacity float64 `json:"opacity,omitempty"` // ^(0(\.[\d]{1,2})?|1)$|^$
Selected bool `json:"selected"`
Tilt int `json:"tilt,omitempty"`
Type string `json:"type,omitempty"` // designerMap|imageMap|googleMap
Unit string `json:"unit,omitempty"` // m|f
Upp float64 `json:"upp,omitempty"`
Zoom int `json:"zoom,omitempty"`
}

View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type MediaFile 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"`
Name string `json:"name,omitempty"`
}

151
unifi/network.generated.go Normal file
View File

@@ -0,0 +1,151 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type Network 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"`
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"`
DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty"` // .{1,256}
DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([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])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$
DHCPDDNS1 string `json:"dhcpd_dns_1"` // ^(([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])$|^$
DHCPDDNS2 string `json:"dhcpd_dns_2"` // ^(([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])$|^$
DHCPDDNS3 string `json:"dhcpd_dns_3"` // ^(([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])$|^$
DHCPDDNS4 string `json:"dhcpd_dns_4"` // ^(([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])$|^$
DHCPDDNSEnabled bool `json:"dhcpd_dns_enabled"`
DHCPDEnabled bool `json:"dhcpd_enabled"`
DHCPDGateway string `json:"dhcpd_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])$|^$
DHCPDGatewayEnabled bool `json:"dhcpd_gateway_enabled"`
DHCPDIP1 string `json:"dhcpd_ip_1"` // ^(([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])$|^$
DHCPDIP2 string `json:"dhcpd_ip_2"` // ^(([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])$|^$
DHCPDIP3 string `json:"dhcpd_ip_3"` // ^(([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])$|^$
DHCPDLeaseTime int `json:"dhcpd_leasetime,omitempty"`
DHCPDMAC1 string `json:"dhcpd_mac_1,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC2 string `json:"dhcpd_mac_2,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC3 string `json:"dhcpd_mac_3,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDNtp1 string `json:"dhcpd_ntp_1"` // ^(([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])$|^$
DHCPDNtp2 string `json:"dhcpd_ntp_2"` // ^(([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])$|^$
DHCPDNtpEnabled bool `json:"dhcpd_ntp_enabled"`
DHCPDStart string `json:"dhcpd_start"` // ^(([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])$|^$
DHCPDStop string `json:"dhcpd_stop"` // ^(([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])$|^$
DHCPDTftpServer string `json:"dhcpd_tftp_server,omitempty"`
DHCPDTimeOffset int `json:"dhcpd_time_offset,omitempty"` // ^0$|^-?([1-9]([0-9]{1,3})?|[1-7][0-9]{4}|[8][0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$
DHCPDTimeOffsetEnabled bool `json:"dhcpd_time_offset_enabled"`
DHCPDUnifiController string `json:"dhcpd_unifi_controller"` // ^(([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])$|^$
DHCPDWins1 string `json:"dhcpd_wins_1"` // ^(([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])$|^$
DHCPDWins2 string `json:"dhcpd_wins_2"` // ^(([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])$|^$
DHCPDWinsEnabled bool `json:"dhcpd_wins_enabled"`
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
DHCPDv6DNS1 string `json:"dhcpdv6_dns_1,omitempty"`
DHCPDv6DNS2 string `json:"dhcpdv6_dns_2,omitempty"`
DHCPDv6DNS3 string `json:"dhcpdv6_dns_3,omitempty"`
DHCPDv6DNS4 string `json:"dhcpdv6_dns_4,omitempty"`
DHCPDv6DNSAuto bool `json:"dhcpdv6_dns_auto"`
DHCPDv6Enabled bool `json:"dhcpdv6_enabled"`
DHCPDv6LeaseTime int `json:"dhcpdv6_leasetime,omitempty"`
DHCPDv6Start string `json:"dhcpdv6_start,omitempty"`
DHCPDv6Stop string `json:"dhcpdv6_stop,omitempty"`
DHCPguardEnabled bool `json:"dhcpguard_enabled"`
DomainName string `json:"domain_name,omitempty"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
DPIEnabled bool `json:"dpi_enabled"`
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
Enabled bool `json:"enabled"`
ExposedToSiteVpn bool `json:"exposed_to_site_vpn"`
IgmpFastleave bool `json:"igmp_fastleave"`
IgmpGroupmembership int `json:"igmp_groupmembership,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
IgmpMaxresponse int `json:"igmp_maxresponse,omitempty"` // [1-9]|1[0-9]|2[0-5]|^$
IgmpMcrtrexpiretime int `json:"igmp_mcrtrexpiretime,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
IgmpQuerier string `json:"igmp_querier"` // ^(([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])$|^$
IgmpSnooping bool `json:"igmp_snooping"`
IgmpSupression bool `json:"igmp_supression"`
IPSubnet string `json:"ip_subnet,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)$
IPsecDhGroup int `json:"ipsec_dh_group,omitempty"` // 2|5|14|15|16|19|20|21|25|26
IPsecDynamicRouting bool `json:"ipsec_dynamic_routing"`
IPsecEncryption string `json:"ipsec_encryption,omitempty"` // aes128|aes192|aes256|3des
IPsecEspDhGroup int `json:"ipsec_esp_dh_group,omitempty"` // 1|2|5|14|15|16|17|18
IPsecHash string `json:"ipsec_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
IPsecIkeDhGroup int `json:"ipsec_ike_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
IPsecInterface string `json:"ipsec_interface,omitempty"` // wan|wan2
IPsecKeyExchange string `json:"ipsec_key_exchange,omitempty"` // ikev1|ikev2
IPsecLocalIP string `json:"ipsec_local_ip,omitempty"` // ^any$|^(([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])$
IPsecPeerIP string `json:"ipsec_peer_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])$
IPsecPfs bool `json:"ipsec_pfs"`
IPsecProfile string `json:"ipsec_profile,omitempty"` // customized|azure_dynamic|azure_static
IPV6InterfaceType string `json:"ipv6_interface_type,omitempty"` // static|pd|none
IPV6PDInterface string `json:"ipv6_pd_interface,omitempty"` // wan|wan2
IPV6PDPrefixid string `json:"ipv6_pd_prefixid"` // ^$|[a-fA-F0-9]{1,4}
IPV6PDStart string `json:"ipv6_pd_start,omitempty"`
IPV6PDStop string `json:"ipv6_pd_stop,omitempty"`
IPV6RaEnabled bool `json:"ipv6_ra_enabled"`
IPV6RaPreferredLifetime int `json:"ipv6_ra_preferred_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
IPV6RaPriority string `json:"ipv6_ra_priority,omitempty"` // high|medium|low
IPV6RaValidLifetime int `json:"ipv6_ra_valid_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
IPV6Subnet string `json:"ipv6_subnet,omitempty"`
IsNAT bool `json:"is_nat"`
L2TpInterface string `json:"l2tp_interface,omitempty"` // wan|wan2
LteLanEnabled bool `json:"lte_lan_enabled"`
Name string `json:"name,omitempty"` // .{1,128}
NATOutboundIP string `json:"nat_outbound_ip,omitempty"`
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?
OpenVPNLocalAddress string `json:"openvpn_local_address,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])$
OpenVPNLocalPort int `json:"openvpn_local_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])$
OpenVPNMode string `json:"openvpn_mode,omitempty"` // site-to-site|client|server
OpenVPNRemoteAddress string `json:"openvpn_remote_address,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])$
OpenVPNRemoteHost string `json:"openvpn_remote_host,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])$
OpenVPNRemotePort int `json:"openvpn_remote_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])$
PptpcRequireMppe bool `json:"pptpc_require_mppe"`
PptpcRouteDistance int `json:"pptpc_route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
PptpcServerIP string `json:"pptpc_server_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])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$
PptpcUsername string `json:"pptpc_username,omitempty"` // [^\"\' ]+
Priority int `json:"priority,omitempty"` // [1-4]
Purpose string `json:"purpose,omitempty"` // corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan
RADIUSprofileID string `json:"radiusprofile_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)$|^$
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)$|^$
ReportWanEvent bool `json:"report_wan_event"`
RequireMschapv2 bool `json:"require_mschapv2"`
RouteDistance int `json:"route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
UpnpLanEnabled bool `json:"upnp_lan_enabled"`
UserGroupID string `json:"usergroup_id"`
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
VLANEnabled bool `json:"vlan_enabled"`
VpnClientDefaultRoute bool `json:"vpn_client_default_route"`
VpnClientPullDNS bool `json:"vpn_client_pull_dns"`
VpnType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server
WanDHCPv6PDSize int `json:"wan_dhcpv6_pd_size,omitempty"` // ^(4[89]|5[0-9]|6[0-4])$|^$
WanDNS1 string `json:"wan_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])$|^$
WanDNS2 string `json:"wan_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])$|^$
WanDNS3 string `json:"wan_dns3"` // ^(([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])$|^$
WanDNS4 string `json:"wan_dns4"` // ^(([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])$|^$
WanEgressQOS int `json:"wan_egress_qos,omitempty"` // [1-7]|^$
WanGateway string `json:"wan_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])$|^$
WanGatewayV6 string `json:"wan_gateway_v6"` // ^(([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]))$|^$
WanIP string `json:"wan_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])$
WanIPV6 string `json:"wan_ipv6"` // ^(([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]))$|^$
WanLoadBalanceType string `json:"wan_load_balance_type,omitempty"` // failover-only|weighted
WanLoadBalanceWeight int `json:"wan_load_balance_weight,omitempty"` // [1-9]|[1-9][0-9]
WanNetmask string `json:"wan_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)))))$
WanNetworkGroup string `json:"wan_networkgroup,omitempty"` // WAN[2]?|WAN_LTE_FAILOVER
WanPrefixlen int `json:"wan_prefixlen,omitempty"` // ^([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])$|^$
WanSmartqDownRate int `json:"wan_smartq_down_rate,omitempty"` // [0-9]{1,6}|1000000
WanSmartqEnabled bool `json:"wan_smartq_enabled"`
WanSmartqUpRate int `json:"wan_smartq_up_rate,omitempty"` // [0-9]{1,6}|1000000
WanType string `json:"wan_type,omitempty"` // disabled|dhcp|static|pppoe
WanTypeV6 string `json:"wan_type_v6,omitempty"` // disabled|dhcpv6|static
WanUsername string `json:"wan_username,omitempty"` // [^"' ]+
WanVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
WanVLANEnabled bool `json:"wan_vlan_enabled"`
XIPsecPreSharedKey string `json:"x_ipsec_pre_shared_key,omitempty"` // [^\"\' ]+
XOpenVPNSharedSecretKey string `json:"x_openvpn_shared_secret_key,omitempty"` // [0-9A-Fa-f]{512}
XPptpcPassword string `json:"x_pptpc_password,omitempty"` // [^\"\' ]+
XWanPassword string `json:"x_wan_password,omitempty"` // [^"' ]+
}

View File

@@ -1,41 +1,31 @@
package unifi
import (
"encoding/json"
"fmt"
)
type Network struct {
ID string `json:"_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
Name string `json:"name"`
// 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"`
Purpose string `json:"purpose"` // "corporate"
NetworkGroup string `json:"networkgroup"` // "LAN"
VLAN string `json:"vlan"`
VLANEnabled bool `json:"vlan_enabled"`
IPSubnet string `json:"ip_subnet"`
Enabled bool `json:"enabled"`
IsNAT bool `json:"is_nat"`
DomainName string `json:"domain_name"`
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
DHCPDStart string `json:"dhcpd_start"` // "10.0.0.6"
DHCPDStop string `json:"dhcpd_stop"` // "10.0.0.254"
DHCPDEnabled bool `json:"dhcpd_enabled"` // true
DHCPDLeaseTime int `json:"dhcpd_leasetime"` // 86400
DHCPDDNSEnabled bool `json:"dhcpd_dns_enabled"`
DHCPDGatewayEnabled bool `json:"dhcpd_gateway_enabled"`
DHCPDTimeOffsetEnabled bool `json:"dhcpd_time_offset_enabled"`
IPV6InterfaceType string `json:"ipv6_interface_type"` // "none"
IPV6PDStart string `json:"ipv6_pd_start"` // "::2"
IPV6PDStop string `json:"ipv6_pd_stop"` // "::7d1"
func (n *Network) UnmarshalJSON(b []byte) error {
type Alias Network
aux := &struct {
VLAN json.Number `json:"vlan"`
*Alias
}{
Alias: (*Alias)(n),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return err
}
n.VLAN = 0
if aux.VLAN.String() != "" {
vlan, err := aux.VLAN.Int64()
if err != nil {
return err
}
n.VLAN = int(vlan)
}
return nil
}
func (c *Client) ListNetwork(site string) ([]Network, error) {

View File

@@ -0,0 +1,48 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type PortConf 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"`
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"`
Forward string `json:"forward,omitempty"` // all|native|customize|disabled
FullDuplex bool `json:"full_duplex"`
Isolation bool `json:"isolation"`
LldpmedEnabled bool `json:"lldpmed_enabled"`
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
Name string `json:"name,omitempty"`
NATiveNetworkconfID string `json:"native_networkconf_id"`
OpMode string `json:"op_mode,omitempty"` // switch
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
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})$
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"`
TaggedNetworkconfIDs []string `json:"tagged_networkconf_ids,omitempty"`
VoiceNetworkconfID string `json:"voice_networkconf_id"`
}

View File

@@ -0,0 +1,24 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type PortForward 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"`
DstPort string `json:"dst_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}
Enabled bool `json:"enabled"`
Fwd string `json:"fwd,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])$
FwdPort string `json:"fwd_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}
Log bool `json:"log"`
Name string `json:"name,omitempty"` // .{1,128}
PfwdInterface string `json:"pfwd_interface,omitempty"` // wan|wan2|both
Proto string `json:"proto,omitempty"` // tcp_udp|tcp|udp
Src string `json:"src,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])$|^(([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-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-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-9]|[1-2][0-9]|3[0-2])$|^!(([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-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-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-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-9]|[1-2][0-9]|3[0-2])$|^any$
}

View File

@@ -0,0 +1,23 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type Routing 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"`
Enabled bool `json:"enabled"`
Name string `json:"name,omitempty"` // .{1,128}
StaticRouteDistance int `json:"static-route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
StaticRouteInterface string `json:"static-route_interface"` // WAN1|WAN2|[\d\w]+|^$
StaticRouteNetwork string `json:"static-route_network,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]|3[0-2])$|^([a-fA-F0-9:]+\/(([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])))$
StaticRouteNexthop string `json:"static-route_nexthop"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^([a-fA-F0-9:]+)$|^$
StaticRouteType string `json:"static-route_type,omitempty"` // nexthop-route|interface-route|blackhole
Type string `json:"type,omitempty"` // static-route
}

17
unifi/tag.generated.go Normal file
View File

@@ -0,0 +1,17 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type Tag 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"`
MemberTable []string `json:"member_table,omitempty"`
Name string `json:"name,omitempty"`
}

25
unifi/user.generated.go Normal file
View File

@@ -0,0 +1,25 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type User 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"`
Blocked bool `json:"blocked,omitempty"`
FixedIP string `json:"fixed_ip,omitempty"`
Hostname string `json:"hostname,omitempty"`
LastSeen string `json:"last_seen,omitempty"`
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Name string `json:"name,omitempty"`
NetworkID string `json:"network_id"`
Note string `json:"note,omitempty"`
UseFixedIP bool `json:"use_fixedip"`
UserGroupID string `json:"usergroup_id"`
}

View File

@@ -10,23 +10,6 @@ import "fmt"
// { note: "my note", usergroup_id: "", name: "Google WiFi alias"}
// {"meta":{"rc":"ok"},"data":[{"_id":"5deeac76439adf048407dd01","mac":"e4:f0:42:bf:bd:11","site_id":"5d6d8b07439adf048407dcd9","oui":"Google","is_guest":false,"first_seen":1575922805,"last_seen":1577889639,"is_wired":true,"fingerprint_engine":"tdts","dev_cat":6,"dev_family":9,"os_class":16,"os_name":56,"dev_vendor":7,"dev_id":2822,"priority":101,"fingerprint_source":0,"name":"Google WiFi","usergroup_id":"","noted":true,"fixed_ip":"10.0.6.11","note":"","confidence":100,"network_id":"5df7f70f1e801c052a1ab032","use_fixedip":true}]}
type User struct {
ID string `json:"_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
Name string `json:"name"`
MAC string `json:"mac"`
UserGroupID string `json:"user_group_id"`
Note string `json:"note"`
UseFixedIP bool `json:"use_fixedip"`
FixedIP string `json:"fixed_ip,omitempty"`
NetworkID string `json:"network_id"`
// not sure if you can end this for create/update, etc, only
// observed modifying via stamgr
Blocked bool `json:"blocked,omitempty"`
}
func (c *Client) ListUser(site string) ([]User, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -0,0 +1,18 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type UserGroup 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"`
Name string `json:"name,omitempty"` // .{1,128}
QOSRateMaxDown int `json:"qos_rate_max_down,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000
QOSRateMaxUp int `json:"qos_rate_max_up,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000
}

View File

@@ -4,20 +4,6 @@ import (
"fmt"
)
type UserGroup struct {
ID string `json:"_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
Name string `json:"name"`
//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"`
QOSRateMaxDown int `json:"qos_rate_max_down"` // -1 for disabled
QOSRateMaxUp int `json:"qos_rate_max_up"` // -1 for disabled
}
func (c *Client) ListUserGroup(site string) ([]UserGroup, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -0,0 +1,21 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type VirtualDevice 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"`
HeightInMeters float64 `json:"heightInMeters,omitempty"`
Locked bool `json:"locked"`
MapID string `json:"map_id"`
Type string `json:"type,omitempty"` // uap|usg|usw
X string `json:"x,omitempty"`
Y string `json:"y,omitempty"`
}

74
unifi/wlan.generated.go Normal file
View File

@@ -0,0 +1,74 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type WLAN 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"`
BroadcastFilterEnabled bool `json:"bc_filter_enabled"`
BroadcastFilterList []string `json:"bc_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
CountryBeacon bool `json:"country_beacon"`
DPIEnabled bool `json:"dpi_enabled"`
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
DTIMMode string `json:"dtim_mode,omitempty"` // default|custom
DTIMNa int `json:"dtim_na,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DTIMNg int `json:"dtim_ng,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
ElementAdopt bool `json:"element_adopt"`
Enabled bool `json:"enabled"`
FastRoamingEnabled bool `json:"fast_roaming_enabled"`
GroupRekey int `json:"group_rekey,omitempty"` // ^(0|[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)$
HideSSID bool `json:"hide_ssid"`
Hotspot2ConfEnabled bool `json:"hotspot2conf_enabled"`
Hotspot2ConfID string `json:"hotspot2conf_id"`
IappEnabled bool `json:"iapp_enabled"`
IsGuest bool `json:"is_guest"`
MACFilterEnabled bool `json:"mac_filter_enabled"`
MACFilterList []string `json:"mac_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
MACFilterPolicy string `json:"mac_filter_policy,omitempty"` // allow|deny
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
MinrateNaAdvertisingRates bool `json:"minrate_na_advertising_rates"`
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps,omitempty"`
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps,omitempty"`
MinrateNaEnabled bool `json:"minrate_na_enabled"`
MinrateNaMgmtRateKbps int `json:"minrate_na_mgmt_rate_kbps,omitempty"`
MinrateNgAdvertisingRates bool `json:"minrate_ng_advertising_rates"`
MinrateNgBeaconRateKbps int `json:"minrate_ng_beacon_rate_kbps,omitempty"`
MinrateNgCckRatesEnabled bool `json:"minrate_ng_cck_rates_enabled"`
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps,omitempty"`
MinrateNgEnabled bool `json:"minrate_ng_enabled"`
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps,omitempty"`
Name string `json:"name,omitempty"` // .{1,32}
NameCombineEnabled bool `json:"name_combine_enabled"`
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
No2GhzOui bool `json:"no2ghz_oui"`
Priority string `json:"priority,omitempty"` // medium|high|low
RADIUSDasEnabled bool `json:"radius_das_enabled"`
RADIUSMACAuthEnabled bool `json:"radius_mac_auth_enabled"`
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
RADIUSprofileID string `json:"radiusprofile_id"`
RoamClusterID int `json:"roam_cluster_id,omitempty"` // [0-9]|[1-2][0-9]|[3][0-1]|^$
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])
ScheduleEnabled bool `json:"schedule_enabled"`
ScheduleReversed bool `json:"schedule_reversed"`
Security string `json:"security,omitempty"` // open|wpapsk|wep|wpaeap
UapsdEnabled bool `json:"uapsd_enabled"`
UserGroupID string `json:"usergroup_id"`
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"`
WEPIDX int `json:"wep_idx,omitempty"` // [1-4]
WLANGroupID string `json:"wlangroup_id"`
WPAEnc string `json:"wpa_enc,omitempty"` // auto|ccmp
WPAMode string `json:"wpa_mode,omitempty"` // auto|wpa1|wpa2
XIappKey string `json:"x_iapp_key,omitempty"` // [0-9A-Fa-f]{32}
XPassphrase string `json:"x_passphrase,omitempty"` // [\x20-\x7E]{8,63}|[0-9a-fA-F]{64}
XWEP string `json:"x_wep,omitempty"`
}

View File

@@ -133,66 +133,6 @@ import (
}
*/
type WLAN struct {
ID string `json:"_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
Enabled bool `json:"enabled"`
Name string `json:"name"`
Security string `json:"security"` // "wpapsk", "wpaeap", "open"
WPAEnc string `json:"wpa_enc"` // "ccmp", "tkip"?
WPAMode string `json:"wpa_mode"` // "wpa2"
XPassphrase string `json:"x_passphrase,omitempty"`
HideSSID bool `json:"hide_ssid"`
IsGuest bool `json:"is_guest"`
// create only?
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled,omitempty"`
FastRoamingEnabled bool `json:"fast_roaming_enabled,omitempty"`
RADIUSDasEnabled bool `json:"radius_das_enabled"`
WLANGroupID string `json:"wlangroup_id"`
UserGroupID string `json:"usergroup_id"`
NameCombineEnabled bool `json:"name_combine_enabled"`
NameCombineSuffix string `json:"name_combine_suffix,omitempty"`
XIappKey string `json:"x_iapp_key,omitempty"`
No2GhzOui bool `json:"no2ghz_oui"`
WEPIdx int `json:"wep_idx,omitempty"`
DTIMMode string `json:"dtim_mode"`
DTIMNg int `json:"dtim_ng,omitempty"`
DTIMNa int `json:"dtim_na,omitempty"`
MinrateNgEnabled bool `json:"minrate_ng_enabled"`
MinrateNgBeaconRateKbps int `json:"minrate_ng_beacon_rate_kbps,omitempty"`
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps,omitempty"`
MinrateNgAdvertisingRates bool `json:"minrate_ng_advertising_rates"`
MinrateNgCckRatesEnabled bool `json:"minrate_ng_cck_rates_enabled"`
MinrateNaEnabled bool `json:"minrate_na_enabled"`
MinrateNaAdvertisingRates bool `json:"minrate_na_advertising_rates"`
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps,omitempty"`
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps,omitempty"`
MinrateNaMgmtRateKbps int `json:"minrate_na_mgmt_rate_kbps,omitempty"`
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps,omitempty"`
MACFilterEnabled bool `json:"mac_filter_enabled"`
MACFilterPolicy string `json:"mac_filter_policy,omitempty"`
MACFilterList []string `json:"mac_filter_list,omitempty"`
BroadcastFilterEnabled bool `json:"bc_filter_enabled"`
BroadcastFilterList []string `json:"bc_filter_list,omitempty"`
GroupRekey int `json:"group_rekey"`
VLANEnabled bool `json:"vlan_enabled"`
VLAN string `json:"vlan"`
Schedule []string `json:"schedule"`
}
func (c *Client) ListWLAN(site string) ([]WLAN, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -0,0 +1,22 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
type WLANGroup 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"`
BSupported bool `json:"b_supported"`
LoadbalanceEnabled bool `json:"loadbalance_enabled"`
Maxsta int `json:"maxsta,omitempty"` // [1-9]|[1-9][0-9]|1[0-9]{2}|200|^$
MinRSSI string `json:"minrssi,omitempty"`
MinRSSIEnabled bool `json:"minrssi_enabled"`
Name string `json:"name,omitempty"` // .{1,128}
PMFMode string `json:"pmf_mode,omitempty"` // disabled|optional|required
}

View File

@@ -4,25 +4,6 @@ import (
"fmt"
)
type WLANGroup struct {
ID string `json:"_id"`
SiteID string `json:"site_id"`
Name string `json:"name"`
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"`
BSupported bool `json:"b_supported"`
LoadBalanceEnabled bool `json:"loadbalance_enabled"`
PMFMode string `json:"pmf_mode"` // "disabled", "optional", "required"
// roam_channel_na: 36
// roam_channel_ng: 1
// roam_enabled: false
// roam_radio: "ng"
}
func (c *Client) ListWLANGroup(site string) ([]WLANGroup, error) {
var respBody struct {
Meta meta `json:"meta"`