Refactor type generator
* Allows for generating top-level types for any embedded struct so
that sub-types can be properly instantiated from calling code
* Specifying `-no-embedded-types` will generate top-level types
rather than embedding the struct
* Refactored "Device" API
* All fields set to `omitempty` because it describes all possible
device types, so effectively any field could be omitted any time
* Fixed `get` call for "Device" API; replacing `rest` with `stat`
* Generated `get` and `update` calls for `Setting*` APIs
* Added `5.14.23` JSON files
This commit is contained in:
committed by
Paul Tyng
parent
79542b4006
commit
35eda4f67b
@@ -23,7 +23,7 @@ type Account struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
IP string `json:"ip,omitempty"`
|
||||
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
Name string `json:"name,omitempty"` // ^[^"' ]+$
|
||||
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
|
||||
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
|
||||
|
||||
@@ -27,14 +27,12 @@ type ChannelPlan struct {
|
||||
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
|
||||
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
|
||||
|
||||
} `json:"ap_blacklisted_channels,omitempty"`
|
||||
ConfSource string `json:"conf_source,omitempty"` // manual|radio-ai
|
||||
Coupling []struct {
|
||||
Rssi int `json:"rssi,omitempty"`
|
||||
Source string `json:"source,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
|
||||
Target string `json:"target,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2}).*$
|
||||
|
||||
} `json:"coupling,omitempty"`
|
||||
Date string `json:"date"` // ^$|^(20[0-9]{2}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])Z?$
|
||||
Fitness float64 `json:"fitness,omitempty"`
|
||||
@@ -48,7 +46,6 @@ type ChannelPlan struct {
|
||||
TxPower string `json:"tx_power,omitempty"` // [\d]+|auto
|
||||
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
|
||||
Width int `json:"width,omitempty"` // 20|40|80|160
|
||||
|
||||
} `json:"radio_table,omitempty"`
|
||||
Satisfaction float64 `json:"satisfaction,omitempty"`
|
||||
SatisfactionTable []struct {
|
||||
@@ -58,7 +55,6 @@ type ChannelPlan struct {
|
||||
SiteBlacklistedChannels []struct {
|
||||
Channel int `json:"channel,omitempty"` // 36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196
|
||||
Timestamp int `json:"timestamp,omitempty"` // [1-9][0-9]{12}
|
||||
|
||||
} `json:"site_blacklisted_channels,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -23,114 +23,111 @@ type Device struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
AtfEnabled bool `json:"atf_enabled"`
|
||||
AtfEnabled bool `json:"atf_enabled,omitempty"`
|
||||
BandsteeringMode string `json:"bandsteering_mode,omitempty"` // off|equal|prefer_5g
|
||||
BaresipAuthUser string `json:"baresip_auth_user,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||
BaresipEnabled bool `json:"baresip_enabled"`
|
||||
BaresipEnabled bool `json:"baresip_enabled,omitempty"`
|
||||
BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||
ConfigNetwork struct {
|
||||
BondingEnabled bool `json:"bonding_enabled"`
|
||||
DNS1 string `json:"dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
DNS2 string `json:"dns2"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
BondingEnabled bool `json:"bonding_enabled,omitempty"`
|
||||
DNS1 string `json:"dns1,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
DNS2 string `json:"dns2,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$|^$
|
||||
DNSsuffix string `json:"dnssuffix,omitempty"`
|
||||
Gateway string `json:"gateway"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
Gateway string `json:"gateway,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
IP string `json:"ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
|
||||
Netmask string `json:"netmask,omitempty"` // ^((128|192|224|240|248|252|254)\.0\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0\.0)|(255\.(((0|128|192|224|240|248|252|254)\.0)|255\.(0|128|192|224|240|248|252|254)))))$
|
||||
Type string `json:"type,omitempty"` // dhcp|static
|
||||
|
||||
} `json:"config_network"`
|
||||
Disabled bool `json:"disabled"`
|
||||
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id"` // [\d\w]+|
|
||||
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled"`
|
||||
DPIEnabled bool `json:"dpi_enabled"`
|
||||
} `json:"config_network,omitempty"`
|
||||
DPIEnabled bool `json:"dpi_enabled,omitempty"`
|
||||
Disabled bool `json:"disabled,omitempty"`
|
||||
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id,omitempty"` // [\d\w]+|
|
||||
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled,omitempty"`
|
||||
EthernetOverrides []struct {
|
||||
Ifname string `json:"ifname,omitempty"` // eth[0-9]{1,2}
|
||||
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?|WAN[2]?
|
||||
|
||||
} `json:"ethernet_overrides,omitempty"`
|
||||
FlowctrlEnabled bool `json:"flowctrl_enabled"`
|
||||
FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"`
|
||||
HeightInMeters float64 `json:"heightInMeters,omitempty"`
|
||||
JumboframeEnabled bool `json:"jumboframe_enabled"`
|
||||
JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"`
|
||||
LcmBrightness int `json:"lcm_brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||
LcmBrightnessOverride bool `json:"lcm_brightness_override"`
|
||||
LcmBrightnessOverride bool `json:"lcm_brightness_override,omitempty"`
|
||||
LcmIDleTimeout int `json:"lcm_idle_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||
LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override"`
|
||||
LcmTrackerEnabled bool `json:"lcm_tracker_enabled"`
|
||||
LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override,omitempty"`
|
||||
LcmTrackerEnabled bool `json:"lcm_tracker_enabled,omitempty"`
|
||||
LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50}
|
||||
LedOverride string `json:"led_override,omitempty"` // default|on|off
|
||||
LedOverrideColor string `json:"led_override_color,omitempty"` // ^#(?:[0-9a-fA-F]{3}){1,2}$
|
||||
LedOverrideColorBrightness int `json:"led_override_color_brightness,omitempty"` // ^[0-9][0-9]?$|^100$
|
||||
Locked bool `json:"locked"`
|
||||
LteExtAnt bool `json:"lte_ext_ant"`
|
||||
LtePoe bool `json:"lte_poe"`
|
||||
Locked bool `json:"locked,omitempty"`
|
||||
LteExtAnt bool `json:"lte_ext_ant,omitempty"`
|
||||
LtePoe bool `json:"lte_poe,omitempty"`
|
||||
LteSoftLimit int `json:"lte_soft_limit,omitempty"`
|
||||
MapID string `json:"map_id"`
|
||||
MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled"`
|
||||
MgmtNetworkID string `json:"mgmt_network_id"` // [\d\w]+
|
||||
MapID string `json:"map_id,omitempty"`
|
||||
MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled,omitempty"`
|
||||
MgmtNetworkID string `json:"mgmt_network_id,omitempty"` // [\d\w]+
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off
|
||||
OutletCycleEnabled bool `json:"outlet_cycle_enabled"`
|
||||
OutletCycleEnabled bool `json:"outlet_cycle_enabled,omitempty"`
|
||||
OutletOverrides []struct {
|
||||
Index int `json:"index,omitempty"`
|
||||
RelayState bool `json:"relay_state"`
|
||||
RelayState bool `json:"relay_state,omitempty"`
|
||||
} `json:"outlet_overrides,omitempty"`
|
||||
PortOverrides []struct {
|
||||
AggregateNumPorts int `json:"aggregate_num_ports,omitempty"` // [2-6]
|
||||
Autoneg bool `json:"autoneg"`
|
||||
Autoneg bool `json:"autoneg,omitempty"`
|
||||
Dot1XCtrl string `json:"dot1x_ctrl,omitempty"` // auto|force_authorized|force_unauthorized|mac_based|multi_host
|
||||
EgressRateLimitKbps int `json:"egress_rate_limit_kbps,omitempty"` // 6[4-9]|[7-9][0-9]|[1-9][0-9]{2,6}
|
||||
EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled"`
|
||||
FullDuplex bool `json:"full_duplex"`
|
||||
Isolation bool `json:"isolation"`
|
||||
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
||||
EgressRateLimitKbpsEnabled bool `json:"egress_rate_limit_kbps_enabled,omitempty"`
|
||||
FullDuplex bool `json:"full_duplex,omitempty"`
|
||||
Isolation bool `json:"isolation,omitempty"`
|
||||
LldpmedEnabled bool `json:"lldpmed_enabled,omitempty"`
|
||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled,omitempty"`
|
||||
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||
Name string `json:"name,omitempty"` // .{0,128}
|
||||
OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate
|
||||
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||
PortSecurityEnabled bool `json:"port_security_enabled"`
|
||||
PortSecurityEnabled bool `json:"port_security_enabled,omitempty"`
|
||||
PortSecurityMACAddress []string `json:"port_security_mac_address,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
||||
PortconfID string `json:"portconf_id"` // [\d\w]+
|
||||
PortconfID string `json:"portconf_id,omitempty"` // [\d\w]+
|
||||
PriorityQueue1Level int `json:"priority_queue1_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue2Level int `json:"priority_queue2_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue3Level int `json:"priority_queue3_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
PriorityQueue4Level int `json:"priority_queue4_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
Speed int `json:"speed,omitempty"` // 10|100|1000|2500|5000|10000|20000|25000|40000|50000|100000
|
||||
StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled"`
|
||||
StormctrlBroadcastastEnabled bool `json:"stormctrl_bcast_enabled,omitempty"`
|
||||
StormctrlBroadcastastLevel int `json:"stormctrl_bcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlBroadcastastRate int `json:"stormctrl_bcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled"`
|
||||
StormctrlMcastEnabled bool `json:"stormctrl_mcast_enabled,omitempty"`
|
||||
StormctrlMcastLevel int `json:"stormctrl_mcast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlMcastRate int `json:"stormctrl_mcast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StormctrlType string `json:"stormctrl_type,omitempty"` // level|rate
|
||||
StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled"`
|
||||
StormctrlUcastEnabled bool `json:"stormctrl_ucast_enabled,omitempty"`
|
||||
StormctrlUcastLevel int `json:"stormctrl_ucast_level,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
StormctrlUcastRate int `json:"stormctrl_ucast_rate,omitempty"` // [0-9]|[1-9][0-9]{1,6}|1[0-3][0-9]{6}|14[0-7][0-9]{5}|148[0-7][0-9]{4}|14880000
|
||||
StpPortMode bool `json:"stp_port_mode"`
|
||||
StpPortMode bool `json:"stp_port_mode,omitempty"`
|
||||
} `json:"port_overrides,omitempty"`
|
||||
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
|
||||
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled"`
|
||||
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
|
||||
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
|
||||
RadioTable []struct {
|
||||
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
|
||||
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
|
||||
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|16|34|36|38|40|42|44|46|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165|183|184|185|187|188|189|192|196|auto
|
||||
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled"`
|
||||
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"`
|
||||
Ht int `json:"ht,omitempty"` // 20|40|80|160|1080|2160
|
||||
MinRssi int `json:"min_rssi,omitempty"` // ^-([1-9]|[1-8][0-9]|9[0-4])$
|
||||
MinRssiEnabled bool `json:"min_rssi_enabled"`
|
||||
MinRssiEnabled bool `json:"min_rssi_enabled,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Radio string `json:"radio,omitempty"` // ng|na|ad
|
||||
SensLevel int `json:"sens_level,omitempty"` // ^-([5-8][0-9]|90)$
|
||||
SensLevelEnabled bool `json:"sens_level_enabled"`
|
||||
SensLevelEnabled bool `json:"sens_level_enabled,omitempty"`
|
||||
TxPower string `json:"tx_power,omitempty"` // [\d]+|auto
|
||||
TxPowerMode string `json:"tx_power_mode,omitempty"` // auto|medium|high|low|custom
|
||||
VwireEnabled bool `json:"vwire_enabled"`
|
||||
WLANGroupID string `json:"wlangroup_id"` // [\d\w]+
|
||||
|
||||
VwireEnabled bool `json:"vwire_enabled,omitempty"`
|
||||
WLANGroupID string `json:"wlangroup_id,omitempty"` // [\d\w]+
|
||||
} `json:"radio_table,omitempty"`
|
||||
RADIUSProfileID string `json:"radiusprofile_id"`
|
||||
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
|
||||
RpsOverride struct {
|
||||
PowerManagementMode string `json:"power_management_mode,omitempty"` // dynamic|static
|
||||
@@ -138,32 +135,30 @@ type Device struct {
|
||||
Name string `json:"name,omitempty"` // .{0,32}
|
||||
PortIDX int `json:"port_idx,omitempty"` // [1-6]
|
||||
PortMode string `json:"port_mode,omitempty"` // auto|force_active|manual|disabled
|
||||
|
||||
} `json:"rps_port_table,omitempty"`
|
||||
} `json:"rps_override"`
|
||||
} `json:"rps_override,omitempty"`
|
||||
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
|
||||
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
|
||||
StpPriority int `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
|
||||
StpPriority string `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
|
||||
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
|
||||
SwitchVLANEnabled bool `json:"switch_vlan_enabled"`
|
||||
SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"`
|
||||
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
|
||||
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||
WLANOverrides []struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
Name string `json:"name,omitempty"` // .{1,32}
|
||||
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||
NameCombineEnabled bool `json:"name_combine_enabled,omitempty"`
|
||||
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
||||
Radio string `json:"radio,omitempty"` // ng|na
|
||||
RadioName string `json:"radio_name,omitempty"`
|
||||
VLAN int `json:"vlan,omitempty"` // [2-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-5]|^$
|
||||
VLANEnabled bool `json:"vlan_enabled"`
|
||||
WLANID string `json:"wlan_id"` // [\d\w]+
|
||||
VLANEnabled bool `json:"vlan_enabled,omitempty"`
|
||||
WLANID string `json:"wlan_id,omitempty"` // [\d\w]+
|
||||
XPassphrase string `json:"x_passphrase,omitempty"` // [\x20-\x7E]{8,63}|[0-9a-fA-F]{64}
|
||||
|
||||
} `json:"wlan_overrides,omitempty"`
|
||||
X string `json:"x,omitempty"`
|
||||
X int `json:"x,omitempty"`
|
||||
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
|
||||
Y string `json:"y,omitempty"`
|
||||
Y int `json:"y,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error) {
|
||||
@@ -172,7 +167,7 @@ func (c *Client) listDevice(ctx context.Context, site string) ([]Device, error)
|
||||
Data []Device `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device", site), nil, &respBody)
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/stat/device", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -186,7 +181,7 @@ func (c *Client) getDevice(ctx context.Context, site, id string) (*Device, error
|
||||
Data []Device `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/rest/device/%s", site, id), nil, &respBody)
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/stat/device/%s", site, id), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -28,13 +28,11 @@ type Hotspot2Conf struct {
|
||||
Port string `json:"port,omitempty"` // (([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]))+(,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])|,([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])-([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])){0,14}
|
||||
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp
|
||||
Status string `json:"status,omitempty"` // closed|open|unknown
|
||||
|
||||
} `json:"capab,omitempty"`
|
||||
CellularNetworkList []struct {
|
||||
Mcc int `json:"mcc,omitempty"`
|
||||
Mnc int `json:"mnc,omitempty"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"cellular_network_list,omitempty"`
|
||||
DeauthReqTimeout int `json:"deauth_req_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||
DisableDgaf bool `json:"disable_dgaf"`
|
||||
@@ -42,7 +40,6 @@ type Hotspot2Conf struct {
|
||||
FriendlyName []struct {
|
||||
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||
Text string `json:"text,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"friendly_name,omitempty"`
|
||||
GasComebackDelay int `json:"gas_comeback_delay,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|300
|
||||
Hessid string `json:"hessid"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$|^$
|
||||
@@ -81,16 +78,13 @@ type Hotspot2Conf struct {
|
||||
Description []struct {
|
||||
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||
Text string `json:"text,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"description,omitempty"`
|
||||
FriendlyName []struct {
|
||||
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||
Text string `json:"text,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"friendly_name,omitempty"`
|
||||
Icon []struct {
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"icon,omitempty"`
|
||||
MethodOmaDm bool `json:"method_oma_dm"`
|
||||
MethodSoapXmlSpp bool `json:"method_soap_xml_spp"`
|
||||
@@ -109,13 +103,11 @@ type Hotspot2Conf struct {
|
||||
QOSMapExceptions []struct {
|
||||
Dcsp int `json:"dcsp,omitempty"`
|
||||
Up int `json:"up,omitempty"` // [0-7]
|
||||
|
||||
} `json:"qos_map_exceptions,omitempty"`
|
||||
QOSMapStatus bool `json:"qos_map_status"`
|
||||
RoamingConsortiumList []struct {
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
Oid string `json:"oid,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"roaming_consortium_list,omitempty"`
|
||||
TCFilename string `json:"t_c_filename,omitempty"` // .{1,256}
|
||||
TCTimestamp int `json:"t_c_timestamp,omitempty"`
|
||||
@@ -123,7 +115,6 @@ type Hotspot2Conf struct {
|
||||
VenueName []struct {
|
||||
Language string `json:"language,omitempty"` // [a-z]{3}
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
|
||||
} `json:"venue_name,omitempty"`
|
||||
VenueType int `json:"venue_type,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ type Network struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
|
||||
DHCPDBootEnabled bool `json:"dhcpd_boot_enabled"`
|
||||
DHCPDBootFilename string `json:"dhcpd_boot_filename,omitempty"` // .{1,256}
|
||||
DHCPDBootServer string `json:"dhcpd_boot_server"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|[a-zA-Z0-9-]{1,63}|^$
|
||||
@@ -39,11 +38,11 @@ type Network struct {
|
||||
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])$|^$
|
||||
DHCPDMAC1 string `json:"dhcpd_mac_1"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||
DHCPDMAC2 string `json:"dhcpd_mac_2"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||
DHCPDMAC3 string `json:"dhcpd_mac_3"` // (^$|^([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])$|^$
|
||||
@@ -51,10 +50,6 @@ type Network struct {
|
||||
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"`
|
||||
@@ -64,10 +59,15 @@ type Network struct {
|
||||
DHCPDV6LeaseTime int `json:"dhcpdv6_leasetime,omitempty"`
|
||||
DHCPDV6Start string `json:"dhcpdv6_start,omitempty"`
|
||||
DHCPDV6Stop string `json:"dhcpdv6_stop,omitempty"`
|
||||
DHCPDWPAdUrl string `json:"dhcpd_wpad_url,omitempty"`
|
||||
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"`
|
||||
DHCPRelayEnabled bool `json:"dhcp_relay_enabled"`
|
||||
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]+|^$
|
||||
DomainName string `json:"domain_name"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
|
||||
Enabled bool `json:"enabled"`
|
||||
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
|
||||
IGMPFastleave bool `json:"igmp_fastleave"`
|
||||
@@ -77,7 +77,6 @@ type Network struct {
|
||||
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
|
||||
@@ -90,6 +89,7 @@ type Network struct {
|
||||
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
|
||||
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)$
|
||||
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}
|
||||
@@ -103,8 +103,8 @@ type Network struct {
|
||||
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"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
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])$
|
||||
|
||||
@@ -32,8 +32,8 @@ type PortConf struct {
|
||||
Isolation bool `json:"isolation"`
|
||||
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
||||
Name string `json:"name,omitempty"`
|
||||
NATiveNetworkID string `json:"native_networkconf_id"`
|
||||
Name string `json:"name,omitempty"`
|
||||
OpMode string `json:"op_mode,omitempty"` // switch
|
||||
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||
PortSecurityEnabled bool `json:"port_security_enabled"`
|
||||
|
||||
@@ -34,7 +34,6 @@ type ScheduleTask struct {
|
||||
StreamType string `json:"stream_type,omitempty"` // media|sample
|
||||
UpgradeTargets []struct {
|
||||
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
|
||||
} `json:"upgrade_targets,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,47 @@ type SettingAutoSpeedtest struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
Interval int `json:"interval,omitempty"` // ^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$
|
||||
}
|
||||
|
||||
func (c *Client) getSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingAutoSpeedtest `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/auto_speedtest", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingAutoSpeedtest(ctx context.Context, site string, d *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingAutoSpeedtest `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/auto_speedtest", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,49 @@ type SettingBaresip struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
OutboundProxy string `json:"outbound_proxy,omitempty"`
|
||||
PackageUrl string `json:"package_url,omitempty"`
|
||||
Server string `json:"server,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingBaresip `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/baresip", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingBaresip(ctx context.Context, site string, d *SettingBaresip) (*SettingBaresip, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingBaresip `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/baresip", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingBroadcast struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
SoundAfterEnabled bool `json:"sound_after_enabled"`
|
||||
SoundAfterResource string `json:"sound_after_resource,omitempty"`
|
||||
SoundAfterType string `json:"sound_after_type,omitempty"` // sample|media
|
||||
@@ -30,3 +32,42 @@ type SettingBroadcast struct {
|
||||
SoundBeforeResource string `json:"sound_before_resource,omitempty"`
|
||||
SoundBeforeType string `json:"sound_before_type,omitempty"` // sample|media
|
||||
}
|
||||
|
||||
func (c *Client) getSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingBroadcast `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/broadcast", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingBroadcast(ctx context.Context, site string, d *SettingBroadcast) (*SettingBroadcast, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingBroadcast `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/broadcast", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingConnectivity struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
EnableIsolatedWLAN bool `json:"enable_isolated_wlan"`
|
||||
Enabled bool `json:"enabled"`
|
||||
UplinkHost string `json:"uplink_host,omitempty"`
|
||||
@@ -30,3 +32,42 @@ type SettingConnectivity struct {
|
||||
XMeshEssid string `json:"x_mesh_essid,omitempty"`
|
||||
XMeshPsk string `json:"x_mesh_psk,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingConnectivity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/connectivity", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingConnectivity(ctx context.Context, site string, d *SettingConnectivity) (*SettingConnectivity, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingConnectivity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/connectivity", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingCountry struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Code int `json:"code,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingCountry(ctx context.Context, site string) (*SettingCountry, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingCountry `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/country", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingCountry(ctx context.Context, site string, d *SettingCountry) (*SettingCountry, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingCountry `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/country", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,47 @@ type SettingDpi struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
FingerprintingEnabled bool `json:"fingerprintingEnabled"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingDpi(ctx context.Context, site string) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/dpi", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingDpi(ctx context.Context, site string, d *SettingDpi) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/dpi", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,7 +23,48 @@ type SettingElementAdopt struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
XElementEssid string `json:"x_element_essid,omitempty"`
|
||||
XElementPsk string `json:"x_element_psk,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingElementAdopt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/element_adopt", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingElementAdopt(ctx context.Context, site string, d *SettingElementAdopt) (*SettingElementAdopt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingElementAdopt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/element_adopt", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingGuestAccess struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
AllowedSubnet string `json:"allowed_subnet_,omitempty"`
|
||||
Auth string `json:"auth,omitempty"` // none|password|hotspot|facebook_wifi|custom
|
||||
AuthorizeUseSandbox bool `json:"authorize_use_sandbox"`
|
||||
@@ -112,3 +114,42 @@ type SettingGuestAccess struct {
|
||||
XWechatAppSecret string `json:"x_wechat_app_secret,omitempty"`
|
||||
XWechatSecretKey string `json:"x_wechat_secret_key,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingGuestAccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/guest_access", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingGuestAccess(ctx context.Context, site string, d *SettingGuestAccess) (*SettingGuestAccess, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingGuestAccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/guest_access", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,12 +23,13 @@ type SettingIps struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
DNSFiltering bool `json:"dns_filtering"`
|
||||
DNSFilters []struct {
|
||||
Filter string `json:"filter,omitempty"` // security|adult|family
|
||||
NetworkID string `json:"network_id"`
|
||||
Version string `json:"version,omitempty"` // v4|v6
|
||||
|
||||
} `json:"dns_filters,omitempty"`
|
||||
EnabledCategories []string `json:"enabled_categories,omitempty"` // emerging-activex|emerging-attackresponse|botcc|emerging-chat|ciarmy|compromised|emerging-dns|emerging-dos|dshield|emerging-exploit|emerging-ftp|emerging-games|emerging-icmp|emerging-icmpinfo|emerging-imap|emerging-inappropriate|emerging-info|emerging-malware|emerging-misc|emerging-mobile|emerging-netbios|emerging-p2p|emerging-policy|emerging-pop3|emerging-rpc|emerging-scada|emerging-scan|emerging-shellcode|emerging-smtp|emerging-snmp|spamhaus|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm
|
||||
EndpointScanning bool `json:"endpoint_scanning"`
|
||||
@@ -36,7 +37,6 @@ type SettingIps struct {
|
||||
IPAddress string `json:"ip_address,omitempty"`
|
||||
NetworkID string `json:"network_id"`
|
||||
Version string `json:"version,omitempty"` // v4|v6
|
||||
|
||||
} `json:"honeypot,omitempty"`
|
||||
HoneypotEnabled bool `json:"honeypot_enabled"`
|
||||
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
|
||||
@@ -55,12 +55,50 @@ type SettingIps struct {
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"tracking,omitempty"`
|
||||
Type string `json:"type,omitempty"` // all|track
|
||||
|
||||
} `json:"alerts,omitempty"`
|
||||
Whitelist []struct {
|
||||
Direction string `json:"direction,omitempty"` // both|src|dest
|
||||
Mode string `json:"mode,omitempty"` // ip|subnet|network
|
||||
Value string `json:"value,omitempty"`
|
||||
} `json:"whitelist,omitempty"`
|
||||
} `json:"suppression"`
|
||||
} `json:"suppression,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingIps(ctx context.Context, site string) (*SettingIps, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingIps `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/ips", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingIps(ctx context.Context, site string, d *SettingIps) (*SettingIps, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingIps `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/ips", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,9 +23,50 @@ type SettingLcm struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Brightness int `json:"brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||
Enabled bool `json:"enabled"`
|
||||
IDleTimeout int `json:"idle_timeout,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]|[1-2][0-9][0-9][0-9]|3[0-5][0-9][0-9]|3600
|
||||
Sync bool `json:"sync"`
|
||||
TouchEvent bool `json:"touch_event"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingLcm(ctx context.Context, site string) (*SettingLcm, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingLcm `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/lcm", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingLcm(ctx context.Context, site string, d *SettingLcm) (*SettingLcm, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingLcm `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/lcm", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingLocale struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Timezone string `json:"timezone,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingLocale(ctx context.Context, site string) (*SettingLocale, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingLocale `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/locale", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingLocale(ctx context.Context, site string, d *SettingLocale) (*SettingLocale, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingLocale `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/locale", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingMgmt struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
AdvancedFeatureEnabled bool `json:"advanced_feature_enabled"`
|
||||
AlertEnabled bool `json:"alert_enabled"`
|
||||
AutoUpgrade bool `json:"auto_upgrade"`
|
||||
@@ -40,3 +42,42 @@ type SettingMgmt struct {
|
||||
XSshSha512Passwd string `json:"x_ssh_sha512passwd,omitempty"`
|
||||
XSshUsername string `json:"x_ssh_username,omitempty"` // ^[_A-Za-z0-9][-_.A-Za-z0-9]{0,29}$
|
||||
}
|
||||
|
||||
func (c *Client) getSettingMgmt(ctx context.Context, site string) (*SettingMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/mgmt", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingMgmt(ctx context.Context, site string, d *SettingMgmt) (*SettingMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/mgmt", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingNetworkOptimization struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingNetworkOptimization `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/network_optimization", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingNetworkOptimization(ctx context.Context, site string, d *SettingNetworkOptimization) (*SettingNetworkOptimization, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingNetworkOptimization `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/network_optimization", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,8 +23,49 @@ type SettingNtp struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
NtpServer1 string `json:"ntp_server_1,omitempty"`
|
||||
NtpServer2 string `json:"ntp_server_2,omitempty"`
|
||||
NtpServer3 string `json:"ntp_server_3,omitempty"`
|
||||
NtpServer4 string `json:"ntp_server_4,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingNtp(ctx context.Context, site string) (*SettingNtp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingNtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/ntp", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingNtp(ctx context.Context, site string, d *SettingNtp) (*SettingNtp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingNtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/ntp", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingPorta struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Ugw3WAN2Enabled bool `json:"ugw3_wan2_enabled"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingPorta(ctx context.Context, site string) (*SettingPorta, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingPorta `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/porta", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingPorta(ctx context.Context, site string, d *SettingPorta) (*SettingPorta, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingPorta `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/porta", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,7 +23,48 @@ type SettingProviderCapabilities struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Download int `json:"download,omitempty"` // ^[1-9][0-9]*$
|
||||
Enabled bool `json:"enabled"`
|
||||
Upload int `json:"upload,omitempty"` // ^[1-9][0-9]*$
|
||||
}
|
||||
|
||||
func (c *Client) getSettingProviderCapabilities(ctx context.Context, site string) (*SettingProviderCapabilities, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingProviderCapabilities `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/provider_capabilities", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingProviderCapabilities(ctx context.Context, site string, d *SettingProviderCapabilities) (*SettingProviderCapabilities, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingProviderCapabilities `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/provider_capabilities", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingRadioAi struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
ChannelsNa []int `json:"channels_na,omitempty"` // 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
|
||||
ChannelsNg []int `json:"channels_ng,omitempty"` // 1|2|3|4|5|6|7|8|9|10|11|12|13|14
|
||||
CronExpr string `json:"cron_expr,omitempty"`
|
||||
@@ -35,3 +37,42 @@ type SettingRadioAi struct {
|
||||
Radios []string `json:"radios,omitempty"` // na|ng
|
||||
UseXY bool `json:"useXY"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRadioAi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/radio_ai", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingRadioAi(ctx context.Context, site string, d *SettingRadioAi) (*SettingRadioAi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRadioAi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/radio_ai", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingRadius struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
AccountingEnabled bool `json:"accounting_enabled"`
|
||||
AcctPort int `json:"acct_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]
|
||||
AuthPort int `json:"auth_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]
|
||||
@@ -32,3 +34,42 @@ type SettingRadius struct {
|
||||
TunneledReply bool `json:"tunneled_reply"`
|
||||
XSecret string `json:"x_secret,omitempty"` // [^\"\' ]{1,128}
|
||||
}
|
||||
|
||||
func (c *Client) getSettingRadius(ctx context.Context, site string) (*SettingRadius, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRadius `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/radius", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingRadius(ctx context.Context, site string, d *SettingRadius) (*SettingRadius, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRadius `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/radius", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingRsyslogd struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Debug bool `json:"debug"`
|
||||
Enabled bool `json:"enabled"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
@@ -33,3 +35,42 @@ type SettingRsyslogd struct {
|
||||
ThisController bool `json:"this_controller"`
|
||||
ThisControllerEncryptedOnly bool `json:"this_controller_encrypted_only"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRsyslogd `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/rsyslogd", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingRsyslogd(ctx context.Context, site string, d *SettingRsyslogd) (*SettingRsyslogd, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingRsyslogd `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/rsyslogd", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,9 +23,50 @@ type SettingSnmp struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Community string `json:"community,omitempty"` // .{1,256}
|
||||
Enabled bool `json:"enabled"`
|
||||
EnabledV3 bool `json:"enabledV3"`
|
||||
Username string `json:"username,omitempty"` // [a-zA-Z0-9_-]{1,30}
|
||||
XPassword string `json:"x_password,omitempty"` // [^'"]{8,32}
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSnmp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/snmp", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSnmp(ctx context.Context, site string, d *SettingSnmp) (*SettingSnmp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSnmp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/snmp", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingSuperCloudaccess struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
DeviceAuth string `json:"device_auth,omitempty"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Enabled bool `json:"enabled"`
|
||||
@@ -31,3 +33,42 @@ type SettingSuperCloudaccess struct {
|
||||
XCertificatePem string `json:"x_certificate_pem,omitempty"`
|
||||
XPrivateKey string `json:"x_private_key,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperCloudaccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_cloudaccess", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperCloudaccess(ctx context.Context, site string, d *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperCloudaccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_cloudaccess", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingSuperEvents struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Ignored string `json:"_ignored,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperEvents `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_events", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperEvents(ctx context.Context, site string, d *SettingSuperEvents) (*SettingSuperEvents, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperEvents `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_events", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,7 +23,48 @@ type SettingSuperFwupdate struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
ControllerChannel string `json:"controller_channel,omitempty"` // internal|alpha|beta|release-candidate|release
|
||||
FirmwareChannel string `json:"firmware_channel,omitempty"` // internal|alpha|beta|release-candidate|release
|
||||
SsoEnabled bool `json:"sso_enabled"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperFwupdate `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_fwupdate", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperFwupdate(ctx context.Context, site string, d *SettingSuperFwupdate) (*SettingSuperFwupdate, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperFwupdate `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_fwupdate", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,47 @@ type SettingSuperIdentity struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperIdentity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_identity", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperIdentity(ctx context.Context, site string, d *SettingSuperIdentity) (*SettingSuperIdentity, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperIdentity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_identity", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingSuperMail struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Provider string `json:"provider,omitempty"` // smtp|cloud|disabled
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperMail `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_mail", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperMail(ctx context.Context, site string, d *SettingSuperMail) (*SettingSuperMail, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperMail `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_mail", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingSuperMgmt struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
AutoUpgrade bool `json:"auto_upgrade"`
|
||||
AutobackupCronExpr string `json:"autobackup_cron_expr,omitempty"`
|
||||
AutobackupDays int `json:"autobackup_days,omitempty"`
|
||||
@@ -69,3 +71,42 @@ type SettingSuperMgmt struct {
|
||||
XSshPassword string `json:"x_ssh_password,omitempty"`
|
||||
XSshUsername string `json:"x_ssh_username,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_mgmt", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperMgmt(ctx context.Context, site string, d *SettingSuperMgmt) (*SettingSuperMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_mgmt", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingSuperSdn struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
AuthToken string `json:"auth_token,omitempty"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Enabled bool `json:"enabled"`
|
||||
@@ -34,3 +36,42 @@ type SettingSuperSdn struct {
|
||||
UbicUuid string `json:"ubic_uuid,omitempty"`
|
||||
XOauthAppSecret string `json:"x_oauth_app_secret,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperSdn `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_sdn", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperSdn(ctx context.Context, site string, d *SettingSuperSdn) (*SettingSuperSdn, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperSdn `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_sdn", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SettingSuperSmtp struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
Enabled bool `json:"enabled"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Port int `json:"port,omitempty"` // [1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5]|^$
|
||||
@@ -33,3 +35,42 @@ type SettingSuperSmtp struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
XPassword string `json:"x_password,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperSmtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/super_smtp", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingSuperSmtp(ctx context.Context, site string, d *SettingSuperSmtp) (*SettingSuperSmtp, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingSuperSmtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/super_smtp", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,9 +23,13 @@ type SettingUsg struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
ArpCacheBaseReachable int `json:"arp_cache_base_reachable,omitempty"` // ^$|^[1-9]{1}[0-9]{0,4}$
|
||||
ArpCacheTimeout int `json:"arp_cache_timeout,omitempty"`
|
||||
ArpCacheTimeout string `json:"arp_cache_timeout,omitempty"` // normal|min-dhcp-lease|custom
|
||||
BroadcastPing bool `json:"broadcast_ping"`
|
||||
DHCPDHostfileUpdate bool `json:"dhcpd_hostfile_update"`
|
||||
DHCPDUseDNSmasq bool `json:"dhcpd_use_dnsmasq"`
|
||||
DHCPRelayAgentsPackets string `json:"dhcp_relay_agents_packets"` // append|discard|forward|replace|^$
|
||||
DHCPRelayHopCount int `json:"dhcp_relay_hop_count,omitempty"` // ([1-9]|[1-8][0-9]|9[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])|^$
|
||||
DHCPRelayMaxSize int `json:"dhcp_relay_max_size,omitempty"` // (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)|^$
|
||||
@@ -35,8 +39,6 @@ type SettingUsg struct {
|
||||
DHCPRelayServer3 string `json:"dhcp_relay_server_3"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer4 string `json:"dhcp_relay_server_4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPRelayServer5 string `json:"dhcp_relay_server_5"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||
DHCPDHostfileUpdate bool `json:"dhcpd_hostfile_update"`
|
||||
DHCPDUseDNSmasq bool `json:"dhcpd_use_dnsmasq"`
|
||||
DNSmasqAllServers bool `json:"dnsmasq_all_servers"`
|
||||
EchoServer string `json:"echo_server,omitempty"` // [^\"\' ]{1,255}
|
||||
FirewallGuestDefaultLog bool `json:"firewall_guest_default_log"`
|
||||
@@ -79,3 +81,42 @@ type SettingUsg struct {
|
||||
UpnpSecureMode bool `json:"upnp_secure_mode"`
|
||||
UpnpWANInterface string `json:"upnp_wan_interface,omitempty"` // WAN|WAN2
|
||||
}
|
||||
|
||||
func (c *Client) getSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingUsg `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/usg", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingUsg(ctx context.Context, site string, d *SettingUsg) (*SettingUsg, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingUsg `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/usg", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -23,5 +23,46 @@ type SettingUsw struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
Key string `json:"key"`
|
||||
|
||||
DHCPSnoop bool `json:"dhcp_snoop"`
|
||||
}
|
||||
|
||||
func (c *Client) getSettingUsw(ctx context.Context, site string) (*SettingUsw, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingUsw `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/usw", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
|
||||
func (c *Client) updateSettingUsw(ctx context.Context, site string, d *SettingUsw) (*SettingUsw, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Data []SettingUsw `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/usw", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ type SpatialRecord struct {
|
||||
X float64 `json:"x,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||
Y float64 `json:"y,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||
Z float64 `json:"z,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
|
||||
|
||||
} `json:"position"`
|
||||
} `json:"position,omitempty"`
|
||||
} `json:"devices,omitempty"`
|
||||
Name string `json:"name,omitempty"` // .{1,128}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type User struct {
|
||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||
|
||||
IP string `json:"ip,omitempty"` // non-generated field
|
||||
|
||||
Blocked bool `json:"blocked,omitempty"`
|
||||
FixedIP string `json:"fixed_ip,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
@@ -33,8 +35,6 @@ type User struct {
|
||||
Note string `json:"note,omitempty"`
|
||||
UseFixedIP bool `json:"use_fixedip"`
|
||||
UserGroupID string `json:"usergroup_id"`
|
||||
// non-generated fields
|
||||
IP string `json:"ip,omitempty"`
|
||||
}
|
||||
|
||||
func (c *Client) listUser(ctx context.Context, site string) ([]User, error) {
|
||||
|
||||
@@ -43,7 +43,6 @@ type WLAN struct {
|
||||
MACFilterEnabled bool `json:"mac_filter_enabled"`
|
||||
MACFilterList []string `json:"mac_filter_list,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||
MACFilterPolicy string `json:"mac_filter_policy,omitempty"` // allow|deny
|
||||
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
|
||||
MinrateNaAdvertisingRates bool `json:"minrate_na_advertising_rates"`
|
||||
MinrateNaBeaconRateKbps int `json:"minrate_na_beacon_rate_kbps,omitempty"`
|
||||
MinrateNaDataRateKbps int `json:"minrate_na_data_rate_kbps,omitempty"`
|
||||
@@ -55,6 +54,7 @@ type WLAN struct {
|
||||
MinrateNgDataRateKbps int `json:"minrate_ng_data_rate_kbps,omitempty"`
|
||||
MinrateNgEnabled bool `json:"minrate_ng_enabled"`
|
||||
MinrateNgMgmtRateKbps int `json:"minrate_ng_mgmt_rate_kbps,omitempty"`
|
||||
MulticastEnhanceEnabled bool `json:"mcastenhance_enabled"`
|
||||
Name string `json:"name,omitempty"` // .{1,32}
|
||||
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
||||
|
||||
Reference in New Issue
Block a user