Merge pull request #7 from vegardengen/6-update-to-90114

Update to network version 9.0.114
This commit is contained in:
2025-04-14 12:04:17 +02:00
committed by GitHub
16 changed files with 685 additions and 225 deletions

View File

@@ -25,12 +25,14 @@ type Account struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
FilterIDs []string `json:"filter_ids,omitempty"`
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
Name string `json:"name,omitempty"` // ^[^"' ]+$
NetworkID string `json:"networkconf_id,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]|^$
UlpUserID string `json:"ulp_user_id"`
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

@@ -28,13 +28,13 @@ type Device struct {
MAC string `json:"mac,omitempty"`
Adopted bool `json:"adopted"`
AfcEnabled bool `json:"afc_enabled,omitempty"`
AtfEnabled bool `json:"atf_enabled,omitempty"`
BandsteeringMode string `json:"bandsteering_mode,omitempty"` // off|equal|prefer_5g
BaresipAuthUser string `json:"baresip_auth_user,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
BaresipEnabled bool `json:"baresip_enabled,omitempty"`
BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
ConfigNetwork DeviceConfigNetwork `json:"config_network,omitempty"`
ConnectedBatteryOverrides []DeviceConnectedBatteryOverrides `json:"connected_battery_overrides,omitempty"`
DPIEnabled bool `json:"dpi_enabled,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id,omitempty"` // [\d\w]+|
@@ -44,6 +44,7 @@ type Device struct {
FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"`
GatewayVrrpMode string `json:"gateway_vrrp_mode,omitempty"` // primary|secondary
GatewayVrrpPriority int `json:"gateway_vrrp_priority,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]
GreenApEnabled bool `json:"green_ap_enabled,omitempty"`
HeightInMeters float64 `json:"heightInMeters,omitempty"`
Hostname string `json:"hostname,omitempty"` // .{1,128}
JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"`
@@ -53,6 +54,7 @@ type Device struct {
LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override,omitempty"`
LcmNightModeBegins string `json:"lcm_night_mode_begins,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
LcmNightModeEnds string `json:"lcm_night_mode_ends,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
LcmOrientationOverride int `json:"lcm_orientation_override,omitempty"` // 0|90|180|270
LcmSettingsRestrictedAccess bool `json:"lcm_settings_restricted_access,omitempty"`
LcmTrackerEnabled bool `json:"lcm_tracker_enabled,omitempty"`
LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50}
@@ -88,6 +90,8 @@ type Device struct {
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
PowerSourceCtrlBudget int `json:"power_source_ctrl_budget,omitempty"` // [0-9]|[1-9][0-9]|[1-9][0-9][0-9]
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
PtmpApMAC string `json:"ptmp_ap_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
PtpApMAC string `json:"ptp_ap_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
RadioTable []DeviceRadioTable `json:"radio_table,omitempty"`
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
@@ -95,6 +99,7 @@ type Device struct {
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
State DeviceState `json:"state"`
StationMode string `json:"station_mode,omitempty"` // ptp|ptmp|wifi
StpPriority string `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"`
@@ -104,8 +109,6 @@ type Device struct {
X float64 `json:"x,omitempty"`
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
Y float64 `json:"y,omitempty"`
PortTable []PortTable `json:"port_table,omitempty"`
}
func (dst *Device) UnmarshalJSON(b []byte) error {
@@ -114,6 +117,7 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
GatewayVrrpPriority emptyStringInt `json:"gateway_vrrp_priority"`
LcmBrightness emptyStringInt `json:"lcm_brightness"`
LcmIDleTimeout emptyStringInt `json:"lcm_idle_timeout"`
LcmOrientationOverride emptyStringInt `json:"lcm_orientation_override"`
LedOverrideColorBrightness emptyStringInt `json:"led_override_color_brightness"`
LteExtAnt booleanishString `json:"lte_ext_ant"`
LteHardLimit emptyStringInt `json:"lte_hard_limit"`
@@ -136,6 +140,7 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
dst.GatewayVrrpPriority = int(aux.GatewayVrrpPriority)
dst.LcmBrightness = int(aux.LcmBrightness)
dst.LcmIDleTimeout = int(aux.LcmIDleTimeout)
dst.LcmOrientationOverride = int(aux.LcmOrientationOverride)
dst.LedOverrideColorBrightness = int(aux.LedOverrideColorBrightness)
dst.LteExtAnt = bool(aux.LteExtAnt)
dst.LteHardLimit = int(aux.LteHardLimit)
@@ -176,29 +181,10 @@ func (dst *DeviceConfigNetwork) UnmarshalJSON(b []byte) error {
return nil
}
type DeviceConnectedBatteryOverrides struct {
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
}
func (dst *DeviceConnectedBatteryOverrides) UnmarshalJSON(b []byte) error {
type Alias DeviceConnectedBatteryOverrides
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
type DeviceEtherLighting struct {
Behavior string `json:"behavior,omitempty"` // breath|steady
Brightness int `json:"brightness,omitempty"` // [1-9]|[1-9][0-9]|100
LedMode string `json:"led_mode,omitempty"` // standard|etherlighting
Mode string `json:"mode,omitempty"` // speed|network
}
@@ -282,12 +268,13 @@ type DevicePortOverrides struct {
Isolation bool `json:"isolation,omitempty"`
LldpmedEnabled bool `json:"lldpmed_enabled,omitempty"`
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled,omitempty"`
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-6]
MulticastRouterNetworkIDs []string `json:"multicast_router_networkconf_ids,omitempty"`
NATiveNetworkID string `json:"native_networkconf_id,omitempty"`
Name string `json:"name,omitempty"` // .{0,128}
OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-6]
PortKeepaliveEnabled bool `json:"port_keepalive_enabled,omitempty"`
PortProfileID string `json:"portconf_id,omitempty"` // [\d\w]+
PortSecurityEnabled bool `json:"port_security_enabled,omitempty"`
@@ -312,8 +299,6 @@ type DevicePortOverrides struct {
StpPortMode bool `json:"stp_port_mode,omitempty"`
TaggedVLANMgmt string `json:"tagged_vlan_mgmt,omitempty"` // auto|block_all|custom
VoiceNetworkID string `json:"voice_networkconf_id,omitempty"`
PortPoe *bool `json:"port_poe,omitempty"`
}
func (dst *DevicePortOverrides) UnmarshalJSON(b []byte) error {

View File

@@ -26,7 +26,6 @@ type FirewallRule struct {
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]+
@@ -38,8 +37,6 @@ type FirewallRule struct {
ICMPv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|beyond-scope|communication-prohibited|destination-unreachable|echo-reply|echo-request|failed-policy|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|reject-route|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"`
@@ -54,17 +51,10 @@ type FirewallRule struct {
SrcNetworkID string `json:"src_networkconf_id"` // [\d\w]+|^$
SrcNetworkType 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"`
}
func (dst *FirewallRule) UnmarshalJSON(b []byte) error {

View File

@@ -75,15 +75,18 @@ type Network struct {
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"`
FirewallZoneID string `json:"firewall_zone_id"`
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"`
IGMPForwardUnknownMulticast bool `json:"igmp_forward_unknown_multicast"`
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|^$
IGMPProxyDownstream bool `json:"igmp_proxy_downstream"`
IGMPProxyDownstreamNetworkIDs []string `json:"igmp_proxy_downstream_networkconf_ids,omitempty"`
IGMPProxyFor string `json:"igmp_proxy_for,omitempty"` // all|some|none
IGMPProxyUpstream bool `json:"igmp_proxy_upstream"`
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])$|^$
IGMPQuerierSwitches []NetworkIGMPQuerierSwitches `json:"igmp_querier_switches,omitempty"`
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
@@ -92,7 +95,7 @@ type Network struct {
IPSecEspDhGroup int `json:"ipsec_esp_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
IPSecEspEncryption string `json:"ipsec_esp_encryption,omitempty"` // aes128|aes192|aes256|3des
IPSecEspHash string `json:"ipsec_esp_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
IPSecEspLifetime emptyStringInt `json:"ipsec_esp_lifetime,omitempty"` // ^(?:3[0-9]|[4-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]{2}|86400)$
IPSecEspLifetime string `json:"ipsec_esp_lifetime,omitempty"` // ^(?:3[0-9]|[4-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]{2}|86400)$
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
IPSecIkeEncryption string `json:"ipsec_ike_encryption,omitempty"` // aes128|aes192|aes256|3des
@@ -169,6 +172,7 @@ type Network struct {
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]$|^$
SdwanRemoteSiteID string `json:"sdwan_remote_site_id"`
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
SingleNetworkLan string `json:"single_network_lan,omitempty"`
UidPolicyEnabled bool `json:"uid_policy_enabled"`
@@ -192,7 +196,7 @@ type Network struct {
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
VPNProtocol string `json:"vpn_protocol,omitempty"` // TCP|UDP
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-client|openvpn-server|openvpn-vpn|pptp-client|l2tp-server|pptp-server|uid-server|wireguard-server|wireguard-client
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-client|openvpn-server|openvpn-vpn|pptp-client|l2tp-server|pptp-server|sdwan-hub-spoke-tunnel|sdwan-mesh-tunnel|uid-server|wireguard-server|wireguard-client
VrrpIPSubnetGw1 string `json:"vrrp_ip_subnet_gw1,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)$
VrrpIPSubnetGw2 string `json:"vrrp_ip_subnet_gw2,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)$
VrrpVrid int `json:"vrrp_vrid,omitempty"` // [1-9]|[1-9][0-9]
@@ -338,6 +342,27 @@ func (dst *Network) UnmarshalJSON(b []byte) error {
return nil
}
type NetworkIGMPQuerierSwitches struct {
QuerierAddress string `json:"querier_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])$|^$
SwitchMAC string `json:"switch_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
}
func (dst *NetworkIGMPQuerierSwitches) UnmarshalJSON(b []byte) error {
type Alias NetworkIGMPQuerierSwitches
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
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])$|^$
IPAddressPool []string `json:"ip_address_pool,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])$

View File

@@ -37,6 +37,7 @@ type PortProfile struct {
Isolation bool `json:"isolation"`
LldpmedEnabled bool `json:"lldpmed_enabled"`
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
MulticastRouterNetworkIDs []string `json:"multicast_router_networkconf_ids,omitempty"`
NATiveNetworkID string `json:"native_networkconf_id"`
Name string `json:"name,omitempty"`
OpMode string `json:"op_mode,omitempty"` // switch

View File

@@ -31,10 +31,17 @@ type RADIUSProfile struct {
InterimUpdateEnabled bool `json:"interim_update_enabled"`
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
Name string `json:"name,omitempty"` // .{1,128}
TlsEnabled bool `json:"tls_enabled"`
UseUsgAcctServer bool `json:"use_usg_acct_server"`
UseUsgAuthServer bool `json:"use_usg_auth_server"`
VLANEnabled bool `json:"vlan_enabled"`
VLANWLANMode string `json:"vlan_wlan_mode,omitempty"` // disabled|optional|required
XCaCrts []RADIUSProfileXCaCrts `json:"x_ca_crts,omitempty"`
XClientCrt string `json:"x_client_crt,omitempty"`
XClientCrtFilename string `json:"x_client_crt_filename,omitempty"`
XClientPrivateKey string `json:"x_client_private_key,omitempty"`
XClientPrivateKeyFilename string `json:"x_client_private_key_filename,omitempty"`
XClientPrivateKeyPassword string `json:"x_client_private_key_password,omitempty"`
}
func (dst *RADIUSProfile) UnmarshalJSON(b []byte) error {
@@ -106,6 +113,27 @@ func (dst *RADIUSProfileAuthServers) UnmarshalJSON(b []byte) error {
return nil
}
type RADIUSProfileXCaCrts struct {
Filename string `json:"filename,omitempty"`
XCaCrt string `json:"x_ca_crt,omitempty"`
}
func (dst *RADIUSProfileXCaCrts) UnmarshalJSON(b []byte) error {
type Alias RADIUSProfileXCaCrts
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
func (c *Client) listRADIUSProfile(ctx context.Context, site string) ([]RADIUSProfile, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -27,7 +27,7 @@ type SettingDashboard struct {
Key string `json:"key"`
LayoutPreference string `json:"layout_preference,omitempty"` // auto|custom
LayoutPreference string `json:"layout_preference,omitempty"` // auto|manual
Widgets []SettingDashboardWidgets `json:"widgets,omitempty"`
}
@@ -48,7 +48,8 @@ func (dst *SettingDashboard) UnmarshalJSON(b []byte) error {
}
type SettingDashboardWidgets struct {
Name string `json:"name,omitempty"` // traffic_identification|connection_types|wifi_technology|most_active_clients|most_active_aps|meshing|network_activity|wireless_experience|internet|wifi_activity|wifi_channels|wifi_client_experience|wifi_tx_retries|admin_activity|device_client_count|server_ip
Enabled bool `json:"enabled"`
Name string `json:"name,omitempty"` // cybersecure|traffic_identification|wifi_technology|wifi_channels|wifi_client_experience|wifi_tx_retries|most_active_apps_aps_clients|most_active_apps_clients|most_active_aps_clients|most_active_apps_aps|most_active_apps|v2_most_active_aps|v2_most_active_clients|wifi_connectivity|ap_radio_density
}
func (dst *SettingDashboardWidgets) UnmarshalJSON(b []byte) error {

View File

@@ -27,8 +27,9 @@ type SettingDoh struct {
Key string `json:"key"`
CustomServers []SettingDohCustomServers `json:"custom_servers,omitempty"`
ServerNames []string `json:"server_names,omitempty"`
State string `json:"state,omitempty"` // off|auto|manual
State string `json:"state,omitempty"` // off|auto|manual|custom
}
func (dst *SettingDoh) UnmarshalJSON(b []byte) error {
@@ -47,6 +48,28 @@ func (dst *SettingDoh) UnmarshalJSON(b []byte) error {
return nil
}
type SettingDohCustomServers struct {
Enabled bool `json:"enabled"`
SdnsStamp string `json:"sdns_stamp,omitempty"`
ServerName string `json:"server_name,omitempty"`
}
func (dst *SettingDohCustomServers) UnmarshalJSON(b []byte) error {
type Alias SettingDohCustomServers
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
func (c *Client) getSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -29,16 +29,15 @@ type SettingIps struct {
AdBlockingConfigurations []SettingIpsAdBlockingConfigurations `json:"ad_blocking_configurations,omitempty"`
AdBlockingEnabled bool `json:"ad_blocking_enabled"`
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |auto|manual|disabled
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |manual|disabled
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|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada
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-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada|dark-web-blocker-list|malicious-hosts
EnabledNetworks []string `json:"enabled_networks,omitempty"`
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
HoneypotEnabled bool `json:"honeypot_enabled"`
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
RestrictIPAddresses bool `json:"restrict_ip_addresses"`
RestrictTor bool `json:"restrict_tor"`
MemoryOptimized bool `json:"memory_optimized"`
RestrictTorrents bool `json:"restrict_torrents"`
Suppression SettingIpsSuppression `json:"suppression,omitempty"`
}

110
unifi/setting_netflow.generated.go generated Normal file
View File

@@ -0,0 +1,110 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
"encoding/json"
"fmt"
)
// just to fix compile issues with the import
var (
_ context.Context
_ fmt.Formatter
_ json.Marshaler
)
type SettingNetflow 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"`
Key string `json:"key"`
AutoEngineIDEnabled bool `json:"auto_engine_id_enabled"`
Enabled bool `json:"enabled"`
EngineID int `json:"engine_id,omitempty"` // ^$|[1-9][0-9]*
ExportFrequency int `json:"export_frequency,omitempty"`
NetworkIDs []string `json:"network_ids,omitempty"`
Port int `json:"port,omitempty"` // 102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{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]
RefreshRate int `json:"refresh_rate,omitempty"`
SamplingMode string `json:"sampling_mode,omitempty"` // off|hash|random|deterministic
SamplingRate int `json:"sampling_rate,omitempty"` // [2-9]|[1-9][0-9]{1,3}|1[0-5][0-9]{3}|16[0-2][0-9]{2}|163[0-7][0-9]|1638[0-3]|^$
Server string `json:"server,omitempty"` // .{0,252}[^\.]$
Version int `json:"version,omitempty"` // 5|9|10
}
func (dst *SettingNetflow) UnmarshalJSON(b []byte) error {
type Alias SettingNetflow
aux := &struct {
EngineID emptyStringInt `json:"engine_id"`
ExportFrequency emptyStringInt `json:"export_frequency"`
Port emptyStringInt `json:"port"`
RefreshRate emptyStringInt `json:"refresh_rate"`
SamplingRate emptyStringInt `json:"sampling_rate"`
Version emptyStringInt `json:"version"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.EngineID = int(aux.EngineID)
dst.ExportFrequency = int(aux.ExportFrequency)
dst.Port = int(aux.Port)
dst.RefreshRate = int(aux.RefreshRate)
dst.SamplingRate = int(aux.SamplingRate)
dst.Version = int(aux.Version)
return nil
}
func (c *Client) getSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []SettingNetflow `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/netflow", site), 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) updateSettingNetflow(ctx context.Context, site string, d *SettingNetflow) (*SettingNetflow, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []SettingNetflow `json:"data"`
}
d.Key = "netflow"
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/netflow", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

16
unifi/setting_netflow.go Normal file
View File

@@ -0,0 +1,16 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
)
func (c *Client) GetSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
return c.getSettingNetflow(ctx, site)
}
func (c *Client) UpdateSettingNetflow(ctx context.Context, site string, d *SettingNetflow) (*SettingNetflow, error) {
return c.updateSettingNetflow(ctx, site, d)
}

View File

@@ -29,6 +29,7 @@ type SettingRadioAi struct {
AutoAdjustChannelsToCountry bool `json:"auto_adjust_channels_to_country"`
Channels6E []int `json:"channels_6e,omitempty"` // [1-9]|[1-2][0-9]|3[3-9]|[4-5][0-9]|6[0-1]|6[5-9]|[7-8][0-9]|9[0-3]|9[7-9]|1[0-1][0-9]|12[0-5]|129|1[3-4][0-9]|15[0-7]|16[1-9]|1[7-8][0-9]|19[3-9]|2[0-1][0-9]|22[0-1]|22[5-9]|233
ChannelsBlacklist []SettingRadioAiChannelsBlacklist `json:"channels_blacklist,omitempty"`
ChannelsNa []int `json:"channels_na,omitempty"` // 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|169
ChannelsNg []int `json:"channels_ng,omitempty"` // 1|2|3|4|5|6|7|8|9|10|11|12|13|14
CronExpr string `json:"cron_expr,omitempty"`
@@ -85,6 +86,33 @@ func (dst *SettingRadioAi) UnmarshalJSON(b []byte) error {
return nil
}
type SettingRadioAiChannelsBlacklist struct {
Channel int `json:"channel,omitempty"` // [1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9]|2[0-1][0-9]|22[0-1]|22[5-9]|233
ChannelWidth int `json:"channel_width,omitempty"` // 20|40|80|160|240|320
Radio string `json:"radio,omitempty"` // na|ng|6e
}
func (dst *SettingRadioAiChannelsBlacklist) UnmarshalJSON(b []byte) error {
type Alias SettingRadioAiChannelsBlacklist
aux := &struct {
Channel emptyStringInt `json:"channel"`
ChannelWidth emptyStringInt `json:"channel_width"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.Channel = int(aux.Channel)
dst.ChannelWidth = int(aux.ChannelWidth)
return nil
}
func (c *Client) getSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -27,9 +27,11 @@ type SettingRsyslogd struct {
Key string `json:"key"`
Contents []string `json:"contents,omitempty"` // device|client|firewall_default_policy|triggers|updates|admin_activity|critical|security_detections|vpn
Debug bool `json:"debug"`
Enabled bool `json:"enabled"`
IP string `json:"ip,omitempty"`
LogAllContents bool `json:"log_all_contents"`
NetconsoleEnabled bool `json:"netconsole_enabled"`
NetconsoleHost string `json:"netconsole_host,omitempty"`
NetconsolePort int `json:"netconsole_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]

View File

@@ -41,11 +41,9 @@ type SettingUsg struct {
DHCPRelayServer3 string `json:"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])$|^$
DHCPRelayServer4 string `json:"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])$|^$
DHCPRelayServer5 string `json:"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])$|^$
DNSVerification SettingUsgDNSVerification `json:"dns_verification,omitempty"`
DNSmasqAllServers bool `json:"dnsmasq_all_servers"`
EchoServer string `json:"echo_server,omitempty"` // [^\"\' ]{1,255}
FirewallGuestDefaultLog bool `json:"firewall_guest_default_log"`
FirewallLanDefaultLog bool `json:"firewall_lan_default_log"`
FirewallWANDefaultLog bool `json:"firewall_wan_default_log"`
FtpModule bool `json:"ftp_module"`
GeoIPFilteringBlock string `json:"geo_ip_filtering_block,omitempty"` // block|allow
GeoIPFilteringCountries string `json:"geo_ip_filtering_countries,omitempty"` // ^([A-Z]{2})?(,[A-Z]{2}){0,149}$
@@ -79,6 +77,7 @@ type SettingUsg struct {
TimeoutSettingPreference string `json:"timeout_setting_preference,omitempty"` // auto|manual
UDPOtherTimeout int `json:"udp_other_timeout,omitempty"`
UDPStreamTimeout int `json:"udp_stream_timeout,omitempty"`
UnbindWANMonitors bool `json:"unbind_wan_monitors"`
UpnpEnabled bool `json:"upnp_enabled"`
UpnpNATPmpEnabled bool `json:"upnp_nat_pmp_enabled"`
UpnpSecureMode bool `json:"upnp_secure_mode"`
@@ -136,6 +135,29 @@ func (dst *SettingUsg) UnmarshalJSON(b []byte) error {
return nil
}
type SettingUsgDNSVerification struct {
Domain string `json:"domain,omitempty"`
PrimaryDNSServer string `json:"primary_dns_server,omitempty"`
SecondaryDNSServer string `json:"secondary_dns_server,omitempty"`
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
}
func (dst *SettingUsgDNSVerification) UnmarshalJSON(b []byte) error {
type Alias SettingUsgDNSVerification
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
func (c *Client) getSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -2,4 +2,4 @@
package unifi
const UnifiVersion = "8.3.32"
const UnifiVersion = "9.0.114"

230
unifi/wlan.generated.go generated
View File

@@ -41,11 +41,12 @@ type WLAN struct {
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"`
EnhancedIot bool `json:"enhanced_iot"`
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"`
Hotspot2 WLANHotspot2 `json:"hotspot2,omitempty"`
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"`
@@ -65,6 +66,8 @@ type WLAN struct {
Name string `json:"name,omitempty"` // .{1,32}
NameCombineEnabled bool `json:"name_combine_enabled"`
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
NasIDentifier string `json:"nas_identifier,omitempty"` // .{0,48}
NasIDentifierType string `json:"nas_identifier_type,omitempty"` // ap_name|ap_mac|bssid|site_name|custom
NetworkID string `json:"networkconf_id"`
No2GhzOui bool `json:"no2ghz_oui"`
OptimizeIotWifiConnectivity bool `json:"optimize_iot_wifi_connectivity"`
@@ -160,6 +163,188 @@ func (dst *WLAN) UnmarshalJSON(b []byte) error {
return nil
}
type WLANCapab struct {
Port int `json:"port,omitempty"` // ^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|$
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp|esp
Status string `json:"status,omitempty"` // closed|open|unknown
}
func (dst *WLANCapab) UnmarshalJSON(b []byte) error {
type Alias WLANCapab
aux := &struct {
Port emptyStringInt `json:"port"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.Port = int(aux.Port)
return nil
}
type WLANCellularNetworkList struct {
CountryCode int `json:"country_code,omitempty"` // [1-9]{1}[0-9]{0,3}
Mcc int `json:"mcc,omitempty"`
Mnc int `json:"mnc,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
}
func (dst *WLANCellularNetworkList) UnmarshalJSON(b []byte) error {
type Alias WLANCellularNetworkList
aux := &struct {
CountryCode emptyStringInt `json:"country_code"`
Mcc emptyStringInt `json:"mcc"`
Mnc emptyStringInt `json:"mnc"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.CountryCode = int(aux.CountryCode)
dst.Mcc = int(aux.Mcc)
dst.Mnc = int(aux.Mnc)
return nil
}
type WLANFriendlyName struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
}
func (dst *WLANFriendlyName) UnmarshalJSON(b []byte) error {
type Alias WLANFriendlyName
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
type WLANHotspot2 struct {
Capab []WLANCapab `json:"capab,omitempty"`
CellularNetworkList []WLANCellularNetworkList `json:"cellular_network_list,omitempty"`
DomainNameList []string `json:"domain_name_list,omitempty"` // .{1,128}
FriendlyName []WLANFriendlyName `json:"friendly_name,omitempty"`
IPaddrTypeAvailV4 int `json:"ipaddr_type_avail_v4,omitempty"` // 0|1|2|3|4|5|6|7
IPaddrTypeAvailV6 int `json:"ipaddr_type_avail_v6,omitempty"` // 0|1|2
MetricsDownlinkLoad int `json:"metrics_downlink_load,omitempty"`
MetricsDownlinkLoadSet bool `json:"metrics_downlink_load_set"`
MetricsDownlinkSpeed int `json:"metrics_downlink_speed,omitempty"`
MetricsDownlinkSpeedSet bool `json:"metrics_downlink_speed_set"`
MetricsInfoAtCapacity bool `json:"metrics_info_at_capacity"`
MetricsInfoLinkStatus string `json:"metrics_info_link_status,omitempty"` // up|down|test
MetricsInfoSymmetric bool `json:"metrics_info_symmetric"`
MetricsMeasurement int `json:"metrics_measurement,omitempty"`
MetricsMeasurementSet bool `json:"metrics_measurement_set"`
MetricsStatus bool `json:"metrics_status"`
MetricsUplinkLoad int `json:"metrics_uplink_load,omitempty"`
MetricsUplinkLoadSet bool `json:"metrics_uplink_load_set"`
MetricsUplinkSpeed int `json:"metrics_uplink_speed,omitempty"`
MetricsUplinkSpeedSet bool `json:"metrics_uplink_speed_set"`
NaiRealmList []WLANNaiRealmList `json:"nai_realm_list,omitempty"`
NetworkType int `json:"network_type,omitempty"` // 0|1|2|3|4|5|14|15
RoamingConsortiumList []WLANRoamingConsortiumList `json:"roaming_consortium_list,omitempty"`
VenueGroup int `json:"venue_group,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11
VenueName []WLANVenueName `json:"venue_name,omitempty"`
VenueType int `json:"venue_type,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
}
func (dst *WLANHotspot2) UnmarshalJSON(b []byte) error {
type Alias WLANHotspot2
aux := &struct {
IPaddrTypeAvailV4 emptyStringInt `json:"ipaddr_type_avail_v4"`
IPaddrTypeAvailV6 emptyStringInt `json:"ipaddr_type_avail_v6"`
MetricsDownlinkLoad emptyStringInt `json:"metrics_downlink_load"`
MetricsDownlinkSpeed emptyStringInt `json:"metrics_downlink_speed"`
MetricsMeasurement emptyStringInt `json:"metrics_measurement"`
MetricsUplinkLoad emptyStringInt `json:"metrics_uplink_load"`
MetricsUplinkSpeed emptyStringInt `json:"metrics_uplink_speed"`
NetworkType emptyStringInt `json:"network_type"`
VenueGroup emptyStringInt `json:"venue_group"`
VenueType emptyStringInt `json:"venue_type"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.IPaddrTypeAvailV4 = int(aux.IPaddrTypeAvailV4)
dst.IPaddrTypeAvailV6 = int(aux.IPaddrTypeAvailV6)
dst.MetricsDownlinkLoad = int(aux.MetricsDownlinkLoad)
dst.MetricsDownlinkSpeed = int(aux.MetricsDownlinkSpeed)
dst.MetricsMeasurement = int(aux.MetricsMeasurement)
dst.MetricsUplinkLoad = int(aux.MetricsUplinkLoad)
dst.MetricsUplinkSpeed = int(aux.MetricsUplinkSpeed)
dst.NetworkType = int(aux.NetworkType)
dst.VenueGroup = int(aux.VenueGroup)
dst.VenueType = int(aux.VenueType)
return nil
}
type WLANNaiRealmList struct {
AuthIDs []int `json:"auth_ids,omitempty"` // 0|1|2|3|4|5
AuthVals []int `json:"auth_vals,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10
EapMethod int `json:"eap_method,omitempty"` // 13|21|18|23|50
Encoding int `json:"encoding,omitempty"` // 0|1
Name string `json:"name,omitempty"` // .{1,128}
Status bool `json:"status"`
}
func (dst *WLANNaiRealmList) UnmarshalJSON(b []byte) error {
type Alias WLANNaiRealmList
aux := &struct {
AuthIDs []emptyStringInt `json:"auth_ids"`
AuthVals []emptyStringInt `json:"auth_vals"`
EapMethod emptyStringInt `json:"eap_method"`
Encoding emptyStringInt `json:"encoding"`
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.AuthIDs = make([]int, len(aux.AuthIDs))
for i, v := range aux.AuthIDs {
dst.AuthIDs[i] = int(v)
}
dst.AuthVals = make([]int, len(aux.AuthVals))
for i, v := range aux.AuthVals {
dst.AuthVals[i] = int(v)
}
dst.EapMethod = int(aux.EapMethod)
dst.Encoding = int(aux.Encoding)
return nil
}
type WLANPrivatePresharedKeys struct {
NetworkID string `json:"networkconf_id"`
Password string `json:"password,omitempty"` // [\x20-\x7E]{8,255}
@@ -181,6 +366,27 @@ func (dst *WLANPrivatePresharedKeys) UnmarshalJSON(b []byte) error {
return nil
}
type WLANRoamingConsortiumList struct {
Name string `json:"name,omitempty"` // .{1,128}
Oid string `json:"oid,omitempty"` // .{1,128}
}
func (dst *WLANRoamingConsortiumList) UnmarshalJSON(b []byte) error {
type Alias WLANRoamingConsortiumList
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
type WLANSaePsk struct {
ID string `json:"id"` // .{0,128}
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
@@ -238,6 +444,28 @@ func (dst *WLANScheduleWithDuration) UnmarshalJSON(b []byte) error {
return nil
}
type WLANVenueName struct {
Language string `json:"language,omitempty"` // [a-z]{0,3}
Name string `json:"name,omitempty"`
Url string `json:"url,omitempty"`
}
func (dst *WLANVenueName) UnmarshalJSON(b []byte) error {
type Alias WLANVenueName
aux := &struct {
*Alias
}{
Alias: (*Alias)(dst),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
return nil
}
func (c *Client) listWLAN(ctx context.Context, site string) ([]WLAN, error) {
var respBody struct {
Meta meta `json:"meta"`