Initial version

Extracted from paultyng/terraform-provider-unifi@ef25893f14
This commit is contained in:
Paul Tyng
2020-01-10 14:31:12 -05:00
commit 435ecf9d6f
135 changed files with 6973 additions and 0 deletions

373
LICENSE Normal file
View File

@@ -0,0 +1,373 @@
Mozilla Public License Version 2.0
==================================
1. Definitions
--------------
1.1. "Contributor"
means each individual or legal entity that creates, contributes to
the creation of, or owns Covered Software.
1.2. "Contributor Version"
means the combination of the Contributions of others (if any) used
by a Contributor and that particular Contributor's Contribution.
1.3. "Contribution"
means Covered Software of a particular Contributor.
1.4. "Covered Software"
means Source Code Form to which the initial Contributor has attached
the notice in Exhibit A, the Executable Form of such Source Code
Form, and Modifications of such Source Code Form, in each case
including portions thereof.
1.5. "Incompatible With Secondary Licenses"
means
(a) that the initial Contributor has attached the notice described
in Exhibit B to the Covered Software; or
(b) that the Covered Software was made available under the terms of
version 1.1 or earlier of the License, but not also under the
terms of a Secondary License.
1.6. "Executable Form"
means any form of the work other than Source Code Form.
1.7. "Larger Work"
means a work that combines Covered Software with other material, in
a separate file or files, that is not Covered Software.
1.8. "License"
means this document.
1.9. "Licensable"
means having the right to grant, to the maximum extent possible,
whether at the time of the initial grant or subsequently, any and
all of the rights conveyed by this License.
1.10. "Modifications"
means any of the following:
(a) any file in Source Code Form that results from an addition to,
deletion from, or modification of the contents of Covered
Software; or
(b) any new file in Source Code Form that contains any Covered
Software.
1.11. "Patent Claims" of a Contributor
means any patent claim(s), including without limitation, method,
process, and apparatus claims, in any patent Licensable by such
Contributor that would be infringed, but for the grant of the
License, by the making, using, selling, offering for sale, having
made, import, or transfer of either its Contributions or its
Contributor Version.
1.12. "Secondary License"
means either the GNU General Public License, Version 2.0, the GNU
Lesser General Public License, Version 2.1, the GNU Affero General
Public License, Version 3.0, or any later versions of those
licenses.
1.13. "Source Code Form"
means the form of the work preferred for making modifications.
1.14. "You" (or "Your")
means an individual or a legal entity exercising rights under this
License. For legal entities, "You" includes any entity that
controls, is controlled by, or is under common control with You. For
purposes of this definition, "control" means (a) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (b) ownership of more than
fifty percent (50%) of the outstanding shares or beneficial
ownership of such entity.
2. License Grants and Conditions
--------------------------------
2.1. Grants
Each Contributor hereby grants You a world-wide, royalty-free,
non-exclusive license:
(a) under intellectual property rights (other than patent or trademark)
Licensable by such Contributor to use, reproduce, make available,
modify, display, perform, distribute, and otherwise exploit its
Contributions, either on an unmodified basis, with Modifications, or
as part of a Larger Work; and
(b) under Patent Claims of such Contributor to make, use, sell, offer
for sale, have made, import, and otherwise transfer either its
Contributions or its Contributor Version.
2.2. Effective Date
The licenses granted in Section 2.1 with respect to any Contribution
become effective for each Contribution on the date the Contributor first
distributes such Contribution.
2.3. Limitations on Grant Scope
The licenses granted in this Section 2 are the only rights granted under
this License. No additional rights or licenses will be implied from the
distribution or licensing of Covered Software under this License.
Notwithstanding Section 2.1(b) above, no patent license is granted by a
Contributor:
(a) for any code that a Contributor has removed from Covered Software;
or
(b) for infringements caused by: (i) Your and any other third party's
modifications of Covered Software, or (ii) the combination of its
Contributions with other software (except as part of its Contributor
Version); or
(c) under Patent Claims infringed by Covered Software in the absence of
its Contributions.
This License does not grant any rights in the trademarks, service marks,
or logos of any Contributor (except as may be necessary to comply with
the notice requirements in Section 3.4).
2.4. Subsequent Licenses
No Contributor makes additional grants as a result of Your choice to
distribute the Covered Software under a subsequent version of this
License (see Section 10.2) or under the terms of a Secondary License (if
permitted under the terms of Section 3.3).
2.5. Representation
Each Contributor represents that the Contributor believes its
Contributions are its original creation(s) or it has sufficient rights
to grant the rights to its Contributions conveyed by this License.
2.6. Fair Use
This License is not intended to limit any rights You have under
applicable copyright doctrines of fair use, fair dealing, or other
equivalents.
2.7. Conditions
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
in Section 2.1.
3. Responsibilities
-------------------
3.1. Distribution of Source Form
All distribution of Covered Software in Source Code Form, including any
Modifications that You create or to which You contribute, must be under
the terms of this License. You must inform recipients that the Source
Code Form of the Covered Software is governed by the terms of this
License, and how they can obtain a copy of this License. You may not
attempt to alter or restrict the recipients' rights in the Source Code
Form.
3.2. Distribution of Executable Form
If You distribute Covered Software in Executable Form then:
(a) such Covered Software must also be made available in Source Code
Form, as described in Section 3.1, and You must inform recipients of
the Executable Form how they can obtain a copy of such Source Code
Form by reasonable means in a timely manner, at a charge no more
than the cost of distribution to the recipient; and
(b) You may distribute such Executable Form under the terms of this
License, or sublicense it under different terms, provided that the
license for the Executable Form does not attempt to limit or alter
the recipients' rights in the Source Code Form under this License.
3.3. Distribution of a Larger Work
You may create and distribute a Larger Work under terms of Your choice,
provided that You also comply with the requirements of this License for
the Covered Software. If the Larger Work is a combination of Covered
Software with a work governed by one or more Secondary Licenses, and the
Covered Software is not Incompatible With Secondary Licenses, this
License permits You to additionally distribute such Covered Software
under the terms of such Secondary License(s), so that the recipient of
the Larger Work may, at their option, further distribute the Covered
Software under the terms of either this License or such Secondary
License(s).
3.4. Notices
You may not remove or alter the substance of any license notices
(including copyright notices, patent notices, disclaimers of warranty,
or limitations of liability) contained within the Source Code Form of
the Covered Software, except that You may alter any license notices to
the extent required to remedy known factual inaccuracies.
3.5. Application of Additional Terms
You may choose to offer, and to charge a fee for, warranty, support,
indemnity or liability obligations to one or more recipients of Covered
Software. However, You may do so only on Your own behalf, and not on
behalf of any Contributor. You must make it absolutely clear that any
such warranty, support, indemnity, or liability obligation is offered by
You alone, and You hereby agree to indemnify every Contributor for any
liability incurred by such Contributor as a result of warranty, support,
indemnity or liability terms You offer. You may include additional
disclaimers of warranty and limitations of liability specific to any
jurisdiction.
4. Inability to Comply Due to Statute or Regulation
---------------------------------------------------
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Software due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description must
be placed in a text file included with all distributions of the Covered
Software under this License. Except to the extent prohibited by statute
or regulation, such description must be sufficiently detailed for a
recipient of ordinary skill to be able to understand it.
5. Termination
--------------
5.1. The rights granted under this License will terminate automatically
if You fail to comply with any of its terms. However, if You become
compliant, then the rights granted under this License from a particular
Contributor are reinstated (a) provisionally, unless and until such
Contributor explicitly and finally terminates Your grants, and (b) on an
ongoing basis, if such Contributor fails to notify You of the
non-compliance by some reasonable means prior to 60 days after You have
come back into compliance. Moreover, Your grants from a particular
Contributor are reinstated on an ongoing basis if such Contributor
notifies You of the non-compliance by some reasonable means, this is the
first time You have received notice of non-compliance with this License
from such Contributor, and You become compliant prior to 30 days after
Your receipt of the notice.
5.2. If You initiate litigation against any entity by asserting a patent
infringement claim (excluding declaratory judgment actions,
counter-claims, and cross-claims) alleging that a Contributor Version
directly or indirectly infringes any patent, then the rights granted to
You by any and all Contributors for the Covered Software under Section
2.1 of this License shall terminate.
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
end user license agreements (excluding distributors and resellers) which
have been validly granted by You or Your distributors under this License
prior to termination shall survive termination.
************************************************************************
* *
* 6. Disclaimer of Warranty *
* ------------------------- *
* *
* Covered Software is provided under this License on an "as is" *
* basis, without warranty of any kind, either expressed, implied, or *
* statutory, including, without limitation, warranties that the *
* Covered Software is free of defects, merchantable, fit for a *
* particular purpose or non-infringing. The entire risk as to the *
* quality and performance of the Covered Software is with You. *
* Should any Covered Software prove defective in any respect, You *
* (not any Contributor) assume the cost of any necessary servicing, *
* repair, or correction. This disclaimer of warranty constitutes an *
* essential part of this License. No use of any Covered Software is *
* authorized under this License except under this disclaimer. *
* *
************************************************************************
************************************************************************
* *
* 7. Limitation of Liability *
* -------------------------- *
* *
* Under no circumstances and under no legal theory, whether tort *
* (including negligence), contract, or otherwise, shall any *
* Contributor, or anyone who distributes Covered Software as *
* permitted above, be liable to You for any direct, indirect, *
* special, incidental, or consequential damages of any character *
* including, without limitation, damages for lost profits, loss of *
* goodwill, work stoppage, computer failure or malfunction, or any *
* and all other commercial damages or losses, even if such party *
* shall have been informed of the possibility of such damages. This *
* limitation of liability shall not apply to liability for death or *
* personal injury resulting from such party's negligence to the *
* extent applicable law prohibits such limitation. Some *
* jurisdictions do not allow the exclusion or limitation of *
* incidental or consequential damages, so this exclusion and *
* limitation may not apply to You. *
* *
************************************************************************
8. Litigation
-------------
Any litigation relating to this License may be brought only in the
courts of a jurisdiction where the defendant maintains its principal
place of business and such litigation shall be governed by laws of that
jurisdiction, without reference to its conflict-of-law provisions.
Nothing in this Section shall prevent a party's ability to bring
cross-claims or counter-claims.
9. Miscellaneous
----------------
This License represents the complete agreement concerning the subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. Any law or regulation which provides
that the language of a contract shall be construed against the drafter
shall not be used to construe this License against a Contributor.
10. Versions of the License
---------------------------
10.1. New Versions
Mozilla Foundation is the license steward. Except as provided in Section
10.3, no one other than the license steward has the right to modify or
publish new versions of this License. Each version will be given a
distinguishing version number.
10.2. Effect of New Versions
You may distribute the Covered Software under the terms of the version
of the License under which You originally received the Covered Software,
or under the terms of any subsequent version published by the license
steward.
10.3. Modified Versions
If you create software not governed by this License, and you want to
create a new license for such software, you may create and use a
modified version of this License if you rename the license and remove
any references to the name of the license steward (except to note that
such modified license differs from this License).
10.4. Distributing Source Code Form that is Incompatible With Secondary
Licenses
If You choose to distribute Source Code Form that is Incompatible With
Secondary Licenses under the terms of this version of the License, the
notice described in Exhibit B of this License must be attached.
Exhibit A - Source Code Form License Notice
-------------------------------------------
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular
file, then You may include the notice in a location (such as a LICENSE
file in a relevant directory) where a recipient would be likely to look
for such a notice.
You may add additional accurate notices of copyright ownership.
Exhibit B - "Incompatible With Secondary Licenses" Notice
---------------------------------------------------------
This Source Code Form is "Incompatible With Secondary Licenses", as
defined by the Mozilla Public License, v. 2.0.

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# Unifi Go SDK
## Note on Code Generation
The data models and basic REST methods are "generated" from JSON files in the JAR that show all fields and the associated regex/validation information.
This is kind of gross, I wanted to switch to using the java classes in the jar like scala2go but the jar is obfuscated and I couldn't find a way to extract that information from anywhere else. Maybe it exists somewhere in the web UI, but I was unable to find it in there in a way that was extractable in a practical way.
Still planning to dig through the bits some more later on.

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,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": ""
}]
}

133
fields/5.12.35/Device.json Normal file
View File

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

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" : "^$|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|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-route-failed|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit",
"icmpv6_typename" : "^$|address-unreachable|bad-header|communication-prohibited|destination-unreachable|echo-reply|echo-request|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|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,122 @@
{
"name": ".{1,128}",
"venue_name": [
{
"language": "[a-z]{3}",
"name": ".{1,128}"
}
],
"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",
"hessid": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$",
"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" : "[0-9A-Fa-f]{1,2}",
"metrics_downlink_speed": "[0-9]{1,10}",
"metrics_uplink_speed": "[0-9]{1,10}",
"metrics_downlink_load": "[0-9]{1,3}",
"metrics_uplink_load": "[0-9]{1,3}",
"metrics_measurement": "[0-9]{1,5}",
"capab" : [
{
"protocol" : "icmp|tcp_udp|tcp|udp",
"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}",
"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}"
}
]
}
],
"proxy_arp" : "true|false",
"ap_isolate" : "true|false",
"p2p" : "true|false",
"gas_comeback_delay" : "[1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|300",
"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}"
}
]
}

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.12.35/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,139 @@
{
"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",
"vlan_enabled": "false|true",
"vlan": "[2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$",
"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": "[^\"' ]+",
"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,35 @@
{
"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",
"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"
}

408
fields/5.12.35/Setting.json Normal file
View File

@@ -0,0 +1,408 @@
{
"mgmt": {
"alert_enabled": "true|false",
"auto_upgrade": "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",
"upload_debugging_info_enabled" : "true|false",
"enable_analytics" : "true|false"
},
"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": [{
"filter": "security|adult|family",
"network_id": "",
"version": "v4|v6"
}],
"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,51 @@
{
"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": [
{
"filter": "security|adult|family",
"network_id": "",
"version": "v4|v6"
}
],
"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,19 @@
{
"alert_enabled": "true|false",
"auto_upgrade": "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",
"upload_debugging_info_enabled": "true|false",
"enable_analytics": "true|false"
}

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.12.35/Tag.json Normal file
View File

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

12
fields/5.12.35/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.12.35/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,61 @@
{
"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",
"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",
"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"
}

16
fields/getjson.sh Normal file
View File

@@ -0,0 +1,16 @@
#! /bin/bash
#! /bin/bash
deburl="https://dl.ui.com/unifi/5.12.35/unifi_sysvinit_all.deb"
wkdir="$(mktemp -d)"
deb="$wkdir\unifi.deb"
curl -o "$deb" "$deburl"
mkdir -p "$wkdir/unifi"
dpkg-deb -R "$deb" "$wkdir/unifi"
# cp "$wkdir/unifi/usr/lib/unifi/lib/ace.jar" ./
# TODO: extract the JSON field files

377
fields/main.go Normal file
View File

@@ -0,0 +1,377 @@
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"github.com/iancoleman/strcase"
)
type replacement struct {
Old string
New string
}
var fieldReps = []replacement{
{"Ipv6", "IPV6"},
{"Pd", "PD"},
{"Leasetime", "LeaseTime"},
{"Networkgroup", "NetworkGroup"},
{"Openvpn", "OpenVPN"},
{"Nat", "NAT"},
{"Wlangroup", "WLANGroup"},
{"Dns", "DNS"},
{"Tftp", "TFTP"},
{"Dhcpdv6", "DHCPDV6"},
{"Dhcpd", "DHCPD"},
{"Dhcp", "DHCP"},
{"Wlan", "WLAN"},
{"Idx", "IDX"},
{"Id", "ID"},
{"Mac", "MAC"},
{"Vlan", "VLAN"},
{"Wep", "WEP"},
{"Dtim", "DTIM"},
{"Wpa", "WPA"},
{"Usergroup", "UserGroup"},
{"Mcastenhance", "MulticastEnhance"},
{"Ssid", "SSID"},
{"Dpi", "DPI"},
{"Bc", "Broadcast"},
{"Radius", "RADIUS"},
{"Fixedip", "FixedIP"},
{"Ipsec", "IPSec"},
{"Ip", "IP"},
{"Pmf", "PMF"},
{"Minrssi", "MinRSSI"},
{"Qos", "QOS"},
{"Wan", "WAN"},
{"Vpn", "VPN"},
{"Igmp", "IGMP"},
{"Tcp", "TCP"},
{"Udp", "UDP"},
}
var fileReps = []replacement{
{"WlanConf", "WLAN"},
{"Dhcp", "DHCP"},
{"Wlan", "WLAN"},
{"NetworkConf", "Network"},
}
func cleanName(name string, reps []replacement) string {
for _, rep := range reps {
name = strings.ReplaceAll(name, rep.Old, rep.New)
}
return name
}
func main() {
version := os.Args[1]
out := os.Args[2]
wd, err := os.Getwd()
if err != nil {
panic(err)
}
fieldsDir := filepath.Join(wd, version)
outDir := filepath.Join(wd, out)
fieldsFiles, err := ioutil.ReadDir(fieldsDir)
if err != nil {
panic(err)
}
for _, fieldsFile := range fieldsFiles {
name := fieldsFile.Name()
// if name != "WlanConf.json" {
// continue
// }
ext := filepath.Ext(name)
if filepath.Ext(name) != ".json" {
continue
}
if name == "Setting.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)
if err != nil {
fmt.Printf("skipping file %s: %s", fieldsFile.Name(), err)
continue
// panic(err)
}
_ = os.Remove(filepath.Join(outDir, goFile))
ioutil.WriteFile(filepath.Join(outDir, goFile), ([]byte)(code), 0644)
}
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
}
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 (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
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 == "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
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
}
validation := fields[name]
fieldCode, err := generateField(name, validation)
if err != nil {
return "", err
}
code += fieldCode + "\n"
}
code = code + "}\n"
if strings.HasPrefix(structName, "Setting") {
return code, nil
}
code = code + fmt.Sprintf(`
func (c *Client) list%[1]s(site string) ([]%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
}
err := c.do("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(site, id string) (*%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
}
err := c.do("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
}
func (c *Client) delete%[1]s(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%%s/rest/%[2]s/%%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) create%[1]s(site string, d *%[1]s) (*%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
}
err := c.do("POST", fmt.Sprintf("s/%%s/rest/%[2]s", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) update%[1]s(site string, d *%[1]s) (*%[1]s, error) {
var respBody struct {
Meta meta `+"`"+`json:"meta"`+"`"+`
Data []%[1]s `+"`"+`json:"data"`+"`"+`
}
err := c.do("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
}
func normalizeValidation(re string) string {
re = strings.ReplaceAll(re, "\\d", "[0-9]")
re = strings.ReplaceAll(re, "[-+]?", "")
re = strings.ReplaceAll(re, "[+-]?", "")
re = strings.ReplaceAll(re, "[-]?", "")
re = strings.ReplaceAll(re, "\\.", ".")
re = strings.ReplaceAll(re, "[.]?", ".")
quants := regexp.MustCompile(`\{\d*,?\d*\}|\*|\+|\?`)
re = quants.ReplaceAllString(re, "")
control := regexp.MustCompile(`[\(\[\]\)\|\-\$\^]`)
re = control.ReplaceAllString(re, "")
re = strings.TrimPrefix(re, "^")
re = strings.TrimSuffix(re, "$")
return re
}
func typeFromValidation(validation interface{}) (string, string, bool, 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 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
}

47
fields/main_test.go Normal file
View File

@@ -0,0 +1,47 @@
package main
import (
"fmt"
"testing"
)
func TestTypeFromValidation(t *testing.T) {
for i, c := range []struct {
expectedType string
expectedComment string
expectedOmitEmpty bool
validation interface{}
}{
{"string", "", true, ""},
{"string", "default|custom", true, "default|custom"},
{"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", "", true, "^[0-9]*$"},
{"float64", "", true, "[-+]?[0-9]*\\.?[0-9]+"},
// this one is really an error as the . is not escaped
{"float64", "", true, "^([-]?[\\d]+[.]?[\\d]*)$"},
{"float64", "", true, "^([\\d]+[.]?[\\d]*)$"},
{"bool", "", false, "false|true"},
{"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)
if err != nil {
t.Fatal(err)
}
if actualType != c.expectedType {
t.Fatalf("expected type %q got %q", c.expectedType, actualType)
}
if actualComment != c.expectedComment {
t.Fatalf("expected comment %q got %q", c.expectedComment, actualComment)
}
if actualOmitEmpty != c.expectedOmitEmpty {
t.Fatalf("expected omitempty %t got %t", c.expectedOmitEmpty, actualOmitEmpty)
}
})
}
}

10
fields/settings.sh Normal file
View File

@@ -0,0 +1,10 @@
#! /bin/bash
ver="5.12.35"
keys=$(jq -r keys[] "$ver/Setting.json")
while IFS= read -r key; do
fn="$(echo $key | sed -r 's/(^|_)([a-z])/\U\2/g')"
echo "... $key $fn ..."
jq ".$key" "$ver/Setting.json" >> "$ver/Setting$fn.json"
done <<< "$keys"

5
go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/paultyng/go-unifi
go 1.12
require github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334

2
go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334 h1:VHgatEHNcBFEB7inlalqfNqw65aNkM1lGX2yt3NmbS8=
github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=

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

@@ -0,0 +1,110 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type Account 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"`
IP string `json:"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])$|^$
Name string `json:"name,omitempty"` // ^[^"' ]+$
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
TunnelType int `json:"tunnel_type,omitempty"` // [1-9]|1[0-3]|^$
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
XPassword string `json:"x_password,omitempty"`
}
func (c *Client) listAccount(site string) ([]Account, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Account `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/account", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getAccount(site, id string) (*Account, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Account `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/account/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteAccount(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/account/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createAccount(site string, d *Account) (*Account, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Account `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/account", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateAccount(site string, d *Account) (*Account, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Account `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/account/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,105 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type BroadcastGroup 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"`
MemberTable []string `json:"member_table,omitempty"`
Name string `json:"name,omitempty"`
}
func (c *Client) listBroadcastGroup(site string) ([]BroadcastGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []BroadcastGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/broadcastgroup", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getBroadcastGroup(site, id string) (*BroadcastGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []BroadcastGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteBroadcastGroup(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createBroadcastGroup(site string, d *BroadcastGroup) (*BroadcastGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []BroadcastGroup `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/broadcastgroup", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateBroadcastGroup(site string, d *BroadcastGroup) (*BroadcastGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []BroadcastGroup `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/broadcastgroup/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,108 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type DHCPOption 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"`
Code string `json:"code,omitempty"` // ^(?!(?: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 string `json:"name,omitempty"` // ^[A-Za-z0-9-_]{1,25}$
Signed bool `json:"signed"`
Type string `json:"type,omitempty"` // ^(boolean|hexarray|integer|ipaddress|macaddress|text)$
Width int `json:"width,omitempty"` // ^(8|16|32)$
}
func (c *Client) listDHCPOption(site string) ([]DHCPOption, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DHCPOption `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dhcpoption", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getDHCPOption(site, id string) (*DHCPOption, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DHCPOption `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dhcpoption/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteDHCPOption(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dhcpoption/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createDHCPOption(site string, d *DHCPOption) (*DHCPOption, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DHCPOption `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/dhcpoption", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateDHCPOption(site string, d *DHCPOption) (*DHCPOption, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DHCPOption `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dhcpoption/%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
}

111
unifi/dpi_app.generated.go Normal file
View File

@@ -0,0 +1,111 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type DpiApp 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"`
Apps []int `json:"apps,omitempty"`
Blocked bool `json:"blocked"`
Cats []int `json:"cats,omitempty"`
Enabled bool `json:"enabled"`
Log bool `json:"log"`
Name string `json:"name,omitempty"` // .{1,128}
QOSRateMaxDown int `json:"qos_rate_max_down,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
QOSRateMaxUp int `json:"qos_rate_max_up,omitempty"` // -1|[2-9]|[1-9][0-9]{1,4}|100000|10[0-1][0-9]{3}|102[0-3][0-9]{2}|102400
}
func (c *Client) listDpiApp(site string) ([]DpiApp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiApp `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpiapp", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getDpiApp(site, id string) (*DpiApp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiApp `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteDpiApp(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createDpiApp(site string, d *DpiApp) (*DpiApp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiApp `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/dpiapp", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateDpiApp(site string, d *DpiApp) (*DpiApp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiApp `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dpiapp/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,106 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type DpiGroup 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"`
DPIappIDs []string `json:"dpiapp_ids,omitempty"` // [\d\w]+
Enabled bool `json:"enabled"`
Name string `json:"name,omitempty"` // .{1,128}
}
func (c *Client) listDpiGroup(site string) ([]DpiGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpigroup", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getDpiGroup(site, id string) (*DpiGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteDpiGroup(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createDpiGroup(site string, d *DpiGroup) (*DpiGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiGroup `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/dpigroup", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateDpiGroup(site string, d *DpiGroup) (*DpiGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DpiGroup `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dpigroup/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,111 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type DynamicDNS 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"`
CustomService string `json:"custom_service,omitempty"` // ^[^"' ]+$
HostName string `json:"host_name,omitempty"` // ^[^"' ]+$
Interface string `json:"interface,omitempty"` // wan|wan2
Login string `json:"login,omitempty"` // ^[^"' ]+$
Options []string `json:"options,omitempty"` // ^[^"' ]+$
Server string `json:"server"` // ^[^"' ]+$|^$
Service string `json:"service,omitempty"` // afraid|changeip|cloudflare|dnspark|dslreports|dyndns|easydns|googledomains|namecheap|noip|sitelutions|zoneedit|custom
XPassword string `json:"x_password,omitempty"` // ^[^"' ]+$
}
func (c *Client) listDynamicDNS(site string) ([]DynamicDNS, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DynamicDNS `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dynamicdns", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getDynamicDNS(site, id string) (*DynamicDNS, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DynamicDNS `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteDynamicDNS(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createDynamicDNS(site string, d *DynamicDNS) (*DynamicDNS, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DynamicDNS `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/dynamicdns", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateDynamicDNS(site string, d *DynamicDNS) (*DynamicDNS, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []DynamicDNS `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/dynamicdns/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,106 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type FirewallGroup 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"`
GroupMembers []string `json:"group_members,omitempty"`
GroupType string `json:"group_type,omitempty"` // address-group|port-group|ipv6-address-group
Name string `json:"name,omitempty"` // .{1,64}
}
func (c *Client) listFirewallGroup(site string) ([]FirewallGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallgroup", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getFirewallGroup(site, id string) (*FirewallGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallGroup `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallgroup/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteFirewallGroup(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/firewallgroup/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallGroup `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/firewallgroup", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallGroup `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/firewallgroup/%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
}

21
unifi/firewall_group.go Normal file
View File

@@ -0,0 +1,21 @@
package unifi
func (c *Client) ListFirewallGroup(site string) ([]FirewallGroup, error) {
return c.listFirewallGroup(site)
}
func (c *Client) GetFirewallGroup(site, id string) (*FirewallGroup, error) {
return c.getFirewallGroup(site, id)
}
func (c *Client) DeleteFirewallGroup(site, id string) error {
return c.deleteFirewallGroup(site, id)
}
func (c *Client) CreateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
return c.createFirewallGroup(site, d)
}
func (c *Client) UpdateFirewallGroup(site string, d *FirewallGroup) (*FirewallGroup, error) {
return c.updateFirewallGroup(site, d)
}

View File

@@ -0,0 +1,142 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type FirewallRule 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"`
Action string `json:"action,omitempty"` // drop|reject|accept
Contiguous bool `json:"contiguous"`
DstAddress string `json:"dst_address,omitempty"`
DstAddressIPV6 string `json:"dst_address_ipv6,omitempty"`
DstFirewallgroupIDs []string `json:"dst_firewallgroup_ids,omitempty"` // [\d\w]+
DstNetworkconfID string `json:"dst_networkconf_id"` // [\d\w]+|^$
DstNetworkconfType string `json:"dst_networkconf_type,omitempty"` // ADDRv4|NETv4
DstPort string `json:"dst_port,omitempty"`
Enabled bool `json:"enabled"`
IcmpTypename string `json:"icmp_typename"` // ^$|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|protocol-unreachable|redirect|required-option-missing|router-advertisement|router-solicitation|source-route-failed|timestamp-reply|timestamp-request|TOS-host-redirect|TOS-host-unreachable|TOS-network-redirect|TOS-network-unreachable|ttl-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit
Icmpv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|communication-prohibited|destination-unreachable|echo-reply|echo-request|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option
IPSec string `json:"ipsec"` // match-ipsec|match-none|^$
Logging bool `json:"logging"`
Monthdays string `json:"monthdays"` // ^$|^(([1-9]|[12][0-9]|3[01])(,([1-9]|[12][0-9]|3[01])){0,30})$
MonthdaysNegate bool `json:"monthdays_negate"`
Name string `json:"name,omitempty"` // .{1,128}
Protocol string `json:"protocol"` // ^$|all|([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|tcp_udp|ah|ax.25|dccp|ddp|egp|eigrp|encap|esp|etherip|fc|ggp|gre|hip|hmp|icmp|idpr-cmtp|idrp|igmp|igp|ip|ipcomp|ipencap|ipip|ipv6|ipv6-frag|ipv6-icmp|ipv6-nonxt|ipv6-opts|ipv6-route|isis|iso-tp4|l2tp|manet|mobility-header|mpls-in-ip|ospf|pim|pup|rdp|rohc|rspf|rsvp|sctp|shim6|skip|st|tcp|udp|udplite|vmtp|vrrp|wesp|xns-idp|xtp
ProtocolMatchExcepted bool `json:"protocol_match_excepted"`
ProtocolV6 string `json:"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
RuleIndex int `json:"rule_index,omitempty"` // 2[0-9]{3}|4[0-9]{3}
Ruleset string `json:"ruleset,omitempty"` // 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
SrcAddress string `json:"src_address,omitempty"`
SrcAddressIPV6 string `json:"src_address_ipv6,omitempty"`
SrcFirewallgroupIDs []string `json:"src_firewallgroup_ids,omitempty"` // [\d\w]+
SrcMACAddress string `json:"src_mac_address"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
SrcNetworkconfID string `json:"src_networkconf_id"` // [\d\w]+|^$
SrcNetworkconfType string `json:"src_networkconf_type,omitempty"` // ADDRv4|NETv4
SrcPort string `json:"src_port,omitempty"`
Startdate string `json:"startdate"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
Starttime string `json:"starttime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
StateEstablished bool `json:"state_established"`
StateInvalid bool `json:"state_invalid"`
StateNew bool `json:"state_new"`
StateRelated bool `json:"state_related"`
Stopdate string `json:"stopdate"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
Stoptime string `json:"stoptime"` // ^$|^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])$
Utc bool `json:"utc"`
Weekdays string `json:"weekdays"` // ^$|^((Mon|Tue|Wed|Thu|Fri|Sat|Sun)(,(Mon|Tue|Wed|Thu|Fri|Sat|Sun)){0,6})$
WeekdaysNegate bool `json:"weekdays_negate"`
}
func (c *Client) listFirewallRule(site string) ([]FirewallRule, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallRule `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallrule", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getFirewallRule(site, id string) (*FirewallRule, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallRule `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/firewallrule/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteFirewallRule(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/firewallrule/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallRule `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/firewallrule", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []FirewallRule `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/firewallrule/%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
}

21
unifi/firewall_rule.go Normal file
View File

@@ -0,0 +1,21 @@
package unifi
func (c *Client) ListFirewallRule(site string) ([]FirewallRule, error) {
return c.listFirewallRule(site)
}
func (c *Client) GetFirewallRule(site, id string) (*FirewallRule, error) {
return c.getFirewallRule(site, id)
}
func (c *Client) DeleteFirewallRule(site, id string) error {
return c.deleteFirewallRule(site, id)
}
func (c *Client) CreateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
return c.createFirewallRule(site, d)
}
func (c *Client) UpdateFirewallRule(site string, d *FirewallRule) (*FirewallRule, error) {
return c.updateFirewallRule(site, d)
}

107
unifi/heat_map.generated.go Normal file
View File

@@ -0,0 +1,107 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type HeatMap 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"`
Description string `json:"description,omitempty"`
MapID string `json:"map_id"`
Name string `json:"name,omitempty"` // .*[^\s]+.*
Type string `json:"type,omitempty"` // download|upload
}
func (c *Client) listHeatMap(site string) ([]HeatMap, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMap `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmap", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getHeatMap(site, id string) (*HeatMap, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMap `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmap/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteHeatMap(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/heatmap/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createHeatMap(site string, d *HeatMap) (*HeatMap, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMap `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/heatmap", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateHeatMap(site string, d *HeatMap) (*HeatMap, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMap `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/heatmap/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,108 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type HeatMapPoint 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"`
DownloadSpeed float64 `json:"download_speed,omitempty"`
HeatmapID string `json:"heatmap_id"`
UploadSpeed float64 `json:"upload_speed,omitempty"`
X float64 `json:"x,omitempty"`
Y float64 `json:"y,omitempty"`
}
func (c *Client) listHeatMapPoint(site string) ([]HeatMapPoint, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMapPoint `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmappoint", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getHeatMapPoint(site, id string) (*HeatMapPoint, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMapPoint `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteHeatMapPoint(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createHeatMapPoint(site string, d *HeatMapPoint) (*HeatMapPoint, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMapPoint `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/heatmappoint", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateHeatMapPoint(site string, d *HeatMapPoint) (*HeatMapPoint, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HeatMapPoint `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/heatmappoint/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,106 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type HotspotOp 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"`
Name string `json:"name,omitempty"` // .{1,256}
Note string `json:"note,omitempty"`
XPassword string `json:"x_password,omitempty"` // .{1,256}
}
func (c *Client) listHotspotOp(site string) ([]HotspotOp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotOp `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotop", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getHotspotOp(site, id string) (*HotspotOp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotOp `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteHotspotOp(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createHotspotOp(site string, d *HotspotOp) (*HotspotOp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotOp `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/hotspotop", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateHotspotOp(site string, d *HotspotOp) (*HotspotOp, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotOp `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/hotspotop/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,132 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type HotspotPackage 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"`
Amount float64 `json:"amount,omitempty"`
ChargedAs string `json:"charged_as,omitempty"`
Currency string `json:"currency,omitempty"` // [A-Z]{3}
CustomPaymentFieldsEnabled bool `json:"custom_payment_fields_enabled"`
Hours int `json:"hours,omitempty"`
Index int `json:"index,omitempty"`
LimitDown int `json:"limit_down,omitempty"`
LimitOverwrite bool `json:"limit_overwrite"`
LimitQuota int `json:"limit_quota,omitempty"`
LimitUp int `json:"limit_up,omitempty"`
Name string `json:"name,omitempty"`
PaymentFieldsAddressEnabled bool `json:"payment_fields_address_enabled"`
PaymentFieldsAddressRequired bool `json:"payment_fields_address_required"`
PaymentFieldsCityEnabled bool `json:"payment_fields_city_enabled"`
PaymentFieldsCityRequired bool `json:"payment_fields_city_required"`
PaymentFieldsCountryDefault string `json:"payment_fields_country_default,omitempty"`
PaymentFieldsCountryEnabled bool `json:"payment_fields_country_enabled"`
PaymentFieldsCountryRequired bool `json:"payment_fields_country_required"`
PaymentFieldsEmailEnabled bool `json:"payment_fields_email_enabled"`
PaymentFieldsEmailRequired bool `json:"payment_fields_email_required"`
PaymentFieldsFirstNameEnabled bool `json:"payment_fields_first_name_enabled"`
PaymentFieldsFirstNameRequired bool `json:"payment_fields_first_name_required"`
PaymentFieldsLastNameEnabled bool `json:"payment_fields_last_name_enabled"`
PaymentFieldsLastNameRequired bool `json:"payment_fields_last_name_required"`
PaymentFieldsStateEnabled bool `json:"payment_fields_state_enabled"`
PaymentFieldsStateRequired bool `json:"payment_fields_state_required"`
PaymentFieldsZipEnabled bool `json:"payment_fields_zip_enabled"`
PaymentFieldsZipRequired bool `json:"payment_fields_zip_required"`
TrialReset float64 `json:"trial_reset,omitempty"`
}
func (c *Client) listHotspotPackage(site string) ([]HotspotPackage, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotPackage `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotpackage", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getHotspotPackage(site, id string) (*HotspotPackage, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotPackage `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/hotspotpackage/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteHotspotPackage(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/hotspotpackage/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createHotspotPackage(site string, d *HotspotPackage) (*HotspotPackage, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotPackage `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/hotspotpackage", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateHotspotPackage(site string, d *HotspotPackage) (*HotspotPackage, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []HotspotPackage `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/hotspotpackage/%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
}

116
unifi/map.generated.go Normal file
View File

@@ -0,0 +1,116 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type Map 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"`
Lat string `json:"lat,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
Lng string `json:"lng,omitempty"` // ^([-]?[\d]+[.]?[\d]*([eE][-+]?[\d]+)?)$
MapTypeID string `json:"mapTypeId"` // satellite|roadmap|hybrid|terrain
Name string `json:"name,omitempty"`
OffsetLeft float64 `json:"offset_left,omitempty"`
OffsetTop float64 `json:"offset_top,omitempty"`
Opacity float64 `json:"opacity,omitempty"` // ^(0(\.[\d]{1,2})?|1)$|^$
Selected bool `json:"selected"`
Tilt int `json:"tilt,omitempty"`
Type string `json:"type,omitempty"` // designerMap|imageMap|googleMap
Unit string `json:"unit,omitempty"` // m|f
Upp float64 `json:"upp,omitempty"`
Zoom int `json:"zoom,omitempty"`
}
func (c *Client) listMap(site string) ([]Map, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Map `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/map", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getMap(site, id string) (*Map, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Map `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/map/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteMap(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/map/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createMap(site string, d *Map) (*Map, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Map `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/map", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateMap(site string, d *Map) (*Map, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Map `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/map/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,104 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type MediaFile 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"`
Name string `json:"name,omitempty"`
}
func (c *Client) listMediaFile(site string) ([]MediaFile, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []MediaFile `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/mediafile", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getMediaFile(site, id string) (*MediaFile, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []MediaFile `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/mediafile/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteMediaFile(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/mediafile/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createMediaFile(site string, d *MediaFile) (*MediaFile, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []MediaFile `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/mediafile", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateMediaFile(site string, d *MediaFile) (*MediaFile, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []MediaFile `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/mediafile/%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
}

239
unifi/network.generated.go Normal file
View File

@@ -0,0 +1,239 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type Network 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"`
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"`
DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty"` // .{1,256}
DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$
DHCPDDNS1 string `json:"dhcpd_dns_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDDNS2 string `json:"dhcpd_dns_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDDNS3 string `json:"dhcpd_dns_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDDNS4 string `json:"dhcpd_dns_4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDDNSEnabled bool `json:"dhcpd_dns_enabled"`
DHCPDEnabled bool `json:"dhcpd_enabled"`
DHCPDGateway string `json:"dhcpd_gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDGatewayEnabled bool `json:"dhcpd_gateway_enabled"`
DHCPDIP1 string `json:"dhcpd_ip_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDIP2 string `json:"dhcpd_ip_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDIP3 string `json:"dhcpd_ip_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDLeaseTime int `json:"dhcpd_leasetime,omitempty"`
DHCPDMAC1 string `json:"dhcpd_mac_1,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC2 string `json:"dhcpd_mac_2,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDMAC3 string `json:"dhcpd_mac_3,omitempty"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
DHCPDNtp1 string `json:"dhcpd_ntp_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDNtp2 string `json:"dhcpd_ntp_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDNtpEnabled bool `json:"dhcpd_ntp_enabled"`
DHCPDStart string `json:"dhcpd_start"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDStop string `json:"dhcpd_stop"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDTFTPServer string `json:"dhcpd_tftp_server,omitempty"`
DHCPDTimeOffset int `json:"dhcpd_time_offset,omitempty"` // ^0$|^-?([1-9]([0-9]{1,3})?|[1-7][0-9]{4}|[8][0-5][0-9]{3}|86[0-3][0-9]{2}|86400)$
DHCPDTimeOffsetEnabled bool `json:"dhcpd_time_offset_enabled"`
DHCPDUnifiController string `json:"dhcpd_unifi_controller"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDWins1 string `json:"dhcpd_wins_1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDWins2 string `json:"dhcpd_wins_2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
DHCPDWinsEnabled bool `json:"dhcpd_wins_enabled"`
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
DHCPDV6DNS1 string `json:"dhcpdv6_dns_1,omitempty"`
DHCPDV6DNS2 string `json:"dhcpdv6_dns_2,omitempty"`
DHCPDV6DNS3 string `json:"dhcpdv6_dns_3,omitempty"`
DHCPDV6DNS4 string `json:"dhcpdv6_dns_4,omitempty"`
DHCPDV6DNSAuto bool `json:"dhcpdv6_dns_auto"`
DHCPDV6Enabled bool `json:"dhcpdv6_enabled"`
DHCPDV6LeaseTime int `json:"dhcpdv6_leasetime,omitempty"`
DHCPDV6Start string `json:"dhcpdv6_start,omitempty"`
DHCPDV6Stop string `json:"dhcpdv6_stop,omitempty"`
DHCPguardEnabled bool `json:"dhcpguard_enabled"`
DomainName string `json:"domain_name,omitempty"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
DPIEnabled bool `json:"dpi_enabled"`
DPIgroupID string `json:"dpigroup_id"` // [\d\w]+|^$
Enabled bool `json:"enabled"`
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
IGMPFastleave bool `json:"igmp_fastleave"`
IGMPGroupmembership int `json:"igmp_groupmembership,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
IGMPMaxresponse int `json:"igmp_maxresponse,omitempty"` // [1-9]|1[0-9]|2[0-5]|^$
IGMPMcrtrexpiretime int `json:"igmp_mcrtrexpiretime,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-2][0-9]{3}|3[0-5][0-9]{2}|3600|^$
IGMPQuerier string `json:"igmp_querier"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
IGMPSnooping bool `json:"igmp_snooping"`
IGMPSupression bool `json:"igmp_supression"`
IPSubnet string `json:"ip_subnet,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$
IPSecDhGroup int `json:"ipsec_dh_group,omitempty"` // 2|5|14|15|16|19|20|21|25|26
IPSecDynamicRouting bool `json:"ipsec_dynamic_routing"`
IPSecEncryption string `json:"ipsec_encryption,omitempty"` // aes128|aes192|aes256|3des
IPSecEspDhGroup int `json:"ipsec_esp_dh_group,omitempty"` // 1|2|5|14|15|16|17|18
IPSecHash string `json:"ipsec_hash,omitempty"` // sha1|md5|sha256|sha384|sha512
IPSecIkeDhGroup int `json:"ipsec_ike_dh_group,omitempty"` // 1|2|5|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32
IPSecInterface string `json:"ipsec_interface,omitempty"` // wan|wan2
IPSecKeyExchange string `json:"ipsec_key_exchange,omitempty"` // ikev1|ikev2
IPSecLocalIP string `json:"ipsec_local_ip,omitempty"` // ^any$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
IPSecPeerIP string `json:"ipsec_peer_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
IPSecPfs bool `json:"ipsec_pfs"`
IPSecProfile string `json:"ipsec_profile,omitempty"` // customized|azure_dynamic|azure_static
IPV6InterfaceType string `json:"ipv6_interface_type,omitempty"` // static|pd|none
IPV6PDInterface string `json:"ipv6_pd_interface,omitempty"` // wan|wan2
IPV6PDPrefixid string `json:"ipv6_pd_prefixid"` // ^$|[a-fA-F0-9]{1,4}
IPV6PDStart string `json:"ipv6_pd_start,omitempty"`
IPV6PDStop string `json:"ipv6_pd_stop,omitempty"`
IPV6RaEnabled bool `json:"ipv6_ra_enabled"`
IPV6RaPreferredLifetime int `json:"ipv6_ra_preferred_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
IPV6RaPriority string `json:"ipv6_ra_priority,omitempty"` // high|medium|low
IPV6RaValidLifetime int `json:"ipv6_ra_valid_lifetime,omitempty"` // ^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|[12][0-9]{7}|30[0-9]{6}|31[0-4][0-9]{5}|315[0-2][0-9]{4}|3153[0-5][0-9]{3}|31536000)$|^$
IPV6Subnet string `json:"ipv6_subnet,omitempty"`
IsNAT bool `json:"is_nat"`
L2TpInterface string `json:"l2tp_interface,omitempty"` // wan|wan2
LteLanEnabled bool `json:"lte_lan_enabled"`
Name string `json:"name,omitempty"` // .{1,128}
NATOutboundIP string `json:"nat_outbound_ip,omitempty"`
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?
OpenVPNLocalAddress string `json:"openvpn_local_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNLocalPort int `json:"openvpn_local_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
OpenVPNMode string `json:"openvpn_mode,omitempty"` // site-to-site|client|server
OpenVPNRemoteAddress string `json:"openvpn_remote_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNRemoteHost string `json:"openvpn_remote_host,omitempty"` // [^\"\' ]+|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNRemotePort int `json:"openvpn_remote_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
PptpcRequireMppe bool `json:"pptpc_require_mppe"`
PptpcRouteDistance int `json:"pptpc_route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
PptpcServerIP string `json:"pptpc_server_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$
PptpcUsername string `json:"pptpc_username,omitempty"` // [^\"\' ]+
Priority int `json:"priority,omitempty"` // [1-4]
Purpose string `json:"purpose,omitempty"` // corporate|guest|remote-user-vpn|site-vpn|vlan-only|vpn-client|wan
RADIUSprofileID string `json:"radiusprofile_id"`
RemoteSiteID string `json:"remote_site_id"`
RemoteSiteSubnets []string `json:"remote_site_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
RemoteVPNSubnets []string `json:"remote_vpn_subnets,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|30)$|^$
ReportWANEvent bool `json:"report_wan_event"`
RequireMschapv2 bool `json:"require_mschapv2"`
RouteDistance int `json:"route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
UpnpLanEnabled bool `json:"upnp_lan_enabled"`
UserGroupID string `json:"usergroup_id"`
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|400[0-9]|^$
VLANEnabled bool `json:"vlan_enabled"`
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server
WANDHCPv6PDSize int `json:"wan_dhcpv6_pd_size,omitempty"` // ^(4[89]|5[0-9]|6[0-4])$|^$
WANDNS1 string `json:"wan_dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
WANDNS2 string `json:"wan_dns2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
WANDNS3 string `json:"wan_dns3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
WANDNS4 string `json:"wan_dns4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
WANEgressQOS int `json:"wan_egress_qos,omitempty"` // [1-7]|^$
WANGateway string `json:"wan_gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
WANGatewayV6 string `json:"wan_gateway_v6"` // ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
WANIP string `json:"wan_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
WANIPV6 string `json:"wan_ipv6"` // ^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
WANLoadBalanceType string `json:"wan_load_balance_type,omitempty"` // failover-only|weighted
WANLoadBalanceWeight int `json:"wan_load_balance_weight,omitempty"` // [1-9]|[1-9][0-9]
WANNetmask string `json:"wan_netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
WANNetworkGroup string `json:"wan_networkgroup,omitempty"` // WAN[2]?|WAN_LTE_FAILOVER
WANPrefixlen int `json:"wan_prefixlen,omitempty"` // ^([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])$|^$
WANSmartqDownRate int `json:"wan_smartq_down_rate,omitempty"` // [0-9]{1,6}|1000000
WANSmartqEnabled bool `json:"wan_smartq_enabled"`
WANSmartqUpRate int `json:"wan_smartq_up_rate,omitempty"` // [0-9]{1,6}|1000000
WANType string `json:"wan_type,omitempty"` // disabled|dhcp|static|pppoe
WANTypeV6 string `json:"wan_type_v6,omitempty"` // disabled|dhcpv6|static
WANUsername string `json:"wan_username,omitempty"` // [^"' ]+
WANVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
WANVLANEnabled bool `json:"wan_vlan_enabled"`
XIPSecPreSharedKey string `json:"x_ipsec_pre_shared_key,omitempty"` // [^\"\' ]+
XOpenVPNSharedSecretKey string `json:"x_openvpn_shared_secret_key,omitempty"` // [0-9A-Fa-f]{512}
XPptpcPassword string `json:"x_pptpc_password,omitempty"` // [^\"\' ]+
XWANPassword string `json:"x_wan_password,omitempty"` // [^"' ]+
}
func (c *Client) listNetwork(site string) ([]Network, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Network `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/networkconf", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getNetwork(site, id string) (*Network, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Network `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteNetwork(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createNetwork(site string, d *Network) (*Network, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Network `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/networkconf", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateNetwork(site string, d *Network) (*Network, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Network `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/networkconf/%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
}

57
unifi/network.go Normal file
View File

@@ -0,0 +1,57 @@
package unifi
import (
"encoding/json"
"fmt"
)
func (n *Network) UnmarshalJSON(b []byte) error {
type Alias Network
aux := &struct {
VLAN json.Number `json:"vlan"`
*Alias
}{
Alias: (*Alias)(n),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return err
}
n.VLAN = 0
if aux.VLAN.String() != "" {
vlan, err := aux.VLAN.Int64()
if err != nil {
return err
}
n.VLAN = int(vlan)
}
return nil
}
func (c *Client) DeleteNetwork(site, id, name string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/networkconf/%s", site, id), struct {
Name string `json:"name"`
}{
Name: name,
}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) ListNetwork(site string) ([]Network, error) {
return c.listNetwork(site)
}
func (c *Client) GetNetwork(site, id string) (*Network, error) {
return c.getNetwork(site, id)
}
func (c *Client) CreateNetwork(site string, d *Network) (*Network, error) {
return c.createNetwork(site, d)
}
func (c *Client) UpdateNetwork(site string, d *Network) (*Network, error) {
return c.updateNetwork(site, d)
}

View File

@@ -0,0 +1,136 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type PortConf 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"`
Autoneg bool `json:"autoneg"`
Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host
EgressRateLimitKbps int `json:"egress_rate_limit_kbps,omitempty"` // 6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}
EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled"`
Forward string `json:"forward,omitempty"` // all|native|customize|disabled
FullDuplex bool `json:"full_duplex"`
Isolation bool `json:"isolation"`
LldpmedEnabled bool `json:"lldpmed_enabled"`
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
Name string `json:"name,omitempty"`
NATiveNetworkconfID string `json:"native_networkconf_id"`
OpMode string `json:"op_mode,omitempty"` // switch
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
PortSecurityEnabled bool `json:"port_security_enabled"`
PortSecurityMACAddress []string `json:"port_security_mac_address,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
PriorityQueue1Level int `json:"priority_queue1_level,omitempty"` // [0-9]|[1-9][0-9]|100
PriorityQueue2Level int `json:"priority_queue2_level,omitempty"` // [0-9]|[1-9][0-9]|100
PriorityQueue3Level int `json:"priority_queue3_level,omitempty"` // [0-9]|[1-9][0-9]|100
PriorityQueue4Level int `json:"priority_queue4_level,omitempty"` // [0-9]|[1-9][0-9]|100
Speed int `json:"speed,omitempty"` // 10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000
StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled"`
StormctrlBroadcastastLevel int `json:"stormctrl_bcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
StormctrlBroadcastastRate int `json:"stormctrl_bcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled"`
StormctrlMcastLevel int `json:"stormctrl_mcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
StormctrlMcastRate int `json:"stormctrl_mcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
StormctrlType string `json:"stormctrl_type,omitempty"` // level|rate
StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled"`
StormctrlUcastLevel int `json:"stormctrl_ucast_level,omitempty"` // [0-9]|[1-9][0-9]|100
StormctrlUcastRate int `json:"stormctrl_ucast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
StpPortMode bool `json:"stp_port_mode"`
TaggedNetworkconfIDs []string `json:"tagged_networkconf_ids,omitempty"`
VoiceNetworkconfID string `json:"voice_networkconf_id"`
}
func (c *Client) listPortConf(site string) ([]PortConf, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortConf `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/portconf", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getPortConf(site, id string) (*PortConf, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortConf `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/portconf/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deletePortConf(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/portconf/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createPortConf(site string, d *PortConf) (*PortConf, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortConf `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/portconf", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updatePortConf(site string, d *PortConf) (*PortConf, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortConf `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/portconf/%s", site, d.ID), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -0,0 +1,112 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type PortForward 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"`
DstPort string `json:"dst_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
Enabled bool `json:"enabled"`
Fwd string `json:"fwd,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
FwdPort string `json:"fwd_port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
Log bool `json:"log"`
Name string `json:"name,omitempty"` // .{1,128}
PfwdInterface string `json:"pfwd_interface,omitempty"` // wan|wan2|both
Proto string `json:"proto,omitempty"` // tcp_udp|tcp|udp
Src string `json:"src,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])-(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([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$
}
func (c *Client) listPortForward(site string) ([]PortForward, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortForward `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/portforward", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getPortForward(site, id string) (*PortForward, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortForward `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/portforward/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deletePortForward(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/portforward/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createPortForward(site string, d *PortForward) (*PortForward, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortForward `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/portforward", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updatePortForward(site string, d *PortForward) (*PortForward, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []PortForward `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/portforward/%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
}

21
unifi/port_forward.go Normal file
View File

@@ -0,0 +1,21 @@
package unifi
func (c *Client) ListPortForward(site string) ([]PortForward, error) {
return c.listPortForward(site)
}
func (c *Client) GetPortForward(site, id string) (*PortForward, error) {
return c.getPortForward(site, id)
}
func (c *Client) DeletePortForward(site, id string) error {
return c.deletePortForward(site, id)
}
func (c *Client) CreatePortForward(site string, d *PortForward) (*PortForward, error) {
return c.createPortForward(site, d)
}
func (c *Client) UpdatePortForward(site string, d *PortForward) (*PortForward, error) {
return c.updatePortForward(site, d)
}

111
unifi/routing.generated.go Normal file
View File

@@ -0,0 +1,111 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type Routing 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"`
Enabled bool `json:"enabled"`
Name string `json:"name,omitempty"` // .{1,128}
StaticRouteDistance int `json:"static-route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
StaticRouteInterface string `json:"static-route_interface"` // WAN1|WAN2|[\d\w]+|^$
StaticRouteNetwork string `json:"static-route_network,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\/([1-9]|[1-2][0-9]|3[0-2])$|^([a-fA-F0-9:]+\/(([1-9]|[1-8][0-9]|9[0-9]|1[01][0-9]|12[0-8])))$
StaticRouteNexthop string `json:"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:]+)$|^$
StaticRouteType string `json:"static-route_type,omitempty"` // nexthop-route|interface-route|blackhole
Type string `json:"type,omitempty"` // static-route
}
func (c *Client) listRouting(site string) ([]Routing, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Routing `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/routing", site), nil, &respBody)
if err != nil {
return nil, err
}
return respBody.Data, nil
}
func (c *Client) getRouting(site, id string) (*Routing, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Routing `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/rest/routing/%s", site, id), nil, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
d := respBody.Data[0]
return &d, nil
}
func (c *Client) deleteRouting(site, id string) error {
err := c.do("DELETE", fmt.Sprintf("s/%s/rest/routing/%s", site, id), struct{}{}, nil)
if err != nil {
return err
}
return nil
}
func (c *Client) createRouting(site string, d *Routing) (*Routing, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Routing `json:"data"`
}
err := c.do("POST", fmt.Sprintf("s/%s/rest/routing", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}
func (c *Client) updateRouting(site string, d *Routing) (*Routing, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []Routing `json:"data"`
}
err := c.do("PUT", fmt.Sprintf("s/%s/rest/routing/%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
}

118
unifi/setting.go Normal file
View File

@@ -0,0 +1,118 @@
package unifi
import "fmt"
import "encoding/json"
type Setting struct {
ID string `json:"_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
Key string `json:"key"`
}
func (s *Setting) newFields() (interface{}, error) {
switch s.Key {
case "auto_speedtest":
return &SettingAutoSpeedtest{}, nil
case "baresip":
return &SettingBaresip{}, nil
case "broadcast":
return &SettingBroadcast{}, nil
case "connectivity":
return &SettingConnectivity{}, nil
case "country":
return &SettingCountry{}, nil
case "dpi":
return &SettingDpi{}, nil
case "element_adopt":
return &SettingElementAdopt{}, nil
case "guest_access":
return &SettingGuestAccess{}, nil
// case "ips":
// return &SettingI
case "lcm":
return &SettingLcm{}, nil
case "locale":
return &SettingLocale{}, nil
case "mgmt":
return &SettingMgmt{}, nil
case "network_optimization":
return &SettingNetworkOptimization{}, nil
case "ntp":
return &SettingNtp{}, nil
case "porta":
return &SettingPorta{}, nil
case "provider_capabilities":
return &SettingProviderCapabilities{}, nil
case "radio_ai":
return &SettingRadioAi{}, nil
case "radius":
return &SettingRadius{}, nil
case "rsyslogd":
return &SettingRsyslogd{}, nil
case "snmp":
return &SettingSnmp{}, nil
case "super_cloudaccess":
return &SettingSuperCloudaccess{}, nil
case "super_events":
return &SettingSuperEvents{}, nil
case "super_fwupdate":
return &SettingSuperFwupdate{}, nil
case "super_identity":
return &SettingSuperIdentity{}, nil
case "super_mail":
return &SettingSuperMail{}, nil
case "super_mgmt":
return &SettingSuperMgmt{}, nil
case "super_sdn":
return &SettingSuperSdn{}, nil
case "super_smtp":
return &SettingSuperSmtp{}, nil
case "usg":
return &SettingUsg{}, nil
case "usw":
return &SettingUsw{}, nil
}
return nil, fmt.Errorf("unexpected key %q", s.Key)
}
func (c *Client) GetSetting(site, key string) (*Setting, interface{}, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []json.RawMessage `json:"data"`
}
err := c.do("GET", fmt.Sprintf("s/%s/get/setting", site), nil, &respBody)
if err != nil {
return nil, nil, err
}
var raw json.RawMessage
var setting *Setting
for _, d := range respBody.Data {
err = json.Unmarshal(d, &setting)
if err != nil {
return nil, nil, err
}
if setting.Key == key {
raw = d
break
}
}
if setting == nil {
return nil, nil, &NotFoundError{}
}
fields, err := setting.newFields()
if err != nil {
return nil, nil, err
}
err = json.Unmarshal(raw, &fields)
if err != nil {
return nil, nil, err
}
return setting, fields, nil
}

View File

@@ -0,0 +1,24 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingAutoSpeedtest 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"`
Enabled bool `json:"enabled"`
Interval int `json:"interval,omitempty"` // ^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$
}

View File

@@ -0,0 +1,26 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingBaresip 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"`
Enabled bool `json:"enabled"`
OutboundProxy string `json:"outbound_proxy,omitempty"`
PackageUrl string `json:"package_url,omitempty"`
Server string `json:"server,omitempty"`
}

View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingBroadcast 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"`
SoundAfterEnabled bool `json:"sound_after_enabled"`
SoundAfterResource string `json:"sound_after_resource,omitempty"`
SoundAfterType string `json:"sound_after_type,omitempty"` // sample|media
SoundBeforeEnabled bool `json:"sound_before_enabled"`
SoundBeforeResource string `json:"sound_before_resource,omitempty"`
SoundBeforeType string `json:"sound_before_type,omitempty"` // sample|media
}

View File

@@ -0,0 +1,28 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingConnectivity 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"`
EnableIsolatedWLAN bool `json:"enable_isolated_wlan"`
Enabled bool `json:"enabled"`
UplinkHost string `json:"uplink_host,omitempty"`
UplinkType string `json:"uplink_type,omitempty"`
XMeshEssid string `json:"x_mesh_essid,omitempty"`
XMeshPsk string `json:"x_mesh_psk,omitempty"`
}

View File

@@ -0,0 +1,23 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingCountry 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"`
Code int `json:"code,omitempty"`
}

View File

@@ -0,0 +1,24 @@
// Code generated from ace.jar fields *.json files
// DO NOT EDIT.
package unifi
import (
"fmt"
)
// just to fix compile issues with the import
var _ fmt.Formatter
type SettingDpi 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"`
Enabled bool `json:"enabled"`
FingerprintingEnabled bool `json:"fingerprintingEnabled"`
}

Some files were not shown because too many files have changed in this diff Show More