Regenerated types so that sub-types are not embedded.

This allows callers to create complex payloads; for example, to create a
Device type for a Unifi Switch with PortOverrides, the caller needs to
create these sub-types, which is not possible when it's purely embedded.
This commit is contained in:
James Stephenson
2020-09-02 17:35:14 -04:00
committed by Paul Tyng
parent 35eda4f67b
commit bee58f48d4
8 changed files with 420 additions and 349 deletions

View File

@@ -23,22 +23,32 @@ type ChannelPlan struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
ApBlacklistedChannels []struct {
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
} `json:"ap_blacklisted_channels,omitempty"`
ApBlacklistedChannels []ChannelPlan_ApBlacklistedChannels `json:"ap_blacklisted_channels,omitempty"`
ConfSource string `json:"conf_source,omitempty"` // manual|radio-ai
Coupling []struct {
Rssi int `json:"rssi,omitempty"`
Source string `json:"source,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
Target string `json:"target,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
} `json:"coupling,omitempty"`
Coupling []ChannelPlan_Coupling `json:"coupling,omitempty"`
Date string `json:"date"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$
Fitness float64 `json:"fitness,omitempty"`
Note string `json:"note,omitempty"` // .{0,1024}
Radio string `json:"radio,omitempty"` // na|ng|ng\+na
RadioTable []struct {
RadioTable []ChannelPlan_RadioTable `json:"radio_table,omitempty"`
Satisfaction float64 `json:"satisfaction,omitempty"`
SatisfactionTable []ChannelPlan_SatisfactionTable `json:"satisfaction_table,omitempty"`
SiteBlacklistedChannels []ChannelPlan_SiteBlacklistedChannels `json:"site_blacklisted_channels,omitempty"`
}
type ChannelPlan_ApBlacklistedChannels struct {
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
}
type ChannelPlan_Coupling struct {
Rssi int `json:"rssi,omitempty"`
Source string `json:"source,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
Target string `json:"target,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
}
type ChannelPlan_RadioTable struct {
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
DeviceMAC string `json:"device_mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
@@ -46,16 +56,16 @@ type ChannelPlan struct {
TxPower string `json:"tx_power,omitempty"` // [\d]+|auto
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
Width int `json:"width,omitempty"` // 20|40|80|160
} `json:"radio_table,omitempty"`
Satisfaction float64 `json:"satisfaction,omitempty"`
SatisfactionTable []struct {
}
type ChannelPlan_SatisfactionTable struct {
DeviceMAC string `json:"device_mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Satisfaction float64 `json:"satisfaction,omitempty"`
} `json:"satisfaction_table,omitempty"`
SiteBlacklistedChannels []struct {
}
type ChannelPlan_SiteBlacklistedChannels struct {
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
} `json:"site_blacklisted_channels,omitempty"`
}
func (c *Client) listChannelPlan(ctx context.Context, site string) ([]ChannelPlan, error) {

View File

@@ -26,13 +26,15 @@ type Dashboard struct {
ControllerVersion string `json:"controller_version,omitempty"`
Desc string `json:"desc,omitempty"`
IsPublic bool `json:"is_public"`
Modules []struct {
Modules []Dashboard_Modules `json:"modules,omitempty"`
Name string `json:"name,omitempty"`
}
type Dashboard_Modules struct {
Config string `json:"config,omitempty"`
ID string `json:"id"`
ModuleID string `json:"module_id"`
Restrictions string `json:"restrictions,omitempty"`
} `json:"modules,omitempty"`
Name string `json:"name,omitempty"`
}
func (c *Client) listDashboard(ctx context.Context, site string) ([]Dashboard, error) {

View File

@@ -28,24 +28,12 @@ type Device struct {
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 struct {
BondingEnabled bool `json:"bonding_enabled,omitempty"`
DNS1 string `json:"dns1,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-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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5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
DNSsuffix string `json:"dnssuffix,omitempty"`
Gateway string `json:"gateway,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])$|^$
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Netmask string `json:"netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
Type string `json:"type,omitempty"` // dhcp|static
} `json:"config_network,omitempty"`
ConfigNetwork Device_ConfigNetwork `json:"config_network,omitempty"`
DPIEnabled bool `json:"dpi_enabled,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id,omitempty"` // [\d\w]+|
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled,omitempty"`
EthernetOverrides []struct {
Ifname string `json:"ifname,omitempty"` // eth[0-9]{1,2}
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?|WAN[2]?
} `json:"ethernet_overrides,omitempty"`
EthernetOverrides []Device_EthernetOverrides `json:"ethernet_overrides,omitempty"`
FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"`
HeightInMeters float64 `json:"heightInMeters,omitempty"`
JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"`
@@ -68,11 +56,49 @@ type Device struct {
Name string `json:"name,omitempty"` // .{1,128}
OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off
OutletCycleEnabled bool `json:"outlet_cycle_enabled,omitempty"`
OutletOverrides []struct {
OutletOverrides []Device_OutletOverrides `json:"outlet_overrides,omitempty"`
PortOverrides []Device_PortOverrides `json:"port_overrides,omitempty"`
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
RadioTable []Device_RadioTable `json:"radio_table,omitempty"`
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
RpsOverride Device_RpsOverride `json:"rps_override,omitempty"`
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
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"`
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
WLANOverrides []Device_WLANOverrides `json:"wlan_overrides,omitempty"`
X int `json:"x,omitempty"`
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
Y int `json:"y,omitempty"`
}
type Device_ConfigNetwork struct {
BondingEnabled bool `json:"bonding_enabled,omitempty"`
DNS1 string `json:"dns1,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-9a-fA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F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
DNSsuffix string `json:"dnssuffix,omitempty"`
Gateway string `json:"gateway,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])$|^$
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Netmask string `json:"netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
Type string `json:"type,omitempty"` // dhcp|static
}
type Device_EthernetOverrides struct {
Ifname string `json:"ifname,omitempty"` // eth[0-9]{1,2}
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?|WAN[2]?
}
type Device_OutletOverrides struct {
Index int `json:"index,omitempty"`
RelayState bool `json:"relay_state,omitempty"`
} `json:"outlet_overrides,omitempty"`
PortOverrides []struct {
}
type Device_PortOverrides struct {
AggregateNumPorts int `json:"aggregate_num_ports,omitempty"` // [2-6]
Autoneg bool `json:"autoneg,omitempty"`
Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host
@@ -106,11 +132,9 @@ type Device struct {
StormctrlUcastLevel int `json:"stormctrl_ucast_level,omitempty"` // [0-9]|[1-9][0-9]|100
StormctrlUcastRate int `json:"stormctrl_ucast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
StpPortMode bool `json:"stp_port_mode,omitempty"`
} `json:"port_overrides,omitempty"`
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
RadioTable []struct {
}
type Device_RadioTable struct {
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
@@ -127,24 +151,20 @@ type Device struct {
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]+
} `json:"radio_table,omitempty"`
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
RpsOverride struct {
}
type Device_RpsOverride struct {
PowerManagementMode string `json:"power_management_mode,omitempty"` // dynamic|static
RpsPortTable []struct {
RpsPortTable []Device_RpsPortTable `json:"rps_port_table,omitempty"`
}
type Device_RpsPortTable struct {
Name string `json:"name,omitempty"` // .{0,32}
PortIDX int `json:"port_idx,omitempty"` // [1-6]
PortMode string `json:"port_mode,omitempty"` // auto|force_active|manual|disabled
} `json:"rps_port_table,omitempty"`
} `json:"rps_override,omitempty"`
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
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"`
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
WLANOverrides []struct {
}
type Device_WLANOverrides struct {
Enabled bool `json:"enabled,omitempty"`
Name string `json:"name,omitempty"` // .{1,32}
NameCombineEnabled bool `json:"name_combine_enabled,omitempty"`
@@ -155,10 +175,6 @@ type Device struct {
VLANEnabled bool `json:"vlan_enabled,omitempty"`
WLANID string `json:"wlan_id,omitempty"` // [\d\w]+
XPassphrase string `json:"x_passphrase,omitempty"` // [\x20-\x7E]{8,63}|[0-9a-fA-F]{64}
} `json:"wlan_overrides,omitempty"`
X int `json:"x,omitempty"`
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
Y int `json:"y,omitempty"`
}
func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error) {

View File

@@ -24,26 +24,71 @@ type Hotspot2Conf struct {
NoEdit bool `json:"attr_no_edit,omitempty"`
ApIsolate bool `json:"ap_isolate"`
Capab []struct {
Port string `json:"port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp
Status string `json:"status,omitempty"` // closed|open|unknown
} `json:"capab,omitempty"`
CellularNetworkList []struct {
Mcc int `json:"mcc,omitempty"`
Mnc int `json:"mnc,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
} `json:"cellular_network_list,omitempty"`
Capab []Hotspot2Conf_Capab `json:"capab,omitempty"`
CellularNetworkList []Hotspot2Conf_CellularNetworkList `json:"cellular_network_list,omitempty"`
DeauthReqTimeout int `json:"deauth_req_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
DisableDgaf bool `json:"disable_dgaf"`
DomainNameList []string `json:"domain_name_list,omitempty"` // .{1,128}
FriendlyName []struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
} `json:"friendly_name,omitempty"`
FriendlyName []Hotspot2Conf_FriendlyName `json:"friendly_name,omitempty"`
GasComebackDelay int `json:"gas_comeback_delay,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|300
Hessid string `json:"hessid"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
Icons []struct {
Icons []Hotspot2Conf_Icons `json:"icons,omitempty"`
MetricsDownlinkLoad int `json:"metrics_downlink_load,omitempty"`
MetricsDownlinkSpeed int `json:"metrics_downlink_speed,omitempty"`
MetricsInfo string `json:"metrics_info,omitempty"` // [0-9A-Fa-f]{1,2}
MetricsMeasurement int `json:"metrics_measurement,omitempty"`
MetricsStatus bool `json:"metrics_status"`
MetricsUplinkLoad int `json:"metrics_uplink_load,omitempty"`
MetricsUplinkSpeed int `json:"metrics_uplink_speed,omitempty"`
NaiRealmList []Hotspot2Conf_NaiRealmList `json:"nai_realm_list,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
NetworkAccessAsra bool `json:"network_access_asra"`
NetworkAccessEsr bool `json:"network_access_esr"`
NetworkAccessInternet bool `json:"network_access_internet"`
NetworkAccessUesa bool `json:"network_access_uesa"`
NetworkType int `json:"network_type,omitempty"` // 0|1|2|3|4|5|14|15
Osu []Hotspot2Conf_Osu `json:"osu,omitempty"`
OsuSSID string `json:"osu_ssid"`
P2P bool `json:"p2p"`
ProxyArp bool `json:"proxy_arp"`
QOSMapDcsp []Hotspot2Conf_QOSMapDcsp `json:"qos_map_dcsp,omitempty"`
QOSMapExceptions []Hotspot2Conf_QOSMapExceptions `json:"qos_map_exceptions,omitempty"`
QOSMapStatus bool `json:"qos_map_status"`
RoamingConsortiumList []Hotspot2Conf_RoamingConsortiumList `json:"roaming_consortium_list,omitempty"`
TCFilename string `json:"t_c_filename,omitempty"` // .{1,256}
TCTimestamp int `json:"t_c_timestamp,omitempty"`
VenueGroup int `json:"venue_group,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11
VenueName []Hotspot2Conf_VenueName `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
}
type Hotspot2Conf_Capab struct {
Port string `json:"port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp
Status string `json:"status,omitempty"` // closed|open|unknown
}
type Hotspot2Conf_CellularNetworkList struct {
Mcc int `json:"mcc,omitempty"`
Mnc int `json:"mnc,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
}
type Hotspot2Conf_Description struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
}
type Hotspot2Conf_FriendlyName struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
}
type Hotspot2Conf_Icon struct {
Name string `json:"name,omitempty"` // .{1,128}
}
type Hotspot2Conf_Icons struct {
Data string `json:"data,omitempty"`
Filename string `json:"filename,omitempty"` // .{1,256}
Height int `json:"height,omitempty"`
@@ -52,71 +97,47 @@ type Hotspot2Conf struct {
Name string `json:"name,omitempty"` // .{1,256}
Size int `json:"size,omitempty"`
Width int `json:"width,omitempty"`
} `json:"icons,omitempty"`
MetricsDownlinkLoad int `json:"metrics_downlink_load,omitempty"`
MetricsDownlinkSpeed int `json:"metrics_downlink_speed,omitempty"`
MetricsInfo string `json:"metrics_info,omitempty"` // [0-9A-Fa-f]{1,2}
MetricsMeasurement int `json:"metrics_measurement,omitempty"`
MetricsStatus bool `json:"metrics_status"`
MetricsUplinkLoad int `json:"metrics_uplink_load,omitempty"`
MetricsUplinkSpeed int `json:"metrics_uplink_speed,omitempty"`
NaiRealmList []struct {
}
type Hotspot2Conf_NaiRealmList struct {
AuthIDs string `json:"auth_ids,omitempty"`
AuthVals string `json:"auth_vals,omitempty"`
EapMethod int `json:"eap_method,omitempty"` // 13|21|18|23|50
Encoding int `json:"encoding,omitempty"` // 0|1
Name string `json:"name,omitempty"` // .{1,128}
Status bool `json:"status"`
} `json:"nai_realm_list,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
NetworkAccessAsra bool `json:"network_access_asra"`
NetworkAccessEsr bool `json:"network_access_esr"`
NetworkAccessInternet bool `json:"network_access_internet"`
NetworkAccessUesa bool `json:"network_access_uesa"`
NetworkType int `json:"network_type,omitempty"` // 0|1|2|3|4|5|14|15
Osu []struct {
Description []struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
} `json:"description,omitempty"`
FriendlyName []struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Text string `json:"text,omitempty"` // .{1,128}
} `json:"friendly_name,omitempty"`
Icon []struct {
Name string `json:"name,omitempty"` // .{1,128}
} `json:"icon,omitempty"`
}
type Hotspot2Conf_Osu struct {
Description []Hotspot2Conf_Description `json:"description,omitempty"`
FriendlyName []Hotspot2Conf_FriendlyName `json:"friendly_name,omitempty"`
Icon []Hotspot2Conf_Icon `json:"icon,omitempty"`
MethodOmaDm bool `json:"method_oma_dm"`
MethodSoapXmlSpp bool `json:"method_soap_xml_spp"`
Nai string `json:"nai,omitempty"`
Nai2 string `json:"nai2,omitempty"`
OperatingClass string `json:"operating_class,omitempty"` // [0-9A-Fa-f]{12}
ServerUri string `json:"server_uri,omitempty"`
} `json:"osu,omitempty"`
OsuSSID string `json:"osu_ssid"`
P2P bool `json:"p2p"`
ProxyArp bool `json:"proxy_arp"`
QOSMapDcsp []struct {
}
type Hotspot2Conf_QOSMapDcsp struct {
High int `json:"high,omitempty"`
Low int `json:"low,omitempty"`
} `json:"qos_map_dcsp,omitempty"`
QOSMapExceptions []struct {
}
type Hotspot2Conf_QOSMapExceptions struct {
Dcsp int `json:"dcsp,omitempty"`
Up int `json:"up,omitempty"` // [0-7]
} `json:"qos_map_exceptions,omitempty"`
QOSMapStatus bool `json:"qos_map_status"`
RoamingConsortiumList []struct {
}
type Hotspot2Conf_RoamingConsortiumList struct {
Name string `json:"name,omitempty"` // .{1,128}
Oid string `json:"oid,omitempty"` // .{1,128}
} `json:"roaming_consortium_list,omitempty"`
TCFilename string `json:"t_c_filename,omitempty"` // .{1,256}
TCTimestamp int `json:"t_c_timestamp,omitempty"`
VenueGroup int `json:"venue_group,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11
VenueName []struct {
}
type Hotspot2Conf_VenueName struct {
Language string `json:"language,omitempty"` // [a-z]{3}
Name string `json:"name,omitempty"` // .{1,128}
} `json:"venue_name,omitempty"`
VenueType int `json:"venue_type,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
}
func (c *Client) listHotspot2Conf(ctx context.Context, site string) ([]Hotspot2Conf, error) {

View File

@@ -24,16 +24,8 @@ type RADIUSProfile struct {
NoEdit bool `json:"attr_no_edit,omitempty"`
AccountingEnabled bool `json:"accounting_enabled"`
AcctServers []struct {
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
XSecret string `json:"x_secret,omitempty"`
} `json:"acct_servers,omitempty"`
AuthServers []struct {
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
XSecret string `json:"x_secret,omitempty"`
} `json:"auth_servers,omitempty"`
AcctServers []RADIUSProfile_AcctServers `json:"acct_servers,omitempty"`
AuthServers []RADIUSProfile_AuthServers `json:"auth_servers,omitempty"`
InterimUpdateEnabled bool `json:"interim_update_enabled"`
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
Name string `json:"name,omitempty"` // .{1,128}
@@ -43,6 +35,18 @@ type RADIUSProfile struct {
VLANWLANMode string `json:"vlan_wlan_mode,omitempty"` // disabled|optional|required
}
type RADIUSProfile_AcctServers struct {
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
XSecret string `json:"x_secret,omitempty"`
}
type RADIUSProfile_AuthServers struct {
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
Port int `json:"port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$
XSecret string `json:"x_secret,omitempty"`
}
func (c *Client) listRADIUSProfile(ctx context.Context, site string) ([]RADIUSProfile, error) {
var respBody struct {
Meta meta `json:"meta"`

View File

@@ -32,9 +32,11 @@ type ScheduleTask struct {
Name string `json:"name,omitempty"`
SampleFilename string `json:"sample_filename,omitempty"`
StreamType string `json:"stream_type,omitempty"` // media|sample
UpgradeTargets []struct {
UpgradeTargets []ScheduleTask_UpgradeTargets `json:"upgrade_targets,omitempty"`
}
type ScheduleTask_UpgradeTargets struct {
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
} `json:"upgrade_targets,omitempty"`
}
func (c *Client) listScheduleTask(ctx context.Context, site string) ([]ScheduleTask, error) {

View File

@@ -26,42 +26,54 @@ type SettingIps struct {
Key string `json:"key"`
DNSFiltering bool `json:"dns_filtering"`
DNSFilters []struct {
Filter string `json:"filter,omitempty"` // security|adult|family
NetworkID string `json:"network_id"`
Version string `json:"version,omitempty"` // v4|v6
} `json:"dns_filters,omitempty"`
DNSFilters []SettingIps_DNSFilters `json:"dns_filters,omitempty"`
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|spamhaus|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
EndpointScanning bool `json:"endpoint_scanning"`
Honeypot []struct {
IPAddress string `json:"ip_address,omitempty"`
NetworkID string `json:"network_id"`
Version string `json:"version,omitempty"` // v4|v6
} `json:"honeypot,omitempty"`
Honeypot []SettingIps_Honeypot `json:"honeypot,omitempty"`
HoneypotEnabled bool `json:"honeypot_enabled"`
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
RestrictIPAddresses bool `json:"restrict_ip_addresses"`
RestrictTor bool `json:"restrict_tor"`
RestrictTorrents bool `json:"restrict_torrents"`
Suppression struct {
Alerts []struct {
Suppression SettingIps_Suppression `json:"suppression,omitempty"`
}
type SettingIps_Alerts struct {
Category string `json:"category,omitempty"`
Gid int `json:"gid,omitempty"`
ID int `json:"id,omitempty"`
Signature string `json:"signature,omitempty"`
Tracking []struct {
Direction string `json:"direction,omitempty"` // both|src|dest
Mode string `json:"mode,omitempty"` // ip|subnet|network
Value string `json:"value,omitempty"`
} `json:"tracking,omitempty"`
Tracking []SettingIps_Tracking `json:"tracking,omitempty"`
Type string `json:"type,omitempty"` // all|track
} `json:"alerts,omitempty"`
Whitelist []struct {
}
type SettingIps_DNSFilters struct {
Filter string `json:"filter,omitempty"` // security|adult|family
NetworkID string `json:"network_id"`
Version string `json:"version,omitempty"` // v4|v6
}
type SettingIps_Honeypot struct {
IPAddress string `json:"ip_address,omitempty"`
NetworkID string `json:"network_id"`
Version string `json:"version,omitempty"` // v4|v6
}
type SettingIps_Suppression struct {
Alerts []SettingIps_Alerts `json:"alerts,omitempty"`
Whitelist []SettingIps_Whitelist `json:"whitelist,omitempty"`
}
type SettingIps_Tracking struct {
Direction string `json:"direction,omitempty"` // both|src|dest
Mode string `json:"mode,omitempty"` // ip|subnet|network
Value string `json:"value,omitempty"`
}
type SettingIps_Whitelist struct {
Direction string `json:"direction,omitempty"` // both|src|dest
Mode string `json:"mode,omitempty"` // ip|subnet|network
Value string `json:"value,omitempty"`
} `json:"whitelist,omitempty"`
} `json:"suppression,omitempty"`
}
func (c *Client) getSettingIps(ctx context.Context, site string) (*SettingIps, error) {

View File

@@ -23,15 +23,19 @@ type SpatialRecord struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
Devices []struct {
Devices []SpatialRecord_Devices `json:"devices,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
}
type SpatialRecord_Devices struct {
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Position struct {
Position SpatialRecord_Position `json:"position,omitempty"`
}
type SpatialRecord_Position struct {
X float64 `json:"x,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Y float64 `json:"y,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Z float64 `json:"z,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
} `json:"position,omitempty"`
} `json:"devices,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
}
func (c *Client) listSpatialRecord(ctx context.Context, site string) ([]SpatialRecord, error) {