[create-pull-request] automated change (#90)

Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2022-08-10 11:06:46 +10:00
committed by GitHub
parent adcc9a2556
commit 8f0bac78f6
8 changed files with 277 additions and 184 deletions

View File

@@ -292,8 +292,8 @@ func (dst *DevicePortOverrides) UnmarshalJSON(b []byte) error {
type DeviceRadioTable struct {
AntennaGain int `json:"antenna_gain,omitempty"` // ^-?([0-9]|[1-9][0-9])
AntennaID int `json:"antenna_id,omitempty"` // -1|[0-9]
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|34|36|37|38|40|42|44|46|48|52|53|56|60|64|69|85|100|101|104|108|112|117|116|120|124|128|132|133|136|140|144|149|153|157|161|165|181|183|184|185|187|188|189|192|196|197|213|229|auto
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|34|36|37|38|40|42|44|46|48|52|53|56|60|64|69|85|100|101|104|108|112|117|116|120|124|128|132|133|136|140|144|149|153|157|161|165|181|183|184|185|187|188|189|192|196|197|213|229|auto
BackupChannel string `json:"backup_channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
Channel string `json:"channel,omitempty"` // [0-9]|[1][0-4]|4.5|5|16|21|33|34|36|37|38|40|41|42|44|45|46|48|49|52|53|56|57|60|61|64|65|69|73|77|81|85|89|93|97|100|101|104|105|108|109|112|113|117|116|120|121|124|125|128|129|132|133|136|137|140|141|144|145|149|153|157|161|165|169|173|177|181|183|184|185|187|188|189|192|193|196|197|201|205|209|213|217|221|225|229|233|auto
HardNoiseFloorEnabled bool `json:"hard_noise_floor_enabled,omitempty"`
Ht int `json:"ht,omitempty"` // 20|40|80|160|1080|2160|4320
LoadbalanceEnabled bool `json:"loadbalance_enabled,omitempty"`

View File

@@ -120,12 +120,15 @@ type Network struct {
NATOutboundIPAddresses []NetworkNATOutboundIPAddresses `json:"nat_outbound_ip_addresses,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
NetworkGroup string `json:"networkgroup,omitempty"` // LAN[2-8]?
OpenVPNConfiguration string `json:"openvpn_configuration,omitempty"`
OpenVPNConfigurationFilename string `json:"openvpn_configuration_filename,omitempty"`
OpenVPNLocalAddress string `json:"openvpn_local_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNLocalPort int `json:"openvpn_local_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
OpenVPNMode string `json:"openvpn_mode,omitempty"` // site-to-site|client|server
OpenVPNRemoteAddress string `json:"openvpn_remote_address,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNRemoteHost string `json:"openvpn_remote_host,omitempty"` // [^\"\' ]+|^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$
OpenVPNRemotePort int `json:"openvpn_remote_port,omitempty"` // ^([1-9][0-9]{0,3}|[1-5][0-9]{4}|[6][0-4][0-9]{3}|[6][5][0-4][0-9]{2}|[6][5][5][0-2][0-9]|[6][5][5][3][0-5])$
OpenVPNUsername string `json:"openvpn_username,omitempty"`
PptpcRequireMppe bool `json:"pptpc_require_mppe"`
PptpcRouteDistance int `json:"pptpc_route_distance,omitempty"` // ^[1-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]$|^$
PptpcServerIP string `json:"pptpc_server_ip,omitempty"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|(?=^.{3,253}$)(^((?!-)[a-zA-Z0-9-]{1,63}(?<!-)\.)+[a-zA-Z]{2,63}$)|^[a-zA-Z0-9-]{1,63}$
@@ -146,7 +149,7 @@ type Network struct {
VLANEnabled bool `json:"vlan_enabled"`
VPNClientDefaultRoute bool `json:"vpn_client_default_route"`
VPNClientPullDNS bool `json:"vpn_client_pull_dns"`
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-vpn|pptp-client|l2tp-server|pptp-server|uid-server
VPNType string `json:"vpn_type,omitempty"` // auto|ipsec-vpn|openvpn-client|openvpn-vpn|pptp-client|l2tp-server|pptp-server|uid-server
WANDHCPOptions []NetworkWANDHCPOptions `json:"wan_dhcp_options,omitempty"`
WANDHCPv6PDSize int `json:"wan_dhcpv6_pd_size,omitempty"` // ^(4[89]|5[0-9]|6[0-4])$|^$
WANDNS1 string `json:"wan_dns1"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
@@ -175,6 +178,7 @@ type Network struct {
WANVLAN int `json:"wan_vlan,omitempty"` // [0-9]|[1-9][0-9]{1,2}|[1-3][0-9]{3}|40[0-8][0-9]|409[0-4]|^$
WANVLANEnabled bool `json:"wan_vlan_enabled"`
XIPSecPreSharedKey string `json:"x_ipsec_pre_shared_key,omitempty"` // [^\"\' ]+
XOpenVPNPassword string `json:"x_openvpn_password,omitempty"`
XOpenVPNSharedSecretKey string `json:"x_openvpn_shared_secret_key,omitempty"` // [0-9A-Fa-f]{512}
XPptpcPassword string `json:"x_pptpc_password,omitempty"` // [^\"\' ]+
XWANPassword string `json:"x_wan_password,omitempty"` // [^"' ]+

View File

@@ -27,15 +27,13 @@ type SettingAutoSpeedtest struct {
Key string `json:"key"`
CronExpr string `json:"cron_expr,omitempty"`
Enabled bool `json:"enabled"`
Interval int `json:"interval,omitempty"` // ^(1[2-9]|[2-9][0-9]|[1-9][0-9]{2,3})$
}
func (dst *SettingAutoSpeedtest) UnmarshalJSON(b []byte) error {
type Alias SettingAutoSpeedtest
aux := &struct {
Interval emptyStringInt `json:"interval"`
*Alias
}{
Alias: (*Alias)(dst),
@@ -45,7 +43,6 @@ func (dst *SettingAutoSpeedtest) UnmarshalJSON(b []byte) error {
if err != nil {
return fmt.Errorf("unable to unmarshal alias: %w", err)
}
dst.Interval = int(aux.Interval)
return nil
}

94
unifi/setting_global_switch.generated.go generated Normal file
View File

@@ -0,0 +1,94 @@
// 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 SettingGlobalSwitch 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"`
DHCPSnoop bool `json:"dhcp_snoop"`
Dot1XFallbackNetworkID string `json:"dot1x_fallback_networkconf_id"` // [\d\w]+|
Dot1XPortctrlEnabled bool `json:"dot1x_portctrl_enabled"`
FlowctrlEnabled bool `json:"flowctrl_enabled"`
JumboframeEnabled bool `json:"jumboframe_enabled"`
RADIUSProfileID string `json:"radiusprofile_id"`
StpVersion string `json:"stp_version,omitempty"` // stp|rstp|disabled
SwitchExclusions []string `json:"switch_exclusions,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
}
func (dst *SettingGlobalSwitch) UnmarshalJSON(b []byte) error {
type Alias SettingGlobalSwitch
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) getSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []SettingGlobalSwitch `json:"data"`
}
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/global_switch", 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) updateSettingGlobalSwitch(ctx context.Context, site string, d *SettingGlobalSwitch) (*SettingGlobalSwitch, error) {
var respBody struct {
Meta meta `json:"meta"`
Data []SettingGlobalSwitch `json:"data"`
}
d.Key = "global_switch"
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/global_switch", site), d, &respBody)
if err != nil {
return nil, err
}
if len(respBody.Data) != 1 {
return nil, &NotFoundError{}
}
new := respBody.Data[0]
return &new, nil
}

View File

@@ -28,7 +28,7 @@ type SettingRadioAi struct {
Key string `json:"key"`
AutoAdjustChannelsToCountry bool `json:"auto_adjust_channels_to_country"`
ChannelsNa []int `json:"channels_na,omitempty"` // 36|40|44|48|52|56|60|64|100|104|108|112|116|120|124|128|132|136|140|144|149|153|157|161|165
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
CronExpr string `json:"cron_expr,omitempty"`
Default bool `json:"default"`

View File

@@ -31,12 +31,8 @@ type SettingSuperSdn struct {
DeviceID string `json:"device_id"`
Enabled bool `json:"enabled"`
Migrated bool `json:"migrated"`
OauthAppID string `json:"oauth_app_id"`
OauthEnabled bool `json:"oauth_enabled"`
OauthRedirectUris []string `json:"oauth_redirect_uris,omitempty"`
SsoLoginEnabled string `json:"sso_login_enabled,omitempty"`
UbicUuid string `json:"ubic_uuid,omitempty"`
XOauthAppSecret string `json:"x_oauth_app_secret,omitempty"`
}
func (dst *SettingSuperSdn) UnmarshalJSON(b []byte) error {

View File

@@ -34,6 +34,8 @@ type User struct {
FixedIP string `json:"fixed_ip,omitempty"`
Hostname string `json:"hostname,omitempty"`
LastSeen int `json:"last_seen,omitempty"`
LocalDNSRecord string `json:"local_dns_record,omitempty"`
LocalDNSRecordEnabled bool `json:"local_dns_record_enabled"`
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Name string `json:"name,omitempty"`
NetworkID string `json:"network_id"`

View File

@@ -2,4 +2,4 @@
package unifi
const UnifiVersion = "7.1.68"
const UnifiVersion = "7.2.92"