Compare commits
17 Commits
v0.0.1-alp
...
v0.0.1-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| bae6a964eb | |||
| bab50ebfc4 | |||
| 8035772f71 | |||
| 92ec48f4e7 | |||
| 6f78447552 | |||
| 898bd842fc | |||
| 4786c4dd6a | |||
| a37a5c45c3 | |||
| 27d358911a | |||
| ab3b625a72 | |||
| 8e97d8acec | |||
| 5f1c56bd42 | |||
| 8cb283ef91 | |||
| 2869909c3f | |||
| 854771b7e6 | |||
| 681ebde3db | |||
| e28d4d754e |
@@ -139,7 +139,7 @@ func extractJSON(jarFile, fieldsDir string) error {
|
|||||||
return fmt.Errorf("unable to open settings file: %w", err)
|
return fmt.Errorf("unable to open settings file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings map[string]any
|
var settings map[string]interface{}
|
||||||
err = json.Unmarshal(settingsData, &settings)
|
err = json.Unmarshal(settingsData, &settings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to unmarshal settings: %w", err)
|
return fmt.Errorf("unable to unmarshal settings: %w", err)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ func (l firmwareUpdateApiResponseEmbeddedFirmwareDataLink) MarshalJSON() ([]byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *firmwareUpdateApiResponseEmbeddedFirmwareDataLink) UnmarshalJSON(j []byte) error {
|
func (l *firmwareUpdateApiResponseEmbeddedFirmwareDataLink) UnmarshalJSON(j []byte) error {
|
||||||
var m map[string]any
|
var m map[string]interface{}
|
||||||
|
|
||||||
err := json.Unmarshal(j, &m)
|
err := json.Unmarshal(j, &m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ func (r *Resource) IsSetting() bool {
|
|||||||
return strings.HasPrefix(r.StructName, "Setting")
|
return strings.HasPrefix(r.StructName, "Setting")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) processFields(fields map[string]any) {
|
func (r *Resource) processFields(fields map[string]interface{}) {
|
||||||
t := r.Types[r.StructName]
|
t := r.Types[r.StructName]
|
||||||
for name, validation := range fields {
|
for name, validation := range fields {
|
||||||
fieldInfo, err := r.fieldInfoFromValidation(name, validation)
|
fieldInfo, err := r.fieldInfoFromValidation(name, validation)
|
||||||
@@ -494,7 +494,7 @@ func (r *Resource) processFields(fields map[string]any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) fieldInfoFromValidation(name string, validation any) (*FieldInfo, error) {
|
func (r *Resource) fieldInfoFromValidation(name string, validation interface{}) (*FieldInfo, error) {
|
||||||
fieldName := strcase.ToCamel(name)
|
fieldName := strcase.ToCamel(name)
|
||||||
fieldName = cleanName(fieldName, fieldReps)
|
fieldName = cleanName(fieldName, fieldReps)
|
||||||
|
|
||||||
@@ -502,7 +502,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation any) (*FieldI
|
|||||||
var fieldInfo *FieldInfo
|
var fieldInfo *FieldInfo
|
||||||
|
|
||||||
switch validation := validation.(type) {
|
switch validation := validation.(type) {
|
||||||
case []any:
|
case []interface{}:
|
||||||
if len(validation) == 0 {
|
if len(validation) == 0 {
|
||||||
fieldInfo = NewFieldInfo(fieldName, name, "string", "", false, true, "")
|
fieldInfo = NewFieldInfo(fieldName, name, "string", "", false, true, "")
|
||||||
err := r.FieldProcessor(fieldName, fieldInfo)
|
err := r.FieldProcessor(fieldName, fieldInfo)
|
||||||
@@ -523,7 +523,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation any) (*FieldI
|
|||||||
err = r.FieldProcessor(fieldName, fieldInfo)
|
err = r.FieldProcessor(fieldName, fieldInfo)
|
||||||
return fieldInfo, err
|
return fieldInfo, err
|
||||||
|
|
||||||
case map[string]any:
|
case map[string]interface{}:
|
||||||
typeName := r.StructName + fieldName
|
typeName := r.StructName + fieldName
|
||||||
|
|
||||||
result := NewFieldInfo(fieldName, name, typeName, "", true, false, "")
|
result := NewFieldInfo(fieldName, name, typeName, "", true, false, "")
|
||||||
@@ -587,7 +587,7 @@ func (r *Resource) fieldInfoFromValidation(name string, validation any) (*FieldI
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Resource) processJSON(b []byte) error {
|
func (r *Resource) processJSON(b []byte) error {
|
||||||
var fields map[string]any
|
var fields map[string]interface{}
|
||||||
err := json.Unmarshal(b, &fields)
|
err := json.Unmarshal(b, &fields)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func TestFieldInfoFromValidation(t *testing.T) {
|
|||||||
expectedType string
|
expectedType string
|
||||||
expectedComment string
|
expectedComment string
|
||||||
expectedOmitEmpty bool
|
expectedOmitEmpty bool
|
||||||
validation any
|
validation interface{}
|
||||||
}{
|
}{
|
||||||
{"string", "", true, ""},
|
{"string", "", true, ""},
|
||||||
{"string", "default|custom", true, "default|custom"},
|
{"string", "default|custom", true, "default|custom"},
|
||||||
|
|||||||
18
unifi/account.generated.go
generated
18
unifi/account.generated.go
generated
@@ -25,16 +25,14 @@ type Account struct {
|
|||||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
FilterIDs []string `json:"filter_ids,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])$|^$
|
||||||
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"` // ^[^"' ]+$
|
||||||
Name string `json:"name,omitempty"` // ^[^"' ]+$
|
NetworkID string `json:"networkconf_id,omitempty"`
|
||||||
NetworkID string `json:"networkconf_id,omitempty"`
|
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
|
||||||
TunnelConfigType string `json:"tunnel_config_type,omitempty"` // vpn|802.1x|custom
|
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
|
||||||
TunnelMediumType int `json:"tunnel_medium_type,omitempty"` // [1-9]|1[0-5]|^$
|
TunnelType int `json:"tunnel_type,omitempty"` // [1-9]|1[0-3]|^$
|
||||||
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]|^$
|
||||||
UlpUserID string `json:"ulp_user_id"`
|
XPassword string `json:"x_password,omitempty"`
|
||||||
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 (dst *Account) UnmarshalJSON(b []byte) error {
|
func (dst *Account) UnmarshalJSON(b []byte) error {
|
||||||
|
|||||||
191
unifi/device.generated.go
generated
191
unifi/device.generated.go
generated
@@ -27,88 +27,85 @@ type Device struct {
|
|||||||
|
|
||||||
MAC string `json:"mac,omitempty"`
|
MAC string `json:"mac,omitempty"`
|
||||||
|
|
||||||
Adopted bool `json:"adopted"`
|
Adopted bool `json:"adopted"`
|
||||||
AfcEnabled bool `json:"afc_enabled,omitempty"`
|
AtfEnabled bool `json:"atf_enabled,omitempty"`
|
||||||
AtfEnabled bool `json:"atf_enabled,omitempty"`
|
BandsteeringMode string `json:"bandsteering_mode,omitempty"` // off|equal|prefer_5g
|
||||||
BandsteeringMode string `json:"bandsteering_mode,omitempty"` // off|equal|prefer_5g
|
BaresipAuthUser string `json:"baresip_auth_user,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||||
BaresipAuthUser string `json:"baresip_auth_user,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
BaresipEnabled bool `json:"baresip_enabled,omitempty"`
|
||||||
BaresipEnabled bool `json:"baresip_enabled,omitempty"`
|
BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
||||||
BaresipExtension string `json:"baresip_extension,omitempty"` // ^\+?[a-zA-Z0-9_.\-!~*'()]*
|
ConfigNetwork DeviceConfigNetwork `json:"config_network,omitempty"`
|
||||||
ConfigNetwork DeviceConfigNetwork `json:"config_network,omitempty"`
|
ConnectedBatteryOverrides []DeviceConnectedBatteryOverrides `json:"connected_battery_overrides,omitempty"`
|
||||||
DPIEnabled bool `json:"dpi_enabled,omitempty"`
|
DPIEnabled bool `json:"dpi_enabled,omitempty"`
|
||||||
Disabled bool `json:"disabled,omitempty"`
|
Disabled bool `json:"disabled,omitempty"`
|
||||||
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id,omitempty"` // [\d\w]+|
|
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id,omitempty"` // [\d\w]+|
|
||||||
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled,omitempty"`
|
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled,omitempty"`
|
||||||
EtherLighting DeviceEtherLighting `json:"ether_lighting,omitempty"`
|
EtherLighting DeviceEtherLighting `json:"ether_lighting,omitempty"`
|
||||||
EthernetOverrides []DeviceEthernetOverrides `json:"ethernet_overrides,omitempty"`
|
EthernetOverrides []DeviceEthernetOverrides `json:"ethernet_overrides,omitempty"`
|
||||||
FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"`
|
FlowctrlEnabled bool `json:"flowctrl_enabled,omitempty"`
|
||||||
GatewayVrrpMode string `json:"gateway_vrrp_mode,omitempty"` // primary|secondary
|
GatewayVrrpMode string `json:"gateway_vrrp_mode,omitempty"` // primary|secondary
|
||||||
GatewayVrrpPriority int `json:"gateway_vrrp_priority,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]
|
GatewayVrrpPriority int `json:"gateway_vrrp_priority,omitempty"` // [1-9][0-9]|[1-9][0-9][0-9]
|
||||||
GreenApEnabled bool `json:"green_ap_enabled,omitempty"`
|
HeightInMeters float64 `json:"heightInMeters,omitempty"`
|
||||||
HeightInMeters float64 `json:"heightInMeters,omitempty"`
|
Hostname string `json:"hostname,omitempty"` // .{1,128}
|
||||||
Hostname string `json:"hostname,omitempty"` // .{1,128}
|
JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"`
|
||||||
JumboframeEnabled bool `json:"jumboframe_enabled,omitempty"`
|
LcmBrightness int `json:"lcm_brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||||
LcmBrightness int `json:"lcm_brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
LcmBrightnessOverride bool `json:"lcm_brightness_override,omitempty"`
|
||||||
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
|
||||||
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,omitempty"`
|
||||||
LcmIDleTimeoutOverride bool `json:"lcm_idle_timeout_override,omitempty"`
|
LcmNightModeBegins string `json:"lcm_night_mode_begins,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
|
||||||
LcmNightModeBegins string `json:"lcm_night_mode_begins,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
|
LcmNightModeEnds string `json:"lcm_night_mode_ends,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
|
||||||
LcmNightModeEnds string `json:"lcm_night_mode_ends,omitempty"` // (^$)|(^(0[1-9])|(1[0-9])|(2[0-3])):([0-5][0-9]$)
|
LcmSettingsRestrictedAccess bool `json:"lcm_settings_restricted_access,omitempty"`
|
||||||
LcmOrientationOverride int `json:"lcm_orientation_override,omitempty"` // 0|90|180|270
|
LcmTrackerEnabled bool `json:"lcm_tracker_enabled,omitempty"`
|
||||||
LcmSettingsRestrictedAccess bool `json:"lcm_settings_restricted_access,omitempty"`
|
LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50}
|
||||||
LcmTrackerEnabled bool `json:"lcm_tracker_enabled,omitempty"`
|
LedOverride string `json:"led_override,omitempty"` // default|on|off
|
||||||
LcmTrackerSeed string `json:"lcm_tracker_seed,omitempty"` // .{0,50}
|
LedOverrideColor string `json:"led_override_color,omitempty"` // ^#(?:[0-9a-fA-F]{3}){1,2}$
|
||||||
LedOverride string `json:"led_override,omitempty"` // default|on|off
|
LedOverrideColorBrightness int `json:"led_override_color_brightness,omitempty"` // ^[0-9][0-9]?$|^100$
|
||||||
LedOverrideColor string `json:"led_override_color,omitempty"` // ^#(?:[0-9a-fA-F]{3}){1,2}$
|
Locked bool `json:"locked,omitempty"`
|
||||||
LedOverrideColorBrightness int `json:"led_override_color_brightness,omitempty"` // ^[0-9][0-9]?$|^100$
|
LowpfmodeOverride bool `json:"lowpfmode_override,omitempty"`
|
||||||
Locked bool `json:"locked,omitempty"`
|
LteApn string `json:"lte_apn,omitempty"` // .{1,128}
|
||||||
LowpfmodeOverride bool `json:"lowpfmode_override,omitempty"`
|
LteAuthType string `json:"lte_auth_type,omitempty"` // PAP|CHAP|PAP-CHAP|NONE
|
||||||
LteApn string `json:"lte_apn,omitempty"` // .{1,128}
|
LteDataLimitEnabled bool `json:"lte_data_limit_enabled,omitempty"`
|
||||||
LteAuthType string `json:"lte_auth_type,omitempty"` // PAP|CHAP|PAP-CHAP|NONE
|
LteDataWarningEnabled bool `json:"lte_data_warning_enabled,omitempty"`
|
||||||
LteDataLimitEnabled bool `json:"lte_data_limit_enabled,omitempty"`
|
LteExtAnt bool `json:"lte_ext_ant,omitempty"`
|
||||||
LteDataWarningEnabled bool `json:"lte_data_warning_enabled,omitempty"`
|
LteHardLimit int `json:"lte_hard_limit,omitempty"`
|
||||||
LteExtAnt bool `json:"lte_ext_ant,omitempty"`
|
LtePassword string `json:"lte_password,omitempty"`
|
||||||
LteHardLimit int `json:"lte_hard_limit,omitempty"`
|
LtePoe bool `json:"lte_poe,omitempty"`
|
||||||
LtePassword string `json:"lte_password,omitempty"`
|
LteRoamingAllowed bool `json:"lte_roaming_allowed,omitempty"`
|
||||||
LtePoe bool `json:"lte_poe,omitempty"`
|
LteSimPin int `json:"lte_sim_pin,omitempty"`
|
||||||
LteRoamingAllowed bool `json:"lte_roaming_allowed,omitempty"`
|
LteSoftLimit int `json:"lte_soft_limit,omitempty"`
|
||||||
LteSimPin int `json:"lte_sim_pin,omitempty"`
|
LteUsername string `json:"lte_username,omitempty"`
|
||||||
LteSoftLimit int `json:"lte_soft_limit,omitempty"`
|
MapID string `json:"map_id,omitempty"`
|
||||||
LteUsername string `json:"lte_username,omitempty"`
|
MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled,omitempty"`
|
||||||
MapID string `json:"map_id,omitempty"`
|
MgmtNetworkID string `json:"mgmt_network_id,omitempty"` // [\d\w]+
|
||||||
MeshStaVapEnabled bool `json:"mesh_sta_vap_enabled,omitempty"`
|
Model string `json:"model,omitempty"`
|
||||||
MgmtNetworkID string `json:"mgmt_network_id,omitempty"` // [\d\w]+
|
Name string `json:"name,omitempty"` // .{0,128}
|
||||||
Model string `json:"model,omitempty"`
|
OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off
|
||||||
Name string `json:"name,omitempty"` // .{0,128}
|
OutletEnabled bool `json:"outlet_enabled,omitempty"`
|
||||||
OutdoorModeOverride string `json:"outdoor_mode_override,omitempty"` // default|on|off
|
OutletOverrides []DeviceOutletOverrides `json:"outlet_overrides,omitempty"`
|
||||||
OutletEnabled bool `json:"outlet_enabled,omitempty"`
|
OutletPowerCycleEnabled bool `json:"outlet_power_cycle_enabled,omitempty"`
|
||||||
OutletOverrides []DeviceOutletOverrides `json:"outlet_overrides,omitempty"`
|
PeerToPeerMode string `json:"peer_to_peer_mode,omitempty"` // ap|sta
|
||||||
OutletPowerCycleEnabled bool `json:"outlet_power_cycle_enabled,omitempty"`
|
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||||
PeerToPeerMode string `json:"peer_to_peer_mode,omitempty"` // ap|sta
|
PortOverrides []DevicePortOverrides `json:"port_overrides"`
|
||||||
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
|
||||||
PortOverrides []DevicePortOverrides `json:"port_overrides"`
|
PowerSourceCtrlBudget int `json:"power_source_ctrl_budget,omitempty"` // [0-9]|[1-9][0-9]|[1-9][0-9][0-9]
|
||||||
PowerSourceCtrl string `json:"power_source_ctrl,omitempty"` // auto|8023af|8023at|8023bt-type3|8023bt-type4|pasv24|poe-injector|ac|adapter|dc|rps
|
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
|
||||||
PowerSourceCtrlBudget int `json:"power_source_ctrl_budget,omitempty"` // [0-9]|[1-9][0-9]|[1-9][0-9][0-9]
|
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
|
||||||
PowerSourceCtrlEnabled bool `json:"power_source_ctrl_enabled,omitempty"`
|
RadioTable []DeviceRadioTable `json:"radio_table,omitempty"`
|
||||||
PtmpApMAC string `json:"ptmp_ap_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
|
||||||
PtpApMAC string `json:"ptp_ap_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
RpsOverride DeviceRpsOverride `json:"rps_override,omitempty"`
|
||||||
RADIUSProfileID string `json:"radiusprofile_id,omitempty"`
|
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
|
||||||
RadioTable []DeviceRadioTable `json:"radio_table,omitempty"`
|
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
|
||||||
ResetbtnEnabled string `json:"resetbtn_enabled,omitempty"` // on|off
|
State DeviceState `json:"state"`
|
||||||
RpsOverride DeviceRpsOverride `json:"rps_override,omitempty"`
|
StpPriority string `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
|
||||||
SnmpContact string `json:"snmp_contact,omitempty"` // .{0,255}
|
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
|
||||||
SnmpLocation string `json:"snmp_location,omitempty"` // .{0,255}
|
SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"`
|
||||||
State DeviceState `json:"state"`
|
Type string `json:"type,omitempty"`
|
||||||
StationMode string `json:"station_mode,omitempty"` // ptp|ptmp|wifi
|
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
|
||||||
StpPriority string `json:"stp_priority,omitempty"` // 0|4096|8192|12288|16384|20480|24576|28672|32768|36864|40960|45056|49152|53248|57344|61440
|
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
|
||||||
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
|
X float64 `json:"x,omitempty"`
|
||||||
SwitchVLANEnabled bool `json:"switch_vlan_enabled,omitempty"`
|
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
|
||||||
Type string `json:"type,omitempty"`
|
Y float64 `json:"y,omitempty"`
|
||||||
UbbPairName string `json:"ubb_pair_name,omitempty"` // .{1,128}
|
|
||||||
Volume int `json:"volume,omitempty"` // [0-9]|[1-9][0-9]|100
|
PortTable []PortTable `json:"port_table,omitempty"`
|
||||||
X float64 `json:"x,omitempty"`
|
|
||||||
XBaresipPassword string `json:"x_baresip_password,omitempty"` // ^[a-zA-Z0-9_.\-!~*'()]*
|
|
||||||
Y float64 `json:"y,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *Device) UnmarshalJSON(b []byte) error {
|
func (dst *Device) UnmarshalJSON(b []byte) error {
|
||||||
@@ -117,7 +114,6 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
|
|||||||
GatewayVrrpPriority emptyStringInt `json:"gateway_vrrp_priority"`
|
GatewayVrrpPriority emptyStringInt `json:"gateway_vrrp_priority"`
|
||||||
LcmBrightness emptyStringInt `json:"lcm_brightness"`
|
LcmBrightness emptyStringInt `json:"lcm_brightness"`
|
||||||
LcmIDleTimeout emptyStringInt `json:"lcm_idle_timeout"`
|
LcmIDleTimeout emptyStringInt `json:"lcm_idle_timeout"`
|
||||||
LcmOrientationOverride emptyStringInt `json:"lcm_orientation_override"`
|
|
||||||
LedOverrideColorBrightness emptyStringInt `json:"led_override_color_brightness"`
|
LedOverrideColorBrightness emptyStringInt `json:"led_override_color_brightness"`
|
||||||
LteExtAnt booleanishString `json:"lte_ext_ant"`
|
LteExtAnt booleanishString `json:"lte_ext_ant"`
|
||||||
LteHardLimit emptyStringInt `json:"lte_hard_limit"`
|
LteHardLimit emptyStringInt `json:"lte_hard_limit"`
|
||||||
@@ -140,7 +136,6 @@ func (dst *Device) UnmarshalJSON(b []byte) error {
|
|||||||
dst.GatewayVrrpPriority = int(aux.GatewayVrrpPriority)
|
dst.GatewayVrrpPriority = int(aux.GatewayVrrpPriority)
|
||||||
dst.LcmBrightness = int(aux.LcmBrightness)
|
dst.LcmBrightness = int(aux.LcmBrightness)
|
||||||
dst.LcmIDleTimeout = int(aux.LcmIDleTimeout)
|
dst.LcmIDleTimeout = int(aux.LcmIDleTimeout)
|
||||||
dst.LcmOrientationOverride = int(aux.LcmOrientationOverride)
|
|
||||||
dst.LedOverrideColorBrightness = int(aux.LedOverrideColorBrightness)
|
dst.LedOverrideColorBrightness = int(aux.LedOverrideColorBrightness)
|
||||||
dst.LteExtAnt = bool(aux.LteExtAnt)
|
dst.LteExtAnt = bool(aux.LteExtAnt)
|
||||||
dst.LteHardLimit = int(aux.LteHardLimit)
|
dst.LteHardLimit = int(aux.LteHardLimit)
|
||||||
@@ -181,10 +176,29 @@ func (dst *DeviceConfigNetwork) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DeviceConnectedBatteryOverrides struct {
|
||||||
|
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dst *DeviceConnectedBatteryOverrides) UnmarshalJSON(b []byte) error {
|
||||||
|
type Alias DeviceConnectedBatteryOverrides
|
||||||
|
aux := &struct {
|
||||||
|
*Alias
|
||||||
|
}{
|
||||||
|
Alias: (*Alias)(dst),
|
||||||
|
}
|
||||||
|
|
||||||
|
err := json.Unmarshal(b, &aux)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type DeviceEtherLighting struct {
|
type DeviceEtherLighting struct {
|
||||||
Behavior string `json:"behavior,omitempty"` // breath|steady
|
Behavior string `json:"behavior,omitempty"` // breath|steady
|
||||||
Brightness int `json:"brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
Brightness int `json:"brightness,omitempty"` // [1-9]|[1-9][0-9]|100
|
||||||
LedMode string `json:"led_mode,omitempty"` // standard|etherlighting
|
|
||||||
Mode string `json:"mode,omitempty"` // speed|network
|
Mode string `json:"mode,omitempty"` // speed|network
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,13 +282,12 @@ type DevicePortOverrides struct {
|
|||||||
Isolation bool `json:"isolation,omitempty"`
|
Isolation bool `json:"isolation,omitempty"`
|
||||||
LldpmedEnabled bool `json:"lldpmed_enabled,omitempty"`
|
LldpmedEnabled bool `json:"lldpmed_enabled,omitempty"`
|
||||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled,omitempty"`
|
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled,omitempty"`
|
||||||
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-6]
|
MirrorPortIDX int `json:"mirror_port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||||
MulticastRouterNetworkIDs []string `json:"multicast_router_networkconf_ids,omitempty"`
|
|
||||||
NATiveNetworkID string `json:"native_networkconf_id,omitempty"`
|
NATiveNetworkID string `json:"native_networkconf_id,omitempty"`
|
||||||
Name string `json:"name,omitempty"` // .{0,128}
|
Name string `json:"name,omitempty"` // .{0,128}
|
||||||
OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate
|
OpMode string `json:"op_mode,omitempty"` // switch|mirror|aggregate
|
||||||
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
PoeMode string `json:"poe_mode,omitempty"` // auto|pasv24|passthrough|off
|
||||||
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-6]
|
PortIDX int `json:"port_idx,omitempty"` // [1-9]|[1-4][0-9]|5[0-2]
|
||||||
PortKeepaliveEnabled bool `json:"port_keepalive_enabled,omitempty"`
|
PortKeepaliveEnabled bool `json:"port_keepalive_enabled,omitempty"`
|
||||||
PortProfileID string `json:"portconf_id,omitempty"` // [\d\w]+
|
PortProfileID string `json:"portconf_id,omitempty"` // [\d\w]+
|
||||||
PortSecurityEnabled bool `json:"port_security_enabled,omitempty"`
|
PortSecurityEnabled bool `json:"port_security_enabled,omitempty"`
|
||||||
@@ -299,6 +312,8 @@ type DevicePortOverrides struct {
|
|||||||
StpPortMode bool `json:"stp_port_mode,omitempty"`
|
StpPortMode bool `json:"stp_port_mode,omitempty"`
|
||||||
TaggedVLANMgmt string `json:"tagged_vlan_mgmt,omitempty"` // auto|block_all|custom
|
TaggedVLANMgmt string `json:"tagged_vlan_mgmt,omitempty"` // auto|block_all|custom
|
||||||
VoiceNetworkID string `json:"voice_networkconf_id,omitempty"`
|
VoiceNetworkID string `json:"voice_networkconf_id,omitempty"`
|
||||||
|
|
||||||
|
PortPoe *bool `json:"port_poe,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *DevicePortOverrides) UnmarshalJSON(b []byte) error {
|
func (dst *DevicePortOverrides) UnmarshalJSON(b []byte) error {
|
||||||
|
|||||||
@@ -1,141 +0,0 @@
|
|||||||
package unifi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type FirewallDestination struct {
|
|
||||||
IPGroupID string `json:"ip_group_id"`
|
|
||||||
IPs []string `json:"ips"`
|
|
||||||
MatchOppositeIPs bool `json:"match_opposite_ips"`
|
|
||||||
MatchOppositePorts bool `json:"match_opposite_ports"`
|
|
||||||
MatchingTarget string `json:"matching_target"`
|
|
||||||
MatchingTargetType string `json:"matching_target_type"`
|
|
||||||
NetworkIDs [] string `json:"network_ids,omitempty"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
PortGroupID string `json:"port_group_id"`
|
|
||||||
PortMatchingType string `json:"port_matching_type"`
|
|
||||||
Regions []string `json:"regions,omitempty"`
|
|
||||||
ZoneID string `json:"zone_id"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallSource struct {
|
|
||||||
ClientMacs []string `json:"client_macs,omitempty"`
|
|
||||||
IPs []string `json:"ips,omitempty"`
|
|
||||||
MatchMac bool `json:"match_mac"`
|
|
||||||
MatchOppositeIPs bool `json:"match_opposite_ips"`
|
|
||||||
MatchOppositeNetworks bool `json:"match_opposite_networks"`
|
|
||||||
MatchOppositePorts bool `json:"match_opposite_ports"`
|
|
||||||
MatchingTarget string `json:"matching_target,omitempty"`
|
|
||||||
MatchingTargetType string `json:"matching_target_type,omitempty"`
|
|
||||||
NetworkIDs []string `json:"network_ids,omitempty"`
|
|
||||||
Port string `json:"port,omitempty"`
|
|
||||||
PortMatchingType string `json:"port_matching_type,omitempty"`
|
|
||||||
ZoneID string `json:"zone_id,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallSchedule struct {
|
|
||||||
Mode string `json:"mode"`
|
|
||||||
DateStart string `json:"date_start,omitempty"`
|
|
||||||
DateEnd string `json:"date_end,omitempty"`
|
|
||||||
RepeatOnDays []string `json:"repeat_on_days"`
|
|
||||||
TimeAllDay bool `json:"time_all_day"`
|
|
||||||
TimeRangeStart string `json:"time_range_start,omitempty"`
|
|
||||||
TimeRangeEnd string `json:"time_range_end,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type FirewallPolicy struct {
|
|
||||||
ID string `json:"_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"`
|
|
||||||
ConnectionStateType string `json:"connection_state_type"`
|
|
||||||
ConnectionStates []string `json:"connection_states"`
|
|
||||||
CreateAllowRespond bool `json:"create_allow_respond"`
|
|
||||||
Description string `json:"description"`
|
|
||||||
Destination FirewallDestination `json:"destination"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
ICMPTypename string `json:"icmp_typename"`
|
|
||||||
ICMPV6Typename string `json:"icmp_v6_typename"`
|
|
||||||
Index int64 `json:"index"`
|
|
||||||
IPVersion string `json:"ip_version"`
|
|
||||||
Logging bool `json:"logging"`
|
|
||||||
MatchIPSec bool `json:"match_ip_sec"`
|
|
||||||
MatchIPSecType string `json:"match_ip_sec_type,omitempty"`
|
|
||||||
MatchOppositeProtocol bool `json:"match_opposite_protocol"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
OriginID string `json:"origin_id,omitempty"`
|
|
||||||
OriginType string `json:"origin_type,omitempty"`
|
|
||||||
Predefined bool `json:"predefined"`
|
|
||||||
Protocol string `json:"protocol"`
|
|
||||||
Schedule FirewallSchedule `json:"schedule"`
|
|
||||||
Source FirewallSource `json:"source"`
|
|
||||||
|
|
||||||
// Role string `json:"role"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) ListFirewallPolicy(ctx context.Context, site string) ([]FirewallPolicy, error) {
|
|
||||||
var respBody []FirewallPolicy
|
|
||||||
|
|
||||||
err := c.do_versioned(ctx, "V2", "GET", fmt.Sprintf("site/%s/firewall-policies", site), nil, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return respBody, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) GetFirewallPolicy(ctx context.Context, site, id string) (*FirewallPolicy, error) {
|
|
||||||
|
|
||||||
var respBody FirewallPolicy
|
|
||||||
err := c.do_versioned(ctx, "V2", "GET", fmt.Sprintf("site/%s/firewall-policies/%s", site,id), nil, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, &NotFoundError{}
|
|
||||||
}
|
|
||||||
|
|
||||||
new := respBody
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) DeleteFirewallPolicy(ctx context.Context, site, id string) error {
|
|
||||||
var respBody FirewallPolicy
|
|
||||||
err := c.do_versioned(ctx, "V2", "DELETE", fmt.Sprintf("site/%s/firewall-policies/%s", site, id), nil, &respBody)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) CreateFirewallPolicy(ctx context.Context, site string, d *FirewallPolicy) (*FirewallPolicy, error) {
|
|
||||||
var respBody FirewallPolicy
|
|
||||||
|
|
||||||
err := c.do_versioned(ctx, "V2", "POST", fmt.Sprintf("site/%s/firewall-policies", site), d, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
new := respBody
|
|
||||||
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) UpdateFirewallPolicy(ctx context.Context, site string, d *FirewallPolicy) (*FirewallPolicy, error) {
|
|
||||||
var respBody FirewallPolicy
|
|
||||||
|
|
||||||
err := c.do_versioned(ctx, "V2", "PUT", fmt.Sprintf("site/%s/firewall-policies/%s", site, d.ID), d, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
new := respBody
|
|
||||||
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
10
unifi/firewall_rule.generated.go
generated
10
unifi/firewall_rule.generated.go
generated
@@ -26,6 +26,7 @@ type FirewallRule struct {
|
|||||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
Action string `json:"action,omitempty"` // drop|reject|accept
|
Action string `json:"action,omitempty"` // drop|reject|accept
|
||||||
|
Contiguous bool `json:"contiguous"`
|
||||||
DstAddress string `json:"dst_address,omitempty"`
|
DstAddress string `json:"dst_address,omitempty"`
|
||||||
DstAddressIPV6 string `json:"dst_address_ipv6,omitempty"`
|
DstAddressIPV6 string `json:"dst_address_ipv6,omitempty"`
|
||||||
DstFirewallGroupIDs []string `json:"dst_firewallgroup_ids,omitempty"` // [\d\w]+
|
DstFirewallGroupIDs []string `json:"dst_firewallgroup_ids,omitempty"` // [\d\w]+
|
||||||
@@ -37,6 +38,8 @@ type FirewallRule struct {
|
|||||||
ICMPv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|beyond-scope|communication-prohibited|destination-unreachable|echo-reply|echo-request|failed-policy|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|reject-route|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option
|
ICMPv6Typename string `json:"icmpv6_typename"` // ^$|address-unreachable|bad-header|beyond-scope|communication-prohibited|destination-unreachable|echo-reply|echo-request|failed-policy|neighbor-advertisement|neighbor-solicitation|no-route|packet-too-big|parameter-problem|port-unreachable|redirect|reject-route|router-advertisement|router-solicitation|time-exceeded|ttl-zero-during-reassembly|ttl-zero-during-transit|unknown-header-type|unknown-option
|
||||||
IPSec string `json:"ipsec"` // match-ipsec|match-none|^$
|
IPSec string `json:"ipsec"` // match-ipsec|match-none|^$
|
||||||
Logging bool `json:"logging"`
|
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}
|
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
|
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"`
|
ProtocolMatchExcepted bool `json:"protocol_match_excepted"`
|
||||||
@@ -51,10 +54,17 @@ type FirewallRule struct {
|
|||||||
SrcNetworkID string `json:"src_networkconf_id"` // [\d\w]+|^$
|
SrcNetworkID string `json:"src_networkconf_id"` // [\d\w]+|^$
|
||||||
SrcNetworkType string `json:"src_networkconf_type,omitempty"` // ADDRv4|NETv4
|
SrcNetworkType string `json:"src_networkconf_type,omitempty"` // ADDRv4|NETv4
|
||||||
SrcPort string `json:"src_port,omitempty"`
|
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"`
|
StateEstablished bool `json:"state_established"`
|
||||||
StateInvalid bool `json:"state_invalid"`
|
StateInvalid bool `json:"state_invalid"`
|
||||||
StateNew bool `json:"state_new"`
|
StateNew bool `json:"state_new"`
|
||||||
StateRelated bool `json:"state_related"`
|
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 (dst *FirewallRule) UnmarshalJSON(b []byte) error {
|
func (dst *FirewallRule) UnmarshalJSON(b []byte) error {
|
||||||
|
|||||||
@@ -14,22 +14,25 @@ type FirewallZone struct {
|
|||||||
// NoEdit bool `json:"attr_no_edit,omitempty"`
|
// NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
DefaultZone bool `json:"default_zone,omitempty"`
|
Description string `json:"desc"`
|
||||||
NetworkIDs []string `json:"network_ids,omitempty"`
|
DefaultZone bool `json:default_zone,omitempty`
|
||||||
ZoneKey string `json:"zone_key,omitempty"`
|
NetworkIDs []string `json:network_ids,omitempty`
|
||||||
|
|
||||||
// Role string `json:"role"`
|
// Role string `json:"role"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ListFirewallZones(ctx context.Context, site string) ([]FirewallZone, error) {
|
func (c *Client) ListFirewallZones(ctx context.Context, site string) ([]FirewallZone, error) {
|
||||||
var respBody []FirewallZone
|
var respBody struct {
|
||||||
|
Meta meta `json:"meta"`
|
||||||
|
Data []FirewallZone `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
err := c.do_versioned(ctx, "V2", "GET", fmt.Sprintf("site/%s/firewall/zone", site), nil, &respBody)
|
err := c.do(ctx, "GET", fmt.Sprintf("site/%s/firewall/zone", site), nil, &respBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return respBody, nil
|
return respBody.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetFirewallZone(ctx context.Context, site, id string) (*FirewallZone, error) {
|
func (c *Client) GetFirewallZone(ctx context.Context, site, id string) (*FirewallZone, error) {
|
||||||
|
|||||||
38
unifi/network.generated.go
generated
38
unifi/network.generated.go
generated
@@ -75,18 +75,15 @@ type Network struct {
|
|||||||
DomainName string `json:"domain_name"` // (?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^$|[a-zA-Z0-9-]{1,63}
|
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"`
|
Enabled bool `json:"enabled"`
|
||||||
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
|
ExposedToSiteVPN bool `json:"exposed_to_site_vpn"`
|
||||||
FirewallZoneID string `json:"firewall_zone_id"`
|
|
||||||
GatewayDevice string `json:"gateway_device"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
GatewayDevice string `json:"gateway_device"` // (^$|^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$)
|
||||||
GatewayType string `json:"gateway_type,omitempty"` // default|switch
|
GatewayType string `json:"gateway_type,omitempty"` // default|switch
|
||||||
IGMPFastleave bool `json:"igmp_fastleave"`
|
IGMPFastleave bool `json:"igmp_fastleave"`
|
||||||
IGMPForwardUnknownMulticast bool `json:"igmp_forward_unknown_multicast"`
|
|
||||||
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|^$
|
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]|^$
|
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|^$
|
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|^$
|
||||||
IGMPProxyDownstreamNetworkIDs []string `json:"igmp_proxy_downstream_networkconf_ids,omitempty"`
|
IGMPProxyDownstream bool `json:"igmp_proxy_downstream"`
|
||||||
IGMPProxyFor string `json:"igmp_proxy_for,omitempty"` // all|some|none
|
|
||||||
IGMPProxyUpstream bool `json:"igmp_proxy_upstream"`
|
IGMPProxyUpstream bool `json:"igmp_proxy_upstream"`
|
||||||
IGMPQuerierSwitches []NetworkIGMPQuerierSwitches `json:"igmp_querier_switches,omitempty"`
|
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"`
|
IGMPSnooping bool `json:"igmp_snooping"`
|
||||||
IGMPSupression bool `json:"igmp_supression"`
|
IGMPSupression bool `json:"igmp_supression"`
|
||||||
IPSecDhGroup int `json:"ipsec_dh_group,omitempty"` // 2|5|14|15|16|19|20|21|25|26
|
IPSecDhGroup int `json:"ipsec_dh_group,omitempty"` // 2|5|14|15|16|19|20|21|25|26
|
||||||
@@ -129,12 +126,13 @@ type Network struct {
|
|||||||
IPV6SettingPreference string `json:"ipv6_setting_preference,omitempty"` // auto|manual
|
IPV6SettingPreference string `json:"ipv6_setting_preference,omitempty"` // auto|manual
|
||||||
IPV6SingleNetworkInterface string `json:"ipv6_single_network_interface,omitempty"`
|
IPV6SingleNetworkInterface string `json:"ipv6_single_network_interface,omitempty"`
|
||||||
IPV6Subnet string `json:"ipv6_subnet,omitempty"`
|
IPV6Subnet string `json:"ipv6_subnet,omitempty"`
|
||||||
|
IPV6Subnets []string `json:"ipv6_subnets,omitempty"`
|
||||||
IPV6WANDelegationType string `json:"ipv6_wan_delegation_type,omitempty"` // pd|single_network|none
|
IPV6WANDelegationType string `json:"ipv6_wan_delegation_type,omitempty"` // pd|single_network|none
|
||||||
InterfaceMtu int `json:"interface_mtu,omitempty"` // ^(6[89]|[7-9][0-9]|[1-9][0-9]{2,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|65500)$
|
InterfaceMtu int `json:"interface_mtu,omitempty"` // ^(6[89]|[7-9][0-9]|[1-9][0-9]{2,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|65500)$
|
||||||
InterfaceMtuEnabled bool `json:"interface_mtu_enabled"`
|
InterfaceMtuEnabled bool `json:"interface_mtu_enabled"`
|
||||||
InternetAccessEnabled bool `json:"internet_access_enabled"`
|
InternetAccessEnabled bool `json:"internet_access_enabled"`
|
||||||
IsNAT bool `json:"is_nat"`
|
IsNAT bool `json:"is_nat"`
|
||||||
L2TpAllowWeakCiphers bool `json:"l2tp_allow_weak_ciphers"`
|
L4TpAllowWeakCiphers bool `json:"l2tp_allow_weak_ciphers"`
|
||||||
L2TpInterface string `json:"l2tp_interface,omitempty"` // wan|wan2
|
L2TpInterface string `json:"l2tp_interface,omitempty"` // wan|wan2
|
||||||
L2TpLocalWANIP string `json:"l2tp_local_wan_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])$
|
L2TpLocalWANIP string `json:"l2tp_local_wan_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])$
|
||||||
LocalPort int `json:"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])$
|
LocalPort int `json:"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])$
|
||||||
@@ -171,8 +169,7 @@ type Network struct {
|
|||||||
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]|3[0-2])$|^$
|
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]|3[0-2])$|^$
|
||||||
ReportWANEvent bool `json:"report_wan_event"`
|
ReportWANEvent bool `json:"report_wan_event"`
|
||||||
RequireMschapv2 bool `json:"require_mschapv2"`
|
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]$|^$
|
RouteDistance int `json:"route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
|
||||||
SdwanRemoteSiteID string `json:"sdwan_remote_site_id"`
|
|
||||||
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
|
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
|
||||||
SingleNetworkLan string `json:"single_network_lan,omitempty"`
|
SingleNetworkLan string `json:"single_network_lan,omitempty"`
|
||||||
UidPolicyEnabled bool `json:"uid_policy_enabled"`
|
UidPolicyEnabled bool `json:"uid_policy_enabled"`
|
||||||
@@ -196,7 +193,7 @@ type Network struct {
|
|||||||
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
|
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
|
||||||
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
|
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
|
||||||
VPNProtocol string `json:"vpn_protocol,omitempty"` // TCP|UDP
|
VPNProtocol string `json:"vpn_protocol,omitempty"` // TCP|UDP
|
||||||
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-client|openvpn-server|openvpn-vpn|pptp-client|l2tp-server|pptp-server|sdwan-hub-spoke-tunnel|sdwan-mesh-tunnel|uid-server|wireguard-server|wireguard-client
|
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-client|openvpn-server|openvpn-vpn|pptp-client|l2tp-server|pptp-server|uid-server|wireguard-server|wireguard-client
|
||||||
VrrpIPSubnetGw1 string `json:"vrrp_ip_subnet_gw1,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)$
|
VrrpIPSubnetGw1 string `json:"vrrp_ip_subnet_gw1,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)$
|
||||||
VrrpIPSubnetGw2 string `json:"vrrp_ip_subnet_gw2,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)$
|
VrrpIPSubnetGw2 string `json:"vrrp_ip_subnet_gw2,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)$
|
||||||
VrrpVrid int `json:"vrrp_vrid,omitempty"` // [1-9]|[1-9][0-9]
|
VrrpVrid int `json:"vrrp_vrid,omitempty"` // [1-9]|[1-9][0-9]
|
||||||
@@ -342,27 +339,6 @@ func (dst *Network) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type NetworkIGMPQuerierSwitches struct {
|
|
||||||
QuerierAddress string `json:"querier_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])$|^$
|
|
||||||
SwitchMAC string `json:"switch_mac,omitempty"` // ^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *NetworkIGMPQuerierSwitches) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias NetworkIGMPQuerierSwitches
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type NetworkNATOutboundIPAddresses struct {
|
type NetworkNATOutboundIPAddresses struct {
|
||||||
IPAddress string `json:"ip_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])$|^$
|
IPAddress string `json:"ip_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])$|^$
|
||||||
IPAddressPool []string `json:"ip_address_pool,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])$
|
IPAddressPool []string `json:"ip_address_pool,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])$
|
||||||
@@ -446,7 +422,7 @@ func (c *Client) listNetwork(ctx context.Context, site string) ([]Network, error
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
fmt.Printf("%+v",respBody.Data)
|
||||||
return respBody.Data, nil
|
return respBody.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
unifi/port_profile.generated.go
generated
1
unifi/port_profile.generated.go
generated
@@ -37,7 +37,6 @@ type PortProfile struct {
|
|||||||
Isolation bool `json:"isolation"`
|
Isolation bool `json:"isolation"`
|
||||||
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
LldpmedEnabled bool `json:"lldpmed_enabled"`
|
||||||
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
LldpmedNotifyEnabled bool `json:"lldpmed_notify_enabled"`
|
||||||
MulticastRouterNetworkIDs []string `json:"multicast_router_networkconf_ids,omitempty"`
|
|
||||||
NATiveNetworkID string `json:"native_networkconf_id"`
|
NATiveNetworkID string `json:"native_networkconf_id"`
|
||||||
Name string `json:"name,omitempty"`
|
Name string `json:"name,omitempty"`
|
||||||
OpMode string `json:"op_mode,omitempty"` // switch
|
OpMode string `json:"op_mode,omitempty"` // switch
|
||||||
|
|||||||
48
unifi/radius_profile.generated.go
generated
48
unifi/radius_profile.generated.go
generated
@@ -25,23 +25,16 @@ type RADIUSProfile struct {
|
|||||||
NoDelete bool `json:"attr_no_delete,omitempty"`
|
NoDelete bool `json:"attr_no_delete,omitempty"`
|
||||||
NoEdit bool `json:"attr_no_edit,omitempty"`
|
NoEdit bool `json:"attr_no_edit,omitempty"`
|
||||||
|
|
||||||
AccountingEnabled bool `json:"accounting_enabled"`
|
AccountingEnabled bool `json:"accounting_enabled"`
|
||||||
AcctServers []RADIUSProfileAcctServers `json:"acct_servers,omitempty"`
|
AcctServers []RADIUSProfileAcctServers `json:"acct_servers,omitempty"`
|
||||||
AuthServers []RADIUSProfileAuthServers `json:"auth_servers,omitempty"`
|
AuthServers []RADIUSProfileAuthServers `json:"auth_servers,omitempty"`
|
||||||
InterimUpdateEnabled bool `json:"interim_update_enabled"`
|
InterimUpdateEnabled bool `json:"interim_update_enabled"`
|
||||||
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
|
InterimUpdateInterval int `json:"interim_update_interval,omitempty"` // ^([6-9][0-9]|[1-9][0-9]{2,3}|[1-7][0-9]{4}|8[0-5][0-9]{3}|86[0-3][0-9][0-9]|86400)$
|
||||||
Name string `json:"name,omitempty"` // .{1,128}
|
Name string `json:"name,omitempty"` // .{1,128}
|
||||||
TlsEnabled bool `json:"tls_enabled"`
|
UseUsgAcctServer bool `json:"use_usg_acct_server"`
|
||||||
UseUsgAcctServer bool `json:"use_usg_acct_server"`
|
UseUsgAuthServer bool `json:"use_usg_auth_server"`
|
||||||
UseUsgAuthServer bool `json:"use_usg_auth_server"`
|
VLANEnabled bool `json:"vlan_enabled"`
|
||||||
VLANEnabled bool `json:"vlan_enabled"`
|
VLANWLANMode string `json:"vlan_wlan_mode,omitempty"` // disabled|optional|required
|
||||||
VLANWLANMode string `json:"vlan_wlan_mode,omitempty"` // disabled|optional|required
|
|
||||||
XCaCrts []RADIUSProfileXCaCrts `json:"x_ca_crts,omitempty"`
|
|
||||||
XClientCrt string `json:"x_client_crt,omitempty"`
|
|
||||||
XClientCrtFilename string `json:"x_client_crt_filename,omitempty"`
|
|
||||||
XClientPrivateKey string `json:"x_client_private_key,omitempty"`
|
|
||||||
XClientPrivateKeyFilename string `json:"x_client_private_key_filename,omitempty"`
|
|
||||||
XClientPrivateKeyPassword string `json:"x_client_private_key_password,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *RADIUSProfile) UnmarshalJSON(b []byte) error {
|
func (dst *RADIUSProfile) UnmarshalJSON(b []byte) error {
|
||||||
@@ -113,27 +106,6 @@ func (dst *RADIUSProfileAuthServers) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type RADIUSProfileXCaCrts struct {
|
|
||||||
Filename string `json:"filename,omitempty"`
|
|
||||||
XCaCrt string `json:"x_ca_crt,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *RADIUSProfileXCaCrts) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias RADIUSProfileXCaCrts
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) listRADIUSProfile(ctx context.Context, site string) ([]RADIUSProfile, error) {
|
func (c *Client) listRADIUSProfile(ctx context.Context, site string) ([]RADIUSProfile, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type Setting struct {
|
|||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Setting) newFields() (any, error) {
|
func (s *Setting) newFields() (interface{}, error) {
|
||||||
switch s.Key {
|
switch s.Key {
|
||||||
case "auto_speedtest":
|
case "auto_speedtest":
|
||||||
return &SettingAutoSpeedtest{}, nil
|
return &SettingAutoSpeedtest{}, nil
|
||||||
@@ -79,7 +79,7 @@ func (s *Setting) newFields() (any, error) {
|
|||||||
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetSetting(ctx context.Context, site, key string) (*Setting, any, error) {
|
func (c *Client) GetSetting(ctx context.Context, site, key string) (*Setting, interface{}, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
Data []json.RawMessage `json:"data"`
|
Data []json.RawMessage `json:"data"`
|
||||||
|
|||||||
5
unifi/setting_dashboard.generated.go
generated
5
unifi/setting_dashboard.generated.go
generated
@@ -27,7 +27,7 @@ type SettingDashboard struct {
|
|||||||
|
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
|
|
||||||
LayoutPreference string `json:"layout_preference,omitempty"` // auto|manual
|
LayoutPreference string `json:"layout_preference,omitempty"` // auto|custom
|
||||||
Widgets []SettingDashboardWidgets `json:"widgets,omitempty"`
|
Widgets []SettingDashboardWidgets `json:"widgets,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,8 +48,7 @@ func (dst *SettingDashboard) UnmarshalJSON(b []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SettingDashboardWidgets struct {
|
type SettingDashboardWidgets struct {
|
||||||
Enabled bool `json:"enabled"`
|
Name string `json:"name,omitempty"` // traffic_identification|connection_types|wifi_technology|most_active_clients|most_active_aps|meshing|network_activity|wireless_experience|internet|wifi_activity|wifi_channels|wifi_client_experience|wifi_tx_retries|admin_activity|device_client_count|server_ip
|
||||||
Name string `json:"name,omitempty"` // cybersecure|traffic_identification|wifi_technology|wifi_channels|wifi_client_experience|wifi_tx_retries|most_active_apps_aps_clients|most_active_apps_clients|most_active_aps_clients|most_active_apps_aps|most_active_apps|v2_most_active_aps|v2_most_active_clients|wifi_connectivity|ap_radio_density
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *SettingDashboardWidgets) UnmarshalJSON(b []byte) error {
|
func (dst *SettingDashboardWidgets) UnmarshalJSON(b []byte) error {
|
||||||
|
|||||||
27
unifi/setting_doh.generated.go
generated
27
unifi/setting_doh.generated.go
generated
@@ -27,9 +27,8 @@ type SettingDoh struct {
|
|||||||
|
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
|
|
||||||
CustomServers []SettingDohCustomServers `json:"custom_servers,omitempty"`
|
ServerNames []string `json:"server_names,omitempty"`
|
||||||
ServerNames []string `json:"server_names,omitempty"`
|
State string `json:"state,omitempty"` // off|auto|manual
|
||||||
State string `json:"state,omitempty"` // off|auto|manual|custom
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *SettingDoh) UnmarshalJSON(b []byte) error {
|
func (dst *SettingDoh) UnmarshalJSON(b []byte) error {
|
||||||
@@ -48,28 +47,6 @@ func (dst *SettingDoh) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettingDohCustomServers struct {
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
SdnsStamp string `json:"sdns_stamp,omitempty"`
|
|
||||||
ServerName string `json:"server_name,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *SettingDohCustomServers) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias SettingDohCustomServers
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) getSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
|
func (c *Client) getSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
7
unifi/setting_ips.generated.go
generated
7
unifi/setting_ips.generated.go
generated
@@ -29,15 +29,16 @@ type SettingIps struct {
|
|||||||
|
|
||||||
AdBlockingConfigurations []SettingIpsAdBlockingConfigurations `json:"ad_blocking_configurations,omitempty"`
|
AdBlockingConfigurations []SettingIpsAdBlockingConfigurations `json:"ad_blocking_configurations,omitempty"`
|
||||||
AdBlockingEnabled bool `json:"ad_blocking_enabled"`
|
AdBlockingEnabled bool `json:"ad_blocking_enabled"`
|
||||||
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |manual|disabled
|
AdvancedFilteringPreference string `json:"advanced_filtering_preference,omitempty"` // |auto|manual|disabled
|
||||||
DNSFiltering bool `json:"dns_filtering"`
|
DNSFiltering bool `json:"dns_filtering"`
|
||||||
DNSFilters []SettingIpsDNSFilters `json:"dns_filters,omitempty"`
|
DNSFilters []SettingIpsDNSFilters `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|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada|dark-web-blocker-list|malicious-hosts
|
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|emerging-sql|emerging-telnet|emerging-tftp|tor|emerging-trojan|emerging-useragent|emerging-voip|emerging-webapps|emerging-webclient|emerging-webserver|emerging-worm|exploit-kit|adware-pup|botcc-portgrouped|phishing|threatview-cs-c2|3coresec|chat|coinminer|current-events|drop|hunting|icmp-info|inappropriate|info|ja3|policy|scada
|
||||||
EnabledNetworks []string `json:"enabled_networks,omitempty"`
|
EnabledNetworks []string `json:"enabled_networks,omitempty"`
|
||||||
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
|
Honeypot []SettingIpsHoneypot `json:"honeypot,omitempty"`
|
||||||
HoneypotEnabled bool `json:"honeypot_enabled"`
|
HoneypotEnabled bool `json:"honeypot_enabled"`
|
||||||
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
|
IPsMode string `json:"ips_mode,omitempty"` // ids|ips|ipsInline|disabled
|
||||||
MemoryOptimized bool `json:"memory_optimized"`
|
RestrictIPAddresses bool `json:"restrict_ip_addresses"`
|
||||||
|
RestrictTor bool `json:"restrict_tor"`
|
||||||
RestrictTorrents bool `json:"restrict_torrents"`
|
RestrictTorrents bool `json:"restrict_torrents"`
|
||||||
Suppression SettingIpsSuppression `json:"suppression,omitempty"`
|
Suppression SettingIpsSuppression `json:"suppression,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
110
unifi/setting_netflow.generated.go
generated
110
unifi/setting_netflow.generated.go
generated
@@ -1,110 +0,0 @@
|
|||||||
// Code generated from ace.jar fields *.json files
|
|
||||||
// DO NOT EDIT.
|
|
||||||
|
|
||||||
package unifi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
// just to fix compile issues with the import
|
|
||||||
var (
|
|
||||||
_ context.Context
|
|
||||||
_ fmt.Formatter
|
|
||||||
_ json.Marshaler
|
|
||||||
)
|
|
||||||
|
|
||||||
type SettingNetflow 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"`
|
|
||||||
|
|
||||||
Key string `json:"key"`
|
|
||||||
|
|
||||||
AutoEngineIDEnabled bool `json:"auto_engine_id_enabled"`
|
|
||||||
Enabled bool `json:"enabled"`
|
|
||||||
EngineID int `json:"engine_id,omitempty"` // ^$|[1-9][0-9]*
|
|
||||||
ExportFrequency int `json:"export_frequency,omitempty"`
|
|
||||||
NetworkIDs []string `json:"network_ids,omitempty"`
|
|
||||||
Port int `json:"port,omitempty"` // 102[4-9]|10[3-9][0-9]|1[1-9][0-9]{2}|[2-9][0-9]{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]
|
|
||||||
RefreshRate int `json:"refresh_rate,omitempty"`
|
|
||||||
SamplingMode string `json:"sampling_mode,omitempty"` // off|hash|random|deterministic
|
|
||||||
SamplingRate int `json:"sampling_rate,omitempty"` // [2-9]|[1-9][0-9]{1,3}|1[0-5][0-9]{3}|16[0-2][0-9]{2}|163[0-7][0-9]|1638[0-3]|^$
|
|
||||||
Server string `json:"server,omitempty"` // .{0,252}[^\.]$
|
|
||||||
Version int `json:"version,omitempty"` // 5|9|10
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *SettingNetflow) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias SettingNetflow
|
|
||||||
aux := &struct {
|
|
||||||
EngineID emptyStringInt `json:"engine_id"`
|
|
||||||
ExportFrequency emptyStringInt `json:"export_frequency"`
|
|
||||||
Port emptyStringInt `json:"port"`
|
|
||||||
RefreshRate emptyStringInt `json:"refresh_rate"`
|
|
||||||
SamplingRate emptyStringInt `json:"sampling_rate"`
|
|
||||||
Version emptyStringInt `json:"version"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.EngineID = int(aux.EngineID)
|
|
||||||
dst.ExportFrequency = int(aux.ExportFrequency)
|
|
||||||
dst.Port = int(aux.Port)
|
|
||||||
dst.RefreshRate = int(aux.RefreshRate)
|
|
||||||
dst.SamplingRate = int(aux.SamplingRate)
|
|
||||||
dst.Version = int(aux.Version)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) getSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
|
|
||||||
var respBody struct {
|
|
||||||
Meta meta `json:"meta"`
|
|
||||||
Data []SettingNetflow `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/netflow", 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) updateSettingNetflow(ctx context.Context, site string, d *SettingNetflow) (*SettingNetflow, error) {
|
|
||||||
var respBody struct {
|
|
||||||
Meta meta `json:"meta"`
|
|
||||||
Data []SettingNetflow `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Key = "netflow"
|
|
||||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/netflow", site), d, &respBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(respBody.Data) != 1 {
|
|
||||||
return nil, &NotFoundError{}
|
|
||||||
}
|
|
||||||
|
|
||||||
new := respBody.Data[0]
|
|
||||||
|
|
||||||
return &new, nil
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// Code generated from ace.jar fields *.json files
|
|
||||||
// DO NOT EDIT.
|
|
||||||
|
|
||||||
package unifi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (c *Client) GetSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
|
|
||||||
return c.getSettingNetflow(ctx, site)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) UpdateSettingNetflow(ctx context.Context, site string, d *SettingNetflow) (*SettingNetflow, error) {
|
|
||||||
return c.updateSettingNetflow(ctx, site, d)
|
|
||||||
}
|
|
||||||
56
unifi/setting_radio_ai.generated.go
generated
56
unifi/setting_radio_ai.generated.go
generated
@@ -27,21 +27,20 @@ type SettingRadioAi struct {
|
|||||||
|
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
|
|
||||||
AutoAdjustChannelsToCountry bool `json:"auto_adjust_channels_to_country"`
|
AutoAdjustChannelsToCountry bool `json:"auto_adjust_channels_to_country"`
|
||||||
Channels6E []int `json:"channels_6e,omitempty"` // [1-9]|[1-2][0-9]|3[3-9]|[4-5][0-9]|6[0-1]|6[5-9]|[7-8][0-9]|9[0-3]|9[7-9]|1[0-1][0-9]|12[0-5]|129|1[3-4][0-9]|15[0-7]|16[1-9]|1[7-8][0-9]|19[3-9]|2[0-1][0-9]|22[0-1]|22[5-9]|233
|
Channels6E []int `json:"channels_6e,omitempty"` // [1-9]|[1-2][0-9]|3[3-9]|[4-5][0-9]|6[0-1]|6[5-9]|[7-8][0-9]|9[0-3]|9[7-9]|1[0-1][0-9]|12[0-5]|129|1[3-4][0-9]|15[0-7]|16[1-9]|1[7-8][0-9]|19[3-9]|2[0-1][0-9]|22[0-1]|22[5-9]|233
|
||||||
ChannelsBlacklist []SettingRadioAiChannelsBlacklist `json:"channels_blacklist,omitempty"`
|
ChannelsNa []int `json:"channels_na,omitempty"` // 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|169
|
||||||
ChannelsNa []int `json:"channels_na,omitempty"` // 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|169
|
ChannelsNg []int `json:"channels_ng,omitempty"` // 1|2|3|4|5|6|7|8|9|10|11|12|13|14
|
||||||
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"`
|
||||||
CronExpr string `json:"cron_expr,omitempty"`
|
Default bool `json:"default"`
|
||||||
Default bool `json:"default"`
|
Enabled bool `json:"enabled"`
|
||||||
Enabled bool `json:"enabled"`
|
ExcludeDevices []string `json:"exclude_devices,omitempty"` // ([0-9a-z]{2}:){5}[0-9a-z]{2}
|
||||||
ExcludeDevices []string `json:"exclude_devices,omitempty"` // ([0-9a-z]{2}:){5}[0-9a-z]{2}
|
HtModesNa []int `json:"ht_modes_na,omitempty"` // ^(20|40|80|160)$
|
||||||
HtModesNa []int `json:"ht_modes_na,omitempty"` // ^(20|40|80|160)$
|
HtModesNg []int `json:"ht_modes_ng,omitempty"` // ^(20|40)$
|
||||||
HtModesNg []int `json:"ht_modes_ng,omitempty"` // ^(20|40)$
|
Optimize []string `json:"optimize,omitempty"` // channel|power
|
||||||
Optimize []string `json:"optimize,omitempty"` // channel|power
|
Radios []string `json:"radios,omitempty"` // na|ng
|
||||||
Radios []string `json:"radios,omitempty"` // na|ng
|
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
|
||||||
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
|
UseXy bool `json:"useXY"`
|
||||||
UseXy bool `json:"useXY"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *SettingRadioAi) UnmarshalJSON(b []byte) error {
|
func (dst *SettingRadioAi) UnmarshalJSON(b []byte) error {
|
||||||
@@ -86,33 +85,6 @@ func (dst *SettingRadioAi) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettingRadioAiChannelsBlacklist struct {
|
|
||||||
Channel int `json:"channel,omitempty"` // [1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-9]|2[0-1][0-9]|22[0-1]|22[5-9]|233
|
|
||||||
ChannelWidth int `json:"channel_width,omitempty"` // 20|40|80|160|240|320
|
|
||||||
Radio string `json:"radio,omitempty"` // na|ng|6e
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *SettingRadioAiChannelsBlacklist) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias SettingRadioAiChannelsBlacklist
|
|
||||||
aux := &struct {
|
|
||||||
Channel emptyStringInt `json:"channel"`
|
|
||||||
ChannelWidth emptyStringInt `json:"channel_width"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.Channel = int(aux.Channel)
|
|
||||||
dst.ChannelWidth = int(aux.ChannelWidth)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) getSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
|
func (c *Client) getSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
20
unifi/setting_rsyslogd.generated.go
generated
20
unifi/setting_rsyslogd.generated.go
generated
@@ -27,17 +27,15 @@ type SettingRsyslogd struct {
|
|||||||
|
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
|
|
||||||
Contents []string `json:"contents,omitempty"` // device|client|firewall_default_policy|triggers|updates|admin_activity|critical|security_detections|vpn
|
Debug bool `json:"debug"`
|
||||||
Debug bool `json:"debug"`
|
Enabled bool `json:"enabled"`
|
||||||
Enabled bool `json:"enabled"`
|
IP string `json:"ip,omitempty"`
|
||||||
IP string `json:"ip,omitempty"`
|
NetconsoleEnabled bool `json:"netconsole_enabled"`
|
||||||
LogAllContents bool `json:"log_all_contents"`
|
NetconsoleHost string `json:"netconsole_host,omitempty"`
|
||||||
NetconsoleEnabled bool `json:"netconsole_enabled"`
|
NetconsolePort int `json:"netconsole_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]
|
||||||
NetconsoleHost string `json:"netconsole_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]
|
||||||
NetconsolePort int `json:"netconsole_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]
|
ThisController bool `json:"this_controller"`
|
||||||
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]
|
ThisControllerEncryptedOnly bool `json:"this_controller_encrypted_only"`
|
||||||
ThisController bool `json:"this_controller"`
|
|
||||||
ThisControllerEncryptedOnly bool `json:"this_controller_encrypted_only"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *SettingRsyslogd) UnmarshalJSON(b []byte) error {
|
func (dst *SettingRsyslogd) UnmarshalJSON(b []byte) error {
|
||||||
|
|||||||
134
unifi/setting_usg.generated.go
generated
134
unifi/setting_usg.generated.go
generated
@@ -27,61 +27,62 @@ type SettingUsg struct {
|
|||||||
|
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
|
|
||||||
ArpCacheBaseReachable int `json:"arp_cache_base_reachable,omitempty"` // ^$|^[1-9]{1}[0-9]{0,4}$
|
ArpCacheBaseReachable int `json:"arp_cache_base_reachable,omitempty"` // ^$|^[1-9]{1}[0-9]{0,4}$
|
||||||
ArpCacheTimeout string `json:"arp_cache_timeout,omitempty"` // normal|min-dhcp-lease|custom
|
ArpCacheTimeout string `json:"arp_cache_timeout,omitempty"` // normal|min-dhcp-lease|custom
|
||||||
BroadcastPing bool `json:"broadcast_ping"`
|
BroadcastPing bool `json:"broadcast_ping"`
|
||||||
DHCPDHostfileUpdate bool `json:"dhcpd_hostfile_update"`
|
DHCPDHostfileUpdate bool `json:"dhcpd_hostfile_update"`
|
||||||
DHCPDUseDNSmasq bool `json:"dhcpd_use_dnsmasq"`
|
DHCPDUseDNSmasq bool `json:"dhcpd_use_dnsmasq"`
|
||||||
DHCPRelayAgentsPackets string `json:"dhcp_relay_agents_packets"` // append|discard|forward|replace|^$
|
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])|^$
|
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)|^$
|
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)|^$
|
||||||
DHCPRelayPort int `json:"dhcp_relay_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]|^$
|
DHCPRelayPort int `json:"dhcp_relay_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]|^$
|
||||||
DHCPRelayServer1 string `json:"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])$|^$
|
DHCPRelayServer1 string `json:"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])$|^$
|
||||||
DHCPRelayServer2 string `json:"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])$|^$
|
DHCPRelayServer2 string `json:"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])$|^$
|
||||||
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])$|^$
|
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])$|^$
|
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])$|^$
|
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])$|^$
|
||||||
DNSVerification SettingUsgDNSVerification `json:"dns_verification,omitempty"`
|
DNSmasqAllServers bool `json:"dnsmasq_all_servers"`
|
||||||
DNSmasqAllServers bool `json:"dnsmasq_all_servers"`
|
EchoServer string `json:"echo_server,omitempty"` // [^\"\' ]{1,255}
|
||||||
EchoServer string `json:"echo_server,omitempty"` // [^\"\' ]{1,255}
|
FirewallGuestDefaultLog bool `json:"firewall_guest_default_log"`
|
||||||
FtpModule bool `json:"ftp_module"`
|
FirewallLanDefaultLog bool `json:"firewall_lan_default_log"`
|
||||||
GeoIPFilteringBlock string `json:"geo_ip_filtering_block,omitempty"` // block|allow
|
FirewallWANDefaultLog bool `json:"firewall_wan_default_log"`
|
||||||
GeoIPFilteringCountries string `json:"geo_ip_filtering_countries,omitempty"` // ^([A-Z]{2})?(,[A-Z]{2}){0,149}$
|
FtpModule bool `json:"ftp_module"`
|
||||||
GeoIPFilteringEnabled bool `json:"geo_ip_filtering_enabled"`
|
GeoIPFilteringBlock string `json:"geo_ip_filtering_block,omitempty"` // block|allow
|
||||||
GeoIPFilteringTrafficDirection string `json:"geo_ip_filtering_traffic_direction,omitempty"` // ^(both|ingress|egress)$
|
GeoIPFilteringCountries string `json:"geo_ip_filtering_countries,omitempty"` // ^([A-Z]{2})?(,[A-Z]{2}){0,149}$
|
||||||
GreModule bool `json:"gre_module"`
|
GeoIPFilteringEnabled bool `json:"geo_ip_filtering_enabled"`
|
||||||
H323Module bool `json:"h323_module"`
|
GeoIPFilteringTrafficDirection string `json:"geo_ip_filtering_traffic_direction,omitempty"` // ^(both|ingress|egress)$
|
||||||
ICMPTimeout int `json:"icmp_timeout,omitempty"`
|
GreModule bool `json:"gre_module"`
|
||||||
LldpEnableAll bool `json:"lldp_enable_all"`
|
H323Module bool `json:"h323_module"`
|
||||||
MdnsEnabled bool `json:"mdns_enabled"`
|
ICMPTimeout int `json:"icmp_timeout,omitempty"`
|
||||||
MssClamp string `json:"mss_clamp,omitempty"` // auto|custom|disabled
|
LldpEnableAll bool `json:"lldp_enable_all"`
|
||||||
MssClampMss int `json:"mss_clamp_mss,omitempty"` // [1-9][0-9]{2,3}
|
MdnsEnabled bool `json:"mdns_enabled"`
|
||||||
OffloadAccounting bool `json:"offload_accounting"`
|
MssClamp string `json:"mss_clamp,omitempty"` // auto|custom|disabled
|
||||||
OffloadL2Blocking bool `json:"offload_l2_blocking"`
|
MssClampMss int `json:"mss_clamp_mss,omitempty"` // [1-9][0-9]{2,3}
|
||||||
OffloadSch bool `json:"offload_sch"`
|
OffloadAccounting bool `json:"offload_accounting"`
|
||||||
OtherTimeout int `json:"other_timeout,omitempty"`
|
OffloadL2Blocking bool `json:"offload_l2_blocking"`
|
||||||
PptpModule bool `json:"pptp_module"`
|
OffloadSch bool `json:"offload_sch"`
|
||||||
ReceiveRedirects bool `json:"receive_redirects"`
|
OtherTimeout int `json:"other_timeout,omitempty"`
|
||||||
SendRedirects bool `json:"send_redirects"`
|
PptpModule bool `json:"pptp_module"`
|
||||||
SipModule bool `json:"sip_module"`
|
ReceiveRedirects bool `json:"receive_redirects"`
|
||||||
SynCookies bool `json:"syn_cookies"`
|
SendRedirects bool `json:"send_redirects"`
|
||||||
TCPCloseTimeout int `json:"tcp_close_timeout,omitempty"`
|
SipModule bool `json:"sip_module"`
|
||||||
TCPCloseWaitTimeout int `json:"tcp_close_wait_timeout,omitempty"`
|
SynCookies bool `json:"syn_cookies"`
|
||||||
TCPEstablishedTimeout int `json:"tcp_established_timeout,omitempty"`
|
TCPCloseTimeout int `json:"tcp_close_timeout,omitempty"`
|
||||||
TCPFinWaitTimeout int `json:"tcp_fin_wait_timeout,omitempty"`
|
TCPCloseWaitTimeout int `json:"tcp_close_wait_timeout,omitempty"`
|
||||||
TCPLastAckTimeout int `json:"tcp_last_ack_timeout,omitempty"`
|
TCPEstablishedTimeout int `json:"tcp_established_timeout,omitempty"`
|
||||||
TCPSynRecvTimeout int `json:"tcp_syn_recv_timeout,omitempty"`
|
TCPFinWaitTimeout int `json:"tcp_fin_wait_timeout,omitempty"`
|
||||||
TCPSynSentTimeout int `json:"tcp_syn_sent_timeout,omitempty"`
|
TCPLastAckTimeout int `json:"tcp_last_ack_timeout,omitempty"`
|
||||||
TCPTimeWaitTimeout int `json:"tcp_time_wait_timeout,omitempty"`
|
TCPSynRecvTimeout int `json:"tcp_syn_recv_timeout,omitempty"`
|
||||||
TFTPModule bool `json:"tftp_module"`
|
TCPSynSentTimeout int `json:"tcp_syn_sent_timeout,omitempty"`
|
||||||
TimeoutSettingPreference string `json:"timeout_setting_preference,omitempty"` // auto|manual
|
TCPTimeWaitTimeout int `json:"tcp_time_wait_timeout,omitempty"`
|
||||||
UDPOtherTimeout int `json:"udp_other_timeout,omitempty"`
|
TFTPModule bool `json:"tftp_module"`
|
||||||
UDPStreamTimeout int `json:"udp_stream_timeout,omitempty"`
|
TimeoutSettingPreference string `json:"timeout_setting_preference,omitempty"` // auto|manual
|
||||||
UnbindWANMonitors bool `json:"unbind_wan_monitors"`
|
UDPOtherTimeout int `json:"udp_other_timeout,omitempty"`
|
||||||
UpnpEnabled bool `json:"upnp_enabled"`
|
UDPStreamTimeout int `json:"udp_stream_timeout,omitempty"`
|
||||||
UpnpNATPmpEnabled bool `json:"upnp_nat_pmp_enabled"`
|
UpnpEnabled bool `json:"upnp_enabled"`
|
||||||
UpnpSecureMode bool `json:"upnp_secure_mode"`
|
UpnpNATPmpEnabled bool `json:"upnp_nat_pmp_enabled"`
|
||||||
UpnpWANInterface string `json:"upnp_wan_interface,omitempty"` // WAN|WAN2
|
UpnpSecureMode bool `json:"upnp_secure_mode"`
|
||||||
|
UpnpWANInterface string `json:"upnp_wan_interface,omitempty"` // WAN|WAN2
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dst *SettingUsg) UnmarshalJSON(b []byte) error {
|
func (dst *SettingUsg) UnmarshalJSON(b []byte) error {
|
||||||
@@ -135,29 +136,6 @@ func (dst *SettingUsg) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type SettingUsgDNSVerification struct {
|
|
||||||
Domain string `json:"domain,omitempty"`
|
|
||||||
PrimaryDNSServer string `json:"primary_dns_server,omitempty"`
|
|
||||||
SecondaryDNSServer string `json:"secondary_dns_server,omitempty"`
|
|
||||||
SettingPreference string `json:"setting_preference,omitempty"` // auto|manual
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *SettingUsgDNSVerification) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias SettingUsgDNSVerification
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) getSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
func (c *Client) getSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
@@ -190,23 +190,11 @@ func (c *Client) Login(ctx context.Context, user, pass string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody any, respBody any) error {
|
func (c *Client) do(ctx context.Context, method, relativeURL string, reqBody interface{}, respBody interface{}) error {
|
||||||
return c.do_versioned(ctx, "V1", method, relativeURL, reqBody, respBody)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) do_versioned(ctx context.Context, version, method, relativeURL string, reqBody any, respBody any) error {
|
|
||||||
// single threading requests, this is mostly to assist in CSRF token propagation
|
// single threading requests, this is mostly to assist in CSRF token propagation
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
|
|
||||||
var apiPath string
|
|
||||||
|
|
||||||
if version == "V2" {
|
|
||||||
apiPath = c.apiV2Path
|
|
||||||
} else {
|
|
||||||
apiPath = c.apiPath
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
reqReader io.Reader
|
reqReader io.Reader
|
||||||
err error
|
err error
|
||||||
@@ -224,8 +212,11 @@ func (c *Client) do_versioned(ctx context.Context, version, method, relativeURL
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err)
|
return fmt.Errorf("unable to parse URL: %s %s %w", method, relativeURL, err)
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(relativeURL, "firewall/zone") {
|
||||||
|
c.apiPath = c.apiV2Path
|
||||||
|
}
|
||||||
if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() {
|
if !strings.HasPrefix(relativeURL, "/") && !reqURL.IsAbs() {
|
||||||
reqURL.Path = path.Join(apiPath, reqURL.Path)
|
reqURL.Path = path.Join(c.apiPath, reqURL.Path)
|
||||||
}
|
}
|
||||||
|
|
||||||
url := c.baseURL.ResolveReference(reqURL)
|
url := c.baseURL.ResolveReference(reqURL)
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ func (c *Client) CreateUser(ctx context.Context, site string, d *User) (*User, e
|
|||||||
return &user, nil
|
return &user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]any) ([]User, error) {
|
func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]interface{}) ([]User, error) {
|
||||||
reqBody := map[string]any{}
|
reqBody := map[string]interface{}{}
|
||||||
|
|
||||||
for k, v := range data {
|
for k, v := range data {
|
||||||
reqBody[k] = v
|
reqBody[k] = v
|
||||||
@@ -94,7 +94,7 @@ func (c *Client) stamgr(ctx context.Context, site, cmd string, data map[string]a
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "block-sta", map[string]any{
|
users, err := c.stamgr(ctx, site, "block-sta", map[string]interface{}{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -107,7 +107,7 @@ func (c *Client) BlockUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "unblock-sta", map[string]any{
|
users, err := c.stamgr(ctx, site, "unblock-sta", map[string]interface{}{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -120,7 +120,7 @@ func (c *Client) UnblockUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "forget-sta", map[string]any{
|
users, err := c.stamgr(ctx, site, "forget-sta", map[string]interface{}{
|
||||||
"macs": []string{mac},
|
"macs": []string{mac},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -133,7 +133,7 @@ func (c *Client) DeleteUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
||||||
users, err := c.stamgr(ctx, site, "kick-sta", map[string]any{
|
users, err := c.stamgr(ctx, site, "kick-sta", map[string]interface{}{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -146,7 +146,7 @@ func (c *Client) KickUserByMAC(ctx context.Context, site, mac string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) OverrideUserFingerprint(ctx context.Context, site, mac string, devIdOveride int) error {
|
func (c *Client) OverrideUserFingerprint(ctx context.Context, site, mac string, devIdOveride int) error {
|
||||||
reqBody := map[string]any{
|
reqBody := map[string]interface{}{
|
||||||
"mac": mac,
|
"mac": mac,
|
||||||
"dev_id_override": devIdOveride,
|
"dev_id_override": devIdOveride,
|
||||||
"search_query": "",
|
"search_query": "",
|
||||||
|
|||||||
2
unifi/version.generated.go
generated
2
unifi/version.generated.go
generated
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
package unifi
|
package unifi
|
||||||
|
|
||||||
const UnifiVersion = "9.0.114"
|
const UnifiVersion = "8.3.32"
|
||||||
|
|||||||
230
unifi/wlan.generated.go
generated
230
unifi/wlan.generated.go
generated
@@ -41,12 +41,11 @@ type WLAN struct {
|
|||||||
DTIMNg int `json:"dtim_ng,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
DTIMNg int `json:"dtim_ng,omitempty"` // ^([1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
|
||||||
ElementAdopt bool `json:"element_adopt"`
|
ElementAdopt bool `json:"element_adopt"`
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
EnhancedIot bool `json:"enhanced_iot"`
|
|
||||||
FastRoamingEnabled bool `json:"fast_roaming_enabled"`
|
FastRoamingEnabled bool `json:"fast_roaming_enabled"`
|
||||||
GroupRekey int `json:"group_rekey,omitempty"` // ^(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)$
|
GroupRekey int `json:"group_rekey,omitempty"` // ^(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)$
|
||||||
HideSSID bool `json:"hide_ssid"`
|
HideSSID bool `json:"hide_ssid"`
|
||||||
Hotspot2 WLANHotspot2 `json:"hotspot2,omitempty"`
|
|
||||||
Hotspot2ConfEnabled bool `json:"hotspot2conf_enabled"`
|
Hotspot2ConfEnabled bool `json:"hotspot2conf_enabled"`
|
||||||
|
Hotspot2ConfID string `json:"hotspot2conf_id"`
|
||||||
IappEnabled bool `json:"iapp_enabled"`
|
IappEnabled bool `json:"iapp_enabled"`
|
||||||
IsGuest bool `json:"is_guest"`
|
IsGuest bool `json:"is_guest"`
|
||||||
L2Isolation bool `json:"l2_isolation"`
|
L2Isolation bool `json:"l2_isolation"`
|
||||||
@@ -66,8 +65,6 @@ type WLAN struct {
|
|||||||
Name string `json:"name,omitempty"` // .{1,32}
|
Name string `json:"name,omitempty"` // .{1,32}
|
||||||
NameCombineEnabled bool `json:"name_combine_enabled"`
|
NameCombineEnabled bool `json:"name_combine_enabled"`
|
||||||
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
NameCombineSuffix string `json:"name_combine_suffix,omitempty"` // .{0,8}
|
||||||
NasIDentifier string `json:"nas_identifier,omitempty"` // .{0,48}
|
|
||||||
NasIDentifierType string `json:"nas_identifier_type,omitempty"` // ap_name|ap_mac|bssid|site_name|custom
|
|
||||||
NetworkID string `json:"networkconf_id"`
|
NetworkID string `json:"networkconf_id"`
|
||||||
No2GhzOui bool `json:"no2ghz_oui"`
|
No2GhzOui bool `json:"no2ghz_oui"`
|
||||||
OptimizeIotWifiConnectivity bool `json:"optimize_iot_wifi_connectivity"`
|
OptimizeIotWifiConnectivity bool `json:"optimize_iot_wifi_connectivity"`
|
||||||
@@ -163,188 +160,6 @@ func (dst *WLAN) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type WLANCapab struct {
|
|
||||||
Port int `json:"port,omitempty"` // ^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])|$
|
|
||||||
Protocol string `json:"protocol,omitempty"` // icmp|tcp_udp|tcp|udp|esp
|
|
||||||
Status string `json:"status,omitempty"` // closed|open|unknown
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANCapab) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANCapab
|
|
||||||
aux := &struct {
|
|
||||||
Port emptyStringInt `json:"port"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.Port = int(aux.Port)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANCellularNetworkList struct {
|
|
||||||
CountryCode int `json:"country_code,omitempty"` // [1-9]{1}[0-9]{0,3}
|
|
||||||
Mcc int `json:"mcc,omitempty"`
|
|
||||||
Mnc int `json:"mnc,omitempty"`
|
|
||||||
Name string `json:"name,omitempty"` // .{1,128}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANCellularNetworkList) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANCellularNetworkList
|
|
||||||
aux := &struct {
|
|
||||||
CountryCode emptyStringInt `json:"country_code"`
|
|
||||||
Mcc emptyStringInt `json:"mcc"`
|
|
||||||
Mnc emptyStringInt `json:"mnc"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.CountryCode = int(aux.CountryCode)
|
|
||||||
dst.Mcc = int(aux.Mcc)
|
|
||||||
dst.Mnc = int(aux.Mnc)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANFriendlyName struct {
|
|
||||||
Language string `json:"language,omitempty"` // [a-z]{3}
|
|
||||||
Text string `json:"text,omitempty"` // .{1,128}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANFriendlyName) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANFriendlyName
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANHotspot2 struct {
|
|
||||||
Capab []WLANCapab `json:"capab,omitempty"`
|
|
||||||
CellularNetworkList []WLANCellularNetworkList `json:"cellular_network_list,omitempty"`
|
|
||||||
DomainNameList []string `json:"domain_name_list,omitempty"` // .{1,128}
|
|
||||||
FriendlyName []WLANFriendlyName `json:"friendly_name,omitempty"`
|
|
||||||
IPaddrTypeAvailV4 int `json:"ipaddr_type_avail_v4,omitempty"` // 0|1|2|3|4|5|6|7
|
|
||||||
IPaddrTypeAvailV6 int `json:"ipaddr_type_avail_v6,omitempty"` // 0|1|2
|
|
||||||
MetricsDownlinkLoad int `json:"metrics_downlink_load,omitempty"`
|
|
||||||
MetricsDownlinkLoadSet bool `json:"metrics_downlink_load_set"`
|
|
||||||
MetricsDownlinkSpeed int `json:"metrics_downlink_speed,omitempty"`
|
|
||||||
MetricsDownlinkSpeedSet bool `json:"metrics_downlink_speed_set"`
|
|
||||||
MetricsInfoAtCapacity bool `json:"metrics_info_at_capacity"`
|
|
||||||
MetricsInfoLinkStatus string `json:"metrics_info_link_status,omitempty"` // up|down|test
|
|
||||||
MetricsInfoSymmetric bool `json:"metrics_info_symmetric"`
|
|
||||||
MetricsMeasurement int `json:"metrics_measurement,omitempty"`
|
|
||||||
MetricsMeasurementSet bool `json:"metrics_measurement_set"`
|
|
||||||
MetricsStatus bool `json:"metrics_status"`
|
|
||||||
MetricsUplinkLoad int `json:"metrics_uplink_load,omitempty"`
|
|
||||||
MetricsUplinkLoadSet bool `json:"metrics_uplink_load_set"`
|
|
||||||
MetricsUplinkSpeed int `json:"metrics_uplink_speed,omitempty"`
|
|
||||||
MetricsUplinkSpeedSet bool `json:"metrics_uplink_speed_set"`
|
|
||||||
NaiRealmList []WLANNaiRealmList `json:"nai_realm_list,omitempty"`
|
|
||||||
NetworkType int `json:"network_type,omitempty"` // 0|1|2|3|4|5|14|15
|
|
||||||
RoamingConsortiumList []WLANRoamingConsortiumList `json:"roaming_consortium_list,omitempty"`
|
|
||||||
VenueGroup int `json:"venue_group,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11
|
|
||||||
VenueName []WLANVenueName `json:"venue_name,omitempty"`
|
|
||||||
VenueType int `json:"venue_type,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANHotspot2) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANHotspot2
|
|
||||||
aux := &struct {
|
|
||||||
IPaddrTypeAvailV4 emptyStringInt `json:"ipaddr_type_avail_v4"`
|
|
||||||
IPaddrTypeAvailV6 emptyStringInt `json:"ipaddr_type_avail_v6"`
|
|
||||||
MetricsDownlinkLoad emptyStringInt `json:"metrics_downlink_load"`
|
|
||||||
MetricsDownlinkSpeed emptyStringInt `json:"metrics_downlink_speed"`
|
|
||||||
MetricsMeasurement emptyStringInt `json:"metrics_measurement"`
|
|
||||||
MetricsUplinkLoad emptyStringInt `json:"metrics_uplink_load"`
|
|
||||||
MetricsUplinkSpeed emptyStringInt `json:"metrics_uplink_speed"`
|
|
||||||
NetworkType emptyStringInt `json:"network_type"`
|
|
||||||
VenueGroup emptyStringInt `json:"venue_group"`
|
|
||||||
VenueType emptyStringInt `json:"venue_type"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.IPaddrTypeAvailV4 = int(aux.IPaddrTypeAvailV4)
|
|
||||||
dst.IPaddrTypeAvailV6 = int(aux.IPaddrTypeAvailV6)
|
|
||||||
dst.MetricsDownlinkLoad = int(aux.MetricsDownlinkLoad)
|
|
||||||
dst.MetricsDownlinkSpeed = int(aux.MetricsDownlinkSpeed)
|
|
||||||
dst.MetricsMeasurement = int(aux.MetricsMeasurement)
|
|
||||||
dst.MetricsUplinkLoad = int(aux.MetricsUplinkLoad)
|
|
||||||
dst.MetricsUplinkSpeed = int(aux.MetricsUplinkSpeed)
|
|
||||||
dst.NetworkType = int(aux.NetworkType)
|
|
||||||
dst.VenueGroup = int(aux.VenueGroup)
|
|
||||||
dst.VenueType = int(aux.VenueType)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANNaiRealmList struct {
|
|
||||||
AuthIDs []int `json:"auth_ids,omitempty"` // 0|1|2|3|4|5
|
|
||||||
AuthVals []int `json:"auth_vals,omitempty"` // 0|1|2|3|4|5|6|7|8|9|10
|
|
||||||
EapMethod int `json:"eap_method,omitempty"` // 13|21|18|23|50
|
|
||||||
Encoding int `json:"encoding,omitempty"` // 0|1
|
|
||||||
Name string `json:"name,omitempty"` // .{1,128}
|
|
||||||
Status bool `json:"status"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANNaiRealmList) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANNaiRealmList
|
|
||||||
aux := &struct {
|
|
||||||
AuthIDs []emptyStringInt `json:"auth_ids"`
|
|
||||||
AuthVals []emptyStringInt `json:"auth_vals"`
|
|
||||||
EapMethod emptyStringInt `json:"eap_method"`
|
|
||||||
Encoding emptyStringInt `json:"encoding"`
|
|
||||||
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
dst.AuthIDs = make([]int, len(aux.AuthIDs))
|
|
||||||
for i, v := range aux.AuthIDs {
|
|
||||||
dst.AuthIDs[i] = int(v)
|
|
||||||
}
|
|
||||||
dst.AuthVals = make([]int, len(aux.AuthVals))
|
|
||||||
for i, v := range aux.AuthVals {
|
|
||||||
dst.AuthVals[i] = int(v)
|
|
||||||
}
|
|
||||||
dst.EapMethod = int(aux.EapMethod)
|
|
||||||
dst.Encoding = int(aux.Encoding)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANPrivatePresharedKeys struct {
|
type WLANPrivatePresharedKeys struct {
|
||||||
NetworkID string `json:"networkconf_id"`
|
NetworkID string `json:"networkconf_id"`
|
||||||
Password string `json:"password,omitempty"` // [\x20-\x7E]{8,255}
|
Password string `json:"password,omitempty"` // [\x20-\x7E]{8,255}
|
||||||
@@ -366,27 +181,6 @@ func (dst *WLANPrivatePresharedKeys) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type WLANRoamingConsortiumList struct {
|
|
||||||
Name string `json:"name,omitempty"` // .{1,128}
|
|
||||||
Oid string `json:"oid,omitempty"` // .{1,128}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANRoamingConsortiumList) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANRoamingConsortiumList
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type WLANSaePsk struct {
|
type WLANSaePsk struct {
|
||||||
ID string `json:"id"` // .{0,128}
|
ID string `json:"id"` // .{0,128}
|
||||||
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
|
||||||
@@ -444,28 +238,6 @@ func (dst *WLANScheduleWithDuration) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type WLANVenueName struct {
|
|
||||||
Language string `json:"language,omitempty"` // [a-z]{0,3}
|
|
||||||
Name string `json:"name,omitempty"`
|
|
||||||
Url string `json:"url,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (dst *WLANVenueName) UnmarshalJSON(b []byte) error {
|
|
||||||
type Alias WLANVenueName
|
|
||||||
aux := &struct {
|
|
||||||
*Alias
|
|
||||||
}{
|
|
||||||
Alias: (*Alias)(dst),
|
|
||||||
}
|
|
||||||
|
|
||||||
err := json.Unmarshal(b, &aux)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to unmarshal alias: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) listWLAN(ctx context.Context, site string) ([]WLAN, error) {
|
func (c *Client) listWLAN(ctx context.Context, site string) ([]WLAN, error) {
|
||||||
var respBody struct {
|
var respBody struct {
|
||||||
Meta meta `json:"meta"`
|
Meta meta `json:"meta"`
|
||||||
|
|||||||
Reference in New Issue
Block a user