Add support for 6.0.23

This commit is contained in:
Paul Tyng
2020-10-19 11:13:51 -04:00
parent 020dad41e7
commit abc676f62b
84 changed files with 2131 additions and 252 deletions

95
unifi/ap_group.go Normal file
View File

@@ -0,0 +1,95 @@
package unifi
import (
"context"
"fmt"
)
// just to fix compile issues with the import
var (
_ fmt.Formatter
_ context.Context
)
// This is a v2 API object, so manually coded for now, need to figure out generation...
type APGroup struct {
ID string `json:"_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"`
DeviceMACs []string `json:"device_macs"`
}
func (c *Client) ListAPGroup(ctx context.Context, site string) ([]APGroup, error) {
var respBody []APGroup
err := c.do(ctx, "GET", fmt.Sprintf("/v2/api/site/%s/apgroups", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody, nil
}
// func (c *Client) getWLANGroup(ctx context.Context, site, id string) (*WLANGroup, error) {
// var respBody struct {
// Meta meta `json:"meta"`
// Data []WLANGroup `json:"data"`
// }
// err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, id), nil, &respBody)
// if err != nil {
// return nil, err
// }
// if len(respBody.Data) != 1 {
// return nil, &NotFoundError{}
// }
// d := respBody.Data[0]
// return &d, nil
// }
// func (c *Client) deleteWLANGroup(ctx context.Context, site, id string) error {
// err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, id), struct{}{}, nil)
// if err != nil {
// return err
// }
// return nil
// }
func (c *Client) CreateAPGroup(ctx context.Context, site string, d *APGroup) (*APGroup, error) {
var respBody APGroup
err := c.do(ctx, "POST", fmt.Sprintf("/v2/api/site/%s/apgroups", site), d, &respBody)
if err != nil {
return nil, err
}
return &respBody, nil
}
// func (c *Client) updateWLANGroup(ctx context.Context, site string, d *WLANGroup) (*WLANGroup, error) {
// var respBody struct {
// Meta meta `json:"meta"`
// Data []WLANGroup `json:"data"`
// }
// err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/wlangroup/%s", site, d.ID), d, &respBody)
// if err != nil {
// return nil, err
// }
// if len(respBody.Data) != 1 {
// return nil, &NotFoundError{}
// }
// new := respBody.Data[0]
// return &new, nil
// }

View File

@@ -147,7 +147,9 @@ type DeviceRadioTable struct {
BackupChannel int `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
Channel int `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"`
Ht string `json:"ht,omitempty"` // 20|40|80|160|1080|2160
Ht string `json:"ht,omitempty"` // 20|40|80|160|1080|2160
LoadbalanceEnabled bool `json:"loadbalance_enabled,omitempty"`
Maxsta int `json:"maxsta,omitempty"` // [1-9]|[1-9][0-9]|1[0-9]{2}|200|^$
MinRssi int `json:"min_rssi,omitempty"` // ^-([1-9]|[1-8][0-9]|9[0-4])$
MinRssiEnabled bool `json:"min_rssi_enabled,omitempty"`
Name string `json:"name,omitempty"`
@@ -157,7 +159,6 @@ type DeviceRadioTable struct {
TxPower int `json:"tx_power,omitempty"` // [\d]+|auto
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
VwireEnabled bool `json:"vwire_enabled,omitempty"`
WLANGroupID string `json:"wlangroup_id,omitempty"` // [\d\w]+
}
type DeviceRpsOverride struct {

View File

@@ -38,7 +38,6 @@ type HotspotPackage struct {
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"`
@@ -51,6 +50,7 @@ type HotspotPackage struct {
PaymentFieldsStateRequired bool `json:"payment_fields_state_required"`
PaymentFieldsZipEnabled bool `json:"payment_fields_zip_enabled"`
PaymentFieldsZipRequired bool `json:"payment_fields_zip_required"`
TrialDurationMinutes int `json:"trial_duration_minutes,omitempty"`
TrialReset float64 `json:"trial_reset,omitempty"`
}

View File

@@ -23,145 +23,152 @@ type Network struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
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"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC2 string `json:"dhcpd_mac_2"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC3 string `json:"dhcpd_mac_3"` // (^$|^([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])$|^$
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"`
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
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"`
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
DHCPguardEnabled bool `json:"dhcpguard_enabled"`
DPIEnabled bool `json:"dpi_enabled"`
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
DomainName string `json:"domain_name"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
Enabled bool `json:"enabled"`
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
GatewayDevice string `json:"gateway_device"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
GatewayType string `json:"gateway_type,omitempty"` // default|switch
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"`
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
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)$
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"`
NATOutboundIP string `json:"nat_outbound_ip,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
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|uid-server
WANDHCPOptions []NetworkWANDHCPOptions `json:"wan_dhcp_options,omitempty"`
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"` // [^"' ]+
AutoScaleEnabled bool `json:"auto_scale_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"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC2 string `json:"dhcpd_mac_2"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC3 string `json:"dhcpd_mac_3"` // (^$|^([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])$|^$
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"`
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
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"`
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
DHCPguardEnabled bool `json:"dhcpguard_enabled"`
DPIEnabled bool `json:"dpi_enabled"`
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
DomainName string `json:"domain_name"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
Enabled bool `json:"enabled"`
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
GatewayDevice string `json:"gateway_device"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
GatewayType string `json:"gateway_type,omitempty"` // default|switch
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"`
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
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)$
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"`
NATOutboundIPAddresses []NetworkNATOutboundIPAddresses `json:"nat_outbound_ip_addresses,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
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|uid-server
WANDHCPOptions []NetworkWANDHCPOptions `json:"wan_dhcp_options,omitempty"`
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])$
WANIPAliases []string `json:"wan_ip_aliases,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)$|^$
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"` // [^"' ]+
}
type NetworkNATOutboundIPAddresses struct {
IPAddress string `json:"ip_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])$|^$
WANNetworkGroup string `json:"wan_network_group,omitempty"` // WAN|WAN2
}
type NetworkWANDHCPOptions struct {

View File

@@ -23,7 +23,8 @@ type PortForward struct {
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}
DestinationIP string `json:"destination_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])$|^any$
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}

View File

@@ -26,7 +26,7 @@ type SettingGuestAccess struct {
Key string `json:"key"`
AllowedSubnet string `json:"allowed_subnet_,omitempty"`
Auth string `json:"auth,omitempty"` // none|password|hotspot|facebook_wifi|custom
Auth string `json:"auth,omitempty"` // none|hotspot|facebook_wifi|custom
AuthorizeUseSandbox bool `json:"authorize_use_sandbox"`
CustomIP string `json:"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])$|^$
EcEnabled bool `json:"ec_enabled"`
@@ -46,6 +46,7 @@ type SettingGuestAccess struct {
GoogleScopeEmail bool `json:"google_scope_email"`
IPpayUseSandbox bool `json:"ippay_use_sandbox"`
MerchantwarriorUseSandbox bool `json:"merchantwarrior_use_sandbox"`
PasswordEnabled bool `json:"password_enabled"`
PaymentEnabled bool `json:"payment_enabled"`
PaypalUseSandbox bool `json:"paypal_use_sandbox"`
PortalCustomized bool `json:"portal_customized"`

View File

@@ -27,7 +27,7 @@ type SettingIps struct {
DNSFiltering bool `json:"dns_filtering"`
DNSFilters []SettingIpsDNSFilters `json:"dns_filters,omitempty"`
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|spamhaus|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
EndpointScanning bool `json:"endpoint_scanning"`
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
HoneypotEnabled bool `json:"honeypot_enabled"`
@@ -52,7 +52,7 @@ type SettingIpsDNSFilters struct {
BlockedSites []string `json:"blocked_sites,omitempty"` // ^[a-zA-Z0-9.-]+$|^$
BlockedTld []string `json:"blocked_tld,omitempty"` // ^[a-zA-Z0-9.-]+$|^$
Description string `json:"description,omitempty"`
Filter string `json:"filter,omitempty"` // none|security|adult|family
Filter string `json:"filter,omitempty"` // none|work|family
Name string `json:"name,omitempty"`
NetworkID string `json:"network_id"`
Version string `json:"version,omitempty"` // v4|v6

View File

@@ -32,6 +32,7 @@ type SettingMgmt struct {
LedEnabled bool `json:"led_enabled"`
OutdoorModeEnabled bool `json:"outdoor_mode_enabled"`
UnifiIDpEnabled bool `json:"unifi_idp_enabled"`
WifimanEnabled bool `json:"wifiman_enabled"`
XMgmtKey string `json:"x_mgmt_key,omitempty"` // [0-9a-f]{32}
XSshAuthPasswordEnabled bool `json:"x_ssh_auth_password_enabled"`
XSshBindWildcard bool `json:"x_ssh_bind_wildcard"`

View File

@@ -32,7 +32,7 @@ type SettingRadius struct {
Enabled bool `json:"enabled"`
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
TunneledReply bool `json:"tunneled_reply"`
XSecret string `json:"x_secret,omitempty"` // [^\"\' ]{1,128}
XSecret string `json:"x_secret,omitempty"` // [^\"\' ]{1,48}
}
func (c *Client) getSettingRadius(ctx context.Context, site string) (*SettingRadius, error) {

View File

@@ -49,12 +49,18 @@ type Client struct {
loginPath string
csrf string
version string
}
func (c *Client) CSRFToken() string {
return c.csrf
}
func (c *Client) Version() string {
return c.version
}
func (c *Client) SetBaseURL(base string) error {
var err error
c.baseURL, err = url.Parse(base)
@@ -128,6 +134,18 @@ func (c *Client) Login(ctx context.Context, user, pass string) error {
return fmt.Errorf("unable to determine API URL style: %w", err)
}
var status struct {
Meta struct {
ServerVersion string `json:"server_version"`
UUID string `json:"uuid"`
} `json:"meta"`
}
err = c.do(ctx, "GET", "/status", nil, &status)
if err != nil {
return err
}
c.version = status.Meta.ServerVersion
err = c.do(ctx, "POST", c.loginPath, &struct {
Username string `json:"username"`
Password string `json:"password"`

View File

@@ -23,72 +23,85 @@ type WLAN struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
AuthCache bool `json:"auth_cache"`
BroadcastFilterEnabled bool `json:"bc_filter_enabled"`
BroadcastFilterList []string `json:"bc_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
BssTransition bool `json:"bss_transition"`
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"`
L2Isolation bool `json:"l2_isolation"`
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
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"`
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
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"`
P2P bool `json:"p2p"`
P2PCrossConnect bool `json:"p2p_cross_connect"`
Priority string `json:"priority,omitempty"` // medium|high|low
ProxyArp bool `json:"proxy_arp"`
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|osen
TdlsProhibit bool `json:"tdls_prohibit"`
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"`
ApGroupIDs []string `json:"ap_group_ids,omitempty"`
AuthCache bool `json:"auth_cache"`
BSupported bool `json:"b_supported"`
BroadcastFilterEnabled bool `json:"bc_filter_enabled"`
BroadcastFilterList []string `json:"bc_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
BssTransition bool `json:"bss_transition"`
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"`
L2Isolation bool `json:"l2_isolation"`
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
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"`
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
Name string `json:"name,omitempty"` // .{1,32}
NameCombineEnabled bool `json:"name_combine_enabled"`
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
NetworkID string `json:"networkconf_id"`
No2GhzOui bool `json:"no2ghz_oui"`
P2P bool `json:"p2p"`
P2PCrossConnect bool `json:"p2p_cross_connect"`
PMFMode string `json:"pmf_mode,omitempty"` // disabled|optional|required
Priority string `json:"priority,omitempty"` // medium|high|low
ProxyArp bool `json:"proxy_arp"`
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"`
ScheduleWithDuration []WLANScheduleWithDuration `json:"schedule_with_duration,omitempty"`
Security string `json:"security,omitempty"` // open|wpapsk|wep|wpaeap|osen
TdlsProhibit bool `json:"tdls_prohibit"`
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]
WLANBand string `json:"wlan_band,omitempty"` // 2g|5g|both
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"`
}
type WLANScheduleWithDuration struct {
DurationMinutes int `json:"duration_minutes,omitempty"` // ^[1-9][0-9]*$
StartDaysOfWeek []string `json:"start_days_of_week,omitempty"` // ^(sun|mon|tue|wed|thu|fri|sat)$
StartHour int `json:"start_hour,omitempty"` // ^(1?[0-9])|(2[0-3])$
StartMinute int `json:"start_minute,omitempty"` // ^[0-5]?[0-9]$
}
func (c *Client) listWLAN(ctx context.Context, site string) ([]WLAN, error) {

View File

@@ -23,13 +23,7 @@ type WLANGroup struct {
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
Name string `json:"name,omitempty"` // .{1,128}
}
func (c *Client) listWLANGroup(ctx context.Context, site string) ([]WLANGroup, error) {

View File

@@ -2,28 +2,8 @@ package unifi
import (
"context"
"encoding/json"
)
func (n *WLANGroup) UnmarshalJSON(b []byte) error {
type Alias WLANGroup
aux := &struct {
Maxsta emptyStringInt `json:"maxsta"`
*Alias
}{
Alias: (*Alias)(n),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return err
}
n.Maxsta = int(aux.Maxsta)
return nil
}
func (c *Client) ListWLANGroup(ctx context.Context, site string) ([]WLANGroup, error) {
return c.listWLANGroup(ctx, site)
}