Refactor type generator

* Allows for generating top-level types for any embedded struct so
  that sub-types can be properly instantiated from calling code
  * Specifying `-no-embedded-types` will generate top-level types
    rather than embedding the struct

* Refactored "Device" API
  * All fields set to `omitempty` because it describes all possible
    device types, so effectively any field could be omitted any time
  * Fixed `get` call for "Device" API; replacing `rest` with `stat`

* Generated `get` and `update` calls for `Setting*` APIs

* Added `5.14.23` JSON files
This commit is contained in:
James Stephenson
2020-08-28 22:18:21 -04:00
committed by Paul Tyng
parent 79542b4006
commit 35eda4f67b
110 changed files with 3589 additions and 374 deletions

View File

@@ -0,0 +1,9 @@
{
"name": "^[^\"' ]+$",
"x_password": "",
"vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$",
"ip":"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"tunnel_config_type": "vpn|802.1x|custom",
"tunnel_type": "[1-9]|1[0-3]|^$",
"tunnel_medium_type": "[1-9]|1[0-5]|^$"
}

View File

@@ -0,0 +1,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}"
}

View File

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

View File

@@ -0,0 +1,35 @@
{
"conf_source": "manual|radio-ai",
"date": "^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$",
"fitness": "^[0-9]+\\.?[0-9]*$",
"note": ".{0,1024}",
"radio": "na|ng|ng\\+na",
"radio_table": [{
"device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"name": "[a-z]*[0-9]*",
"channel": "[0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto",
"backup_channel": "[0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto",
"width": "20|40|80|160",
"tx_power": "[\\d]+|auto",
"tx_power_mode": "auto|medium|high|low|custom"
}],
"satisfaction_table": [{
"device_mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"satisfaction": "^[0-9]+\\.?[0-9]*$"
}],
"site_blacklisted_channels": [{
"channel": "36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196",
"timestamp": "[1-9][0-9]{12}"
}],
"ap_blacklisted_channels": [{
"mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"channel": "36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196",
"timestamp": "[1-9][0-9]{12}"
}],
"coupling": [{
"source": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$",
"target": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$",
"rssi": "-?[0-9]{1,3}"
}],
"satisfaction": "^[0-9]+\\.?[0-9]*$"
}

View File

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

143
fields/5.14.23/Device.json Normal file
View File

@@ -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}"
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,48 @@
{
"name": ".{1,128}",
"ruleset": "WAN_IN|WAN_OUT|WAN_LOCAL|LAN_IN|LAN_OUT|LAN_LOCAL|GUEST_IN|GUEST_OUT|GUEST_LOCAL|WANv6_IN|WANv6_OUT|WANv6_LOCAL|LANv6_IN|LANv6_OUT|LANv6_LOCAL|GUESTv6_IN|GUESTv6_OUT|GUESTv6_LOCAL",
"rule_index": "2[0-9]{3}|4[0-9]{3}",
"enabled": "true|false",
"action": "drop|reject|accept",
"protocol": "^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp",
"protocol_v6": "^$|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|ah|all|dccp|eigrp|esp|gre|icmpv6|ipcomp|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|rsvp|sctp|shim6|tcp|tcp_udp|udp|vrrp",
"protocol_match_excepted": "false|true",
"state_established": "false|true",
"state_invalid": "false|true",
"state_new": "false|true",
"state_related": "false|true",
"ipsec": "match-ipsec|match-none|^$",
"icmp_typename" : "^$|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"
}

View File

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

View File

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

View File

@@ -0,0 +1,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": ""
}

View File

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

View File

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

15
fields/5.14.23/Map.json Normal file
View File

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

View File

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

View File

@@ -0,0 +1,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}(?<!-)\\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}",
"dhcpd_enabled": "true|false",
"dhcpd_start": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_stop": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_gateway": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_gateway_enabled": "^true|false$",
"dhcpd_dns_enabled": "true|false",
"dhcpd_dns_1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_dns_2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_dns_3": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_dns_4": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_leasetime": "[\\d]+",
"dhcpd_wins_enabled": "true|false",
"dhcpd_wins_1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_wins_2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_ntp_enabled": "true|false",
"dhcpd_ntp_1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_ntp_2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_boot_enabled": "true|false",
"dhcpd_boot_server": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$",
"dhcpd_boot_filename": ".{1,256}",
"dhcpd_unifi_controller": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_time_offset_enabled": "true|false",
"dhcpd_time_offset": "^0$|^-?([1-9]([0-9]{1,3})?|[1-7][0-9]{4}|[8][0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$",
"dhcpd_wpad_url": "",
"dhcpd_tftp_server": "",
"dhcp_relay_enabled": "true|false",
"dhcpguard_enabled": "true|false",
"dhcpd_ip_1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_ip_2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_ip_3": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcpd_mac_1": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpd_mac_2": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpd_mac_3": "(^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)",
"dhcpdv6_enabled": "true|false",
"dhcpdv6_start": "",
"dhcpdv6_stop": "",
"dhcpdv6_leasetime": "[\\d]+",
"dhcpdv6_dns_auto": "true|false",
"dhcpdv6_dns_1": "",
"dhcpdv6_dns_2": "",
"dhcpdv6_dns_3": "",
"dhcpdv6_dns_4": "",
"is_nat": "true|false",
"nat_outbound_ip": "",
"networkgroup": "LAN[2-8]?",
"usergroup_id": "",
"dpi_enabled": "false|true",
"dpigroup_id": "[\\d\\w]+|^$",
"remote_site_id": "",
"remote_site_subnets": [ "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\/([1-9]|[1-2][0-9]|30)$|^$" ],
"exposed_to_site_vpn": "false|true",
"require_mschapv2": "true|false",
"remote_vpn_subnets": [ "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\/([1-9]|[1-2][0-9]|30)$|^$" ],
"ipsec_peer_ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"ipsec_local_ip": "^any$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"x_ipsec_pre_shared_key": "[^\\\"\\' ]+",
"ipsec_profile": "customized|azure_dynamic|azure_static",
"ipsec_encryption": "aes128|aes192|aes256|3des",
"ipsec_hash": "sha1|md5|sha256|sha384|sha512",
"ipsec_dh_group": "2|5|14|15|16|19|20|21|25|26",
"ipsec_ike_dh_group": "1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32",
"ipsec_esp_dh_group": "1|2|5|14|15|16|17|18",
"ipsec_key_exchange": "ikev1|ikev2",
"ipsec_pfs": "false|true",
"ipsec_dynamic_routing": "true|false",
"lte_lan_enabled": "true|false",
"l2tp_interface": "wan|wan2",
"openvpn_mode": "site-to-site|client|server",
"openvpn_remote_host": "[^\\\"\\' ]+|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"openvpn_local_port": "^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$",
"openvpn_remote_port": "^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$",
"openvpn_local_address": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"openvpn_remote_address": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"x_openvpn_shared_secret_key": "[0-9A-Fa-f]{512}",
"pptpc_server_ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$",
"pptpc_username": "[^\\\"\\' ]+",
"x_pptpc_password": "[^\\\"\\' ]+",
"pptpc_require_mppe": "true|false",
"pptpc_route_distance": "^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$",
"vpn_client_pull_dns": "true|false",
"vpn_client_default_route": "true|false",
"upnp_lan_enabled": "true|false",
"route_distance": "^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$",
"radiusprofile_id": "",
"wan_type": "disabled|dhcp|static|pppoe",
"wan_networkgroup": "WAN[2]?|WAN_LTE_FAILOVER",
"wan_ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"wan_netmask": "^((128|192|224|240|248|252|254)\\.0\\.0\\.0)|(255\\.(((0|128|192|224|240|248|252|254)\\.0\\.0)|(255\\.(((0|128|192|224|240|248|252|254)\\.0)|255\\.(0|128|192|224|240|248|252|254)))))$",
"wan_gateway": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"wan_username": "[^\"' ]+",
"wan_dhcp_options": [{
"optionNumber": "([1-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-4])",
"value": ""
}],
"x_wan_password": "[^\"' ]+",
"report_wan_event": "true|false",
"wan_dns1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"wan_dns2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"wan_dns3": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"wan_dns4": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"wan_vlan_enabled": "false|true",
"wan_vlan": "[0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$",
"wan_egress_qos": "[1-7]|^$",
"wan_smartq_enabled": "false|true",
"wan_smartq_up_rate": "[0-9]{1,6}|1000000",
"wan_smartq_down_rate": "[0-9]{1,6}|1000000",
"wan_load_balance_type": "failover-only|weighted",
"wan_load_balance_weight": "[1-9]|[1-9][0-9]",
"wan_type_v6": "disabled|dhcpv6|static",
"wan_dhcpv6_pd_size": "^(4[89]|5[0-9]|6[0-4])$|^$",
"wan_ipv6": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$",
"wan_prefixlen": "^([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])$|^$",
"wan_gateway_v6": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$",
"ipsec_interface": "wan|wan2"
}

View File

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

View File

@@ -0,0 +1,11 @@
{
"name": ".{1,128}",
"enabled": "true|false",
"src": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([0-9]|[1-2][0-9]|3[0-2])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^!(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([0-9]|[1-2][0-9]|3[0-2])$|^any$",
"dst_port": "(([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}",
"fwd": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"fwd_port": "(([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}",
"proto": "tcp_udp|tcp|udp",
"log": "true|false",
"pfwd_interface": "wan|wan2|both"
}

View File

@@ -0,0 +1,20 @@
{
"name": ".{1,128}",
"vlan_enabled": "false|true",
"vlan_wlan_mode": "disabled|optional|required",
"use_usg_auth_server": "false|true",
"auth_servers": [{
"ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"port": "^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$",
"x_secret": ""
}],
"accounting_enabled": "false|true",
"use_usg_acct_server": "false|true",
"interim_update_enabled": "false|true",
"interim_update_interval": "^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$",
"acct_servers": [{
"ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$",
"port": "^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$|^$",
"x_secret": ""
}]
}

View File

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

View File

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

420
fields/5.14.23/Setting.json Normal file
View File

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

View File

@@ -0,0 +1,4 @@
{
"enabled": "false|true",
"interval": "^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$"
}

View File

@@ -0,0 +1,6 @@
{
"enabled": "true|false",
"server": "",
"outbound_proxy": "",
"package_url": ""
}

View File

@@ -0,0 +1,8 @@
{
"sound_before_enabled": "true|false",
"sound_before_type": "sample|media",
"sound_before_resource": "",
"sound_after_enabled": "true|false",
"sound_after_type": "sample|media",
"sound_after_resource": ""
}

View File

@@ -0,0 +1,8 @@
{
"enable_isolated_wlan": "true|false",
"enabled": "true|false",
"x_mesh_essid": "",
"x_mesh_psk": "",
"uplink_host": "",
"uplink_type": ""
}

View File

@@ -0,0 +1,3 @@
{
"code": "[\\d]{1,3}"
}

View File

@@ -0,0 +1,4 @@
{
"enabled": "false|true",
"fingerprintingEnabled": "false|true"
}

View File

@@ -0,0 +1,5 @@
{
"enabled": "true|false",
"x_element_essid": "",
"x_element_psk": ""
}

View File

@@ -0,0 +1,94 @@
{
"portal_enabled": "true|false",
"auth": "none|password|hotspot|facebook_wifi|custom",
"redirect_enabled": "true|false",
"redirect_url": "",
"redirect_https": "true|false",
"redirect_to_https": "true|false",
"portal_customized": "true|false",
"portal_use_hostname": "true|false",
"portal_hostname": "^[a-zA-Z0-9.-]+$|^$",
"expire": "[\\d]+|custom",
"expire_number": "^[1-9][0-9]{0,5}|1000000$",
"expire_unit": "1|60|1440",
"x_password": "",
"custom_ip": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"facebook_enabled": "true|false",
"facebook_app_id": "",
"x_facebook_app_secret": "",
"facebook_scope_email": "true|false",
"facebook_wifi_gw_id": "",
"facebook_wifi_gw_name": "",
"x_facebook_wifi_gw_secret": "",
"facebook_wifi_block_https": "true|false",
"google_enabled": "true|false",
"google_client_id": "",
"x_google_client_secret": "",
"google_domain": "",
"google_scope_email": "true|false",
"voucher_enabled": "true|false",
"voucher_customized": "true|false",
"payment_enabled": "true|false",
"restricted_subnet_": "",
"allowed_subnet_": "",
"restricted_dns_enabled": "false|true",
"restricted_dns_servers": [
"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"
],
"gateway": "paypal|stripe|authorize|quickpay|merchantwarrior|ippay",
"paypal_use_sandbox": "true|false",
"x_paypal_username": "",
"x_paypal_password": "",
"x_paypal_signature": "",
"x_stripe_api_key": "",
"x_quickpay_agreementid": "",
"x_quickpay_apikey": "",
"x_quickpay_merchantid": "",
"quickpay_testmode": "true|false",
"x_authorize_loginid": "",
"x_authorize_transactionkey": "",
"x_merchantwarrior_merchantuuid": "",
"x_merchantwarrior_apikey": "",
"x_merchantwarrior_apipassphrase": "",
"x_ippay_terminalid": "",
"merchantwarrior_use_sandbox": "false|true",
"authorize_use_sandbox": "true|false",
"ippay_use_sandbox": "true|false",
"template_engine": "jsp|angular",
"portal_customized_bg_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_bg_image_enabled": "true|false",
"portal_customized_bg_image_filename": "",
"portal_customized_bg_image_tile": "true|false",
"portal_customized_box_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_opacity": "^[1-9][0-9]?$|^100$|^$",
"portal_customized_button_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_button_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_logo_enabled": "true|false",
"portal_customized_logo_filename": "",
"portal_customized_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_title": "",
"portal_customized_tos_enabled": "true|false",
"portal_customized_tos": "",
"portal_customized_unsplash_author_name": "",
"portal_customized_unsplash_author_username": "",
"portal_customized_welcome_text": "",
"portal_customized_welcome_text_enabled": "true|false",
"portal_customized_welcome_text_position": "under_logo|above_boxes",
"portal_customized_box_link_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_box_text_color": "^#[a-zA-Z0-9]{6}$|^#[a-zA-Z0-9]{3}$|^$",
"portal_customized_languages": [
"^[a-z]{2}(_[A-Z]{2})*$"
],
"radius_enabled": "true|false",
"radius_auth_type": "chap|mschapv2",
"radius_disconnect_enabled": "true|false",
"radius_disconnect_port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]",
"radiusprofile_id": "",
"wechat_enabled": "true|false",
"wechat_app_id": "",
"wechat_shop_id": "",
"x_wechat_app_secret": "",
"x_wechat_secret_key": "",
"ec_enabled": "true|false"
}

View File

@@ -0,0 +1,62 @@
{
"enabled_categories": [
"emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|spamhaus|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm"
],
"endpoint_scanning": "true|false",
"ips_mode": "ids|ips|ipsInline|disabled",
"restrict_tor": "true|false",
"restrict_torrents": "true|false",
"restrict_ip_addresses": "true|false",
"suppression": {
"alerts": [
{
"category": "",
"gid": "[\\d]+",
"id": "[\\d]+",
"signature": "",
"tracking": [
{
"direction": "both|src|dest",
"mode": "ip|subnet|network",
"value": ""
}
],
"type": "all|track"
}
],
"whitelist": [
{
"direction": "both|src|dest",
"mode": "ip|subnet|network",
"value": ""
}
]
},
"dns_filtering": "true|false",
"dns_filters": [
{
"name": "",
"description": "",
"filter": "none|security|adult|family",
"network_id": "",
"version": "v4|v6",
"allowed_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_sites": [
"^[a-zA-Z0-9.-]+$|^$"
],
"blocked_tld": [
"^[a-zA-Z0-9.-]+$|^$"
]
}
],
"honeypot_enabled": "true|false",
"honeypot": [
{
"network_id": "",
"ip_address": "",
"version": "v4|v6"
}
]
}

View File

@@ -0,0 +1,7 @@
{
"enabled": "true|false",
"sync": "true|false",
"touch_event": "true|false",
"brightness": "[1-9]|[1-9][0-9]|100",
"idle_timeout": "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600"
}

View File

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

View File

@@ -0,0 +1,20 @@
{
"alert_enabled": "true|false",
"auto_upgrade": "true|false",
"boot_sound": "true|false",
"led_enabled": "true|false",
"advanced_feature_enabled": "true|false",
"outdoor_mode_enabled": "true|false",
"unifi_idp_enabled": "true|false",
"x_mgmt_key": "[0-9a-f]{32}",
"x_ssh_keys": [
""
],
"x_ssh_username": "^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$",
"x_ssh_password": ".{1,128}",
"x_ssh_md5passwd": "",
"x_ssh_sha512passwd": "",
"x_ssh_enabled": "true|false",
"x_ssh_bind_wildcard": "true|false",
"x_ssh_auth_password_enabled": "true|false"
}

View File

@@ -0,0 +1,3 @@
{
"enabled": "true|false"
}

View File

@@ -0,0 +1,6 @@
{
"ntp_server_1": "",
"ntp_server_2": "",
"ntp_server_3": "",
"ntp_server_4": ""
}

View File

@@ -0,0 +1,3 @@
{
"ugw3_wan2_enabled": "false|true"
}

View File

@@ -0,0 +1,5 @@
{
"enabled": "false|true",
"download": "^[1-9][0-9]*$",
"upload": "^[1-9][0-9]*$"
}

View File

@@ -0,0 +1,27 @@
{
"enabled": "true|false",
"cron_expr": "",
"default": "true|false",
"radios": [
"na|ng"
],
"optimize": [
"channel|power"
],
"channels_ng": [
"1|2|3|4|5|6|7|8|9|10|11|12|13|14"
],
"channels_na": [
"36|40|44|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165"
],
"ht_modes_ng": [
"^(20|40)$"
],
"ht_modes_na": [
"^(20|40|80|160)$"
],
"exclude_devices": [
"([0-9a-z]{2}:){5}[0-9a-z]{2}"
],
"useXY": "true|false"
}

View File

@@ -0,0 +1,10 @@
{
"enabled": "true|false",
"auth_port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]",
"acct_port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]",
"configure_whole_network": "true|false",
"tunneled_reply": "true|false",
"interim_update_interval": "^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$",
"accounting_enabled": "true|false",
"x_secret": "[^\\\"\\' ]{1,128}"
}

View File

@@ -0,0 +1,11 @@
{
"enabled": "true|false",
"ip": "",
"port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]",
"debug": "false|true",
"this_controller": "false|true",
"this_controller_encrypted_only": "false|true",
"netconsole_enabled": "true|false",
"netconsole_host": "",
"netconsole_port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]"
}

View File

@@ -0,0 +1,7 @@
{
"enabled": "true|false",
"enabledV3": "true|false",
"community": ".{1,256}",
"username": "[a-zA-Z0-9_-]{1,30}",
"x_password": "[^'\"]{8,32}"
}

View File

@@ -0,0 +1,9 @@
{
"enabled": "true|false",
"x_certificate_arn": "",
"x_certificate_pem": "",
"device_id": "",
"device_auth": "",
"x_private_key": "",
"ubic_uuid": ""
}

View File

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

View File

@@ -0,0 +1,5 @@
{
"controller_channel": "internal|alpha|beta|release-candidate|release",
"firmware_channel": "internal|alpha|beta|release-candidate|release",
"sso_enabled": "true|false"
}

View File

@@ -0,0 +1,4 @@
{
"name": "",
"hostname": ""
}

View File

@@ -0,0 +1,3 @@
{
"provider": "smtp|cloud|disabled"
}

View File

@@ -0,0 +1,49 @@
{
"override_inform_host": "true|false",
"auto_upgrade": "true|false",
"discoverable": "true|false",
"led_enabled": "true|false",
"live_chat": "disabled|super-only|everyone",
"live_updates": "disabled|live|auto",
"store_enabled": "disabled|super-only|everyone",
"x_ssh_username": "",
"x_ssh_password": "",
"autobackup_enabled": "true|false",
"autobackup_cron_expr": "",
"autobackup_days": "-?[\\d]+",
"autobackup_max_files": "[\\d]+",
"autobackup_timezone": "",
"autobackup_s3_access_key": "",
"autobackup_s3_access_secret": "",
"autobackup_s3_bucket": "",
"autobackup_gcs_certificate_path": "",
"autobackup_gcs_bucket": "",
"autobackup_local_path": "",
"autobackup_post_actions": [
"copy_local|copy_s3|copy_gcs|copy_cloud"
],
"backup_to_cloud_enabled": "true|false",
"google_maps_api_key": "",
"minimum_usable_hd_space": "[\\d]+",
"minimum_usable_sd_space": "[\\d]+",
"image_maps_use_google_engine": "true|false",
"data_retention_time_enabled": "true|false",
"data_retention_time_in_hours_for_5minutes_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_hourly_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_daily_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_monthly_scale": "-?[\\d]+",
"data_retention_time_in_hours_for_others": "-?[\\d]+",
"time_series_per_client_stats_enabled": "true|false",
"contact_info_full_name": "",
"contact_info_company_name": "",
"contact_info_phone_number": "",
"contact_info_shipping_address_1": "",
"contact_info_shipping_address_2": "",
"contact_info_city": "",
"contact_info_state": "",
"contact_info_zip": "",
"contact_info_country": "",
"default_site_device_auth_password_alert": "false",
"enable_analytics": "true|false",
"analytics_disapproved_for": ""
}

View File

@@ -0,0 +1,14 @@
{
"enabled": "true|false",
"migrated": "true|false",
"ubic_uuid": "",
"auth_token": "",
"device_id": "",
"oauth_enabled": "true|false",
"oauth_redirect_uris": [
""
],
"oauth_app_id": "",
"x_oauth_app_secret": "",
"sso_login_enabled": ""
}

View File

@@ -0,0 +1,11 @@
{
"enabled": "true|false",
"host": "",
"port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]|^$",
"sender": "",
"use_ssl": "true|false",
"use_sender": "true|false",
"use_auth": "true|false",
"username": "",
"x_password": ""
}

View File

@@ -0,0 +1,57 @@
{
"dhcp_relay_server_1": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcp_relay_server_2": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcp_relay_server_3": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcp_relay_server_4": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcp_relay_server_5": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$",
"dhcp_relay_hop_count": "([1-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|^$",
"dhcp_relay_max_size": "(6[4-9]|[7-9][0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1[0-3][0-9]{2}|1400)|^$",
"dhcp_relay_port": "[1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]|^$",
"dhcp_relay_agents_packets": "append|discard|forward|replace|^$",
"upnp_enabled": "true|false",
"upnp_wan_interface": "WAN|WAN2",
"upnp_nat_pmp_enabled": "true|false",
"upnp_secure_mode": "true|false",
"firewall_wan_default_log": "true|false",
"firewall_lan_default_log": "true|false",
"firewall_guest_default_log": "true|false",
"ftp_module": "true|false",
"gre_module": "true|false",
"h323_module": "true|false",
"pptp_module": "true|false",
"sip_module": "true|false",
"tftp_module": "true|false",
"icmp_timeout": "",
"other_timeout": "",
"tcp_close_timeout": "",
"tcp_close_wait_timeout": "",
"tcp_established_timeout": "",
"tcp_fin_wait_timeout": "",
"tcp_last_ack_timeout": "",
"tcp_syn_recv_timeout": "",
"tcp_syn_sent_timeout": "",
"tcp_time_wait_timeout": "",
"udp_other_timeout": "",
"udp_stream_timeout": "",
"broadcast_ping": "true|false",
"receive_redirects": "true|false",
"send_redirects": "true|false",
"syn_cookies": "true|false",
"offload_accounting": "true|false",
"offload_l2_blocking": "true|false",
"offload_sch": "true|false",
"mdns_enabled": "true|false",
"echo_server": "[^\\\"\\' ]{1,255}",
"lldp_enable_all": "true|false",
"mss_clamp_mss": "[1-9][0-9]{2,3}",
"mss_clamp": "auto|custom|disabled",
"dhcpd_use_dnsmasq": "true|false",
"dhcpd_hostfile_update": "true|false",
"geo_ip_filtering_enabled": "true|false",
"geo_ip_filtering_block": "block|allow",
"geo_ip_filtering_countries": "^([A-Z]{2})?(,[A-Z]{2}){0,149}$",
"geo_ip_filtering_traffic_direction": "^(both|ingress|egress)$",
"arp_cache_timeout": "normal|min-dhcp-lease|custom",
"arp_cache_base_reachable": "^$|^[1-9]{1}[0-9]{0,4}$",
"dnsmasq_all_servers": "true|false"
}

View File

@@ -0,0 +1,3 @@
{
"dhcp_snoop": "true|false"
}

View File

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

4
fields/5.14.23/Tag.json Normal file
View File

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

12
fields/5.14.23/User.json Normal file
View File

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

View File

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

View File

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

9
fields/5.14.23/Wall.json Normal file
View File

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

View File

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

View File

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

131
fields/api.go.tmpl Normal file
View File

@@ -0,0 +1,131 @@
{{- $structName := .StructName }}
{{ define "field" }}
{{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ .FieldType }} `json:"{{ .JSONName }}{{ if .OmitEmpty }},omitempty{{ end }}"` {{ if .FieldValidation }}// {{ .FieldValidation }}{{ end }} {{- end }}
{{ define "field-embed" }}
{{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ if not .Fields }}{{ .FieldType }}{{ else }}struct {
{{ range $fk, $fv := .Fields }}{{ if not $fv }}
{{ else }}{{- template "field-embed" $fv }}{{ end }}{{ end }}
}{{ end }} `json:"{{ .JSONName }}{{ if .OmitEmpty }},omitempty{{ end }}"` {{ if .FieldValidation }}// {{ .FieldValidation }}{{ end }} {{- end }}
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
"fmt"
)
// just to fix compile issues with the import
var (
_ fmt.Formatter
_ context.Context
)
{{ if embedTypes -}}
{{- $k := .StructName -}}
{{- $v :=index .Types .StructName -}}
type {{ $k }} struct {
{{ range $fk, $fv := $v.Fields }}{{ if not $fv }}
{{ else }}{{- template "field-embed" $fv }}{{ end }}{{ end }}
}
{{- else -}}
{{ range $k, $v := .Types }}
type {{ $k }} struct {
{{ range $fk, $fv := $v.Fields }}{{ if not $fv }}
{{ else }}{{- template "field" $fv }}{{ end }}{{ end }}
}
{{ end }}
{{- end -}}
{{ if not .IsSetting }}
func (c *Client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ .StructName }}, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []{{ .StructName }} `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat{{ else }}rest{{ end }}/{{ .ResourcePath }}", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
{{- end }}
func (c *Client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSetting }}, id{{ end }} string) (*{{ .StructName }}, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []{{ .StructName }} `json:"data"`
}
{{ if .IsSetting }}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/{{ .ResourcePath }}", site), nil, &respBody)
{{- else }}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat{{ else }}rest{{ end }}/{{ .ResourcePath }}/%s", site, id), nil, &respBody)
{{- end }}
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
{{ if not .IsSetting }}
func (c *Client) delete{{ .StructName }}(ctx context.Context, site, id string) error {
err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) create{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []{{ .StructName }} `json:"data"`
}
err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
{{- end }}
func (c *Client) update{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []{{ .StructName }} `json:"data"`
}
{{ if .IsSetting }}
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/{{ .ResourcePath }}", site), d, &respBody)
{{- else }}
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, d.ID), d, &respBody)
{{- end }}
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -1,15 +1,19 @@
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"text/template"
"github.com/iancoleman/strcase"
)
@@ -79,6 +83,76 @@ var fileReps = []replacement{
{"RadiusProfile", "RADIUSProfile"},
}
var embedTypes bool
type Resource struct {
StructName string
ResourcePath string
Types map[string]*FieldInfo
}
type FieldInfo struct {
FieldName string
JSONName string
FieldType string
FieldValidation string
OmitEmpty bool
IsArray bool
Fields map[string]*FieldInfo
}
func NewResource(structName string, resourcePath string) *Resource {
baseType := NewFieldInfo(structName, resourcePath, "struct", "", false, false)
resource := &Resource{
StructName: structName,
ResourcePath: resourcePath,
Types: map[string]*FieldInfo{
structName: baseType,
},
}
// Since template files iterate through map keys in sorted order, these initial fields
// are named such that they stay at the top for consistency. The spacer items create a
// blank line in the resulting generated file.
//
// This hack is here for stability of the generatd code, but can be removed if desired.
baseType.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,
}
if resource.IsSetting() {
resource.ResourcePath = strcase.ToSnake(strings.TrimPrefix(structName, "Setting"))
baseType.Fields[" Key"] = NewFieldInfo("Key", "key", "string", "", false, false)
}
if resource.StructName == "User" {
baseType.Fields[" IP"] = NewFieldInfo("IP", "ip", "string", "non-generated field", true, false)
}
return resource
}
func NewFieldInfo(fieldName string, jsonName string, fieldType string, fieldValidation string, omitempty bool, isArray bool) *FieldInfo {
return &FieldInfo{
FieldName: fieldName,
JSONName: jsonName,
FieldType: fieldType,
FieldValidation: fieldValidation,
OmitEmpty: omitempty,
IsArray: isArray,
}
}
func cleanName(name string, reps []replacement) string {
for _, rep := range reps {
name = strings.ReplaceAll(name, rep.Old, rep.New)
@@ -87,16 +161,41 @@ func cleanName(name string, reps []replacement) string {
return name
}
func usage() {
fmt.Printf("Usage: %s [OPTIONS] versionDir outputDir\n", path.Base(os.Args[0]))
flag.PrintDefaults()
}
func main() {
version := os.Args[1]
out := os.Args[2]
flag.Usage = usage
noEmbeddedTypes := flag.Bool("no-embedded-types", false, "Whether to generate top-level type definitions for embedded type definitions")
flag.Parse()
versionDir := flag.Arg(0)
outputDir := flag.Arg(1)
embedTypes = !*noEmbeddedTypes
if versionDir == "" {
fmt.Print("error: no version directory specified\n\n")
usage()
os.Exit(1)
}
if outputDir == "" {
fmt.Print("error: no output directory specified\n\n")
usage()
os.Exit(1)
}
wd, err := os.Getwd()
if err != nil {
panic(err)
}
fieldsDir := filepath.Join(wd, version)
outDir := filepath.Join(wd, out)
fieldsDir := filepath.Join(wd, versionDir)
outDir := filepath.Join(wd, outputDir)
fieldsFiles, err := ioutil.ReadDir(fieldsDir)
if err != nil {
@@ -105,38 +204,39 @@ func main() {
for _, fieldsFile := range fieldsFiles {
name := fieldsFile.Name()
// if name != "WlanConf.json" {
// continue
// }
ext := filepath.Ext(name)
switch name {
case "AuthenticationRequest.json", "Setting.json", "Wall.json":
continue
}
if filepath.Ext(name) != ".json" {
continue
}
if name == "Setting.json" {
continue
}
if name == "Wall.json" {
continue
}
name = name[:len(name)-len(ext)]
urlPath := strings.ToLower(name)
structName := cleanName(name, fileReps)
goFile := strcase.ToSnake(structName) + ".generated.go"
code, err := generateCode(filepath.Join(fieldsDir, fieldsFile.Name()), structName, urlPath)
fieldsFilePath := filepath.Join(fieldsDir, fieldsFile.Name())
b, err := ioutil.ReadFile(fieldsFilePath)
if err != nil {
fmt.Printf("skipping file %s: %s", fieldsFile.Name(), err)
continue
// panic(err)
}
resource := NewResource(structName, urlPath)
err = resource.processJSON(b)
if err != nil {
fmt.Printf("skipping file %s: %s", fieldsFile.Name(), err)
continue
}
code, _ := resource.generateCode()
_ = os.Remove(filepath.Join(outDir, goFile))
ioutil.WriteFile(filepath.Join(outDir, goFile), ([]byte)(code), 0644)
}
@@ -144,174 +244,144 @@ func main() {
fmt.Printf("%s\n", outDir)
}
func generateCode(fieldsFile string, structName string, urlPath string) (string, error) {
b, err := ioutil.ReadFile(fieldsFile)
if err != nil {
return "", err
}
func (r *Resource) IsSetting() bool {
return strings.HasPrefix(r.StructName, "Setting")
}
var fields map[string]interface{}
err = json.Unmarshal(b, &fields)
if err != nil {
return "", err
}
code := fmt.Sprintf(`// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"context"
"fmt"
)
// just to fix compile issues with the import
var (
_ fmt.Formatter
_ context.Context
)
type %s struct {
ID string `+"`json:\"_id,omitempty\"`"+`
SiteID string `+"`json:\"site_id,omitempty\"`"+`
Hidden bool `+"`json:\"attr_hidden,omitempty\"`"+`
HiddenID string `+"`json:\"attr_hidden_id,omitempty\"`"+`
NoDelete bool `+"`json:\"attr_no_delete,omitempty\"`"+`
NoEdit bool `+"`json:\"attr_no_edit,omitempty\"`"+`
`, structName)
fieldNames := []string{}
for name := range fields {
fieldNames = append(fieldNames, name)
}
// TODO: sort by normalized name, not this name
sort.Strings(fieldNames)
for _, name := range fieldNames {
switch {
case structName == "Account" && name == "ip":
code += "\tIP string `json:\"ip,omitempty\"`\n"
continue
case structName == "SettingUsg" && strings.HasSuffix(name, "_timeout"):
field := strcase.ToCamel(name)
field = cleanName(field, fieldReps)
code += fmt.Sprintf("\t%s int `json:\"%s,omitempty\"`\n", field, name)
continue
case structName == "User" && name == "blocked":
code += "\tBlocked bool `json:\"blocked,omitempty\"`\n"
continue
case structName == "User" && name == "last_seen":
code += "\tLastSeen int `json:\"last_seen,omitempty\"`\n"
continue
}
validation := fields[name]
fieldCode, err := generateField(name, validation)
func (r *Resource) processFields(fields map[string]interface{}) {
t := r.Types[r.StructName]
for name, validation := range fields {
fieldInfo, err := r.fieldInfoFromValidation(name, validation)
if err != nil {
return "", err
continue
}
code += fieldCode + "\n"
switch {
case r.StructName == "Account" && name == "ip":
fieldInfo.OmitEmpty = true
case r.StructName == "Device" && name == "stp_priority":
fieldInfo.OmitEmpty = true
fieldInfo.FieldType = "string"
case r.StructName == "Device" && (name == "x" || name == "y"):
fieldInfo.OmitEmpty = true
fieldInfo.FieldType = "int"
case r.StructName == "Device":
fieldInfo.OmitEmpty = true
case r.StructName == "SettingUsg" && strings.HasSuffix(name, "_timeout") && name != "arp_cache_timeout":
fieldInfo.FieldType = "int"
case r.StructName == "User" && name == "blocked":
fieldInfo.FieldType = "bool"
case r.StructName == "User" && name == "last_seen":
fieldInfo.FieldType = "int"
}
t.Fields[fieldInfo.FieldName] = fieldInfo
}
switch structName {
case "User":
code += "\t// non-generated fields\n\tIP string `json:\"ip,omitempty\"`\n"
}
code = code + "}\n"
if strings.HasPrefix(structName, "Setting") {
return code, nil
}
code = code + fmt.Sprintf(`
func (c *Client) list%[1]s(ctx context.Context, site string) ([]%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%%s/rest/%[2]s", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) get%[1]s(ctx context.Context, site, id string) (*%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
func (r *Resource) fieldInfoFromValidation(name string, validation interface{}) (f *FieldInfo, err error) {
fieldName := strcase.ToCamel(name)
fieldName = cleanName(fieldName, fieldReps)
empty := &FieldInfo{}
switch validation := validation.(type) {
case []interface{}:
if len(validation) == 0 {
return NewFieldInfo(fieldName, name, "string", "", false, true), nil
}
if len(validation) > 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
}

View File

@@ -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)
})
}

7
fields/settings.sh Normal file → Executable file
View File

@@ -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"
done <<< "$keys"