diff --git a/fields/5.14.23/Account.json b/fields/5.14.23/Account.json new file mode 100644 index 0000000..9f104aa --- /dev/null +++ b/fields/5.14.23/Account.json @@ -0,0 +1,9 @@ +{ + "name": "^[^\"' ]+$", + "x_password": "", + "vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$", + "ip":"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", + "tunnel_config_type": "vpn|802.1x|custom", + "tunnel_type": "[1-9]|1[0-3]|^$", + "tunnel_medium_type": "[1-9]|1[0-5]|^$" +} diff --git a/fields/5.14.23/AuthenticationRequest.json b/fields/5.14.23/AuthenticationRequest.json new file mode 100644 index 0000000..8e88f6e --- /dev/null +++ b/fields/5.14.23/AuthenticationRequest.json @@ -0,0 +1,12 @@ +{ + "username": ".{1,256}", + "password": ".{1,256}", + "remember": "true|false", + "strict": "true|false", + "site_name": ".{0,256}", + "sso_token": ".{0,256}", + "for_hotspot": "true|false", + "for_sso": "true|false", + "ubic_2fa_token": ".{0,256}", + "ubic_uuid": ".{0,256}" +} diff --git a/fields/5.14.23/BroadcastGroup.json b/fields/5.14.23/BroadcastGroup.json new file mode 100644 index 0000000..677d265 --- /dev/null +++ b/fields/5.14.23/BroadcastGroup.json @@ -0,0 +1,4 @@ +{ + "name": "", + "member_table": [""] +} diff --git a/fields/5.14.23/ChannelPlan.json b/fields/5.14.23/ChannelPlan.json new file mode 100644 index 0000000..a790643 --- /dev/null +++ b/fields/5.14.23/ChannelPlan.json @@ -0,0 +1,35 @@ +{ + "conf_source": "manual|radio-ai", + "date": "^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$", + "fitness": "^[0-9]+\\.?[0-9]*$", + "note": ".{0,1024}", + "radio": "na|ng|ng\\+na", + "radio_table": [{ + "device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", + "name": "[a-z]*[0-9]*", + "channel": "[0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto", + "backup_channel": "[0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto", + "width": "20|40|80|160", + "tx_power": "[\\d]+|auto", + "tx_power_mode": "auto|medium|high|low|custom" + }], + "satisfaction_table": [{ + "device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", + "satisfaction": "^[0-9]+\\.?[0-9]*$" + }], + "site_blacklisted_channels": [{ + "channel": "36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196", + "timestamp": "[1-9][0-9]{12}" + }], + "ap_blacklisted_channels": [{ + "mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", + "channel": "36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196", + "timestamp": "[1-9][0-9]{12}" + }], + "coupling": [{ + "source": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$", + "target": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$", + "rssi": "-?[0-9]{1,3}" + }], + "satisfaction": "^[0-9]+\\.?[0-9]*$" +} diff --git a/fields/5.14.23/Dashboard.json b/fields/5.14.23/Dashboard.json new file mode 100644 index 0000000..eb5bc1f --- /dev/null +++ b/fields/5.14.23/Dashboard.json @@ -0,0 +1,12 @@ +{ + "name": "", + "desc": "", + "is_public": "true|false", + "controller_version": "", + "modules":[{ + "id": "", + "module_id": "", + "config": "", + "restrictions": "" + }] +} diff --git a/fields/5.14.23/Device.json b/fields/5.14.23/Device.json new file mode 100644 index 0000000..ac5bd9b --- /dev/null +++ b/fields/5.14.23/Device.json @@ -0,0 +1,143 @@ +{ + "name": ".{1,128}", + "x": "", + "y": "", + "heightInMeters": "^([-]?[\\d]+[.]?[\\d]*)$", + "locked": "true|false", + "map_id": "", + "disabled": "true|false", + "led_override": "default|on|off", + "led_override_color": "^#(?:[0-9a-fA-F]{3}){1,2}$", + "led_override_color_brightness": "^[0-9][0-9]?$|^100$", + "outdoor_mode_override": "default|on|off", + "mesh_sta_vap_enabled": "true|false", + "config_network": { + "bonding_enabled": "true|false", + "type": "dhcp|static", + "ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$", + "netmask": "^((128|192|224|240|248|252|254)\\.0\\.0\\.0)|(255\\.(((0|128|192|224|240|248|252|254)\\.0\\.0)|(255\\.(((0|128|192|224|240|248|252|254)\\.0)|255\\.(0|128|192|224|240|248|252|254)))))$", + "gateway": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", + "dns1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$", + "dns2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$", + "dnssuffix": "" + }, + "radio_table": [{ + "radio": "ng|na|ad", + "channel": "[0-9]|[1][0-4]|4.5|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto", + "backup_channel": "[0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto", + "ht": "20|40|80|160|1080|2160", + "tx_power_mode": "auto|medium|high|low|custom", + "tx_power": "[\\d]+|auto", + "min_rssi_enabled": "true|false", + "min_rssi": "^-([1-9]|[1-8][0-9]|9[0-4])$", + "name": "", + "hard_noise_floor_enabled": "true|false", + "sens_level_enabled": "true|false", + "sens_level": "^-([5-8][0-9]|90)$", + "antenna_gain": "^-?([0-9]|[1-9][0-9])", + "antenna_id": "-1|[0-9]", + "wlangroup_id": "[\\d\\w]+", + "vwire_enabled":"true|false" + }], + "wlan_overrides": [{ + "enabled":"true|false", + "name":".{1,32}", + "name_combine_enabled":"true|false", + "name_combine_suffix":".{0,8}", + "vlan":"[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$", + "vlan_enabled":"true|false", + "x_passphrase": "[\\x20-\\x7E]{8,63}|[0-9a-fA-F]{64}", + "wlan_id":"[\\d\\w]+", + "radio":"ng|na", + "radio_name":"" + }], + "outlet_overrides": [{ + "index": "[0-9]{1,2}", + "name":".{0,128}", + "relay_state": "true|false", + "cycle_enabled": "true|false" + }], + "outlet_enabled": "true|false", + "ethernet_overrides": [{ + "ifname": "eth[0-9]{1,2}", + "networkgroup": "LAN[2-8]?|WAN[2]?" + }], + "jumboframe_enabled": "true|false", + "flowctrl_enabled": "true|false", + "stp_version": "stp|rstp|disabled", + "stp_priority": "0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440", + "dot1x_portctrl_enabled": "true|false", + "dot1x_fallback_networkconf_id": "[\\d\\w]+|", + "radiusprofile_id": "", + "atf_enabled": "true|false", + "bandsteering_mode": "off|equal|prefer_5g", + "dpi_enabled": "true|false", + "resetbtn_enabled": "on|off", + "mgmt_network_id": "[\\d\\w]+", + "switch_vlan_enabled": "false|true", + "port_overrides": [{ + "port_idx":"[1-9]|[1-4][0-9]|5[0-2]", + "name":".{0,128}", + "op_mode":"switch|mirror|aggregate", + "autoneg":"true|false", + "speed":"10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000", + "full_duplex":"true|false", + "poe_mode":"auto|pasv24|passthrough|off", + "isolation":"true|false", + "dot1x_ctrl":"auto|force_authorized|force_unauthorized|mac_based|multi_host", + "dot1x_idle_timeout":"[0-9]|[1-9][0-9]{1,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]", + "stormctrl_type": "level|rate", + "stormctrl_ucast_enabled": "true|false", + "stormctrl_ucast_level": "[0-9]|[1-9][0-9]|100", + "stormctrl_ucast_rate": "[0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000", + "stormctrl_mcast_enabled": "true|false", + "stormctrl_mcast_level": "[0-9]|[1-9][0-9]|100", + "stormctrl_mcast_rate": "[0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000", + "stormctrl_bcast_enabled": "true|false", + "stormctrl_bcast_level": "[0-9]|[1-9][0-9]|100", + "stormctrl_bcast_rate": "[0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000", + "priority_queue1_level": "[0-9]|[1-9][0-9]|100", + "priority_queue2_level": "[0-9]|[1-9][0-9]|100", + "priority_queue3_level": "[0-9]|[1-9][0-9]|100", + "priority_queue4_level": "[0-9]|[1-9][0-9]|100", + "portconf_id":"[\\d\\w]+", + "mirror_port_idx":"[1-9]|[1-4][0-9]|5[0-2]", + "lldpmed_enabled": "true|false", + "lldpmed_notify_enabled": "true|false", + "stp_port_mode": "true|false", + "egress_rate_limit_kbps_enabled": "true|false", + "egress_rate_limit_kbps": "6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}", + "aggregate_num_ports":"[2-6]", + "port_security_enabled": "true|false", + "port_security_mac_address": ["^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$"] + }], + "power_source_ctrl_enabled": "true|false", + "power_source_ctrl": "auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps", + "snmp_location": ".{0,255}", + "snmp_contact": ".{0,255}", + "baresip_enabled": "true|false", + "baresip_extension": "^\\+?[a-zA-Z0-9_.\\-!~*'()]*", + "baresip_auth_user": "^\\+?[a-zA-Z0-9_.\\-!~*'()]*", + "x_baresip_password": "^[a-zA-Z0-9_.\\-!~*'()]*", + "volume": "[0-9]|[1-9][0-9]|100", + "lte_ext_ant": "true|false", + "lte_poe": "true|false", + "lte_soft_limit": "\\d+", + "lcm_brightness_override": "true|false", + "lcm_brightness": "[1-9]|[1-9][0-9]|100", + "lcm_idle_timeout_override": "true|false", + "lcm_idle_timeout": "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600", + "rps_override": { + "power_management_mode": "dynamic|static", + "rps_port_table": [{ + "port_idx": "[1-6]", + "name": ".{0,32}", + "port_mode":"auto|force_active|manual|disabled" + }] + }, + "lcm_tracker_seed": ".{0,50}", + "lcm_tracker_enabled": "true|false", + "ubb_pair_name": ".{1,128}", + "lte_sim_pin": "[0-9]{4,8}", + "lte_apn": ".{1,128}" +} diff --git a/fields/5.14.23/DhcpOption.json b/fields/5.14.23/DhcpOption.json new file mode 100644 index 0000000..63f9c8d --- /dev/null +++ b/fields/5.14.23/DhcpOption.json @@ -0,0 +1,8 @@ +{ + "type": "^(boolean|hexarray|integer|ipaddress|macaddress|text)$", + "code": "^(?!(?:15|42|43|44|51|66|67|252)$)([7-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-4])$", + "name": "^[A-Za-z0-9-_]{1,25}$", + "signed": "^(true|false)$", + "width": "^(8|16|32)$" +} + diff --git a/fields/5.14.23/DpiApp.json b/fields/5.14.23/DpiApp.json new file mode 100644 index 0000000..55760c2 --- /dev/null +++ b/fields/5.14.23/DpiApp.json @@ -0,0 +1,10 @@ +{ + "name": ".{1,128}", + "enabled": "false|true", + "apps": [ "[0-9]{1,8}" ], + "cats": [ "[0-9]{1,3}" ], + "blocked": "false|true", + "log": "false|true", + "qos_rate_max_up": "-1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400", + "qos_rate_max_down": "-1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400" +} diff --git a/fields/5.14.23/DpiGroup.json b/fields/5.14.23/DpiGroup.json new file mode 100644 index 0000000..de915a1 --- /dev/null +++ b/fields/5.14.23/DpiGroup.json @@ -0,0 +1,5 @@ +{ + "name":".{1,128}", + "enabled": "false|true", + "dpiapp_ids": [ "[\\d\\w]+" ] +} diff --git a/fields/5.14.23/DynamicDNS.json b/fields/5.14.23/DynamicDNS.json new file mode 100644 index 0000000..b866f64 --- /dev/null +++ b/fields/5.14.23/DynamicDNS.json @@ -0,0 +1,10 @@ +{ + "interface": "wan|wan2", + "service": "afraid|changeip|cloudflare|dnspark|dslreports|dyndns|easydns|googledomains|namecheap|noip|sitelutions|zoneedit|custom", + "custom_service": "^[^\"' ]+$", + "host_name": "^[^\"' ]+$", + "login": "^[^\"' ]+$", + "x_password": "^[^\"' ]+$", + "server": "^[^\"' ]+$|^$", + "options": ["^[^\"' ]+$"] +} diff --git a/fields/5.14.23/FirewallGroup.json b/fields/5.14.23/FirewallGroup.json new file mode 100644 index 0000000..a148c69 --- /dev/null +++ b/fields/5.14.23/FirewallGroup.json @@ -0,0 +1,5 @@ +{ + "name": ".{1,64}", + "group_type": "address-group|port-group|ipv6-address-group", + "group_members": [ "" ] +} diff --git a/fields/5.14.23/FirewallRule.json b/fields/5.14.23/FirewallRule.json new file mode 100644 index 0000000..9e3f7df --- /dev/null +++ b/fields/5.14.23/FirewallRule.json @@ -0,0 +1,48 @@ +{ + "name": ".{1,128}", + "ruleset": "WAN_IN|WAN_OUT|WAN_LOCAL|LAN_IN|LAN_OUT|LAN_LOCAL|GUEST_IN|GUEST_OUT|GUEST_LOCAL|WANv6_IN|WANv6_OUT|WANv6_LOCAL|LANv6_IN|LANv6_OUT|LANv6_LOCAL|GUESTv6_IN|GUESTv6_OUT|GUESTv6_LOCAL", + "rule_index": "2[0-9]{3}|4[0-9]{3}", + + "enabled": "true|false", + "action": "drop|reject|accept", + "protocol": "^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp", + "protocol_v6": "^$|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|ah|all|dccp|eigrp|esp|gre|icmpv6|ipcomp|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|rsvp|sctp|shim6|tcp|tcp_udp|udp|vrrp", + "protocol_match_excepted": "false|true", + + "state_established": "false|true", + "state_invalid": "false|true", + "state_new": "false|true", + "state_related": "false|true", + + "ipsec": "match-ipsec|match-none|^$", + "icmp_typename" : "^$|address-mask-reply|address-mask-request|any|communication-prohibited|destination-unreachable|echo-reply|echo-request|fragmentation-needed|host-precedence-violation|host-prohibited|host-redirect|host-unknown|host-unreachable|ip-header-bad|network-prohibited|network-redirect|network-unknown|network-unreachable|parameter-problem|port-unreachable|precedence-cutoff|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-quench|source-route-failed|time-exceeded|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-zero-during-reassembly|ttl-zero-during-transit", + "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", + + "dst_address": "", + "dst_address_ipv6": "", + "dst_port": "", + "dst_firewallgroup_ids": [ "[\\d\\w]+" ], + "dst_networkconf_id": "[\\d\\w]+|^$", + "dst_networkconf_type": "ADDRv4|NETv4", + + "src_address": "", + "src_address_ipv6": "", + "src_port": "", + "src_firewallgroup_ids": [ "[\\d\\w]+" ], + "src_networkconf_id": "[\\d\\w]+|^$", + "src_networkconf_type": "ADDRv4|NETv4", + "src_mac_address": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$", + + "startdate": "^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$", + "stopdate": "^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$", + "starttime": "^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$", + "stoptime": "^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$", + "monthdays": "^$|^(([1-9]|[12][0-9]|3[01])(,([1-9]|[12][0-9]|3[01])){0,30})$", + "monthdays_negate": "false|true", + "weekdays": "^$|^((Mon|Tue|Wed|Thu|Fri|Sat|Sun)(,(Mon|Tue|Wed|Thu|Fri|Sat|Sun)){0,6})$", + "weekdays_negate": "false|true", + "utc": "false|true", + "contiguous": "false|true", + + "logging": "false|true" +} diff --git a/fields/5.14.23/HeatMap.json b/fields/5.14.23/HeatMap.json new file mode 100644 index 0000000..eaa6021 --- /dev/null +++ b/fields/5.14.23/HeatMap.json @@ -0,0 +1,6 @@ +{ + "map_id": "", + "type": "download|upload", + "name": ".*[^\\s]+.*", + "description": "" +} diff --git a/fields/5.14.23/HeatMapPoint.json b/fields/5.14.23/HeatMapPoint.json new file mode 100644 index 0000000..f119f69 --- /dev/null +++ b/fields/5.14.23/HeatMapPoint.json @@ -0,0 +1,7 @@ +{ + "heatmap_id": "", + "x": "[-+]?[0-9]*\\.?[0-9]+", + "y": "[-+]?[0-9]*\\.?[0-9]+", + "upload_speed": "[-+]?[0-9]*\\.?[0-9]+", + "download_speed": "[-+]?[0-9]*\\.?[0-9]+" +} diff --git a/fields/5.14.23/Hotspot2Conf.json b/fields/5.14.23/Hotspot2Conf.json new file mode 100644 index 0000000..8344c7a --- /dev/null +++ b/fields/5.14.23/Hotspot2Conf.json @@ -0,0 +1,136 @@ +{ + "name": ".{1,128}", + "venue_name": [ + { + "language": "[a-z]{3}", + "name": "", + "url": "" + } + ], + "venue_group": "0|1|2|3|4|5|6|7|8|9|10|11", + "venue_type": "0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15", + "network_type": "0|1|2|3|4|5|14|15", + "network_access_internet": "true|false", + "network_access_asra": "true|false", + "network_access_esr": "true|false", + "network_access_uesa": "true|false", + "ipaddr_type_avail_v4": "0|1|2|3|4|5|6|7", + "ipaddr_type_avail_v6": "0|1|2", + "hessid_used" : "true|false", + "hessid": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$", + "anqp_domain_id": "^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]|$", + "network_auth_type": "-1|0|1|2|3", + "network_auth_url": "", + "disable_dgaf": "true|false", + "deauth_req_timeout" : "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600", + "osu_ssid": "", + "nai_realm_list": [ + { + "name": ".{1,128}", + "status": "true|false", + "encoding": "0|1", + "eap_method": "13|21|18|23|50", + "auth_ids": "", + "auth_vals": "" + } + ], + "domain_name_list": [".{1,128}"], + "roaming_consortium_list": [ + { + "name": ".{1,128}", + "oid": ".{1,128}" + } + ], + "cellular_network_list": [ + { + "name": ".{1,128}", + "mcc": "[0-9]{3}", + "mnc": "[0-9]{3}" + } + ], + "friendly_name" : [ + { + "language": "[a-z]{3}", + "text": ".{1,128}" + } + ], + "t_c_filename" : ".{1,256}", + "t_c_timestamp" : "[0-9]{1,12}", + "icons" : [ + { + "name" : ".{1,256}", + "width": "[0-9]{1,8}", + "height": "[0-9]{1,8}", + "media": ".{1,256}", + "language": "[a-z]{3}", + "filename": ".{1,256}", + "data": "", + "size": "[0-9]{1,8}" + } + ], + "metrics_status" : "true|false", + "metrics_info_link_status" : "up|down|test", + "metrics_info_symmetric" : "true|false", + "metrics_info_at_capacity" : "true|false", + "metrics_downlink_speed_set": "true|false", + "metrics_downlink_speed": "[0-9]{1,10}", + "metrics_uplink_speed_set": "true|false", + "metrics_uplink_speed": "[0-9]{1,10}", + "metrics_downlink_load_set": "true|false", + "metrics_downlink_load": "[0-9]{1,3}", + "metrics_uplink_load_set": "true|false", + "metrics_uplink_load": "[0-9]{1,3}", + "metrics_measurement_set": "true|false", + "metrics_measurement": "[0-9]{1,5}", + "capab" : [ + { + "protocol" : "icmp|tcp_udp|tcp|udp|esp", + "port": "^(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])|$", + "status" : "closed|open|unknown" + } + ], + "osu" : [ + { + "server_uri": "", + "friendly_name" : [ + { + "language": "[a-z]{3}", + "text": ".{1,128}" + } + ], + "description" : [ + { + "language": "[a-z]{3}", + "text": ".{1,128}" + } + ], + "nai" : "", + "nai2" : "", + "operating_class" : "[0-9A-Fa-f]{12}", + "method_soap_xml_spp": "true|false", + "method_oma_dm": "true|false", + "icon" : [ + { + "name": ".{1,128}" + } + ] + } + ], + "gas_advanced": "true|false", + "gas_frag_limit" : "[0-9]{0,5}", + "gas_comeback_delay" : "[0-9]{0,4}", + "qos_map_status" : "true|false", + "qos_map_exceptions" : [ + { + "dcsp" : "[0-9]{1,2}", + "up" : "[0-7]" + } + ], + "qos_map_dcsp" : [ + { + "low" : "[0-9]{1,3}", + "high" : "[0-9]{1,3}" + } + ], + "save_timestamp": "" +} diff --git a/fields/5.14.23/HotspotOp.json b/fields/5.14.23/HotspotOp.json new file mode 100644 index 0000000..aa464df --- /dev/null +++ b/fields/5.14.23/HotspotOp.json @@ -0,0 +1,5 @@ +{ + "name": ".{1,256}", + "x_password": ".{1,256}", + "note": "" +} diff --git a/fields/5.14.23/HotspotPackage.json b/fields/5.14.23/HotspotPackage.json new file mode 100644 index 0000000..840ae4a --- /dev/null +++ b/fields/5.14.23/HotspotPackage.json @@ -0,0 +1,31 @@ +{ + "name": "", + "charged_as": "", + "amount": "^([\\d]+[.]?[\\d]*)$", + "currency": "[A-Z]{3}", + "hours": "[\\d]+", + "trial_reset": "^([\\d]+[.]?[\\d]*)$|^$", + "limit_overwrite": "true|false", + "limit_up": "[\\d]+|^$", + "limit_down": "[\\d]+|^$", + "limit_quota": "[\\d]+|^$", + "index": "[\\d]+", + "custom_payment_fields_enabled": "true|false", + "payment_fields_address_enabled": "true|false", + "payment_fields_address_required": "true|false", + "payment_fields_city_enabled": "true|false", + "payment_fields_city_required": "true|false", + "payment_fields_country_enabled": "true|false", + "payment_fields_country_required": "true|false", + "payment_fields_country_default": "", + "payment_fields_email_enabled": "true|false", + "payment_fields_email_required": "true|false", + "payment_fields_first_name_enabled": "true|false", + "payment_fields_first_name_required": "true|false", + "payment_fields_last_name_enabled": "true|false", + "payment_fields_last_name_required": "true|false", + "payment_fields_state_enabled": "true|false", + "payment_fields_state_required": "true|false", + "payment_fields_zip_enabled": "true|false", + "payment_fields_zip_required": "true|false" +} diff --git a/fields/5.14.23/Map.json b/fields/5.14.23/Map.json new file mode 100644 index 0000000..0fa5c6d --- /dev/null +++ b/fields/5.14.23/Map.json @@ -0,0 +1,15 @@ +{ + "name": "", + "mapTypeId": "satellite|roadmap|hybrid|terrain", + "tilt": "[\\d]+", + "type": "designerMap|imageMap|googleMap", + "upp": "^([\\d]+[.]?[\\d]*)$", + "unit": "m|f", + "lat": "^([-]?[\\d]+[.]?[\\d]*([eE][-+]?[\\d]+)?)$", + "lng": "^([-]?[\\d]+[.]?[\\d]*([eE][-+]?[\\d]+)?)$", + "selected": "true|false", + "zoom": "[\\d]+", + "offset_top": "^([-]?[\\d]+[.]?[\\d]*)$", + "offset_left": "^([-]?[\\d]+[.]?[\\d]*)$", + "opacity": "^(0(\\.[\\d]{1,2})?|1)$|^$" +} diff --git a/fields/5.14.23/MediaFile.json b/fields/5.14.23/MediaFile.json new file mode 100644 index 0000000..7c98cf6 --- /dev/null +++ b/fields/5.14.23/MediaFile.json @@ -0,0 +1,3 @@ +{ + "name": "" +} diff --git a/fields/5.14.23/NetworkConf.json b/fields/5.14.23/NetworkConf.json new file mode 100644 index 0000000..c26e9d7 --- /dev/null +++ b/fields/5.14.23/NetworkConf.json @@ -0,0 +1,145 @@ +{ + "name": ".{1,128}", + "enabled": "true|false", + "purpose": "corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan", + "vpn_type": "auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server|uid-server", + "vlan_enabled": "false|true", + "vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$", + "gateway_type":"default|switch", + "gateway_device": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)", + "priority": "[1-4]", + "igmp_snooping": "true|false", + "igmp_fastleave": "true|false", + "igmp_supression": "true|false", + "igmp_maxresponse": "[1-9]|1[0-9]|2[0-5]|^$", + "igmp_mcrtrexpiretime": "[0-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$", + "igmp_groupmembership": "[2-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$", + "igmp_querier": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", + "ip_subnet": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\/([1-9]|[1-2][0-9]|30)$", + "ipv6_subnet": "", + + "ipv6_interface_type": "static|pd|none", + "ipv6_pd_interface": "wan|wan2", + "ipv6_pd_prefixid": "^$|[a-fA-F0-9]{1,4}", + "ipv6_ra_enabled": "false|true", + "ipv6_ra_priority": "high|medium|low", + "ipv6_ra_valid_lifetime": "^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$", + "ipv6_ra_preferred_lifetime": "^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$", + "ipv6_pd_start": "", + "ipv6_pd_stop": "", + "domain_name": "(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(? 1 { + return empty, fmt.Errorf("unknown validation %#v", validation) + } + + fieldInfo, err := r.fieldInfoFromValidation(name, validation[0]) + if err != nil { + return empty, err + } + + fieldInfo.OmitEmpty = true + fieldInfo.IsArray = true + + return fieldInfo, nil + case map[string]interface{}: + typeName := r.StructName + "_" + fieldName + + result := NewFieldInfo(fieldName, name, typeName, "", true, false) + result.Fields = make(map[string]*FieldInfo) + + for name, fv := range validation { + child, err := r.fieldInfoFromValidation(name, fv) + if err != nil { + return empty, err + } + + result.Fields[child.FieldName] = child + } + + r.Types[typeName] = result + return result, nil + + case string: + fieldValidation := validation + normalized := normalizeValidation(validation) + + omitEmpty := r.StructName == "Device" + + switch { + case normalized == "falsetrue" || normalized == "truefalse": + return NewFieldInfo(fieldName, name, "bool", "", omitEmpty, false), nil + default: + if _, err := strconv.ParseFloat(normalized, 64); err == nil { + if normalized == "09" || normalized == "09.09" { + fieldValidation = "" + } + + if strings.Contains(normalized, ".") { + if strings.Contains(validation, "\\.){3}") { + break + } + + return NewFieldInfo(fieldName, name, "float64", fieldValidation, true, false), nil + } + + return NewFieldInfo(fieldName, name, "int", fieldValidation, true, false), nil + } + } + if validation != "" && normalized != "" { + fmt.Printf("normalize %q to %q\n", validation, normalized) + } + + omitEmpty = omitEmpty || (!strings.Contains(validation, "^$") && !strings.HasSuffix(fieldName, "ID")) + return NewFieldInfo(fieldName, name, "string", fieldValidation, omitEmpty, false), nil } - err := c.do(ctx, "GET", fmt.Sprintf("s/%%s/rest/%[2]s/%%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 + return empty, fmt.Errorf("unable to determine type from validation %q", validation) } -func (c *Client) delete%[1]s(ctx context.Context, site, id string) error { - err := c.do(ctx, "DELETE", fmt.Sprintf("s/%%s/rest/%[2]s/%%s", site, id), struct{}{}, nil) +func (r *Resource) processJSON(b []byte) error { + var fields map[string]interface{} + err := json.Unmarshal(b, &fields) if err != nil { return err } + + r.processFields(fields) + return nil } -func (c *Client) create%[1]s(ctx context.Context, site string, d *%[1]s) (*%[1]s, error) { - var respBody struct { - Meta meta `+"`"+`json:"meta"`+"`"+` - Data []%[1]s `+"`"+`json:"data"`+"`"+` - } +func (r *Resource) generateCode() (string, error) { + var err error + var buf bytes.Buffer + writer := io.Writer(&buf) - err := c.do(ctx, "POST", fmt.Sprintf("s/%%s/rest/%[2]s", site), d, &respBody) - if err != nil { - return nil, err - } + tpl := template.Must(template.New("api.go.tmpl").Funcs(template.FuncMap{ + "embedTypes": func() bool { return embedTypes }, + }).ParseFiles("api.go.tmpl")) - if len(respBody.Data) != 1 { - return nil, &NotFoundError{} - } + tpl.Execute(writer, r) - new := respBody.Data[0] - - return &new, nil -} - -func (c *Client) update%[1]s(ctx context.Context, site string, d *%[1]s) (*%[1]s, error) { - var respBody struct { - Meta meta `+"`"+`json:"meta"`+"`"+` - Data []%[1]s `+"`"+`json:"data"`+"`"+` - } - - err := c.do(ctx, "PUT", fmt.Sprintf("s/%%s/rest/%[2]s/%%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 -} -`, structName, urlPath) - - return code, nil + return buf.String(), err } func normalizeValidation(re string) string { @@ -333,96 +403,3 @@ func normalizeValidation(re string) string { return re } - -func typeFromValidation(validation interface{}) (ty string, comment string, omitempty bool, err error) { - switch validation := validation.(type) { - case []interface{}: - if len(validation) == 0 { - return "[]string", "", false, nil - } - if len(validation) > 1 { - return "", "", false, fmt.Errorf("unknown validation %#v", validation) - } - elementType, elementComment, _, err := typeFromValidation(validation[0]) - if err != nil { - return "", "", false, err - } - return fmt.Sprintf("[]%s", elementType), elementComment, true, nil - case map[string]interface{}: - fieldNames := []string{} - fieldCodes := map[string]string{} - for name, fv := range validation { - fieldNames = append(fieldNames, name) - fieldCode, err := generateField(name, fv) - if err != nil { - return "", "", false, err - } - fieldCodes[name] = fieldCode - } - - // TODO: sort by normalized name, not this name - sort.Strings(fieldNames) - - code := "struct {\n" - for _, name := range fieldNames { - code += fieldCodes[name] + "\n" - } - code += "\n}" - - return code, "", false, nil - case string: - comment := validation - normalized := normalizeValidation(validation) - allowEmpty := strings.HasSuffix(validation, "|^$") || strings.HasPrefix(validation, "^$|") - switch { - case normalized == "falsetrue" || normalized == "truefalse": - return "bool", "", false, nil - default: - if _, err := strconv.ParseFloat(normalized, 64); err == nil { - if normalized == "09" || normalized == "09.09" { - comment = "" - } - - if strings.Contains(normalized, ".") { - if strings.Contains(validation, "\\.){3}") { - break - } - - return "float64", comment, true, nil - } - - return "int", comment, true, nil - } - } - if validation != "" && normalized != "" { - fmt.Printf("normalize %q to %q\n", validation, normalized) - } - return "string", validation, !allowEmpty, nil - } - return "", "", false, fmt.Errorf("unable to determine type from validation %q", validation) -} - -func generateField(name string, validation interface{}) (string, error) { - field := strcase.ToCamel(name) - field = cleanName(field, fieldReps) - fieldType, comment, omitempty, err := typeFromValidation(validation) - if err != nil { - return "", err - } - - comment = strings.TrimSpace(fmt.Sprintf("// %s", comment)) - if comment == "//" { - comment = "" - } - - if fieldType == "string" && strings.HasSuffix(field, "ID") { - omitempty = false - } - - omitemptyCode := "" - if omitempty { - omitemptyCode = ",omitempty" - } - - return fmt.Sprintf("\t%s %s `json:\"%s%s\"` %s", field, fieldType, name, omitemptyCode, comment), nil -} diff --git a/fields/main_test.go b/fields/main_test.go index 28a924c..31d5040 100644 --- a/fields/main_test.go +++ b/fields/main_test.go @@ -2,10 +2,11 @@ package main import ( "fmt" + assert "github.com/stretchr/testify/assert" "testing" ) -func TestTypeFromValidation(t *testing.T) { +func TestFieldInfoFromValidation(t *testing.T) { for i, c := range []struct { expectedType string expectedComment string @@ -17,7 +18,7 @@ func TestTypeFromValidation(t *testing.T) { {"string", ".{0,32}", true, ".{0,32}"}, {"string", "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", false, "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"}, - {"int", "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", false, "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"}, + {"int", "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$", true, "^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"}, {"int", "", true, "^[0-9]*$"}, {"float64", "", true, "[-+]?[0-9]*\\.?[0-9]+"}, @@ -29,19 +30,113 @@ func TestTypeFromValidation(t *testing.T) { {"bool", "", false, "true|false"}, } { t.Run(fmt.Sprintf("%d %s %s", i, c.expectedType, c.validation), func(t *testing.T) { - actualType, actualComment, actualOmitEmpty, err := typeFromValidation(c.validation) + resource := &Resource{StructName: "TestType", Types: make(map[string]*FieldInfo)} + fieldInfo, err := resource.fieldInfoFromValidation("fieldName", c.validation) + //actualType, actualComment, actualOmitEmpty, err := fieldInfoFromValidation(c.validation) if err != nil { t.Fatal(err) } - if actualType != c.expectedType { - t.Fatalf("expected type %q got %q", c.expectedType, actualType) + if fieldInfo.FieldType != c.expectedType { + t.Fatalf("expected type %q got %q", c.expectedType, fieldInfo.FieldType) } - if actualComment != c.expectedComment { - t.Fatalf("expected comment %q got %q", c.expectedComment, actualComment) + if fieldInfo.FieldValidation != c.expectedComment { + t.Fatalf("expected comment %q got %q", c.expectedComment, fieldInfo.FieldValidation) } - if actualOmitEmpty != c.expectedOmitEmpty { - t.Fatalf("expected omitempty %t got %t", c.expectedOmitEmpty, actualOmitEmpty) + if fieldInfo.OmitEmpty != c.expectedOmitEmpty { + t.Fatalf("expected omitempty %t got %t", c.expectedOmitEmpty, fieldInfo.OmitEmpty) } }) } } + +func TestResourceTypes(t *testing.T) { + testData := ` +{ + "note": ".{0,1024}", + "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?$", + "mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", + "number": "\\d+", + "boolean": "true|false", + "nested_type": { + "nested_field": "^$" + }, + "nested_type_array": [{ + "nested_field": "^$" + }] +} + ` + expectedFields := map[string]*FieldInfo{ + "Note": NewFieldInfo("Note", "note", "string", ".{0,1024}", true, false), + "Date": NewFieldInfo("Date", "date", "string", "^$|^(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?$", false, false), + "MAC": NewFieldInfo("MAC", "mac", "string", "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", true, false), + "Number": NewFieldInfo("Number", "number", "int", "", true, false), + "Boolean": NewFieldInfo("Boolean", "boolean", "bool", "", false, false), + "NestedType": &FieldInfo{ + FieldName: "NestedType", + JSONName: "nested_type", + FieldType: "Struct_NestedType", + FieldValidation: "", + OmitEmpty: true, + IsArray: false, + Fields: map[string]*FieldInfo{ + "NestedField": NewFieldInfo("NestedField", "nested_field", "string", "^$", false, false), + }, + }, + "NestedTypeArray": &FieldInfo{ + FieldName: "NestedTypeArray", + JSONName: "nested_type_array", + FieldType: "Struct_NestedTypeArray", + FieldValidation: "", + OmitEmpty: true, + IsArray: true, + Fields: map[string]*FieldInfo{ + "NestedField": NewFieldInfo("NestedField", "nested_field", "string", "^$", false, false), + }, + }, + } + + expectedStruct := map[string]*FieldInfo{ + "Struct": &FieldInfo{ + FieldName: "Struct", + JSONName: "path", + FieldType: "struct", + FieldValidation: "", + OmitEmpty: false, + IsArray: false, + Fields: map[string]*FieldInfo{ + " ID": NewFieldInfo("ID", "_id", "string", "", true, false), + " SiteID": NewFieldInfo("SiteID", "site_id", "string", "", true, false), + " _Spacer": nil, + " Hidden": NewFieldInfo("Hidden", "attr_hidden", "bool", "", true, false), + " HiddenID": NewFieldInfo("HiddenID", "attr_hidden_id", "string", "", true, false), + " NoDelete": NewFieldInfo("NoDelete", "attr_no_delete", "bool", "", true, false), + " NoEdit": NewFieldInfo("NoEdit", "attr_no_edit", "bool", "", true, false), + " _Spacer": nil, + " _Spacer": nil, + }, + }, + } + + for k, v := range expectedFields { + expectedStruct["Struct"].Fields[k] = v + } + + expectation := &Resource{ + StructName: "Struct", + ResourcePath: "path", + + Types: map[string]*FieldInfo{ + "Struct": expectedStruct["Struct"], + "Struct_NestedType": expectedStruct["Struct"].Fields["NestedType"], + "Struct_NestedTypeArray": expectedStruct["Struct"].Fields["NestedTypeArray"], + }, + } + + t.Run("structural test", func(t *testing.T) { + resource := NewResource("Struct", "path") + err := resource.processJSON(([]byte)(testData)) + + assert.Empty(t, err, "No error processing JSON") + assert.Equal(t, expectation, resource) + }) +} diff --git a/fields/settings.sh b/fields/settings.sh old mode 100644 new mode 100755 index 8196406..90d865c --- a/fields/settings.sh +++ b/fields/settings.sh @@ -1,10 +1,11 @@ -#! /bin/bash +#!/usr/bin/env bash ver="$1" keys=$(jq -r keys[] "$ver/Setting.json") while IFS= read -r key; do - fn="$(echo $key | sed -r 's/(^|_)([a-z])/\U\2/g')" + readarray -td ' ' arr <<< "${key//_/ }" + fn=$(printf %s "${arr[@]^}") echo "... $key $fn ..." jq ".$key" "$ver/Setting.json" > "$ver/Setting$fn.json" -done <<< "$keys" \ No newline at end of file +done <<< "$keys" diff --git a/go.mod b/go.mod index 711b22b..cda951c 100644 --- a/go.mod +++ b/go.mod @@ -4,5 +4,7 @@ go 1.12 require ( github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 + github.com/stretchr/testify v1.6.1 github.com/tj/assert v0.0.3 + golang.org/x/tools/gopls v0.4.4 // indirect ) diff --git a/go.sum b/go.sum index 80d3d8a..3ffd19b 100644 --- a/go.sum +++ b/go.sum @@ -1,19 +1,79 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.6.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729181040-64cdafbe085c h1:jLQLIAedRoS9I2Py7l/ZAGGzUxLFsdg42JXEpS/a+ow= +golang.org/x/tools v0.0.0-20200729181040-64cdafbe085c/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200831203904-5a2aa26beb65 h1:DajXNh69ob79PCQz1N7OHxmqq6ASZC5xAnJJWIQGR6I= +golang.org/x/tools/gopls v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk= +golang.org/x/tools/gopls v0.4.4/go.mod h1:zhyGzA+CAtREUwwq/btQxEx2FHnGzDwJvGs5YqdVCbE= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c h1:grhR+C34yXImVGp7EzNk+DTIk+323eIUWOmEevy6bDo= gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f h1:gi7cb8HTDZ6q8VqsUpkdoFi3vxwHMneQ6+Q5Ap5hjPE= +mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f/go.mod h1:9VQ397fNXEnF84t90W4r4TRCQK+pg9f8ugVfyj+S26w= +mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A= +mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= diff --git a/unifi/account.generated.go b/unifi/account.generated.go index 494d183..6419fe8 100644 --- a/unifi/account.generated.go +++ b/unifi/account.generated.go @@ -23,7 +23,7 @@ type Account struct { NoDelete bool `json:"attr_no_delete,omitempty"` NoEdit bool `json:"attr_no_edit,omitempty"` - IP string `json:"ip,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"` // ^[^"' ]+$ TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$ diff --git a/unifi/channel_plan.generated.go b/unifi/channel_plan.generated.go index 863e7d7..cc71614 100644 --- a/unifi/channel_plan.generated.go +++ b/unifi/channel_plan.generated.go @@ -27,14 +27,12 @@ type ChannelPlan struct { Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196 MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$ Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12} - } `json:"ap_blacklisted_channels,omitempty"` ConfSource string `json:"conf_source,omitempty"` // manual|radio-ai Coupling []struct { Rssi int `json:"rssi,omitempty"` Source string `json:"source,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$ Target string `json:"target,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$ - } `json:"coupling,omitempty"` Date string `json:"date"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$ Fitness float64 `json:"fitness,omitempty"` @@ -48,7 +46,6 @@ 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 { @@ -58,7 +55,6 @@ type ChannelPlan struct { 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"` } diff --git a/unifi/device.generated.go b/unifi/device.generated.go index 261286b..c2c669f 100644 --- a/unifi/device.generated.go +++ b/unifi/device.generated.go @@ -23,114 +23,111 @@ type Device struct { NoDelete bool `json:"attr_no_delete,omitempty"` NoEdit bool `json:"attr_no_edit,omitempty"` - AtfEnabled bool `json:"atf_enabled"` + 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"` + BaresipEnabled bool `json:"baresip_enabled,omitempty"` BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]* ConfigNetwork struct { - BondingEnabled bool `json:"bonding_enabled"` - DNS1 string `json:"dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$ - DNS2 string `json:"dns2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$ + 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}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$ + DNS2 string `json:"dns2,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}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$ DNSsuffix string `json:"dnssuffix,omitempty"` - Gateway string `json:"gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$ + 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"` - Disabled bool `json:"disabled"` - Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id"` // [\d\w]+| - Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled"` - DPIEnabled bool `json:"dpi_enabled"` + } `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"` - FlowctrlEnabled bool `json:"flowctrl_enabled"` + FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"` HeightInMeters float64 `json:"heightInMeters,omitempty"` - JumboframeEnabled bool `json:"jumboframe_enabled"` + JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"` LcmBrightness int `json:"lcm_brightness,omitempty"` // [1-9]|[1-9][0-9]|100 - LcmBrightnessOverride bool `json:"lcm_brightness_override"` + LcmBrightnessOverride bool `json:"lcm_brightness_override,omitempty"` LcmIDleTimeout int `json:"lcm_idle_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600 - LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override"` - LcmTrackerEnabled bool `json:"lcm_tracker_enabled"` + LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override,omitempty"` + LcmTrackerEnabled bool `json:"lcm_tracker_enabled,omitempty"` LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50} LedOverride string `json:"led_override,omitempty"` // default|on|off LedOverrideColor string `json:"led_override_color,omitempty"` // ^#(?:[0-9a-fA-F]{3}){1,2}$ LedOverrideColorBrightness int `json:"led_override_color_brightness,omitempty"` // ^[0-9][0-9]?$|^100$ - Locked bool `json:"locked"` - LteExtAnt bool `json:"lte_ext_ant"` - LtePoe bool `json:"lte_poe"` + Locked bool `json:"locked,omitempty"` + LteExtAnt bool `json:"lte_ext_ant,omitempty"` + LtePoe bool `json:"lte_poe,omitempty"` LteSoftLimit int `json:"lte_soft_limit,omitempty"` - MapID string `json:"map_id"` - MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled"` - MgmtNetworkID string `json:"mgmt_network_id"` // [\d\w]+ + MapID string `json:"map_id,omitempty"` + MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled,omitempty"` + MgmtNetworkID string `json:"mgmt_network_id,omitempty"` // [\d\w]+ Name string `json:"name,omitempty"` // .{1,128} OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off - OutletCycleEnabled bool `json:"outlet_cycle_enabled"` + OutletCycleEnabled bool `json:"outlet_cycle_enabled,omitempty"` OutletOverrides []struct { Index int `json:"index,omitempty"` - RelayState bool `json:"relay_state"` + RelayState bool `json:"relay_state,omitempty"` } `json:"outlet_overrides,omitempty"` PortOverrides []struct { AggregateNumPorts int `json:"aggregate_num_ports,omitempty"` // [2-6] - Autoneg bool `json:"autoneg"` + Autoneg bool `json:"autoneg,omitempty"` Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host EgressRateLimitKbps int `json:"egress_rate_limit_kbps,omitempty"` // 6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6} - EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled"` - FullDuplex bool `json:"full_duplex"` - Isolation bool `json:"isolation"` - LldpmedEnabled bool `json:"lldpmed_enabled"` - LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"` + EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled,omitempty"` + FullDuplex bool `json:"full_duplex,omitempty"` + 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] Name string `json:"name,omitempty"` // .{0,128} OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2] - PortSecurityEnabled bool `json:"port_security_enabled"` + PortSecurityEnabled bool `json:"port_security_enabled,omitempty"` PortSecurityMACAddress []string `json:"port_security_mac_address,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$ - PortconfID string `json:"portconf_id"` // [\d\w]+ + PortconfID string `json:"portconf_id,omitempty"` // [\d\w]+ PriorityQueue1Level int `json:"priority_queue1_level,omitempty"` // [0-9]|[1-9][0-9]|100 PriorityQueue2Level int `json:"priority_queue2_level,omitempty"` // [0-9]|[1-9][0-9]|100 PriorityQueue3Level int `json:"priority_queue3_level,omitempty"` // [0-9]|[1-9][0-9]|100 PriorityQueue4Level int `json:"priority_queue4_level,omitempty"` // [0-9]|[1-9][0-9]|100 Speed int `json:"speed,omitempty"` // 10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000 - StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled"` + StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled,omitempty"` StormctrlBroadcastastLevel int `json:"stormctrl_bcast_level,omitempty"` // [0-9]|[1-9][0-9]|100 StormctrlBroadcastastRate int `json:"stormctrl_bcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000 - StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled"` + StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled,omitempty"` StormctrlMcastLevel int `json:"stormctrl_mcast_level,omitempty"` // [0-9]|[1-9][0-9]|100 StormctrlMcastRate int `json:"stormctrl_mcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000 StormctrlType string `json:"stormctrl_type,omitempty"` // level|rate - StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled"` + StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled,omitempty"` 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"` + 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"` + PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"` + RADIUSProfileID string `json:"radiusprofile_id,omitempty"` RadioTable []struct { AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9]) AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9] BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto - HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled"` + HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"` Ht int `json:"ht,omitempty"` // 20|40|80|160|1080|2160 MinRssi int `json:"min_rssi,omitempty"` // ^-([1-9]|[1-8][0-9]|9[0-4])$ - MinRssiEnabled bool `json:"min_rssi_enabled"` + MinRssiEnabled bool `json:"min_rssi_enabled,omitempty"` Name string `json:"name,omitempty"` Radio string `json:"radio,omitempty"` // ng|na|ad SensLevel int `json:"sens_level,omitempty"` // ^-([5-8][0-9]|90)$ - SensLevelEnabled bool `json:"sens_level_enabled"` + SensLevelEnabled bool `json:"sens_level_enabled,omitempty"` TxPower string `json:"tx_power,omitempty"` // [\d]+|auto TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom - VwireEnabled bool `json:"vwire_enabled"` - WLANGroupID string `json:"wlangroup_id"` // [\d\w]+ - + VwireEnabled bool `json:"vwire_enabled,omitempty"` + WLANGroupID string `json:"wlangroup_id,omitempty"` // [\d\w]+ } `json:"radio_table,omitempty"` - RADIUSProfileID string `json:"radiusprofile_id"` ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off RpsOverride struct { PowerManagementMode string `json:"power_management_mode,omitempty"` // dynamic|static @@ -138,32 +135,30 @@ type Device 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"` + } `json:"rps_override,omitempty"` SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255} SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255} - StpPriority int `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440 + 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"` + 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 { - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled,omitempty"` Name string `json:"name,omitempty"` // .{1,32} - NameCombineEnabled bool `json:"name_combine_enabled"` + NameCombineEnabled bool `json:"name_combine_enabled,omitempty"` NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8} Radio string `json:"radio,omitempty"` // ng|na RadioName string `json:"radio_name,omitempty"` VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$ - VLANEnabled bool `json:"vlan_enabled"` - WLANID string `json:"wlan_id"` // [\d\w]+ + 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 string `json:"x,omitempty"` + X int `json:"x,omitempty"` XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]* - Y string `json:"y,omitempty"` + Y int `json:"y,omitempty"` } func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error) { @@ -172,7 +167,7 @@ func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error) Data []Device `json:"data"` } - err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device", site), nil, &respBody) + err := c.do(ctx, "GET", fmt.Sprintf("s/%s/stat/device", site), nil, &respBody) if err != nil { return nil, err } @@ -186,7 +181,7 @@ func (c *Client) getDevice(ctx context.Context, site, id string) (*Device, error Data []Device `json:"data"` } - err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device/%s", site, id), nil, &respBody) + err := c.do(ctx, "GET", fmt.Sprintf("s/%s/stat/device/%s", site, id), nil, &respBody) if err != nil { return nil, err } diff --git a/unifi/hotspot_2_conf.generated.go b/unifi/hotspot_2_conf.generated.go index 8f66097..b29c744 100644 --- a/unifi/hotspot_2_conf.generated.go +++ b/unifi/hotspot_2_conf.generated.go @@ -28,13 +28,11 @@ type Hotspot2Conf struct { Port string `json:"port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14} Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp Status string `json:"status,omitempty"` // closed|open|unknown - } `json:"capab,omitempty"` CellularNetworkList []struct { Mcc int `json:"mcc,omitempty"` Mnc int `json:"mnc,omitempty"` Name string `json:"name,omitempty"` // .{1,128} - } `json:"cellular_network_list,omitempty"` DeauthReqTimeout int `json:"deauth_req_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600 DisableDgaf bool `json:"disable_dgaf"` @@ -42,7 +40,6 @@ type Hotspot2Conf struct { FriendlyName []struct { Language string `json:"language,omitempty"` // [a-z]{3} Text string `json:"text,omitempty"` // .{1,128} - } `json:"friendly_name,omitempty"` GasComebackDelay int `json:"gas_comeback_delay,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|300 Hessid string `json:"hessid"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$ @@ -81,16 +78,13 @@ type Hotspot2Conf struct { Description []struct { Language string `json:"language,omitempty"` // [a-z]{3} Text string `json:"text,omitempty"` // .{1,128} - } `json:"description,omitempty"` FriendlyName []struct { Language string `json:"language,omitempty"` // [a-z]{3} Text string `json:"text,omitempty"` // .{1,128} - } `json:"friendly_name,omitempty"` Icon []struct { Name string `json:"name,omitempty"` // .{1,128} - } `json:"icon,omitempty"` MethodOmaDm bool `json:"method_oma_dm"` MethodSoapXmlSpp bool `json:"method_soap_xml_spp"` @@ -109,13 +103,11 @@ type Hotspot2Conf struct { QOSMapExceptions []struct { Dcsp int `json:"dcsp,omitempty"` Up int `json:"up,omitempty"` // [0-7] - } `json:"qos_map_exceptions,omitempty"` QOSMapStatus bool `json:"qos_map_status"` RoamingConsortiumList []struct { Name string `json:"name,omitempty"` // .{1,128} Oid string `json:"oid,omitempty"` // .{1,128} - } `json:"roaming_consortium_list,omitempty"` TCFilename string `json:"t_c_filename,omitempty"` // .{1,256} TCTimestamp int `json:"t_c_timestamp,omitempty"` @@ -123,7 +115,6 @@ type Hotspot2Conf struct { 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 } diff --git a/unifi/network.generated.go b/unifi/network.generated.go index 8ac35e8..114f34e 100644 --- a/unifi/network.generated.go +++ b/unifi/network.generated.go @@ -23,7 +23,6 @@ type Network struct { NoDelete bool `json:"attr_no_delete,omitempty"` NoEdit bool `json:"attr_no_edit,omitempty"` - DHCPRelayEnabled bool `json:"dhcp_relay_enabled"` DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"` DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty"` // .{1,256} DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?